repo_name
stringlengths
6
69
path
stringlengths
6
178
copies
stringclasses
278 values
size
stringlengths
4
7
content
stringlengths
671
917k
license
stringclasses
15 values
Celtech/BOL
Outdated/EmoteSpammer.lua
1
8023
--[[ /$$ /$$ /$$ /$$$$$$ /$$$$$$$$ /$$ /$$ | $$ | $$|__/ |_ $$_/ | $$_____/ | $$ |__/ | $$ | $$ /$$ | $$ /$$$$$$/$$$$ | $$ /$$$$$$/$$$$ /$$$$$$ /$$$$$$ /$$ /$$$$$$$ /$$$$$$ | $$$$$$$$| $$ | $$ | $$_ $$_ $$ | $$$$$ | $$_ $$_ $$ /$$__ $$|_ $$_/ | $$| $$__ $$ /$$__ $$ | $$__ $$| $$ | $$ | $$ \ $$ \ $$ | $$__/ | $$ \ $$ \ $$| $$ \ $$ | $$ | $$| $$ \ $$| $$ \ $$ | $$ | $$| $$ | $$ | $$ | $$ | $$ | $$ | $$ | $$ | $$| $$ | $$ | $$ /$$| $$| $$ | $$| $$ | $$ | $$ | $$| $$ /$$$$$$| $$ | $$ | $$ | $$$$$$$$| $$ | $$ | $$| $$$$$$/ | $$$$/| $$| $$ | $$| $$$$$$$ |__/ |__/|__/ |______/|__/ |__/ |__/ |________/|__/ |__/ |__/ \______/ \___/ |__/|__/ |__/ \____ $$ /$$ \ $$ | $$$$$$/ \______/ Author: Celtech Version: 0.01 Last Updated: 01/17/2016 for Patch 6.01 Permission to encode granted by GNAAAAR ]] assert(load(Base64Decode("G0x1YVIAAQQEBAgAGZMNChoKAAAAAAAAAAAAAQYhAAAABgBAAEZAQACGgEAAwcAAAJ2AAAHEAAAAAQEBAEUBAABdAIACHYAAAB1AgAAGQEEAQYABAB1AAAEGwEEAHYCAAEEAAgCBQAIA5QAAAAjAAIXlQAAACMCAheWAAAAIwACG5cAAAAjAgIblAAEACMAAh+VAAQAIwICH5YABAAjAAIgfAIAAEQAAAAQHAAAAYXNzZXJ0AAQFAAAAbG9hZAAEDQAAAEJhc2U2NERlY29kZQAEOQgAAEcweDFZVklBQVFRRUJBZ0FHWk1OQ2hvS0FBQUFBQUFBQUFBQUFRSUtBQUFBQmdCQUFFRkFBQUFkUUFBQkJrQkFBR1VBQUFBS1FBQ0JCa0JBQUdWQUFBQUtRSUNCSHdDQUFBUUFBQUFFQmdBQUFHTnNZWE56QUFRTkFBQUFVMk55YVhCMFUzUmhkSFZ6QUFRSEFBQUFYMTlwYm1sMEFBUUxBQUFBVTJWdVpGVndaR0YwWlFBQ0FBQUFBZ0FBQUFnQUFBQUNBQW90QUFBQWhrQkFBTWFBUUFBR3dVQUFCd0ZCQWtGQkFRQWRnUUFCUnNGQUFFY0J3UUtCZ1FFQVhZRUFBWWJCUUFDSEFVRUR3Y0VCQUoyQkFBSEd3VUFBeHdIQkF3RUNBZ0RkZ1FBQkJzSkFBQWNDUVFSQlFnSUFIWUlBQVJZQkFnTGRBQUFCbllBQUFBcUFBSUFLUUFDRmhnQkRBTUhBQWdDZGdBQUJDb0NBaFFxQXc0YUdBRVFBeDhCQ0FNZkF3d0hkQUlBQW5ZQUFBQXFBZ0llTVFFUUFBWUVFQUoxQWdBR0d3RVFBNVFBQUFKMUFBQUVmQUlBQUZBQUFBQVFGQUFBQWFIZHBaQUFFRFFBQUFFSmhjMlUyTkVWdVkyOWtaUUFFQ1FBQUFIUnZjM1J5YVc1bkFBUURBQUFBYjNNQUJBY0FBQUJuWlhSbGJuWUFCQlVBQUFCUVVrOURSVk5UVDFKZlNVUkZUbFJKUmtsRlVnQUVDUUFBQUZWVFJWSk9RVTFGQUFRTkFBQUFRMDlOVUZWVVJWSk9RVTFGQUFRUUFBQUFVRkpQUTBWVFUwOVNYMHhGVmtWTUFBUVRBQUFBVUZKUFEwVlRVMDlTWDFKRlZrbFRTVTlPQUFRRUFBQUFTMlY1QUFRSEFBQUFjMjlqYTJWMEFBUUlBQUFBY21WeGRXbHlaUUFFQ2dBQUFHZGhiV1ZUZEdGMFpRQUFCQVFBQUFCMFkzQUFCQWNBQUFCaGMzTmxjblFBQkFzQUFBQlRaVzVrVlhCa1lYUmxBQU1BQUFBQUFBRHdQd1FVQUFBQVFXUmtRblZuYzNCc1lYUkRZV3hzWW1GamF3QUJBQUFBQ0FBQUFBZ0FBQUFBQUFNRkFBQUFCUUFBQUF3QVFBQ0JRQUFBSFVDQUFSOEFnQUFDQUFBQUJBc0FBQUJUWlc1a1ZYQmtZWFJsQUFNQUFBQUFBQUFBUUFBQUFBQUJBQUFBQVFBUUFBQUFRRzlpWm5WelkyRjBaV1F1YkhWaEFBVUFBQUFJQUFBQUNBQUFBQWdBQUFBSUFBQUFDQUFBQUFBQUFBQUJBQUFBQlFBQUFITmxiR1lBQVFBQUFBQUFFQUFBQUVCdlltWjFjMk5oZEdWa0xteDFZUUF0QUFBQUF3QUFBQU1BQUFBRUFBQUFCQUFBQUFRQUFBQUVBQUFBQkFBQUFBUUFBQUFFQUFBQUJBQUFBQVVBQUFBRkFBQUFCUUFBQUFVQUFBQUZBQUFBQlFBQUFBVUFBQUFGQUFBQUJnQUFBQVlBQUFBR0FBQUFCZ0FBQUFVQUFBQURBQUFBQXdBQUFBWUFBQUFHQUFBQUJnQUFBQVlBQUFBR0FBQUFCZ0FBQUFZQUFBQUhBQUFBQndBQUFBY0FBQUFIQUFBQUJ3QUFBQWNBQUFBSEFBQUFCd0FBQUFjQUFBQUlBQUFBQ0FBQUFBZ0FBQUFJQUFBQUFnQUFBQVVBQUFCelpXeG1BQUFBQUFBdEFBQUFBZ0FBQUdFQUFBQUFBQzBBQUFBQkFBQUFCUUFBQUY5RlRsWUFDUUFBQUE0QUFBQUNBQTBYQUFBQWh3QkFBSXhBUUFFQmdRQUFRY0VBQUoxQUFBS0hBRUFBakFCQkFRRkJBUUJIZ1VFQWdjRUJBTWNCUWdBQndnRUFRQUtBQUlIQ0FRREdRa0lBeDRMQ0JRSERBZ0FXQVFNQ25VQ0FBWWNBUUFDTUFFTUJuVUFBQVI4QWdBQU5BQUFBQkFRQUFBQjBZM0FBQkFnQUFBQmpiMjV1WldOMEFBUVJBQUFBYzJOeWFYQjBjM1JoZEhWekxtNWxkQUFEQUFBQUFBQUFWRUFFQlFBQUFITmxibVFBQkFzQUFBQkhSVlFnTDNONWJtTXRBQVFFQUFBQVMyVjVBQVFDQUFBQUxRQUVCUUFBQUdoM2FXUUFCQWNBQUFCdGVVaGxjbThBQkFrQUFBQmphR0Z5VG1GdFpRQUVKZ0FBQUNCSVZGUlFMekV1TUEwS1NHOXpkRG9nYzJOeWFYQjBjM1JoZEhWekxtNWxkQTBLRFFvQUJBWUFBQUJqYkc5elpRQUFBQUFBQVFBQUFBQUFFQUFBQUVCdlltWjFjMk5oZEdWa0xteDFZUUFYQUFBQUNnQUFBQW9BQUFBS0FBQUFDZ0FBQUFvQUFBQUxBQUFBQ3dBQUFBc0FBQUFMQUFBQURBQUFBQXdBQUFBTkFBQUFEUUFBQUEwQUFBQU9BQUFBRGdBQUFBNEFBQUFPQUFBQUN3QUFBQTRBQUFBT0FBQUFEZ0FBQUE0QUFBQUNBQUFBQlFBQUFITmxiR1lBQUFBQUFCY0FBQUFDQUFBQVlRQUFBQUFBRndBQUFBRUFBQUFGQUFBQVgwVk9WZ0FCQUFBQUFRQVFBQUFBUUc5aVpuVnpZMkYwWldRdWJIVmhBQW9BQUFBQkFBQUFBUUFBQUFFQUFBQUNBQUFBQ0FBQUFBSUFBQUFKQUFBQURnQUFBQWtBQUFBT0FBQUFBQUFBQUFFQUFBQUZBQUFBWDBWT1ZnQT0ABAMAAABidAAEDQAAAFNjcmlwdFN0YXR1cwAEDAAAAFZJTE1LSEpKTU5OAAQKAAAAR2V0TXlIZXJvAAQFAAAAMC4wMgADAAAAAAAAAAAEBwAAAE9uTG9hZAAEBwAAAE9uVGljawAECgAAAFNlbmRFbW90ZQAEDAAAAFNlbmRNYXN0ZXJ5AAQFAAAATWVudQAEFAAAAEN1cnJlbnRUaW1lSW5NaWxsaXMABA4AAABTY3JpcHRNZXNzYWdlAAcAAAAHAAAACgAAAAAAAwgAAAAGAEAAHUCAAAZAQABBgAAAhQCAAFaAgAAdQAABHwCAAAMAAAAEBQAAAE1lbnUABA4AAABTY3JpcHRNZXNzYWdlAAQQAAAATG9hZGVkIFZlcnNpb24gAAAAAAACAAAAAAABAQAAAAAAAAAAAAAAAAAAAAAMAAAAJAAAAAAAA0UAAAAGAEAAHYCAAEZAQACFAIAAXYAAAQ5AAABGQEAAgYAAAF2AAAEZAIAAFwAOgAYAQAAdgIAACQCAAAbAQAAHAEEAG0AAABfAAIAGwEAAB0BBABsAAAAXgACABoBBAEHAAQAdQAABBsBAAAcAQgAbQAAAF8AAgAbAQAAHQEIAGwAAABeAAIAGgEEAQYACAB1AAAEGwEAAB8BCABtAAAAXwACABsBAAAcAQwAbAAAAF4AAgAaAQQBBQAMAHUAAAQbAQAAHgEMAG0AAABfAAIAGwEAAB8BDABsAAAAXgACABoBBAEEABAAdQAABBsBAAAdARAAbQAAAF8AAgAbAQAAHgEQAGwAAABdAAIAGwEQAHUCAAB8AgAAUAAAABBQAAABDdXJyZW50VGltZUluTWlsbGlzAAQJAAAAdG9udW1iZXIAAwAAAAAAQG9ABAUAAABNZW51AAQFAAAAZW10MQAEBQAAAHRvZzEABAoAAABTZW5kRW1vdGUAAwAAAAAAAPA/BAUAAABlbXQyAAQFAAAAdG9nMgADAAAAAAAAAEAEBQAAAGVtdDMABAUAAAB0b2czAAMAAAAAAAAIQAQFAAAAZW10NAAEBQAAAHRvZzQAAwAAAAAAABBABAQAAABtc3QABAUAAAB0b2c1AAQMAAAAU2VuZE1hc3RlcnkAAAAAAAIAAAAAAAECAAAAAAAAAAAAAAAAAAAAACYAAAAvAAAAAQAGGgAAAEsAAAKBAAAAwUAAAAGBAABBwQAAZEAAAoYAQQDBQAEAnYAAAYrAQYPMAEIBRkHCAN1AgAHMgEIBRwGAAN1AgAHMwEIBQQEDAN1AgAHMgEIBQQEDAN1AgAHGQEMAAAEAAd1AAAEfAIAADgAAAAMAAAAAAEBlQAMAAAAAAIBvQAMAAAAAAEBQQAMAAAAAAABZQAQLAAAAQ0xvTFBhY2tldAADAAAAAAAAdEAEBwAAAHZUYWJsZQADAAAAgIQVbkEECAAAAEVuY29kZUYABAoAAABuZXR3b3JrSUQABAgAAABFbmNvZGUxAAQIAAAARW5jb2RlNAADAAAAAAAAAAAECwAAAFNlbmRQYWNrZXQAAAAAAAIAAAAAAAEAAAAAAAAAAAAAAAAAAAAAADEAAAA3AAAAAAAIEwAAAAYAQABBQAAAHYAAAQrAQIFMAEEAxkDBAF1AgAFBgAEAgcABAMGAAQBhgACATAFCAMFBAgBdQYABYMD+f0aAQgCAAAAAXUAAAR8AgAALAAAABAsAAABDTG9MUGFja2V0AAMAAAAAAMBnQAQHAAAAdlRhYmxlAAMAAACAcP1tQQQIAAAARW5jb2RlRgAECgAAAG5ldHdvcmtJRAADAAAAAAAA8D8DAAAAAAAAEEAECAAAAEVuY29kZTEAAwAAAAAAQFBABAsAAABTZW5kUGFja2V0AAAAAAACAAAAAAABAAAAAAAAAAAAAAAAAAAAAAA5AAAASAAAAAAACW8AAAAGQEAAQYAAAIHAAAAdgIABCAAAgAYAQAAMAEEAgUABAMGAAQAGwUEAQwEAAIYBQgCHQUIDwYECAJ0BAAEdQAAABgBAAAwAQQCBwAIAwQADAAbBQQBDAQAAhgFCAIdBQgPBQQMAnQEAAR1AAAAGAEAADABBAIGAAwDBwAMABsFBAEMBAACGAUIAh0FCA8EBBACdAQABHUAAAAYAQAAMAEEAgUAEAMGABAAGwUEAQwEAAIYBQgCHQUIDwcEEAJ0BAAEdQAAABgBAAAwAQQCBAAUAwUAFAAbBQQBDAQAAhgFCAIdBQgPBgQUAnQEAAR1AAAAGAEAAB8BFAAwAQQCBAAYAwUAGAAGBBgBDAQAAHUAAAwYAQAAHwEUADABBAIHABgDBAAcAAYEGAEMBAAAdQAADBgBAAAfARQAMAEEAgUAHAMGABwABgQYAQwEAAB1AAAMGAEAAB8BFAAwAQQCBwAcAwQAIAAGBBgBDAQAAHUAAAwYAQAAHwEUADABBAIFACADBgAgAAYEGAEMBAAAdQAADBgBAAAwAQQCBwAgAwQAJAAZBSQBBgQkAgYEGAMHBCQAGAkoAHUCABB8AgAApAAAABAUAAABNZW51AAQNAAAAc2NyaXB0Q29uZmlnAAQOAAAARW1vdGUgU3BhbW1lcgAEBAAAAGVtdAAECQAAAGFkZFBhcmFtAAQFAAAAZW10MQAECgAAAFNwYW0gSm9rZQAEFwAAAFNDUklQVF9QQVJBTV9PTktFWURPV04ABAcAAABzdHJpbmcABAUAAABieXRlAAQCAAAAVAAEBQAAAGVtdDIABAsAAABTcGFtIFRhdW50AAQCAAAAWQAEBQAAAGVtdDMABAsAAABTcGFtIERhbmNlAAQCAAAAVQAEBQAAAGVtdDQABAsAAABTcGFtIExhdWdoAAQCAAAASQAEBAAAAG1zdAAEDQAAAFNwYW0gTWFzdGVyeQAEAgAAAE8ABAcAAABoYXJhc3MABAUAAAB0b2cxAAQRAAAAVG9nZ2xlIFNwYW0gSm9rZQADAAAAAAAA8D8EBQAAAHRvZzIABBIAAABUb2dnbGUgU3BhbSBUYXVudAAEBQAAAHRvZzMABBIAAABUb2dnbGUgU3BhbSBEYW5jZQAEBQAAAHRvZzQABBIAAABUb2dnbGUgU3BhbSBMYXVnaAAEBQAAAHRvZzUABBQAAABUb2dnbGUgU3BhbSBNYXN0ZXJ5AAQGAAAAZGVsYXkABAwAAABFbW90ZSBEZWxheQAEEwAAAFNDUklQVF9QQVJBTV9TTElDRQADAAAAAAAAaUADAAAAAABAf0AEDQAAAGRlY2ltYWxQbGFjZQAAAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAEoAAABMAAAAAAACBgAAAAYAQAAHQEAAHYCAAA+AQAAfAAABHwCAAAMAAAAEAwAAAG9zAAQGAAAAY2xvY2sAAwAAAAAAQI9AAAAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAABOAAAAUAAAAAEABQcAAABGAEAAgUAAAMAAAAABgQAAlgABAV1AAAEfAIAAAwAAAAQGAAAAcHJpbnQABEgAAAA8Yj48Zm9udCBjb2xvcj0iI0ZGMDAwMCI+W0hpIEknbSBFbW90aW5nXTwvZm9udD48Zm9udCBjb2xvcj0iI0ZGRkZGRiI+IAAECAAAADwvZm9udD4AAAAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAAAAQAAAAAAAAAAAAAAAAAAAAAA"), nil, "bt", _ENV))()
gpl-2.0
gedadsbranch/Darkstar-Mission
scripts/zones/Windurst_Waters/npcs/Rukuku.lua
36
1417
----------------------------------- -- Area: Windurst Waters -- NPC: Rukuku -- Involved in Quest: Making the Grade -- Working 100% -- @zone = 238 -- @pos = 130 -6 160 ----------------------------------- package.loaded["scripts/zones/Windurst_Waters/TextIDs"] = nil; ----------------------------------- require("scripts/globals/quests"); require("scripts/globals/settings"); require("scripts/globals/titles"); require("scripts/globals/keyitems"); require("scripts/zones/Windurst_Waters/TextIDs"); ----------------------------------- -- onTrade Action ----------------------------------- function onTrade(player,npc,trade) end; ----------------------------------- -- onTrigger Action ----------------------------------- function onTrigger(player,npc) if (player:getQuestStatus(WINDURST,MAKING_THE_GRADE) == QUEST_ACCEPTED) then player:startEvent(0x01c2); -- During Making the GRADE else player:startEvent(0x01aa); -- Standard conversation 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
gedadsbranch/Darkstar-Mission
scripts/zones/East_Ronfaure/npcs/Rayochindot.lua
38
1028
----------------------------------- -- Area: East Ronfaure -- NPC: Rayochindot -- Type: Gate Guard -- @pos 93.159 -62.999 272.601 101 ----------------------------------- package.loaded["scripts/zones/East_Ronfaure/TextIDs"] = nil; ----------------------------------- require("scripts/zones/East_Ronfaure/TextIDs"); ----------------------------------- -- onTrade Action ----------------------------------- function onTrade(player,npc,trade) end; ----------------------------------- -- onTrigger Action ----------------------------------- function onTrigger(player,npc) player:showText(npc, RAYOCHINDOT_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
gedadsbranch/Darkstar-Mission
scripts/zones/Lower_Jeuno/npcs/_l07.lua
36
1561
----------------------------------- -- Area: Lower Jeuno -- NPC: Streetlamp -- Involved in Quests: Community Service -- @zone 245 -- @pos -45.148 0 -47.279 ----------------------------------- package.loaded["scripts/zones/Lower_Jeuno/TextIDs"] = nil; ----------------------------------- require("scripts/globals/settings"); require("scripts/globals/quests"); require("scripts/zones/Lower_Jeuno/TextIDs"); ----------------------------------- -- onTrade Action ----------------------------------- function onTrade(player,npc,trade) end; ----------------------------------- -- onTrigger Action ----------------------------------- function onTrigger(player,npc) local hour = VanadielHour(); if (hour >= 18 and hour < 21) then if (player:getQuestStatus(JEUNO,COMMUNITY_SERVICE) == QUEST_ACCEPTED) then if (player:getVar("cService") == 4) then player:setVar("cService",5); end elseif (hour >= 18 and hour < 21) then if (player:getQuestStatus(JEUNO,COMMUNITY_SERVICE) == QUEST_COMPLETED) then if (player:getVar("cService") == 17) then player:setVar("cService",18); end end 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
FishFilletsNG/fillets-data
script/tank/dialogs_en.lua
1
1549
dialogId("sv-m-pomohli", "font_small", "This is some improvement. From bathyscaph to tank, this is like from a line into a net.") dialogId("sv-v-bezsneku", "font_big", "At least there are no oh-so-obliging snails here.") dialogId("sv-m-utecha", "font_small", "That is but little consolation.") dialogId("sv-v-chtel", "font_big", "Thinking about it, I always wanted to see the inside of a tank.") dialogId("sv-m-doscasu", "font_small", "It seems you will have plenty of opportunity to look around.") dialogId("sv-m-tank", "font_small", "I wonder how this tank got into the sea.") dialogId("sv-v-obojzivelny", "font_big", "Maybe it was an amphibious tank.") dialogId("sv-m-kecy", "font_small", "An amphibious tank? Just imagine: On the moonless night, the uncomprehending defenders bewilderedly watch the mass of snorkels emerging from the surf, searching in vain for the landing craft...") dialogId("sv-v-proc", "font_big", "So why are you asking, if you are so darned clever?!") dialogId("sv-v-potopena", "font_big", "Maybe there is a sunken landing craft nearby.") dialogId("sv-m-pravdepodob", "font_small", "It is possible.") dialogId("sv-m-munice", "font_small", "Do you think that this ammunition could harm us?") dialogId("sv-v-nevim", "font_big", "I don’t know, but I’ll try to keep my distance from it.") dialogId("sv-v-zebrik", "font_big", "I think we are going to need that ladder.") dialogId("sv-m-ven", "font_small", "To climb out? But we have only fins.") dialogId("sv-v-ucpat", "font_big", "No. To plug that hole.")
gpl-2.0
hooksta4/darkstar
scripts/globals/weaponskills/realmrazer.lua
30
1450
----------------------------------- -- Realmrazer -- Club weapon skill -- Skill Level: 357 -- Delivers a seven-hit attack. params.accuracy varies with TP. -- Will stack with Sneak Attack. -- Aligned with the Shadow Gorget & Soil Gorget. -- Aligned with the Shadow Belt & Soil Belt. -- Element: None -- Modifiers: MND:73~85% -- 100%TP 200%TP 300%TP -- .88 .88 .88 ----------------------------------- require("scripts/globals/status"); require("scripts/globals/settings"); require("scripts/globals/weaponskills"); ----------------------------------- function onUseWeaponSkill(player, target, wsID) local params = {}; params.numHits = 7; params.ftp100 = 0.88; params.ftp200 = 0.88; params.ftp300 = 0.88; params.str_wsc = 0.0; params.dex_wsc = 0.0; params.vit_wsc = 0.0; params.agi_wsc = 0.0; params.int_wsc = 0.0; params.mnd_wsc = 0.85 + (player:getMerit(MERIT_REALMRAZER) / 100); params.chr_wsc = 0.0; params.crit100 = 0.0; params.crit200 = 0.0; params.crit300 = 0.0; params.canCrit = false; params.acc100 = 0.8; params.acc200= 0.9; params.acc300= 1; params.atkmulti = 1; if (USE_ADOULIN_WEAPON_SKILL_CHANGES == true) then params.mnd_wsc = 0.7 + (player:getMerit(MERIT_REALMRAZER) / 100); end local damage, criticalHit, tpHits, extraHits = doPhysicalWeaponskill(player, target, params); damage = damage * WEAPON_SKILL_POWER return tpHits, extraHits, criticalHit, damage; end
gpl-3.0
warrenseine/premake
tests/actions/vstudio/vc200x/test_platforms.lua
3
1850
-- -- tests/actions/vstudio/vc200x/test_platforms.lua -- Test the Visual Studio 2002-2008 project's Platforms block -- Copyright (c) 2009-2012 Jason Perkins and the Premake project -- T.vstudio_vc200x_platforms = { } local suite = T.vstudio_vc200x_platforms local vc200x = premake.vstudio.vc200x -- -- Setup -- local sln, prj function suite.setup() _ACTION = "vs2008" sln = test.createsolution() end local function prepare() prj = premake.solution.getproject(sln, 1) vc200x.platforms(prj) end -- -- If no architectures are specified, Win32 should be the default. -- function suite.win32Listed_onNoPlatforms() prepare() test.capture [[ <Platforms> <Platform Name="Win32" /> </Platforms> ]] end -- -- If multiple configurations use the same architecture, it should -- still only be listed once. -- function suite.architectureListedOnlyOnce_onMultipleConfigurations() platforms { "Static", "Dynamic" } prepare() test.capture [[ <Platforms> <Platform Name="Win32" /> </Platforms> ]] end -- -- If multiple architectures are used, they should all be listed. -- function suite.allArchitecturesListed_onMultipleArchitectures() platforms { "x32", "x64" } prepare() test.capture [[ <Platforms> <Platform Name="Win32" /> <Platform Name="x64" /> </Platforms> ]] end -- -- Verify the PS3 platform. -- function suite.platformIsCorrect_onPS3() platforms { "PS3" } prepare() test.capture [[ <Platforms> <Platform Name="Win32" /> </Platforms> ]] end -- -- Verify the Xbox360 platform. -- function suite.platformIsCorrect_onXbox360() platforms { "Xbox360" } prepare() test.capture [[ <Platforms> <Platform Name="Xbox 360" /> </Platforms> ]] end
bsd-3-clause
prosody-modules/import2
mod_blocking/mod_blocking.lua
32
5669
local jid_split = require "util.jid".split; local st = require "util.stanza"; local xmlns_blocking = "urn:xmpp:blocking"; module:add_feature("urn:xmpp:blocking"); -- Add JID to default privacy list function add_blocked_jid(username, host, jid) local privacy_lists = datamanager.load(username, host, "privacy") or {lists = {}}; local default_list_name = privacy_lists.default; if not privacy_lists.lists then privacy_lists.lists = {} end if not default_list_name then default_list_name = "blocklist"; privacy_lists.default = default_list_name; end local default_list = privacy_lists.lists[default_list_name]; if not default_list then default_list = { name = default_list_name, items = {} }; privacy_lists.lists[default_list_name] = default_list; end local items = default_list.items; local order = items[1] and items[1].order or 0; -- Must come first for i=1,#items do -- order must be unique local item = items[i]; item.order = item.order + 1; if item.type == "jid" and item.action == "deny" and item.value == jid then return false; end end table.insert(items, 1, { type = "jid" , action = "deny" , value = jid , message = false , ["presence-out"] = false , ["presence-in"] = false , iq = false , order = order }); datamanager.store(username, host, "privacy", privacy_lists); return true; end -- Remove JID from default privacy list function remove_blocked_jid(username, host, jid) local privacy_lists = datamanager.load(username, host, "privacy") or {}; local default_list_name = privacy_lists.default; if not default_list_name then return; end local default_list = privacy_lists.lists[default_list_name]; if not default_list then return; end local items = default_list.items; local item, removed = nil, false; for i=1,#items do -- order must be unique item = items[i]; if item.type == "jid" and item.action == "deny" and item.value == jid then table.remove(items, i); removed = true; break; end end if removed then datamanager.store(username, host, "privacy", privacy_lists); end return removed; end function remove_all_blocked_jids(username, host) local privacy_lists = datamanager.load(username, host, "privacy") or {}; local default_list_name = privacy_lists.default; if not default_list_name then return; end local default_list = privacy_lists.lists[default_list_name]; if not default_list then return; end local items = default_list.items; local item; for i=#items,1,-1 do -- order must be unique item = items[i]; if item.type == "jid" and item.action == "deny" then table.remove(items, i); end end datamanager.store(username, host, "privacy", privacy_lists); return true; end function get_blocked_jids(username, host) -- Return array of blocked JIDs in default privacy list local privacy_lists = datamanager.load(username, host, "privacy") or {}; local default_list_name = privacy_lists.default; if not default_list_name then return {}; end local default_list = privacy_lists.lists[default_list_name]; if not default_list then return {}; end local items = default_list.items; local item; local jid_list = {}; for i=1,#items do -- order must be unique item = items[i]; if item.type == "jid" and item.action == "deny" then jid_list[#jid_list+1] = item.value; end end return jid_list; end local function send_push_iqs(username, host, command_type, jids) local bare_jid = username.."@"..host; local stanza_content = st.stanza(command_type, { xmlns = xmlns_blocking }); for _, jid in ipairs(jids) do stanza_content:tag("item", { jid = jid }):up(); end for resource, session in pairs(prosody.bare_sessions[bare_jid].sessions) do local iq_push_stanza = st.iq({ type = "set", to = bare_jid.."/"..resource }); iq_push_stanza:add_child(stanza_content); session.send(iq_push_stanza); end end function handle_blocking_command(event) local session, stanza = event.origin, event.stanza; local username, host = jid_split(stanza.attr.from); if stanza.attr.type == "set" then if stanza.tags[1].name == "block" then local block = stanza.tags[1]; local block_jid_list = {}; for item in block:childtags() do block_jid_list[#block_jid_list+1] = item.attr.jid; end if #block_jid_list == 0 then session.send(st.error_reply(stanza, "modify", "bad-request")); else for _, jid in ipairs(block_jid_list) do add_blocked_jid(username, host, jid); end session.send(st.reply(stanza)); send_push_iqs(username, host, "block", block_jid_list); end return true; elseif stanza.tags[1].name == "unblock" then local unblock = stanza.tags[1]; local unblock_jid_list = {}; for item in unblock:childtags() do unblock_jid_list[#unblock_jid_list+1] = item.attr.jid; end if #unblock_jid_list == 0 then remove_all_blocked_jids(username, host); else for _, jid_to_unblock in ipairs(unblock_jid_list) do remove_blocked_jid(username, host, jid_to_unblock); end end session.send(st.reply(stanza)); send_push_iqs(username, host, "unblock", unblock_jid_list); return true; end elseif stanza.attr.type == "get" and stanza.tags[1].name == "blocklist" then local reply = st.reply(stanza):tag("blocklist", { xmlns = xmlns_blocking }); local blocked_jids = get_blocked_jids(username, host); for _, jid in ipairs(blocked_jids) do reply:tag("item", { jid = jid }):up(); end session.send(reply); return true; end end module:hook("iq/self/urn:xmpp:blocking:blocklist", handle_blocking_command); module:hook("iq/self/urn:xmpp:blocking:block", handle_blocking_command); module:hook("iq/self/urn:xmpp:blocking:unblock", handle_blocking_command);
mit
bigcrush/cqueues
regress/61-multiwriters.lua
4
1661
#!/bin/sh _=[[ . "${0%%/*}/regress.sh" exec runlua "$0" "$@" ]] require"regress".export".*" local main = cqueues.new() local _cache = {} local function megarep(s) if not _cache[s] then _cache[s] = string.rep(string.rep(s, 1024), 1024) end return _cache[s] end local function test(bufsiz) local loop = cqueues.new() local rd, wr = check(socket.pair()) wr:setvbuf("full", bufsiz) local sem = { count = 0, condvar = condition.new() } local function sem_get() while sem.count < 1 do sem.condvar:wait() end sem.count = sem.count - 1 sem.condvar:signal() cqueues.sleep(0) end local function sem_put(n) sem.count = sem.count + (n or 1) sem.condvar:signal() cqueues.sleep(0) end for i=0,3 do loop:wrap(function () sem_get() local ch = string.char(string.byte"A" + i) for i=1,10 do check(wr:write(megarep(ch))) end check(wr:flush()) sem_put() end) end loop:wrap(function () sem_put(4) repeat sem.condvar:wait() until sem.count == 4 wr:shutdown"rw" end) local interleaved = false loop:wrap(function () while true do local buf = rd:read(1024 * 1024) if buf == nil then break end local ch = string.sub(buf, 1, 1) local uniform = not buf:match(string.format("[^%s]", ch)) interleaved = interleaved or not uniform info("read %d bytes (interleaved:%s)", #buf, tostring(not uniform)) end end) check(loop:loop()) return interleaved end info"begin control test" check(test(4096) == true, "expected control test to interleave") info"control test OK" info"begin test case" check(test(-1) == false, "test case interleaved") info"test case OK" say("OK")
mit
Vavius/moai-framework
src/core/SceneTransitions.lua
1
6281
-------------------------------------------------------------------------------- -- -- -- -------------------------------------------------------------------------------- local App = require("core.App") local SceneTransitions = {} -- fadeIn -- fadeOut -- fadeOutIn -- crossfade -- zoomOutIn -- zoomOutInFade -- zoomInOut -- zoomItOutFade -- fromRight -- fromLeft -- fromTop -- fromBottom -- slideRight -- slideLeft -- slideTop -- slideBottom -- params: -- time -- ease -- -- local no_params = {time = 0.4} SceneTransitions.fadeIn = function(params) params = params or no_params return function(sceneOut, sceneIn) local time = params.time local ease = params.ease sceneIn:setVisible(true) sceneIn:setColor(0, 0, 0, 0) MOAICoroutine.blockOnAction(sceneIn:seekColor(1, 1, 1, 1, time, ease)) sceneOut:setVisible(false) end end SceneTransitions.fadeOutIn = function(params) params = params or no_params return function(sceneOut, sceneIn) local time = params.time local ease = params.ease sceneIn:setVisible(true) sceneIn:setColor(0, 0, 0, 0) MOAICoroutine.blockOnAction(sceneOut:seekColor(0, 0, 0, 0, time, ease)) MOAICoroutine.blockOnAction(sceneIn:seekColor(1, 1, 1, 1, time, ease)) sceneOut:setVisible(false) sceneOut:setColor(1, 1, 1, 1) end end SceneTransitions.crossfade = function(params) params = params or no_params return function(sceneOut, sceneIn) local time = params.time local ease = params.ease sceneIn:setVisible(true) sceneIn:setColor(0, 0, 0, 0) local action1 = sceneOut:seekColor(0, 0, 0, 0, time, ease) local action2 = sceneIn:seekColor(1, 1, 1, 1, time, ease) MOAICoroutine.blockOnAction(action1) sceneOut:setVisible(false) sceneOut:setColor(1, 1, 1, 1) end end SceneTransitions.fromRight = function(params) params = params or no_params return function(sceneOut, sceneIn) local time = params.time local ease = params.ease local sw, sh = App.screenWidth, App.screenHeight sceneIn:setVisible(true) sceneIn:setLoc(sw, 0) MOAICoroutine.blockOnAction(sceneIn:moveLoc(-sw, 0, 0, time, ease)) sceneOut:setVisible(false) sceneIn:setLoc(0, 0) end end SceneTransitions.fromLeft = function(params) params = params or no_params return function(sceneOut, sceneIn) local time = params.time local ease = params.ease local sw, sh = App.screenWidth, App.screenHeight sceneIn:setVisible(true) sceneIn:setLoc(-sw, 0) MOAICoroutine.blockOnAction(sceneIn:moveLoc(sw, 0, 0, time, ease)) sceneOut:setVisible(false) sceneIn:setLoc(0, 0) end end SceneTransitions.fromTop = function(params) params = params or no_params return function(sceneOut, sceneIn) local time = params.time local ease = params.ease local sw, sh = App.screenWidth, App.screenHeight sceneIn:setVisible(true) sceneIn:setLoc(0, -sh) MOAICoroutine.blockOnAction(sceneIn:moveLoc(0, sh, 0, time, ease)) sceneOut:setVisible(false) sceneIn:setLoc(0, 0) end end SceneTransitions.fromBottom = function(params) params = params or no_params return function(sceneOut, sceneIn) local time = params.time local ease = params.ease local sw, sh = App.screenWidth, App.screenHeight sceneIn:setVisible(true) sceneIn:setLoc(0, sh) MOAICoroutine.blockOnAction(sceneIn:moveLoc(0, -sh, 0, time, ease)) sceneOut:setVisible(false) sceneIn:setLoc(0, 0) end end SceneTransitions.slideRight = function(params) params = params or no_params return function(sceneOut, sceneIn) local time = params.time local ease = params.ease local sw, sh = App.screenWidth, App.screenHeight sceneIn:setVisible(true) sceneIn:setLoc(-sw, 0) local action1 = sceneOut:moveLoc(sw, 0, 0, time, ease) local action2 = sceneIn:moveLoc(sw, 0, 0, time, ease) MOAICoroutine.blockOnAction(action1) sceneOut:setVisible(false) sceneOut:setLoc(0, 0) sceneIn:setLoc(0, 0) end end SceneTransitions.slideLeft = function(params) params = params or no_params return function(sceneOut, sceneIn) local time = params.time local ease = params.ease local sw, sh = App.screenWidth, App.screenHeight sceneIn:setVisible(true) sceneIn:setLoc(sw, 0) local action1 = sceneOut:moveLoc(-sw, 0, 0, time, ease) local action2 = sceneIn:moveLoc(-sw, 0, 0, time, ease) MOAICoroutine.blockOnAction(action1) sceneOut:setVisible(false) sceneOut:setLoc(0, 0) sceneIn:setLoc(0, 0) end end SceneTransitions.slideTop = function(params) params = params or no_params return function(sceneOut, sceneIn) local time = params.time local ease = params.ease local sw, sh = App.screenWidth, App.screenHeight sceneIn:setVisible(true) sceneIn:setLoc(0, sh) local action1 = sceneOut:moveLoc(0, -sh, 0, time, ease) local action2 = sceneIn:moveLoc(0, -sh, 0, time, ease) MOAICoroutine.blockOnAction(action1) sceneOut:setVisible(false) sceneOut:setLoc(0, 0) sceneIn:setLoc(0, 0) end end SceneTransitions.slideBottom = function(params) params = params or no_params return function(sceneOut, sceneIn) local time = params.time local ease = params.ease local sw, sh = App.screenWidth, App.screenHeight sceneIn:setVisible(true) sceneIn:setLoc(0, -sh) local action1 = sceneOut:moveLoc(0, sh, 0, time, ease) local action2 = sceneIn:moveLoc(0, sh, 0, time, ease) MOAICoroutine.blockOnAction(action1) sceneOut:setVisible(false) sceneOut:setLoc(0, 0) sceneIn:setLoc(0, 0) end end return SceneTransitions
mit
gedadsbranch/Darkstar-Mission
scripts/globals/items/plate_of_tentacle_sushi.lua
21
1809
----------------------------------------- -- ID: 5215 -- Item: plate_of_tentacle_sushi -- Food Effect: 30Min, All Races ----------------------------------------- -- HP 20 -- Dexterity 3 -- Agility 3 -- Mind -1 -- Accuracy % 19 (cap 18) -- Ranged Accuracy % 19 (cap 18) -- Double Attack 1 ----------------------------------------- require("scripts/globals/status"); ----------------------------------------- -- OnItemCheck ----------------------------------------- function onItemCheck(target) local result = 0; if (target:hasStatusEffect(EFFECT_FOOD) == true or target:hasStatusEffect(EFFECT_FIELD_SUPPORT_FOOD) == true) then result = 246; end return result; end; ----------------------------------------- -- OnItemUse ----------------------------------------- function onItemUse(target) target:addStatusEffect(EFFECT_FOOD,0,0,1800,5215); end; ----------------------------------- -- onEffectGain Action ----------------------------------- function onEffectGain(target,effect) target:addMod(MOD_HP, 20); target:addMod(MOD_DEX, 3); target:addMod(MOD_AGI, 3); target:addMod(MOD_MND, -1); target:addMod(MOD_FOOD_ACCP, 19); target:addMod(MOD_FOOD_ACC_CAP, 18); target:addMod(MOD_FOOD_RACCP, 19); target:addMod(MOD_FOOD_RACC_CAP, 18); target:addMod(MOD_DOUBLE_ATTACK, 1); end; ----------------------------------------- -- onEffectLose Action ----------------------------------------- function onEffectLose(target,effect) target:delMod(MOD_HP, 20); target:delMod(MOD_DEX, 3); target:delMod(MOD_AGI, 3); target:delMod(MOD_MND, -1); target:delMod(MOD_FOOD_ACCP, 19); target:delMod(MOD_FOOD_ACC_CAP, 18); target:delMod(MOD_FOOD_RACCP, 19); target:delMod(MOD_FOOD_RACC_CAP, 18); target:delMod(MOD_DOUBLE_ATTACK, 1); end;
gpl-3.0
gedadsbranch/Darkstar-Mission
scripts/zones/Selbina/Zone.lua
12
2512
----------------------------------- -- -- Zone: Selbina (248) -- ----------------------------------- package.loaded["scripts/zones/Selbina/TextIDs"] = nil; ----------------------------------- require("scripts/globals/keyitems"); require("scripts/globals/zone"); require("scripts/globals/shop"); require("scripts/globals/quests"); require("scripts/zones/Selbina/TextIDs"); ----------------------------------- -- onInitialize ----------------------------------- function onInitialize(zone) SetExplorerMoogles(17793127); end; ----------------------------------- -- onZoneIn ----------------------------------- function onZoneIn(player,prevZone) local cs = -1; if((player:getXPos() == 0) and (player:getYPos() == 0) and (player:getZPos() == 0)) then if(prevZone == 220) then cs = 0x00ca; player:setPos(32.500,-2.500,-45.500,192); else player:setPos(17.981,-16.806,99.83,64); end end if(player:hasKeyItem(SEANCE_STAFF) and player:getVar("Enagakure_Killed") == 1) then cs = 0x044d; end return cs; 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; ----------------------------------- -- onTransportEvent ----------------------------------- function onTransportEvent(player,transport) player:startEvent(0x00c8); 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 == 0x00c8) then player:setPos(0,0,0,0,221); elseif(csid == 0x044d) then if(player:getFreeSlotsCount() < 1) then player:messageSpecial(ITEM_CANNOT_BE_OBTAINED,14226); else player:delKeyItem(SEANCE_STAFF); player:addItem(14226); player:messageSpecial(ITEM_OBTAINED,14226); -- Ninja Hakama player:setVar("Enagakure_Killed",0); player:setVar("illTakeTheBigBoxCS",0); player:addFame(OUTLANDS,NORG_FAME*30); player:completeQuest(OUTLANDS,I_LL_TAKE_THE_BIG_BOX); end end end;
gpl-3.0
gedadsbranch/Darkstar-Mission
scripts/globals/spells/bluemagic/asuran_claws.lua
28
1798
----------------------------------------- -- Spell: Asuran Claws -- Delivers a sixfold attack. Accuracy varies with TP -- Spell cost: 81 MP -- Monster Type: Beasts -- Spell Type: Physical (Blunt) -- Blue Magic Points: 2 -- Stat Bonus: AGI +3 -- Level: 70 -- Casting Time: 3 seconds -- Recast Time: 60 seconds -- Skillchain Element(s): Fire (Primary) and Lightning (Secondary) - (can open Scission, Detonation, Liquefaction, or Fusion; can close Liquefaction, Impaction, or Fusion) -- Combos: Counter ----------------------------------------- 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_ACC; params.dmgtype = DMGTYPE_H2H; params.scattr = SC_IMPACTION; params.numhits = 6; params.multiplier = 1.0; params.tp150 = 1.05; params.tp300 = 1.1; params.azuretp = 1.2; params.duppercap = 21; 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.0; params.chr_wsc = 0.0; damage = BluePhysicalSpell(caster, target, spell, params); damage = BlueFinalAdjustments(caster, target, spell, damage, params); return damage; end;
gpl-3.0
gedadsbranch/Darkstar-Mission
scripts/zones/Arrapago_Reef/npcs/qm1.lua
15
1170
----------------------------------- -- Area: Arrapago Reef -- NPC: ??? (Spawn Lil'Apkallu(ZNM T1)) -- @pos 488 -1 166 54 ----------------------------------- package.loaded["scripts/zones/Arrapago_Reef/TextIDs"] = nil; ----------------------------------- require("scripts/zones/Arrapago_Reef/TextIDs"); ----------------------------------- -- onTrade Action ----------------------------------- function onTrade(player,npc,trade) if(trade:hasItemQty(2601,1) and trade:getItemCount() == 1) then -- Trade Greenling player:tradeComplete(); SpawnMob(16998871,180):updateEnmity(player); end end; ----------------------------------- -- onTrigger Action ----------------------------------- function onTrigger(player,npc) player:messageSpecial(NOTHING_HAPPENS); 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
gedadsbranch/Darkstar-Mission
scripts/zones/Windurst_Waters/npcs/Akkeke.lua
36
1418
----------------------------------- -- Area: Windurst Waters -- NPC: Akkeke -- Involved in Quest: Making the Grade -- Working 100% -- @zone = 238 -- @pos = 135 -6 165 ----------------------------------- package.loaded["scripts/zones/Windurst_Waters/TextIDs"] = nil; ----------------------------------- require("scripts/globals/quests"); require("scripts/globals/settings"); require("scripts/globals/titles"); require("scripts/globals/keyitems"); require("scripts/zones/Windurst_Waters/TextIDs"); ----------------------------------- -- onTrade Action ----------------------------------- function onTrade(player,npc,trade) end; ----------------------------------- -- onTrigger Action ----------------------------------- function onTrigger(player,npc) if (player:getQuestStatus(WINDURST,MAKING_THE_GRADE) == QUEST_ACCEPTED) then player:startEvent(0x01c5); -- During Making the GRADE else player:startEvent(0x01ab); -- Standard conversation 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
ak48disk/wowaddons
Quartz/libs/CallbackHandler-1.0/CallbackHandler-1.0.lua
4
9244
--[[ $Id: CallbackHandler-1.0.lua 14 2010-08-09 00:43:38Z mikk $ ]] local MAJOR, MINOR = "CallbackHandler-1.0", 6 local CallbackHandler = LibStub:NewLibrary(MAJOR, MINOR) if not CallbackHandler then return end -- No upgrade needed local meta = {__index = function(tbl, key) tbl[key] = {} return tbl[key] end} -- Lua APIs local tconcat = table.concat local assert, error, loadstring = assert, error, loadstring local setmetatable, rawset, rawget = setmetatable, rawset, rawget local next, select, pairs, type, tostring = next, select, pairs, type, tostring -- Global vars/functions that we don't upvalue since they might get hooked, or upgraded -- List them here for Mikk's FindGlobals script -- GLOBALS: geterrorhandler local xpcall = xpcall local function errorhandler(err) return geterrorhandler()(err) end local function CreateDispatcher(argCount) local code = [[ local next, xpcall, eh = ... local method, ARGS local function call() method(ARGS) end local function dispatch(handlers, ...) local index index, method = next(handlers) if not method then return end local OLD_ARGS = ARGS ARGS = ... repeat xpcall(call, eh) index, method = next(handlers, index) until not method ARGS = OLD_ARGS end return dispatch ]] local ARGS, OLD_ARGS = {}, {} for i = 1, argCount do ARGS[i], OLD_ARGS[i] = "arg"..i, "old_arg"..i end code = code:gsub("OLD_ARGS", tconcat(OLD_ARGS, ", ")):gsub("ARGS", tconcat(ARGS, ", ")) return assert(loadstring(code, "safecall Dispatcher["..argCount.."]"))(next, xpcall, errorhandler) end local Dispatchers = setmetatable({}, {__index=function(self, argCount) local dispatcher = CreateDispatcher(argCount) rawset(self, argCount, dispatcher) return dispatcher end}) -------------------------------------------------------------------------- -- CallbackHandler:New -- -- target - target object to embed public APIs in -- RegisterName - name of the callback registration API, default "RegisterCallback" -- UnregisterName - name of the callback unregistration API, default "UnregisterCallback" -- UnregisterAllName - name of the API to unregister all callbacks, default "UnregisterAllCallbacks". false == don't publish this API. function CallbackHandler:New(target, RegisterName, UnregisterName, UnregisterAllName, OnUsed, OnUnused) -- TODO: Remove this after beta has gone out assert(not OnUsed and not OnUnused, "ACE-80: OnUsed/OnUnused are deprecated. Callbacks are now done to registry.OnUsed and registry.OnUnused") RegisterName = RegisterName or "RegisterCallback" UnregisterName = UnregisterName or "UnregisterCallback" if UnregisterAllName==nil then -- false is used to indicate "don't want this method" UnregisterAllName = "UnregisterAllCallbacks" end -- we declare all objects and exported APIs inside this closure to quickly gain access -- to e.g. function names, the "target" parameter, etc -- Create the registry object local events = setmetatable({}, meta) local registry = { recurse=0, events=events } -- registry:Fire() - fires the given event/message into the registry function registry:Fire(eventname, ...) if not rawget(events, eventname) or not next(events[eventname]) then return end local oldrecurse = registry.recurse registry.recurse = oldrecurse + 1 Dispatchers[select('#', ...) + 1](events[eventname], eventname, ...) registry.recurse = oldrecurse if registry.insertQueue and oldrecurse==0 then -- Something in one of our callbacks wanted to register more callbacks; they got queued for eventname,callbacks in pairs(registry.insertQueue) do local first = not rawget(events, eventname) or not next(events[eventname]) -- test for empty before. not test for one member after. that one member may have been overwritten. for self,func in pairs(callbacks) do events[eventname][self] = func -- fire OnUsed callback? if first and registry.OnUsed then registry.OnUsed(registry, target, eventname) first = nil end end end registry.insertQueue = nil end end -- Registration of a callback, handles: -- self["method"], leads to self["method"](self, ...) -- self with function ref, leads to functionref(...) -- "addonId" (instead of self) with function ref, leads to functionref(...) -- all with an optional arg, which, if present, gets passed as first argument (after self if present) target[RegisterName] = function(self, eventname, method, ... --[[actually just a single arg]]) if type(eventname) ~= "string" then error("Usage: "..RegisterName.."(eventname, method[, arg]): 'eventname' - string expected.", 2) end method = method or eventname local first = not rawget(events, eventname) or not next(events[eventname]) -- test for empty before. not test for one member after. that one member may have been overwritten. if type(method) ~= "string" and type(method) ~= "function" then error("Usage: "..RegisterName.."(\"eventname\", \"methodname\"): 'methodname' - string or function expected.", 2) end local regfunc if type(method) == "string" then -- self["method"] calling style if type(self) ~= "table" then error("Usage: "..RegisterName.."(\"eventname\", \"methodname\"): self was not a table?", 2) elseif self==target then error("Usage: "..RegisterName.."(\"eventname\", \"methodname\"): do not use Library:"..RegisterName.."(), use your own 'self'", 2) elseif type(self[method]) ~= "function" then error("Usage: "..RegisterName.."(\"eventname\", \"methodname\"): 'methodname' - method '"..tostring(method).."' not found on self.", 2) end if select("#",...)>=1 then -- this is not the same as testing for arg==nil! local arg=select(1,...) regfunc = function(...) self[method](self,arg,...) end else regfunc = function(...) self[method](self,...) end end else -- function ref with self=object or self="addonId" or self=thread if type(self)~="table" and type(self)~="string" and type(self)~="thread" then error("Usage: "..RegisterName.."(self or \"addonId\", eventname, method): 'self or addonId': table or string or thread expected.", 2) end if select("#",...)>=1 then -- this is not the same as testing for arg==nil! local arg=select(1,...) regfunc = function(...) method(arg,...) end else regfunc = method end end if events[eventname][self] or registry.recurse<1 then -- if registry.recurse<1 then -- we're overwriting an existing entry, or not currently recursing. just set it. events[eventname][self] = regfunc -- fire OnUsed callback? if registry.OnUsed and first then registry.OnUsed(registry, target, eventname) end else -- we're currently processing a callback in this registry, so delay the registration of this new entry! -- yes, we're a bit wasteful on garbage, but this is a fringe case, so we're picking low implementation overhead over garbage efficiency registry.insertQueue = registry.insertQueue or setmetatable({},meta) registry.insertQueue[eventname][self] = regfunc end end -- Unregister a callback target[UnregisterName] = function(self, eventname) if not self or self==target then error("Usage: "..UnregisterName.."(eventname): bad 'self'", 2) end if type(eventname) ~= "string" then error("Usage: "..UnregisterName.."(eventname): 'eventname' - string expected.", 2) end if rawget(events, eventname) and events[eventname][self] then events[eventname][self] = nil -- Fire OnUnused callback? if registry.OnUnused and not next(events[eventname]) then registry.OnUnused(registry, target, eventname) end end if registry.insertQueue and rawget(registry.insertQueue, eventname) and registry.insertQueue[eventname][self] then registry.insertQueue[eventname][self] = nil end end -- OPTIONAL: Unregister all callbacks for given selfs/addonIds if UnregisterAllName then target[UnregisterAllName] = function(...) if select("#",...)<1 then error("Usage: "..UnregisterAllName.."([whatFor]): missing 'self' or \"addonId\" to unregister events for.", 2) end if select("#",...)==1 and ...==target then error("Usage: "..UnregisterAllName.."([whatFor]): supply a meaningful 'self' or \"addonId\"", 2) end for i=1,select("#",...) do local self = select(i,...) if registry.insertQueue then for eventname, callbacks in pairs(registry.insertQueue) do if callbacks[self] then callbacks[self] = nil end end end for eventname, callbacks in pairs(events) do if callbacks[self] then callbacks[self] = nil -- Fire OnUnused callback? if registry.OnUnused and not next(callbacks) then registry.OnUnused(registry, target, eventname) end end end end end end return registry end -- CallbackHandler purposefully does NOT do explicit embedding. Nor does it -- try to upgrade old implicit embeds since the system is selfcontained and -- relies on closures to work.
mit
hooksta4/darkstar
scripts/globals/spells/knights_minne_iii.lua
18
1520
----------------------------------------- -- Spell: Knight's Minne III -- Grants Defense bonus to all allies. ----------------------------------------- require("scripts/globals/status"); ----------------------------------------- -- OnSpellCast ----------------------------------------- function onMagicCastingCheck(caster,target,spell) return 0; end; function onSpellCast(caster,target,spell) local sLvl = caster:getSkillLevel(SKILL_SNG); -- Gets skill level of Singing local iLvl = caster:getWeaponSkillLevel(SLOT_RANGED); local power = 18 + math.floor((sLvl + iLvl)/10); if (power >= 64) then power = 64; end local iBoost = caster:getMod(MOD_MINNE_EFFECT) + caster:getMod(MOD_ALL_SONGS_EFFECT); if (iBoost > 0) then power = power + 1 + (iBoost-1)*4; end power = power + caster:getMerit(MERIT_MINNE_EFFECT); if (caster:hasStatusEffect(EFFECT_SOUL_VOICE)) then power = power * 2; elseif (caster:hasStatusEffect(EFFECT_MARCATO)) then power = power * 1.5; end caster:delStatusEffect(EFFECT_MARCATO); local duration = 120; duration = duration * ((iBoost * 0.1) + (caster:getMod(MOD_SONG_DURATION_BONUS)/100) + 1); if (caster:hasStatusEffect(EFFECT_TROUBADOUR)) then duration = duration * 2; end if not (target:addBardSong(caster,EFFECT_MINNE,power,0,duration,caster:getID(), 0, 3)) then spell:setMsg(75); end return EFFECT_MINNE; end;
gpl-3.0
puchiedarcy/fceuxd
output/luaScripts/ButtonCount.lua
10
4028
--Written by Brandon Evans --You can change the number of controllers tracked here. local controllers = 2 --You can change the position of the text here. local x = 0 local y = 8 local players = {} local states = {} local pressed = 0 local inputted = 0 function table.copy(t) local t2 = {} for k, v in pairs(t) do t2[k] = v end return t2 end function counts() --Display the counts of the buttons pressed and inputted. gui.text(x, y, 'Pressed: ' .. pressed) gui.text(x, y + 8, 'Inputted: ' .. inputted) end function load(slot) --As Lua starts counting from 1, and there may be a slot 0, increment. slot = slot + 1 if not states[slot] or states[slot].inputted == nil then gui.text(x, y + 16, 'No data loaded from slot ' .. tostring(slot - 1)) counts() return end --Load the data if there is any available for this slot. players = table.copy(states[slot].players) pressed = states[slot].pressed inputted = states[slot].inputted gui.text(x, y + 16, 'Data loaded from slot ' .. tostring(slot - 1)) counts() end function parse() --If there is an open, read-only FM2 file, parse it for the initial data. if not movie.active() then return false end local fh = io.open(movie.name()) if not fh or movie.mode() == 'record' or movie.name():match( '.%.(%w+)$' ) ~= 'fm2' then return false end local frame = -1 local last = {} local match = { 'right', 'left', 'down', 'up', 'start', 'select', 'B', 'A' } --Parse up until two frames before the current one. while frame ~= emu.framecount() - 2 do line = fh:read() if not line then break end --This is only a frame if it starts with a vertical bar. if string.sub(line, 0, 1) == '|' then frame = frame + 1 players = {} local player = -1 --Split up the sections by a vertical bar. for section in string.gmatch(line, '[^|]+') do player = player + 1 --Only deal with actual players. if player ~= 0 then local button = 0 --Run through all the buttons. for text in string.gmatch(section, '.') do button = button + 1 --Check if this button is pressed. if text ~= ' ' and text ~= '.' then inputted = inputted + 1 --If the button was not previously pressed, --increment. if table.maxn(last) < player or not last[player][ match[button] ] then pressed = pressed + 1 end if table.maxn(players) < player then table.insert(players, {}) end --Mark this button as pressed. players[player][match[button]] = true end end end end --Save the players to compare with the next frame in the file. last = players end end return true end function save(slot) --As Lua starts counting from 1, and there may be a slot 0, increment. slot = slot + 1 while table.maxn(states) < slot do table.insert(states, {}) end --Mark the current data as the data for this slot. states[slot].players = table.copy(players) states[slot].pressed = pressed states[slot].inputted = inputted gui.text(x, y + 16, 'Data saved to slot ' .. tostring(slot - 1)) counts() end if parse() then gui.text(x, y + 16, 'Movie parsed for data') else gui.text(x, y + 16, 'No movie parsed for data') end if savestate.registerload then savestate.registerload(load) savestate.registersave(save) end while true do --If this is the first frame, reset the data. if emu.framecount() == 0 then players = {} pressed = 0 inputted = 0 end --Check players one and two. for player = 1, controllers do local buttons = joypad.getdown(player) --Run through all of the pressed buttons. for i, v in pairs(buttons) do inputted = inputted + 1 --If in the previous frame the button was not pressed, increment. if table.maxn(players) >= player and not players[player][i] then pressed = pressed + 1 end end if table.maxn(players) < player then table.insert(players, true) end --Mark these buttons as pressed. players[player] = buttons end counts() emu.frameadvance() end
gpl-2.0
gedadsbranch/Darkstar-Mission
scripts/zones/Port_San_dOria/npcs/Albinie.lua
37
1468
----------------------------------- -- Area: Port San d'Oria -- NPC: Albinie -- Standard Merchant NPC -- Working 100% ----------------------------------- package.loaded["scripts/zones/Port_San_dOria/TextIDs"] = nil; ----------------------------------- require("scripts/globals/shop"); require("scripts/zones/Port_San_dOria/TextIDs"); ----------------------------------- -- onTrade Action ----------------------------------- function onTrade(player,npc,trade) end; ----------------------------------- -- onTrigger Action ----------------------------------- function onTrigger(player,npc) player:showText(npc,ALBINIE_SHOP_DIALOG); stock = { 0x02bb,5688,1, --Oak Log 0x0284,1800,1, --Mythril Ore 0x0343,225,1, --Flax Flower 0x02b6,2543,2, --Chestnut Log 0x0280,10,2, --Copper Ore 0x0283,810,2, --Iron Ore 0x0341,18,2, --Moko Grass 0x11da,50,2, --Bird Egg 0x02ba,86,3, --Ash Log 0x0001,1800,3 --Chocobo Bedding } showNationShop(player, SANDORIA, stock); end; ----------------------------------- -- onEventUpdate ----------------------------------- function onEventUpdate(player,csid,option) --printf("CSID: %u",csid); --printf("RESULT: %u",option); end; ----------------------------------- -- onEventFinish ----------------------------------- function onEventFinish(player,csid,option) --printf("CSID: %u",csid); --printf("RESULT: %u",option); end;
gpl-3.0
hooksta4/darkstar
scripts/zones/Yughott_Grotto/TextIDs.lua
9
1096
-- Variable TextID Description text -- General Texts ITEM_CANNOT_BE_OBTAINED = 6538; -- You cannot obtain the item <item>. Come back after sorting your inventory. ITEM_OBTAINED = 6543; -- Obtained: <item>. GIL_OBTAINED = 6544; -- Obtained <number> gil. KEYITEM_OBTAINED = 6546; -- Obtained key item: <keyitem>. FISHING_MESSAGE_OFFSET = 7202; -- You can't fish here. HOMEPOINT_SET = 7430; -- Home point set! -- Treasure Coffer/Chest Dialog CHEST_UNLOCKED = 7322; -- You unlock the chest! CHEST_FAIL = 7323; -- Fails to open the chest. CHEST_TRAP = 7324; -- The chest was trapped! CHEST_WEAK = 7325; -- You cannot open the chest when you are in a weakened state. CHEST_MIMIC = 7326; -- The chest was a mimic! CHEST_MOOGLE = 7327; -- You cannot open the chest while participating in the moogle event. CHEST_ILLUSION = 7328; -- The chest was but an illusion... CHEST_LOCKED = 7329; -- The chest appears to be locked. -- Mining MINING_IS_POSSIBLE_HERE = 7330; -- Mining is possible here if you have -- conquest Base CONQUEST_BASE = 0;
gpl-3.0
hooksta4/darkstar
scripts/globals/items/slice_of_buffalo_meat.lua
18
1424
----------------------------------------- -- ID: 5152 -- Item: slice_of_buffalo_meat -- Food Effect: 5Min, Galka only ----------------------------------------- -- Strength 4 -- Agility -5 -- Intelligence -7 ----------------------------------------- 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,5152); end; ----------------------------------------- -- onEffectGain Action ----------------------------------------- function onEffectGain(target,effect) target:addMod(MOD_STR, 4); target:addMod(MOD_AGI, -5); target:addMod(MOD_INT, -7); end; ----------------------------------------- -- onEffectLose Action ----------------------------------------- function onEffectLose(target,effect) target:delMod(MOD_STR, 4); target:delMod(MOD_AGI, -5); target:delMod(MOD_INT, -7); end;
gpl-3.0
rizaumami/merbot
plugins/urbandictionary.lua
1
2138
do local function get_udescription(msg, matches) local url = 'http://api.urbandictionary.com/v0/define?term=' .. URL.escape(matches) local jstr, res = http.request(url) if res ~= 200 then send_message(msg, '<b>Connection error</b>', 'html') return end local jdat = json:decode(jstr) if jdat.result_type == 'no_results' then send_message(msg, "There aren't any definitions for <i>" .. matches .. "</i> yet.", 'html') return end local output = jdat.list[1].definition:trim() if string.len(jdat.list[1].example) > 0 then output = output .. '\n\n' .. jdat.list[1].example:trim() end send_message(msg, output, nil) end local function ud_by_reply(extra, success, result) if extra.to.peer_id == result.to.peer_id then get_udescription(result, result.text) else reply_msg(extra.id, "Sorry, I can't resolve a username from an old message", ok_cb, true) end end local function run(msg, matches) if msg.reply_id then if matches[1] == 'urbandictionary' or matches[1] == 'ud' or matches[1] == 'urban' then get_message(msg.reply_id, ud_by_reply, msg) end else if msg.reply_to_message then get_udescription(msg, msg.reply_to_message.text) else get_udescription(msg, matches[1]) end end end return { description = 'Returns a definition from Urban Dictionary.', usage = { '<code>!ud [query]</code>', '<code>!urban [query]</code>', '<code>!urbandictionary [query]</code>', 'Returns a <code>[query]</code> definition from urbandictionary.com', '<b>Example</b>: <code>!ud fam</code>', '', '<code>!ud</code>', '<code>!urban</code>', '<code>!urbandictionary</code>', 'By reply. Returns a <code>[query]</code> definition from urbandictionary.com', 'The <code>[query]</code> is the replied message text.' }, patterns = { '^!(urbandictionary)$', '^!(ud)$', '^!(urban)$', '^!urbandictionary (.+)$', '^!ud (.+)$', '^!urban (.+)$' }, run = run } end
gpl-2.0
hooksta4/darkstar
scripts/zones/zones/Buburimu_Peninsula/Zone.lua
15
4493
----------------------------------- -- -- Zone: Buburimu_Peninsula (118) -- ----------------------------------- package.loaded[ "scripts/zones/Buburimu_Peninsula/TextIDs"] = nil; package.loaded["scripts/globals/chocobo_digging"] = nil; ----------------------------------- require("scripts/zones/Buburimu_Peninsula/TextIDs"); require("scripts/globals/icanheararainbow"); require("scripts/globals/zone"); require("scripts/globals/conquest"); require("scripts/globals/chocobo_digging"); ----------------------------------- -- Chocobo Digging vars ----------------------------------- local itemMap = { -- itemid, abundance, requirement { 847, 45, DIGREQ_NONE }, { 887, 1, DIGREQ_NONE }, { 893, 53, DIGREQ_NONE }, { 17395, 98, DIGREQ_NONE }, { 738, 3, DIGREQ_NONE }, { 888, 195, DIGREQ_NONE }, { 4484, 47, DIGREQ_NONE }, { 17397, 66, DIGREQ_NONE }, { 641, 134, DIGREQ_NONE }, { 885, 12, DIGREQ_NONE }, { 4096, 100, DIGREQ_NONE }, -- all crystals { 845, 125, DIGREQ_BURROW }, { 843, 1, DIGREQ_BURROW }, { 844, 64, DIGREQ_BURROW }, { 1845, 34, DIGREQ_BURROW }, { 838, 7, DIGREQ_BURROW }, { 880, 34, DIGREQ_BORE }, { 902, 5, DIGREQ_BORE }, { 886, 3, DIGREQ_BORE }, { 867, 3, DIGREQ_BORE }, { 864, 21, DIGREQ_BORE }, { 1587, 19, DIGREQ_BORE }, { 1586, 9, DIGREQ_BORE }, { 866, 2, DIGREQ_BORE }, { 4570, 10, DIGREQ_MODIFIER }, { 4487, 11, DIGREQ_MODIFIER }, { 4409, 12, DIGREQ_MODIFIER }, { 1188, 10, DIGREQ_MODIFIER }, { 4532, 12, DIGREQ_MODIFIER }, }; local messageArray = { DIG_THROW_AWAY, FIND_NOTHING, ITEM_OBTAINED }; ----------------------------------- -- onChocoboDig ----------------------------------- function onChocoboDig(player, precheck) return chocoboDig(player, itemMap, precheck, messageArray); end; ----------------------------------- -- onInitialize ----------------------------------- function onInitialize(zone) local manuals = {17261199,17261200}; SetFieldManual(manuals); SetRegionalConquestOverseers(zone:getRegionID()) end; ----------------------------------- -- onZoneIn ----------------------------------- function onZoneIn( player, prevZone) local cs = -1; if (player:getXPos() == 0 and player:getYPos() == 0 and player:getZPos() == 0) then player:setPos( -276.529, 16.403, -324.519, 14); end if (triggerLightCutscene(player)) then -- Quest: I Can Hear A Rainbow cs = 0x0003; elseif (player:getCurrentMission(WINDURST) == VAIN and player:getVar("MissionStatus") ==1) then cs = 0x0005; -- zone 4 buburimu no update (north) end return cs; 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; ----------------------------------- -- onRegionEnter ----------------------------------- function onRegionEnter(player,region) end; ----------------------------------- -- onEventUpdate ----------------------------------- function onEventUpdate( player, csid, option) -- printf("CSID: %u",csid); -- printf("RESULT: %u",option); if (csid == 0x0003) then lightCutsceneUpdate(player); -- Quest: I Can Hear A Rainbow elseif (csid == 0x0005) then if (player:getPreviousZone() == 213 or player:getPreviousZone() == 249) then player:updateEvent(0,0,0,0,0,7); elseif (player:getPreviousZone() == 198) then player:updateEvent(0,0,0,0,0,6); end end end; ----------------------------------- -- onEventFinish ----------------------------------- function onEventFinish( player, csid, option) -- printf("CSID: %u",csid); -- printf("RESULT: %u",option); if (csid == 0x0003) then lightCutsceneFinish(player); -- Quest: I Can Hear A Rainbow end end;
gpl-3.0
telemagma/prj-1
plugins/sticker_lock.lua
2
19228
-- data saved to data/moderation.json do local administrators_only = 'For administrator only!' local moderators_only = 'For moderators only!' local function create_group(msg) if not is_admin(msg) then return administrators_only end local group_creator = msg.from.print_name create_group_chat (group_creator, group_name, ok_cb, false) return 'Group '..string.gsub(group_name, '_', ' ')..' has been created.' end local function addgroup(msg) if not is_admin(msg) then return administrators_only end local data = load_data(_config.moderation.data) if data[tostring(msg.to.id)] then return 'Group is already added.' end -- create data array in moderation.json data[tostring(msg.to.id)] = { moderators ={}, settings = { set_name = string.gsub(msg.to.print_name, '_', ' '), lock_bots = 'no', lock_name = 'no', lock_photo = 'no', lock_member = 'no', anti_flood = 'no', welcome = 'no', sticker = 'ok' } } save_data(_config.moderation.data, data) return 'Group has been added.' end local function remgroup(msg) if not is_admin(msg) then return administrators_only end local data = load_data(_config.moderation.data) local receiver = get_receiver(msg) if not data[tostring(msg.to.id)] then return 'Group is not added.' end data[tostring(msg.to.id)] = nil save_data(_config.moderation.data, data) return 'Group has been removed' end local function export_chat_link_callback(extra, success, result) local msg = extra.msg local group_name = msg.to.title local data = extra.data local receiver = get_receiver(msg) if success == 0 then return send_large_msg(receiver, 'Cannot generate invite link for this group.\nMake sure you are an admin or a sudoer.') end data[tostring(msg.to.id)]['link'] = result save_data(_config.moderation.data, data) return send_large_msg(receiver,'Newest generated invite link for '..group_name..' is:\n'..result) end local function set_description(msg, data) if not is_mod(msg) then return moderators_only end local data_cat = 'description' data[tostring(msg.to.id)][data_cat] = deskripsi save_data(_config.moderation.data, data) return 'Set group description to:\n'..deskripsi end local function get_description(msg, data) local data_cat = 'description' if not data[tostring(msg.to.id)][data_cat] then return 'No description available.' end local about = data[tostring(msg.to.id)][data_cat] return string.gsub(msg.to.print_name, "_", " ")..':\n\n'..about end local function set_rules(msg, data) if not is_mod(msg) then return moderators_only end local data_cat = 'rules' data[tostring(msg.to.id)][data_cat] = rules save_data(_config.moderation.data, data) return 'Set group rules to:\n'..rules end local function get_rules(msg, data) local data_cat = 'rules' if not data[tostring(msg.to.id)][data_cat] then return 'No rules available.' end local rules = data[tostring(msg.to.id)][data_cat] local rules = string.gsub(msg.to.print_name, '_', ' ')..' rules:\n\n'..rules return rules end -- dis/allow APIs bots to enter group. Spam prevention. local function allow_api_bots(msg, data) if not is_mod(msg) then return moderators_only end local group_bot_lock = data[tostring(msg.to.id)]['settings']['lock_bots'] if group_bot_lock == 'no' then return 'Bots are allowed to enter group.' else data[tostring(msg.to.id)]['settings']['lock_bots'] = 'no' save_data(_config.moderation.data, data) return 'Group is open for bots.' end end local function disallow_api_bots(msg, data) if not is_mod(msg) then return moderators_only end local group_bot_lock = data[tostring(msg.to.id)]['settings']['lock_bots'] if group_bot_lock == 'yes' then return 'Group is already locked from bots.' else data[tostring(msg.to.id)]['settings']['lock_bots'] = 'yes' save_data(_config.moderation.data, data) return 'Group is locked from bots.' end end -- lock/unlock group name. bot automatically change group name when locked local function lock_group_name(msg, data) if not is_mod(msg) then return moderators_only end local group_name_set = data[tostring(msg.to.id)]['settings']['set_name'] local group_name_lock = data[tostring(msg.to.id)]['settings']['lock_name'] if group_name_lock == 'yes' then return 'Group name is already locked' else data[tostring(msg.to.id)]['settings']['lock_name'] = 'yes' save_data(_config.moderation.data, data) data[tostring(msg.to.id)]['settings']['set_name'] = string.gsub(msg.to.print_name, '_', ' ') save_data(_config.moderation.data, data) return 'Group name has been locked' end end local function unlock_group_name(msg, data) if not is_mod(msg) then return moderators_only end local group_name_set = data[tostring(msg.to.id)]['settings']['set_name'] local group_name_lock = data[tostring(msg.to.id)]['settings']['lock_name'] if group_name_lock == 'no' then return 'Group name is already unlocked' else data[tostring(msg.to.id)]['settings']['lock_name'] = 'no' save_data(_config.moderation.data, data) return 'Group name has been unlocked' end end --lock/unlock group member. bot automatically kick new added user when locked local function lock_group_member(msg, data) if not is_mod(msg) then return moderators_only end local group_member_lock = data[tostring(msg.to.id)]['settings']['lock_member'] if group_member_lock == 'yes' then return 'Group members are already locked' else data[tostring(msg.to.id)]['settings']['lock_member'] = 'yes' save_data(_config.moderation.data, data) end return 'Group members has been locked' end local function unlock_group_member(msg, data) if not is_mod(msg) then return moderators_only end local group_member_lock = data[tostring(msg.to.id)]['settings']['lock_member'] if group_member_lock == 'no' then return 'Group members are not locked' else data[tostring(msg.to.id)]['settings']['lock_member'] = 'no' save_data(_config.moderation.data, data) return 'Group members has been unlocked' end end --lock/unlock group photo. bot automatically keep group photo when locked local function lock_group_photo(msg, data) if not is_mod(msg) then return moderators_only end local group_photo_lock = data[tostring(msg.to.id)]['settings']['lock_photo'] if group_photo_lock == 'yes' then return 'Group photo is already locked' else data[tostring(msg.to.id)]['settings']['set_photo'] = 'waiting' save_data(_config.moderation.data, data) end return 'Please send me the group photo now' end local function unlock_group_photo(msg, data) if not is_mod(msg) then return moderators_only end local group_photo_lock = data[tostring(msg.to.id)]['settings']['lock_photo'] if group_photo_lock == 'no' then return 'Group photo is not locked' else data[tostring(msg.to.id)]['settings']['lock_photo'] = 'no' save_data(_config.moderation.data, data) return 'Group photo has been unlocked' end end local function set_group_photo(msg, success, result) local data = load_data(_config.moderation.data) local receiver = get_receiver(msg) if success then local file = 'data/photos/chat_photo_'..msg.to.id..'.jpg' print('File downloaded to:', result) os.rename(result, file) print('File moved to:', file) chat_set_photo (receiver, file, ok_cb, false) data[tostring(msg.to.id)]['settings']['set_photo'] = file save_data(_config.moderation.data, data) data[tostring(msg.to.id)]['settings']['lock_photo'] = 'yes' save_data(_config.moderation.data, data) send_large_msg(receiver, 'Photo saved!', ok_cb, false) else print('Error downloading: '..msg.id) send_large_msg(receiver, 'Failed, please try again!', ok_cb, false) end end -- show group settings local function show_group_settings(msg, data) if not is_mod(msg) then return moderators_only end local settings = data[tostring(msg.to.id)]['settings'] if settings.lock_bots == 'yes' then lock_bots_state = 'ًں”’' elseif settings.lock_bots == 'no' then lock_bots_state = 'ًں”“' end if settings.lock_name == 'yes' then lock_name_state = 'ًں”’' elseif settings.lock_name == 'no' then lock_name_state = 'ًں”“' end if settings.lock_photo == 'yes' then lock_photo_state = 'ًں”’' elseif settings.lock_photo == 'no' then lock_photo_state = 'ًں”“' end if settings.lock_member == 'yes' then lock_member_state = 'ًں”’' elseif settings.lock_member == 'no' then lock_member_state = 'ًں”“' end if settings.anti_flood ~= 'no' then antiflood_state = 'ًں”’' elseif settings.anti_flood == 'no' then antiflood_state = 'ًں”“' end if settings.welcome ~= 'no' then greeting_state = 'ًں”’' elseif settings.welcome == 'no' then greeting_state = 'ًں”“' end if settings.sticker ~= 'ok' then sticker_state = 'ًں”’' elseif settings.sticker == 'ok' then sticker_state = 'ًں”“' end local text = 'Group settings:\n' ..'\n'..lock_bots_state..' Lock group from bot : '..settings.lock_bots ..'\n'..lock_name_state..' Lock group name : '..settings.lock_name ..'\n'..lock_photo_state..' Lock group photo : '..settings.lock_photo ..'\n'..lock_member_state..' Lock group member : '..settings.lock_member ..'\n'..antiflood_state..' Flood protection : '..settings.anti_flood ..'\n'..greeting_state..' Welcome message : '..settings.welcome ..'\n'..sticker_state..' Sticker policy : '..settings.sticker return text end -- media handler. needed by group_photo_lock local function pre_process(msg) if not msg.text and msg.media then msg.text = '['..msg.media.type..']' end return msg end function run(msg, matches) if not is_chat_msg(msg) then return "This is not a group chat." end local data = load_data(_config.moderation.data) local receiver = get_receiver(msg) -- create a group if matches[1] == 'mkgroup' and matches[2] then group_name = matches[2] return create_group(msg) end -- add a group to be moderated if matches[1] == 'addgroup' then return addgroup(msg) end -- remove group from moderation if matches[1] == 'remgroup' then return remgroup(msg) end if msg.media and is_chat_msg(msg) and is_momod(msg) then if msg.media.type == 'photo' and data[tostring(msg.to.id)] then if data[tostring(msg.to.id)]['settings']['set_photo'] == 'waiting' then load_photo(msg.id, set_group_photo, msg) end end end if data[tostring(msg.to.id)] then local settings = data[tostring(msg.to.id)]['settings'] if matches[1] == 'setabout' and matches[2] then deskripsi = matches[2] return set_description(msg, data) end if matches[1] == 'about' then return get_description(msg, data) end if matches[1] == 'setrules' then rules = matches[2] return set_rules(msg, data) end if matches[1] == 'rules' then return get_rules(msg, data) end -- group link {get|set} if matches[1] == 'link' then if matches[2] == 'get' then if data[tostring(msg.to.id)]['link'] then local about = get_description(msg, data) local link = data[tostring(msg.to.id)]['link'] return about.."\n\n"..link else return 'Invite link does not exist.\nTry !link set to generate it.' end end if matches[2] == 'set' and is_mod(msg) then msgr = export_chat_link(receiver, export_chat_link_callback, {data=data, msg=msg}) end end if matches[1] == 'group' then -- lock {bot|name|member|photo|sticker} if matches[2] == 'lock' then if matches[3] == 'bot' then return disallow_api_bots(msg, data) end if matches[3] == 'name' then return lock_group_name(msg, data) end if matches[3] == 'member' then return lock_group_member(msg, data) end if matches[3] == 'photo' then return lock_group_photo(msg, data) end -- unlock {bot|name|member|photo|sticker} elseif matches[2] == 'unlock' then if matches[3] == 'bot' then return allow_api_bots(msg, data) end if matches[3] == 'name' then return unlock_group_name(msg, data) end if matches[3] == 'member' then return unlock_group_member(msg, data) end if matches[3] == 'photo' then return unlock_group_photo(msg, data) end -- view group settings elseif matches[2] == 'settings' then return show_group_settings(msg, data) end end if matches[1] == 'sticker' then if matches[2] == 'warn' then if welcome_stat ~= 'warn' then data[tostring(msg.to.id)]['settings']['sticker'] = 'warn' save_data(_config.moderation.data, data) end return '[Alredy Enabled]\nSticker Sender will be warned first, then kicked for second Sticker.' end if matches[2] == 'kick' then if welcome_stat ~= 'kick' then data[tostring(msg.to.id)]['settings']['sticker'] = 'kick' save_data(_config.moderation.data, data) end return '[Already Enabled]Sticker Sender will be kicked!' end if matches[2] == 'ok' then if welcome_stat == 'ok' then return '[Already Disabled]Nothing Will Happend If Sticker Sent!' else data[tostring(msg.to.id)]['settings']['sticker'] = 'ok' save_data(_config.moderation.data, data) return 'Nothing Will Happend If Sticker Sent! ' end end end -- if group name is renamed if matches[1] == 'chat_rename' then if not msg.service then return 'Are you trying to troll me?' end local group_name_set = settings.set_name local group_name_lock = settings.lock_name local to_rename = 'chat#id'..msg.to.id if group_name_lock == 'yes' then if group_name_set ~= tostring(msg.to.print_name) then rename_chat(to_rename, group_name_set, ok_cb, false) end elseif group_name_lock == 'no' then return nil end end -- set group name if matches[1] == 'setname' and is_mod(msg) then local new_name = string.gsub(matches[2], '_', ' ') data[tostring(msg.to.id)]['settings']['set_name'] = new_name save_data(_config.moderation.data, data) local group_name_set = data[tostring(msg.to.id)]['settings']['set_name'] local to_rename = 'chat#id'..msg.to.id rename_chat(to_rename, group_name_set, ok_cb, false) end -- set group photo if matches[1] == 'setphoto' and is_mod(msg) then data[tostring(msg.to.id)]['settings']['set_photo'] = 'waiting' save_data(_config.moderation.data, data) return 'Please send me new group photo now' end -- if a user is added to group if matches[1] == 'chat_add_user' then if not msg.service then return 'Are you trying to troll me?' end local group_member_lock = settings.lock_member local group_bot_lock = settings.lock_bots local user = 'user#id'..msg.action.user.id if group_member_lock == 'yes' then chat_del_user(receiver, user, ok_cb, true) -- no APIs bot are allowed to enter chat group. elseif group_bot_lock == 'yes' and msg.action.user.flags == 4352 then chat_del_user(receiver, user, ok_cb, true) elseif group_bot_lock == 'no' or group_member_lock == 'no' then return nil end end -- if sticker is sent if msg.media and msg.media.caption == 'sticker.webp' and not is_momod(msg) then local user_id = msg.from.id local chat_id = msg.to.id local sticker_hash = 'mer_sticker:'..chat_id..':'..user_id local is_sticker_offender = redis:get(sticker_hash) if settings.sticker == 'warn' then if is_sticker_offender then chat_del_user(receiver, 'user#id'..user_id, ok_cb, true) redis:del(sticker_hash) return '[Warned Before]Kicked Because You Have Sent Stickers' elseif not is_sticker_offender then redis:set(sticker_hash, true) return ' Stop Sending Sticker.This Is A Warn Next Time You Will Kicked!' end elseif settings.sticker == 'kick' then chat_del_user(receiver, 'user#id'..user_id, ok_cb, true) return 'You Kicked Because You Have Sent Stickers??' elseif settings.sticker == 'ok' then return nil end end -- if group photo is deleted if matches[1] == 'chat_delete_photo' then if not msg.service then return 'Are you trying to troll me?' end local group_photo_lock = settings.lock_photo if group_photo_lock == 'yes' then chat_set_photo (receiver, settings.set_photo, ok_cb, false) elseif group_photo_lock == 'no' then return nil end end -- if group photo is changed if matches[1] == 'chat_change_photo' and msg.from.id ~= 0 then if not msg.service then return 'Are you trying to troll me?' end local group_photo_lock = settings.lock_photo if group_photo_lock == 'yes' then chat_set_photo (receiver, settings.set_photo, ok_cb, false) elseif group_photo_lock == 'no' then return nil end end end end return { description = 'Plugin to manage group chat.', usage = { admin = { '!mkgroup <group_name> : Make/create a new group.', '!addgroup : Add group to moderation list.', '!remgroup : Remove group from moderation list.' }, moderator = { '!group <lock|unlock> bot : {Dis}allow APIs bots.', '!group <lock|unlock> member : Lock/unlock group member.', '!group <lock|unlock> name : Lock/unlock group name.', '!group <lock|unlock> photo : Lock/unlock group photo.', '!group settings : Show group settings.', '!link <set> : Generate/revoke invite link.', '!setabout <description> : Set group description.', '!setname <new_name> : Set group name.', '!setphoto : Set group photo.', '!setrules <rules> : Set group rules.', '!sticker warn : Sticker restriction, sender will be warned for the first violation.', '!sticker kick : Sticker restriction, sender will be kick.', '!sticker ok : Disable sticker restriction.' }, user = { '!about : Read group description', '!rules : Read group rules', '!link <get> : Print invite link' }, }, patterns = { "^!(about)$", "^!(addgroup)$", "%[(audio)%]", "%[(document)%]", "^!(group) (lock) (.*)$", "^!(group) (settings)$", "^!(group) (unlock) (.*)$", "^!(link) (.*)$", "^!(mkgroup) (.*)$", "%[(photo)%]", "^!(remgroup)$", "^!(rules)$", "^!(setabout) (.*)$", "^!(setname) (.*)$", "^!(setphoto)$", "^!(setrules) (.*)$", "^[!/](sticker) (.*)$", "^!!tgservice (.+)$", "%[(video)%]" }, run = run, pre_process = pre_process } end --To Have This Update Lua-tg-c avaiable on tg folder
gpl-2.0
FishFilletsNG/fillets-data
script/city/dialogs_sv.lua
1
7024
dialogId("vit-hs-vitejteA", "font_statue", "Welcome to the most beautiful city under the sun.") dialogStr("Välkommen till den vackraste staden under solen.") dialogId("vit-hs-vitejteB", "font_statue", "Welcome to our city - the city of unlimited opportunities.") dialogStr("Välkommen till vår stad, staden med obegränsade möjligheter.") dialogId("vit-hs-vitejteC", "font_statue", "On behalf of the citizens of this town I welcome you.") dialogStr("Å innevånarnas vägnar hälsar jag er välkomna.") dialogId("vit-hs-vitejteD", "font_statue", "Welcome to our city, whose beauty eclipses that of the gods themselves.") dialogStr("Välkommen till vår stad vars skönhet överglänser till och med gudarnas.") dialogId("vit-hs-klid1", "font_statue", "Citizens, please remain calm.") dialogStr("Innevånare, behåll ert lugn.") dialogId("vit-hs-klid2", "font_statue", "There is no imminent danger.") dialogStr("Det finns ingen omedelbar fara.") dialogId("vit-hs-klid3", "font_statue", "The sinking of the northern part of our island is only temporary.") dialogStr("Sänkningen av den norra delen av ön är endast tillfällig.") dialogId("vit-hs-klid4", "font_statue", "We have the situation completely under control.") dialogStr("Vi har allt helt under kontroll.") dialogId("vit-hs-lod0", "font_statue", "The ship from Lemury has now docked at pier #5. This ship continues on to Utopia, Mu and Atlantis.") dialogStr("Fartyget från Lemurien har nu ankrat vid pir 5. Det fortsätter mot Utopia, Mu och Atlantis.") dialogId("vit-hs-pojis0", "font_statue", "With First Fishermen Insurance, your house is covered against damage caused by fire, tornadoes, hurricanes, acts of God and dragons’ raids. Because fishermen think of everything, choose First Fisherman.") dialogStr("Med första fiskarens försäkringen ersätts ditt hus vid skada av brand, tornado, storm, gudahandlingar och drakräder. Fiskarna tänker på allt, välj därför första fiskaren !") dialogId("vit-hs-reklama1", "font_statue", "Where are you running?") dialogStr("Vart springer du?") dialogId("vit-hs-reklama2", "font_white", "To Moon Street. I need to order eight swords.") dialogStr("Till mångatan. Jag måste beställa åtta svärd.") dialogId("vit-hs-reklama3", "font_statue", "Why so many swords?") dialogStr("Varför så många svärd?") dialogId("vit-hs-reklama4", "font_white", "You haven’t heard?!? For every eight swords you purchase, you get a pair of bronze earrings absolutely FREE!") dialogStr("Har du inte hört?!? För vart åttonde svärd som du köper få du ett par bronsörhängen helt GRATIS!") dialogId("vit-hs-reklama5", "font_statue", "Wait for me. I’m coming with you!") dialogStr("Vänta på mig. Jag hänger på!") dialogId("vit-hs-soud0", "font_statue", "The City Court kindly invites you to the annual town festival of interrogations and executions. Proper attire required.") dialogStr("Tingsrätten inbjuder till den årliga förhörs och avrättnings festivalen. Proper klädsel krävs.") dialogId("vit-hs-vodovod0", "font_statue", "The City Council has decided to build an aqueduct, thereby providing direct water service to each home.") dialogStr("Kommunstyrelsen har beslutat att bygga en akvedukt, vilket kommer att resultera i en direkt vattenanslutning till alla hem.") dialogId("vit-hs-dite0", "font_statue", "Would the mother of the child who got lost on the grounds of city treasury please come to the front desk to pick up his remains.") dialogStr("Kan mamman till det barn som kom bort i stadskassan vara vänlig att komma till informationen och hämta resterna av honom.") dialogId("vit-hs-demoni0", "font_statue", "Citizens, our employees will be stopping by individual homes tomorrow after midnight in order to rid your home of demons and ghosts. We ask that you kindly let them in.") dialogStr("Innevånare, våra anställda kommer att titta in hos enskilda i morgon efter midnatt för att driva ut demoner och andar. Vänligen släpp in dem.") dialogId("vit-hs-kacir", "font_statue", "Our chief heretic Demikuls will present a lecture this evening in the small auditorium entitled ’Do the gods really exist? or Rest assured they cannot harm you!’") dialogStr("Våran över kättare Demikuls kommer att hålla en liten seminarie i eftermiddag under titeln \"Finns verkligen gudarna? eller Rest försäkrar att de inte kan skada oss!\".") dialogId("vit-hs-jidelna1", "font_statue", "Come visit our seafood restaurant located at the Main Square. Delicious fish specialties and...") dialogStr("Kom och besök våran fiskrestaurang vid stortorget. Delikata fiskspecialitéer och...") dialogId("vit-hs-jidelna2", "font_statue", "Oh, excuse me.") dialogStr("Oj, förlåt mig.") dialogId("vit-m-jakze", "font_small", "What?! A fish restaurant?") dialogStr("Va? En fiskrestaurang") dialogId("vit-v-vazne", "font_big", "Are you serious?") dialogStr("Är det sant?") dialogId("vit-m-nechutne", "font_small", "How disgusting!") dialogStr("Vad avskyvärt!") dialogId("vit-v-nevsimla", "font_big", "That sculpture obviously hasn’t noticed that the city sank a long time ago.") dialogStr("Den där skulpturen har tydligen inte märkt att staden sjönk för ett bra tag sedan.") dialogId("vit-v-automat", "font_big", "It’s probably some kind of automaton. It still thinks that the city is alive.") dialogStr("Det är troligen en sorts förnekelse. Den tror fortfarande att staden lever") dialogId("vit-m-nebo", "font_small", "Or it just can’t face the truth.") dialogStr("Eller så kan den inte tåla sanningen.") dialogId("vit-m-hlava", "font_small", "I’m getting a headache from that head.") dialogStr("Jag får huvudvärk av det där huvudet.") dialogId("vit-v-hlava", "font_big", "That head is giving me a headache.") dialogStr("Huvudet ger mig huvudvärk.") dialogId("vit-m-nezkusime", "font_small", "Let’s try to shut that head up somehow.") dialogStr("Se till att få tyst på huvudet.") dialogId("vit-v-proc", "font_big", "Why? We’re getting invaluable information about the everyday life of our ancestors.") dialogStr("Varför? Vi får ovärderlig information om det dagliga livet hos våra förfäder.") dialogId("vit-v-krabi", "font_big", "If we could get all these crabs up near the head...") dialogStr("Om vi skulle kunna få upp alla krabbor i närheten av huvudet...") dialogId("vit-m-tak", "font_small", "...then...?") dialogStr("...och...?") dialogId("vit-v-pockej", "font_big", "Wait, I have to think about it for a moment...") dialogStr("Vänta, jag måste tänka på det en stund...") dialogId("vit-m-vecnost", "font_small", "Just imagine - that head has been like doing this all these years...") dialogStr("Tänk dig, huvudet har gjort så där i alla dessa år...") dialogId("vit-v-noa", "font_big", "So what?") dialogStr("Och vad då?") dialogId("vit-m-jak", "font_small", "Well think about how these poor crabs must feel!") dialogStr("Tänk hur alla dessa stackars krabbor måste känna sig!")
gpl-2.0
hooksta4/darkstar
scripts/zones/Mog_Garden/npcs/GreenThumbMo.lua
15
2319
package.loaded["scripts/zones/Mog_Garden/TextIDs"] = nil; require("scripts/zones/Mog_Garden/TextIDs"); require("scripts/globals/moghouse") require("scripts/globals/shop"); local BRONZE_PIECE_ITEMID = 2184; ----------------------------------- -- onTrade ----------------------------------- function onTrade(player, npc, trade) moogleTrade(player, npc, trade) end; ----------------------------------- -- onTrigger ----------------------------------- function onTrigger(player, npc) player:startEvent(1016); end; ----------------------------------- -- onEventUpdate ----------------------------------- function onEventUpdate(player,csid,option) --printf("CSID: %u",csid); --printf("RESULT: %u",option); end; ----------------------------------- -- onEventFinish ----------------------------------- function onEventFinish(player, csid, option) if (csid == 1016 and option == 0xFFF00FF) then -- Show the Mog House menu.. -- Print the expire time for mog locker if exists.. local lockerLease = getMogLockerExpiryTimestamp(player); if (lockerLease ~= nil) then if (lockerLease == -1) then -- Lease expired.. player:messageSpecial(MOGLOCKER_MESSAGE_OFFSET + 2, BRONZE_PIECE_ITEMID); else player:messageSpecial(MOGLOCKER_MESSAGE_OFFSET + 1, lockerLease); end end -- Show the mog house menu.. player:sendMenu(1); elseif (csid == 1016 and option == 0xFFE00FF) then -- Buy/Sell Things local stock = { 573, 280, -- Vegetable Seeds 574, 320, -- Fruit Seeds 575, 280, -- Grain Seeds 572, 280, -- Herb Seeds 1236, 1685, -- Cactus Stems 2235, 320, -- Wildgrass Seeds 3986, 1111, -- Chestnut Tree Sap (11th Anniversary Campaign) 3985, 1111, -- Monarch Beetle Saliva (11th Anniversary Campaign) 3984, 1111, -- Golden Seed Pouch (11th Anniversary Campaign) }; showShop( player, STATIC, stock ); elseif (csid == 1016 and option == 0xFFB00FF) then -- Leave this Mog Garden -> Whence I Came player:warp(); -- Ghetto for now, the last zone seems to get messed up due to mog house issues. end end;
gpl-3.0
RAlexis/ArcEmu_MoP
src/scripts/lua/LuaBridge/Stable Scripts/Azeroth/Karazhan/BOSS_Karazhan_Malchezaar.lua
30
4212
function Malchezaar_Hellfire(Unit, event, miscunit, misc) print "Malchezaar Hellfire" Unit:FullCastSpellOnTarget(43465,Unit:GetClosestPlayer()) Unit:SendChatMessage(11, 0, "BURN...") end function Malchezaar_Thrash(Unit, event, miscunit, misc) print "Malchezaar Thrash" Unit:FullCastSpell(21919) Unit:SendChatMessage(11, 0, "Watch the speed...") end function Malchezaar_Parry(Unit, event, miscunit, misc) print "Malchezaar Parry" Unit:FullCastSpell(13668) Unit:SendChatMessage(11, 0, "Miss...") end function Malchezaar_Sunder_Armor(Unit, event, miscunit, misc) print "Malchezaar Sunder Armor" Unit:FullCastSpellOnTarget(30901,Unit:GetClosestPlayer()) Unit:SendChatMessage(11, 0, "You lose some protection!...") end function Malchezaar_Cleave(Unit, event, miscunit, misc) print "Malchezaar Cleave" Unit:FullCastSpellOnTarget(39174,Unit:GetClosestPlayer()) Unit:SendChatMessage(11, 0, "Cleave...") end function Malchezaar_Amplify(Unit, event, miscunit, misc) print "Malchezaar Amplify" Unit:FullCastSpellOnTarget(39095,Unit:GetRandomPlayer()) Unit:SendChatMessage(11, 0, "More damage to you...") end function Malchezaar_Flying_Axes(Unit, event, miscunit, misc) print "Malchezaar Flying_Axes" Unit:FullCastSpell(17650) Unit:SendChatMessage(11, 0, "My Axes will kill you...") end function Malchezaar_Shadow_Word_Pain(Unit, event, miscunit, misc) print "Malchezaar Shadow_Word Pain" Unit:FullCastSpellOnTarget(30854,Unit:GetClosestPlayer()) Unit:SendChatMessage(11, 0, "More Pain...") end function Malchezaar_Shadow_Word_Pain2(Unit, event, miscunit, misc) print "Malchezaar Shadow_Word Pain2" Unit:FullCastSpellOnTarget(30854,Unit:GetRandomPlayer()) Unit:SendChatMessage(11, 0, "More Pain...") end function Malchezaar_Summon_Infernal(Unit, event, miscunit, misc) print "Malchezaar Summon Infernal" Unit:SpawnCreature(17646, -10924.5, -1974.66, 275.522, 0, 18, 180000); Unit:SendChatMessage(11, 0, "Help me infernal creature...") end function Malchezaar_Enfeeble(Unit, event, miscunit, misc) print "Malchezaar Enfeeble" Unit:FullCastSpellOnTarget(30843,Unit:GetRandomPlayer()) Unit:FullCastSpellOnTarget(30843,Unit:GetRandomPlayer()) Unit:FullCastSpellOnTarget(30843,Unit:GetRandomPlayer()) Unit:FullCastSpellOnTarget(30843,Unit:GetRandomPlayer()) Unit:FullCastSpellOnTarget(30843,Unit:GetRandomPlayer()) Unit:SendChatMessage(11, 0, "More Pain...") end function Malchezaar_Shadow_Nova(Unit, event, miscunit, misc) print "Malchezaar Shadow Nova" Unit:FullCastSpellOnTarget(30852,Unit:GetClosestPlayer()) Unit:SendChatMessage(11, 0, "A big blast to finish this fight...") end function Malchezaar(unit, event, miscunit, misc) print "Malchezaar" if unit:GetHealthPct() < 100 and Didthat == 0 then unit:SendAreaTriggerMessage("PHASE 1") unit:SendChatMessage(11, 0, "You face not Malchezaar alone, but the legions I command!") unit:RegisterEvent("Malchezaar_Hellfire",2000,0) unit:RegisterEvent("Malchezaar_Shadow_Word_Pain",25000,0) unit:RegisterEvent("Malchezaar_Summon_Infernal",35000,0) unit:RegisterEvent("Malchezaar_Enfeeble",45000,0) unit:RegisterEvent("Malchezaar_Shadow_Nova",47000,0) Didthat = 1 else end if unit:GetHealthPct() < 60 and Didthat == 1 then unit:SendAreaTriggerMessage("PHASE 2") unit:RegisterEvent("Malchezaar_Hellfire",2000,0) unit:RegisterEvent("Malchezaar_Thrash",5000,0) unit:RegisterEvent("Malchezaar_Parry",6000,0) unit:RegisterEvent("Malchezaar_Sunder_Armor",7000,0) unit:RegisterEvent("Malchezaar_Cleave",8000,0) unit:RegisterEvent("Malchezaar_Summon_Infernal",45000,0) unit:RegisterEvent("Malchezaar_Enfeeble",46000,0) unit:RegisterEvent("Malchezaar_Shadow_Nova",47000,0) Didthat = 2 else end if unit:GetHealthPct() < 30 and Didthat == 2 then unit:SendAreaTriggerMessage("PHASE 3") unit:RegisterEvent("Malchezaar_Hellfire",2000,0) unit:RegisterEvent("Malchezaar_Amplify",10000,0) unit:RegisterEvent("Malchezaar_Summon_Infernal",15000,0) unit:RegisterEvent("Malchezaar_Shadow_Word_Pain2",25000,0) unit:RegisterEvent("Malchezaar_Flying_Axes",17000,0) unit:RegisterEvent("Malchezaar_Shadow_Nova",47000,0) Didthat = 3 else end end RegisterUnitEvent(15690,1,"Malchezaar")
agpl-3.0
Erotix8210/FrozenCore
src/scripts/lua/Lua/Stable Scripts/Azeroth/Karazhan/BOSS_Karazhan_Malchezaar.lua
30
4212
function Malchezaar_Hellfire(Unit, event, miscunit, misc) print "Malchezaar Hellfire" Unit:FullCastSpellOnTarget(43465,Unit:GetClosestPlayer()) Unit:SendChatMessage(11, 0, "BURN...") end function Malchezaar_Thrash(Unit, event, miscunit, misc) print "Malchezaar Thrash" Unit:FullCastSpell(21919) Unit:SendChatMessage(11, 0, "Watch the speed...") end function Malchezaar_Parry(Unit, event, miscunit, misc) print "Malchezaar Parry" Unit:FullCastSpell(13668) Unit:SendChatMessage(11, 0, "Miss...") end function Malchezaar_Sunder_Armor(Unit, event, miscunit, misc) print "Malchezaar Sunder Armor" Unit:FullCastSpellOnTarget(30901,Unit:GetClosestPlayer()) Unit:SendChatMessage(11, 0, "You lose some protection!...") end function Malchezaar_Cleave(Unit, event, miscunit, misc) print "Malchezaar Cleave" Unit:FullCastSpellOnTarget(39174,Unit:GetClosestPlayer()) Unit:SendChatMessage(11, 0, "Cleave...") end function Malchezaar_Amplify(Unit, event, miscunit, misc) print "Malchezaar Amplify" Unit:FullCastSpellOnTarget(39095,Unit:GetRandomPlayer()) Unit:SendChatMessage(11, 0, "More damage to you...") end function Malchezaar_Flying_Axes(Unit, event, miscunit, misc) print "Malchezaar Flying_Axes" Unit:FullCastSpell(17650) Unit:SendChatMessage(11, 0, "My Axes will kill you...") end function Malchezaar_Shadow_Word_Pain(Unit, event, miscunit, misc) print "Malchezaar Shadow_Word Pain" Unit:FullCastSpellOnTarget(30854,Unit:GetClosestPlayer()) Unit:SendChatMessage(11, 0, "More Pain...") end function Malchezaar_Shadow_Word_Pain2(Unit, event, miscunit, misc) print "Malchezaar Shadow_Word Pain2" Unit:FullCastSpellOnTarget(30854,Unit:GetRandomPlayer()) Unit:SendChatMessage(11, 0, "More Pain...") end function Malchezaar_Summon_Infernal(Unit, event, miscunit, misc) print "Malchezaar Summon Infernal" Unit:SpawnCreature(17646, -10924.5, -1974.66, 275.522, 0, 18, 180000); Unit:SendChatMessage(11, 0, "Help me infernal creature...") end function Malchezaar_Enfeeble(Unit, event, miscunit, misc) print "Malchezaar Enfeeble" Unit:FullCastSpellOnTarget(30843,Unit:GetRandomPlayer()) Unit:FullCastSpellOnTarget(30843,Unit:GetRandomPlayer()) Unit:FullCastSpellOnTarget(30843,Unit:GetRandomPlayer()) Unit:FullCastSpellOnTarget(30843,Unit:GetRandomPlayer()) Unit:FullCastSpellOnTarget(30843,Unit:GetRandomPlayer()) Unit:SendChatMessage(11, 0, "More Pain...") end function Malchezaar_Shadow_Nova(Unit, event, miscunit, misc) print "Malchezaar Shadow Nova" Unit:FullCastSpellOnTarget(30852,Unit:GetClosestPlayer()) Unit:SendChatMessage(11, 0, "A big blast to finish this fight...") end function Malchezaar(unit, event, miscunit, misc) print "Malchezaar" if unit:GetHealthPct() < 100 and Didthat == 0 then unit:SendAreaTriggerMessage("PHASE 1") unit:SendChatMessage(11, 0, "You face not Malchezaar alone, but the legions I command!") unit:RegisterEvent("Malchezaar_Hellfire",2000,0) unit:RegisterEvent("Malchezaar_Shadow_Word_Pain",25000,0) unit:RegisterEvent("Malchezaar_Summon_Infernal",35000,0) unit:RegisterEvent("Malchezaar_Enfeeble",45000,0) unit:RegisterEvent("Malchezaar_Shadow_Nova",47000,0) Didthat = 1 else end if unit:GetHealthPct() < 60 and Didthat == 1 then unit:SendAreaTriggerMessage("PHASE 2") unit:RegisterEvent("Malchezaar_Hellfire",2000,0) unit:RegisterEvent("Malchezaar_Thrash",5000,0) unit:RegisterEvent("Malchezaar_Parry",6000,0) unit:RegisterEvent("Malchezaar_Sunder_Armor",7000,0) unit:RegisterEvent("Malchezaar_Cleave",8000,0) unit:RegisterEvent("Malchezaar_Summon_Infernal",45000,0) unit:RegisterEvent("Malchezaar_Enfeeble",46000,0) unit:RegisterEvent("Malchezaar_Shadow_Nova",47000,0) Didthat = 2 else end if unit:GetHealthPct() < 30 and Didthat == 2 then unit:SendAreaTriggerMessage("PHASE 3") unit:RegisterEvent("Malchezaar_Hellfire",2000,0) unit:RegisterEvent("Malchezaar_Amplify",10000,0) unit:RegisterEvent("Malchezaar_Summon_Infernal",15000,0) unit:RegisterEvent("Malchezaar_Shadow_Word_Pain2",25000,0) unit:RegisterEvent("Malchezaar_Flying_Axes",17000,0) unit:RegisterEvent("Malchezaar_Shadow_Nova",47000,0) Didthat = 3 else end end RegisterUnitEvent(15690,1,"Malchezaar")
agpl-3.0
hooksta4/darkstar
scripts/zones/zones/Heavens_Tower/npcs/Kupipi.lua
2
6369
----------------------------------- -- Area: Heaven's Tower -- NPC: Kupipi -- Involved in Mission 2-3 -- Involved in Quest: Riding on the Clouds -- @pos 2 0.1 30 242 ----------------------------------- package.loaded["scripts/zones/Heavens_Tower/TextIDs"] = nil; ----------------------------------- require("scripts/globals/keyitems"); require("scripts/globals/quests"); require("scripts/globals/missions"); require("scripts/zones/Heavens_Tower/TextIDs"); ----------------------------------- -- onTrade Action ----------------------------------- function onTrade(player,npc,trade) if (player:getQuestStatus(JEUNO,RIDING_ON_THE_CLOUDS) == QUEST_ACCEPTED and player:getVar("ridingOnTheClouds_4") == 8) then if (trade:hasItemQty(1127,1) and trade:getItemCount() == 1) then -- Trade Kindred seal player:setVar("ridingOnTheClouds_4",0); player:tradeComplete(); player:addKeyItem(SPIRITED_STONE); player:messageSpecial(KEYITEM_OBTAINED,SPIRITED_STONE); end end if (trade:hasItemQty(4365,1) and trade:getItemCount() == 1 and player:getNation() == WINDURST and player:getRank() >= 2 and player:hasKeyItem(PORTAL_CHARM) == false) then -- Trade Rolanberry if (player:hasCompletedMission(WINDURST,WRITTEN_IN_THE_STARS)) then player:startEvent(0x0123); -- Qualifies for the reward immediately else player:startEvent(0x0124); -- Kupipi owes you the portal charm later end end end; ----------------------------------- -- onTrigger Action ----------------------------------- function onTrigger(player,npc) local pNation = player:getNation(); local currentMission = player:getCurrentMission(pNation); local MissionStatus = player:getVar("MissionStatus"); if (pNation == SANDORIA) then -- San d'Oria Mission 2-3 Part I - Windurst > Bastok if (currentMission == JOURNEY_TO_WINDURST) then if (MissionStatus == 4) then player:startEvent(0x00ee,1,1,1,1,pNation); elseif (MissionStatus == 5) then player:startEvent(0x00f0); elseif (MissionStatus == 6) then player:startEvent(0x00f1); end -- San d'Oria Mission 2-3 Part II - Bastok > Windurst elseif (currentMission == JOURNEY_TO_WINDURST2) then if (MissionStatus == 7) then player:startEvent(0x00f2,1,1,1,1,0); elseif (MissionStatus == 8) then player:startEvent(0x00f3); elseif (MissionStatus == 9) then player:startEvent(0x00f6); elseif (MissionStatus == 10) then player:startEvent(0x00f7); end else player:startEvent(0x00fb); end elseif (pNation == BASTOK) then -- Bastok Mission 2-3 Part I - Windurst > San d'Oria if (currentMission == THE_EMISSARY_WINDURST) then if (MissionStatus == 3) then player:startEvent(0x00ee,1,1,1,1,pNation); elseif (MissionStatus <= 5) then player:startEvent(0x00f0); elseif (MissionStatus == 6) then player:startEvent(0x00f1); end -- Bastok Mission 2-3 Part II - San d'Oria > Windurst elseif (currentMission == THE_EMISSARY_WINDURST2) then if (MissionStatus == 7) then player:startEvent(0x00f2,1,1,1,1,pNation); elseif (MissionStatus == 8) then player:startEvent(0x00f3); elseif (MissionStatus == 9) then player:startEvent(0x00f4); elseif (MissionStatus == 10) then player:startEvent(0x00f5); end else player:startEvent(0x00fb); end elseif (pNation == WINDURST) then if (currentMission == THE_THREE_KINGDOMS and MissionStatus == 0) then player:startEvent(0x005F,0,0,0,LETTER_TO_THE_CONSULS_WINDURST); elseif (currentMission == THE_THREE_KINGDOMS and MissionStatus == 11) then player:startEvent(0x0065,0,0,ADVENTURERS_CERTIFICATE); elseif (currentMission == THE_THREE_KINGDOMS) then player:startEvent(0x0061); elseif (currentMission == TO_EACH_HIS_OWN_RIGHT and MissionStatus == 0) then player:startEvent(0x0067,0,0,STARWAY_STAIRWAY_BAUBLE); elseif (currentMission == TO_EACH_HIS_OWN_RIGHT and MissionStatus == 1) then player:startEvent(0x0068); elseif (player:getCurrentMission(WINDURST) == THE_JESTER_WHO_D_BE_KING and MissionStatus == 3) then player:startEvent(0x0146); elseif (player:hasCompletedMission(WINDURST,WRITTEN_IN_THE_STARS) and player:getVar("OwesPortalCharm") == 1) then player:startEvent(0x0125); -- Kupipi repays your favor else player:startEvent(0x00fb); end else player:startEvent(0x00fb); 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 == 0x00ee) then if (player:getNation() == BASTOK) then player:setVar("MissionStatus",4); player:addKeyItem(SWORD_OFFERING); player:messageSpecial(KEYITEM_OBTAINED,SWORD_OFFERING); else player:setVar("MissionStatus",5); player:addKeyItem(SHIELD_OFFERING); player:messageSpecial(KEYITEM_OBTAINED,SHIELD_OFFERING); end elseif (csid == 0x00f4 or csid == 0x00f6) then player:setVar("MissionStatus",10); elseif (csid == 0x00f2) then player:addKeyItem(DARK_KEY); player:messageSpecial(KEYITEM_OBTAINED,DARK_KEY); player:setVar("MissionStatus",8); elseif (csid == 0x005F) then player:setVar("MissionStatus",1); player:addKeyItem(LETTER_TO_THE_CONSULS_WINDURST); player:messageSpecial(KEYITEM_OBTAINED,LETTER_TO_THE_CONSULS_WINDURST); elseif (csid == 0x0067) then player:setVar("MissionStatus",1); player:addKeyItem(STARWAY_STAIRWAY_BAUBLE); player:messageSpecial(KEYITEM_OBTAINED,STARWAY_STAIRWAY_BAUBLE); elseif (csid == 0x0065) then finishMissionTimeline(player,1,csid,option); elseif (csid == 0x0123) then -- All condition met, grant Portal Charm player:tradeComplete(); player:addKeyItem(PORTAL_CHARM); player:messageSpecial(KEYITEM_OBTAINED,PORTAL_CHARM); elseif (csid == 0x0124) then -- Traded rolanberry, but not all conditions met player:tradeComplete(); player:setVar("OwesPortalCharm",1); elseif (csid == 0x0125) then -- Traded rolanberry before, and all conditions are now met player:setVar("OwesPortalCharm",0); player:addKeyItem(PORTAL_CHARM); player:messageSpecial(KEYITEM_OBTAINED,PORTAL_CHARM); elseif (csid == 0x0146) then player:setVar("MissionStatus",4); end end;
gpl-3.0
moteus/lua-lluv-gsmmodem
examples/basic.lua
1
2170
package.path = '../src/lua/?.lua;' .. package.path local GsmModem = require "lluv.gsmmodem" local uv = require "lluv" local ut = require "lluv.utils" local utils = require "lluv.gsmmodem.utils" local ok, pp = pcall(require, "pp") if not ok then pp = print end local device = GsmModem.new('COM3', { baud = '_9600'; data_bits = '_8'; parity = 'NONE'; stop_bits = '_1'; flow_control = 'OFF'; rts = 'ON'; }) local SMS_NUMBER = nil local USSD_NUMBER = '#100#' local CODE_PAGE = 'cp866' device:open(function(self, err, info) if err then print("Port open FAIL:", err) return self:close() end print("Port open:", info) self:configure(function(self, err, cmd, info) if err then print("Fail init modem:", err, 'Command:', cmd) return self:close() end print("Configure done") -- self:set_rs232_trace(true) self:read_sms(8, {memory='SM'}, function(self, err, sms) print(err or sms and sms:text(CODE_PAGE)) end) self:read_sms(1, {memory='ME'}, function(self, err, sms) print(err or sms:text(CODE_PAGE)) end) self:each_sms({memory = 'SM'}, function(self, err, index, sms, total, last) if err and not index then return print("Error:", err) end if err then -- try read sms directly return self:read_sms(index, {memory = 'SM'}, function(self, err, sms) print(index, sms and sms:number(), sms and sms:text(CODE_PAGE) or err, sms and sms:date()) end) end print(index, sms and sms:number(), sms and sms:text(CODE_PAGE) or err, sms and sms:date()) end) if USSD_NUMBER then self:send_ussd(USSD_NUMBER, function(self, err, msg) print('USSD Result:', err, msg and msg:status(), msg and msg:text(CODE_PAGE)) end) end if SMS_NUMBER then self:send_sms(SMS_NUMBER, 'hello', {validity = 5, waitReport = true}, function(self, err, ref) print('SMS Send result:', err or 'OK', 'Message reference:', ref or '<NONE>') end) end self:cmd():at(function() self:close() end) end) end) uv.run(debug.traceback)
mit
hooksta4/darkstar
scripts/zones/zones/Buburimu_Peninsula/npcs/Signpost.lua
19
1356
----------------------------------- -- 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() == 17261155) then player:messageSpecial(SIGN_5); elseif (npc:getID() == 17261156) then player:messageSpecial(SIGN_4); elseif (npc:getID() == 17261157) then player:messageSpecial(SIGN_3); elseif (npc:getID() == 17261158) then player:messageSpecial(SIGN_2); elseif (npc:getID() == 17261159) or (npc:getID() == 17261160) or (npc:getID() == 17261161) 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
hooksta4/darkstar
scripts/globals/spells/diaga_ii.lua
18
1869
----------------------------------------- -- Spell: Diaga II -- Lowers an enemy's defense and gradually deals light elemental damage. ----------------------------------------- require("scripts/globals/settings"); require("scripts/globals/status"); require("scripts/globals/magic"); ----------------------------------------- -- OnSpellCast ----------------------------------------- function onMagicCastingCheck(caster,target,spell) return 0; end; function onSpellCast(caster,target,spell) --calculate raw damage local basedmg = caster:getSkillLevel(ENFEEBLING_MAGIC_SKILL) / 4; local dmg = calculateMagicDamage(basedmg,3,caster,spell,target,ENFEEBLING_MAGIC_SKILL,MOD_INT,false); dmg = utils.clamp(dmg, 1, 40); --get resist multiplier (1x if no resist) local resist = applyResistance(caster,spell,target,caster:getStat(MOD_INT)-target:getStat(MOD_INT),ENFEEBLING_MAGIC_SKILL,1.0); --get the resisted damage dmg = dmg*resist; --add on bonuses (staff/day/weather/jas/mab/etc all go in this function) dmg = addBonuses(caster,spell,target,dmg); --add in target adjustment dmg = adjustForTarget(target,dmg,spell:getElement()); --add in final adjustments including the actual damage dealt local final = finalMagicAdjustments(caster,target,spell,dmg); -- Calculate duration. local duration = 120; -- Check for Bio. local bio = target:getStatusEffect(EFFECT_BIO); -- Do it! if (bio == nil or (DIA_OVERWRITE == 0 and bio:getPower() <= 2) or (DIA_OVERWRITE == 1 and bio:getPower() < 2)) then target:addStatusEffect(EFFECT_DIA,2,3,duration,FLAG_ERASABLE, 10); spell:setMsg(2); else spell:setMsg(75); end -- Try to kill same tier Bio if (BIO_OVERWRITE == 1 and bio ~= nil) then if (bio:getPower() <= 2) then target:delStatusEffect(EFFECT_BIO); end end return final; end;
gpl-3.0
gedadsbranch/Darkstar-Mission
scripts/globals/abilities/pets/fire_iv.lua
5
1159
--------------------------------------------------- -- Aero 2 --------------------------------------------------- require("/scripts/globals/settings"); require("/scripts/globals/status"); require("/scripts/globals/monstertpmoves"); require("/scripts/globals/magic"); --------------------------------------------------- function onAbilityCheck(player, target, ability) return 0,0; end; function onPetAbility(target, pet, skill) local spell = getSpell(147); --calculate raw damage local dmg = calculateMagicDamage(472,2,pet,spell,target,ELEMENTAL_MAGIC_SKILL,MOD_INT,false); --get resist multiplier (1x if no resist) local resist = applyPlayerResistance(pet,-1,target,pet:getStat(MOD_INT)-target:getStat(MOD_INT),ELEMENTAL_MAGIC_SKILL, ELE_FIRE); --get the resisted damage dmg = dmg*resist; --add on bonuses (staff/day/weather/jas/mab/etc all go in this function) dmg = mobAddBonuses(pet,spell,target,dmg, 1); --add on TP bonuses local tp = pet:getTP(); if tp < 100 then tp = 100; end dmg = dmg * tp / 100; --add in final adjustments dmg = finalMagicAdjustments(pet,target,spell,dmg); return dmg; end
gpl-3.0
FishFilletsNG/fillets-data
script/tetris/code.lua
1
3137
local cubes = {} for index = 0, 9 do cubes[index] = getModelsTable()[first_cube.index + index] end -- ----------------------------------------------------------------- -- Init -- ----------------------------------------------------------------- local function prog_init() initModels() sound_playMusic("music/rybky07.ogg") local pokus = getRestartCount() -- ------------------------------------------------------------- local function prog_init_room() local pom1, pom2, pomb1, pomb2 = 0, 0, false, false room.zacatek = 0 room.pocitadlo = 300 + random(400 + pokus * 500) room.konec = 0 return function() if no_dialog() and isReady(small) and isReady(big) then if room.pocitadlo > 1 then room.pocitadlo = room.pocitadlo - 1 end if room.zacatek == 0 then addm(9 + random(35), "tet-m-vypadala") if pokus < 5 or random(100) < 50 then addv(5, "tet-v-ucta") addm(9, "tet-m-usudek") end room.zacatek = 1 elseif room.pocitadlo == 0 then room.pocitadlo = -1 addv(9, "tet-v-myslim") if random(100) < 50 then addm(9, "tet-m-ano") end addv(9, "tet-v-lepsi") if random(100) < 50 then addm(16, "tet-m-jaklepsi") addv(6, "tet-v-hybat") end if random(100) < 70 then addm(16, "tet-m-predmety") end addv(16, "tet-v-uprava") addm(6, "tet-m-program") if random(100) < 50 then addm(60, "tet-m-pozor") end elseif room.konec == 0 and trubka.X == 29 and trubka.dir == dir_no then room.konec = 1 pom2 = 100 for key, cube in pairs(cubes) do if cube.Y < pom2 then pom2 = cube.Y end end if pom2 < 17 then addv(9, "tet-v-kostky") if random(100) > 10 * (pokus - 3) or random(100) < 50 then addm(15 + random(7), "tet-m-lepe") end end end end end end -- -------------------- local update_table = {} local subinit subinit = prog_init_room() if subinit then table.insert(update_table, subinit) end return update_table end local update_table = prog_init() -- ----------------------------------------------------------------- -- Update -- ----------------------------------------------------------------- function prog_update() for key, subupdate in pairs(update_table) do subupdate() end end
gpl-2.0
AnySDK/Sample_Lua
frameworks/cocos2d-x/cocos/scripting/lua-bindings/auto/api/TargetedAction.lua
10
1593
-------------------------------- -- @module TargetedAction -- @extend ActionInterval -- @parent_module cc -------------------------------- -- @overload self -- @overload self -- @function [parent=#TargetedAction] getForcedTarget -- @param self -- @return Node#Node ret (return value: cc.Node) -------------------------------- -- Sets the target that the action will be forced to run with -- @function [parent=#TargetedAction] setForcedTarget -- @param self -- @param #cc.Node forcedTarget -------------------------------- -- Create an action with the specified action and forced target -- @function [parent=#TargetedAction] create -- @param self -- @param #cc.Node target -- @param #cc.FiniteTimeAction action -- @return TargetedAction#TargetedAction ret (return value: cc.TargetedAction) -------------------------------- -- -- @function [parent=#TargetedAction] startWithTarget -- @param self -- @param #cc.Node target -------------------------------- -- -- @function [parent=#TargetedAction] clone -- @param self -- @return TargetedAction#TargetedAction ret (return value: cc.TargetedAction) -------------------------------- -- -- @function [parent=#TargetedAction] stop -- @param self -------------------------------- -- -- @function [parent=#TargetedAction] reverse -- @param self -- @return TargetedAction#TargetedAction ret (return value: cc.TargetedAction) -------------------------------- -- -- @function [parent=#TargetedAction] update -- @param self -- @param #float time return nil
mit
hooksta4/darkstar
scripts/zones/Dangruf_Wadi/npcs/qm5.lua
2
1828
----------------------------------- -- NPC: ??? (QM5) -- Type: Eggblix dice roll game part 3 -- @zone: 191 -- Involved in quest "As Thick As Thieves" ----------------------------------- package.loaded["scripts/zones/Dangruf_Wadi/TextIDs"] = nil; ----------------------------------- require("scripts/globals/quests"); require("scripts/zones/Dangruf_Wadi/TextIDs"); ----------------------------------- -- onTrade Action ----------------------------------- function onTrade(player,npc,trade) local thickAsThievesGamblingCS = player:getVar("thickAsThievesGamblingCS"); if (thickAsThievesGamblingCS == 4) then if (trade:hasItemQty(4362,1) and trade:getItemCount() == 1) then -- Trade 1x lizard egg local rand1 = math.random(1,999); local rand2 = math.random(1,999); if (rand1 > rand2) then player:startEvent(0x008a,1092,0,rand1,rand2); -- complete 2/3 gamble mini quest else player:startEvent(0x008d,0,0,rand1,rand2); -- player looses end end end end; ----------------------------------- -- onTrigger Action ----------------------------------- function onTrigger(player,npc) 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 == 0x008d and option == 1) then -- player looses dice game player:tradeComplete(); player:setVar("thickAsThievesGamblingCS",2); elseif (csid == 0x008a and option == 0) then -- player wins dice game player:tradeComplete(); player:setVar("thickAsThievesGamblingCS",5); end end;
gpl-3.0
hooksta4/darkstar
scripts/zones/zones/Korroloka_Tunnel/npcs/Excavation_Point.lua
2
1075
----------------------------------- -- Area: Korroloka Tunnel -- NPC: Excavation Point ----------------------------------- package.loaded["scripts/zones/Korroloka_Tunnel/TextIDs"] = nil; ------------------------------------- require("scripts/globals/excavation"); require("scripts/zones/Korroloka_Tunnel/TextIDs"); ----------------------------------- -- onTrade ----------------------------------- function onTrade(player,npc,trade) startExcavation(player,player:getZoneID(),npc,trade,0x0000); end; ----------------------------------- -- onTrigger ----------------------------------- function onTrigger(player,npc) player:messageSpecial(MINING_IS_POSSIBLE_HERE,605); 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
hooksta4/darkstar
scripts/globals/items/high_breath_mantle.lua
43
1427
----------------------------------------- -- ID: 15487 -- Item: High Breath Mantle -- Item Effect: HP+38 / Enmity+5 ----------------------------------------- require("scripts/globals/settings"); require("scripts/globals/status"); ----------------------------------------- -- OnItemCheck ----------------------------------------- function onItemCheck(target) local effect = target:getStatusEffect(EFFECT_ENCHANTMENT); if (effect ~= nil) then if (effect:getSubType() == 15487) then target:delStatusEffect(EFFECT_ENCHANTMENT); end; end; return 0; end; ----------------------------------------- -- OnItemUse ----------------------------------------- function onItemUse(target) if (target:hasStatusEffect(EFFECT_ENCHANTMENT) == true) then target:delStatusEffect(EFFECT_ENCHANTMENT); target:addStatusEffect(EFFECT_ENCHANTMENT,0,0,1800,15487); else target:addStatusEffect(EFFECT_ENCHANTMENT,0,0,1800,15487); end; end; ----------------------------------------- -- onEffectGain Action ----------------------------------------- function onEffectGain(target,effect) target:addMod(MOD_HP, 38); target:addMod(MOD_ENMITY, 5); end; ----------------------------------------- -- onEffectLose Action ----------------------------------------- function onEffectLose(target,effect) target:delMod(MOD_HP, 38); target:delMod(MOD_ENMITY, 5); end;
gpl-3.0
DarkRoku12/lua_sort
qsort_op.lua
1
3034
-- Copyright (C) 2017 - DarkRoku12 -- Optimized version. -- Stack slot #1 = t. local function set2( t , i , j , ival , jval ) t[ i ] = ival ; -- lua_rawseti(L, 1, i); t[ j ] = jval ; -- lua_rawseti(L, 1, j); end local function default_comp( a , b ) return a < b end local auxsort ; function auxsort( t , l , u , sort_comp ) while l < u do -- sort elements a[l], a[(l+u)/2] and a[u] do local a = t[ l ] -- lua_rawgeti(L, 1, l); local b = t[ u ] -- lua_rawgeti(L, 1, u); if sort_comp( b , a ) then set2( t , l , u , b , a ) -- /* swap a[l] - a[u] */ end end if u - l == 1 then break end -- only 2 elements local i = math.floor( ( l + u ) / 2 ) ; -- -- for tail recursion (i). do local a = t[ i ] -- lua_rawgeti(L, 1, i); local b = t[ l ] -- lua_rawgeti(L, 1, l); if sort_comp( a , b ) then -- a[i] < a[l] ? set2( t , i , l , b , a ) else b = nil -- remove a[l] b = t[ u ] if sort_comp( b , a ) then -- a[u]<a[i] ? set2( t , i , u , b , a ) end end end if u - l == 2 then break end ; -- only 3 elements local P = t[ i ] -- Pivot. local P2 = P -- lua_pushvalue(L, -1); local b = t[ u - 1 ] set2( t , i , u - 1 , b , P2 ) -- a[l] <= P == a[u-1] <= a[u], only need to sort from l+1 to u-2 */ i = l ; local j = u - 1 ; -- for tail recursion (j). while true do -- for( ; ; ) -- invariant: a[l..i] <= P <= a[j..u] -- repeat ++i until a[i] >= P i = i + 1 ; -- ++i local a = t[ i ] -- lua_rawgeti(L, 1, i) while sort_comp( a , P ) do i = i + 1 ; -- ++i a = t[ i ] -- lua_rawgeti(L, 1, i) end -- repeat --j until a[j] <= P j = j - 1 ; -- --j local b = t[ j ] while sort_comp( P , b ) do j = j - 1 ; -- --j b = t[ j ] -- lua_rawgeti(L, 1, j) end if j < i then break end set2( t , i , j , b , a ) end -- End for. t[ u - 1 ] , t[ i ] = t[ i ] , t[ u - 1 ] ; -- a[l..i-1] <= a[i] == P <= a[i+1..u] */ -- adjust so that smaller half is in [j..i] and larger one in [l..u] */ if ( i - l ) < ( u - i ) then j = l ; i = i - 1 ; l = i + 2 ; else j = i + 1 ; i = u ; u = j - 2 ; end auxsort( t , j , i , sort_comp ) ; -- call recursively the smaller one */ end -- end of while -- repeat the routine for the larger one end -- sort function. return function( t , comp ) assert( type( t ) == "table" ) if comp then assert( type( comp ) == "function" ) end auxsort( t , 1 , #t , comp or default_comp ) end
mit
catinred2/skynet
service/bootstrap.lua
29
1191
local skynet = require "skynet" local harbor = require "skynet.harbor" require "skynet.manager" -- import skynet.launch, ... local memory = require "memory" skynet.start(function() local sharestring = tonumber(skynet.getenv "sharestring") memory.ssexpand(sharestring or 4096) local standalone = skynet.getenv "standalone" local launcher = assert(skynet.launch("snlua","launcher")) skynet.name(".launcher", launcher) local harbor_id = tonumber(skynet.getenv "harbor") if harbor_id == 0 then assert(standalone == nil) standalone = true skynet.setenv("standalone", "true") local ok, slave = pcall(skynet.newservice, "cdummy") if not ok then skynet.abort() end skynet.name(".cslave", slave) else if standalone then if not pcall(skynet.newservice,"cmaster") then skynet.abort() end end local ok, slave = pcall(skynet.newservice, "cslave") if not ok then skynet.abort() end skynet.name(".cslave", slave) end if standalone then local datacenter = skynet.newservice "datacenterd" skynet.name("DATACENTER", datacenter) end skynet.newservice "service_mgr" pcall(skynet.newservice,skynet.getenv "start" or "main") skynet.exit() end)
mit
gedadsbranch/Darkstar-Mission
scripts/zones/Northern_San_dOria/npcs/HomePoint#2.lua
12
1261
----------------------------------- -- Area: Northern San dOria -- NPC: HomePoint#2 -- @pos 10 -0.2 95 231 ----------------------------------- package.loaded["scripts/zones/Northern_San_dOria/TextIDs"] = nil; require("scripts/globals/settings"); require("scripts/zones/Northern_San_dOria/TextIDs"); require("scripts/globals/homepoint"); ----------------------------------- -- onTrade Action ----------------------------------- function onTrade(player,npc,trade) end; ----------------------------------- -- onTrigger Action ----------------------------------- function onTrigger(player,npc) homepointMenu( player, 0x21fd, 4); end; ----------------------------------- -- onEventUpdate ----------------------------------- function onEventUpdate(player,csid,option) --printf("CSID: %u",csid); --printf("RESULT: %u",option); end; ----------------------------------- -- onEventFinish ----------------------------------- function onEventFinish(player,csid,option) --printf("CSID: %u",csid); --printf("RESULT: %u",option); if(csid == 0x21fd) then if (option == 1) then player:setHomePoint(); player:messageSpecial(HOMEPOINT_SET); else hpTeleport( player, option); end end end;
gpl-3.0
chihyang/koreader
frontend/ui/widget/linewidget.lua
3
1099
local Widget = require("ui/widget/widget") local Blitbuffer = require("ffi/blitbuffer") local LineWidget = Widget:new{ style = "solid", background = Blitbuffer.COLOR_BLACK, dimen = nil, --@TODO replay dirty hack here 13.03 2013 (houqp) empty_segments = nil, } function LineWidget:paintTo(bb, x, y) if self.style == "none" then return end if self.style == "dashed" then for i = 0, self.dimen.w - 20, 20 do bb:paintRect(x + i, y, 16, self.dimen.h, self.background) end else if self.empty_segments then bb:paintRect(x, y, self.empty_segments[1].s, self.dimen.h, self.background) bb:paintRect(x + self.empty_segments[1].e, y, self.dimen.w - x - self.empty_segments[1].e, self.dimen.h, self.background) else bb:paintRect(x, y, self.dimen.w, self.dimen.h, self.background) end end end return LineWidget
agpl-3.0
thetaeo/cuberite
MCServer/Plugins/NetworkTest/Info.lua
13
3430
-- Info.lua -- Implements the g_PluginInfo standard plugin description g_PluginInfo = { Name = "NetworkTest", Version = "1", Date = "2015-01-28", Description = [[Implements test code (and examples) for the cNetwork API]], Commands = { }, ConsoleCommands = { net = { Subcommands = { client = { HelpString = "Connects, as a client, to a specified webpage (google.com by default) and downloads its front page using HTTP", Handler = HandleConsoleNetClient, ParameterCombinations = { { Params = "", Help = "Connects, as a client, to google.com and downloads its front page using HTTP", }, { Params = "host [port]", Help = "Connects, as a client, to the specified host and downloads its front page using HTTP", }, }, -- ParameterCombinations }, -- client close = { HelpString = "Close a listening socket", Handler = HandleConsoleNetClose, ParameterCombinations = { { Params = "[Port]", Help = "Closes a socket listening on the specified port [1024]", }, }, -- ParameterCombinations }, -- close ips = { HelpString = "Prints all locally available IP addresses", Handler = HandleConsoleNetIps, }, -- ips listen = { HelpString = "Creates a new listening socket on the specified port with the specified service attached to it", Handler = HandleConsoleNetListen, ParameterCombinations = { { Params = "[Port] [Service]", Help = "Starts listening on the specified port [1024] providing the specified service [echo]", }, }, -- ParameterCombinations }, -- listen lookup = { HelpString = "Looks up the IP addresses corresponding to the given hostname (google.com by default)", Handler = HandleConsoleNetLookup, ParameterCombinations = { { Params = "", Help = "Looks up the IP addresses of google.com.", }, { Params = "Hostname", Help = "Looks up the IP addresses of the specified hostname.", }, { Params = "IP", Help = "Looks up the canonical name of the specified IP.", }, }, }, -- lookup udp = { Subcommands = { close = { Handler = HandleConsoleNetUdpClose, ParameterCombinations = { { Params = "[Port]", Help = "Closes the UDP endpoint on the specified port [1024].", } }, }, -- close listen = { Handler = HandleConsoleNetUdpListen, ParameterCombinations = { { Params = "[Port]", Help = "Listens on the specified UDP port [1024], dumping the incoming datagrams into log", }, }, }, -- listen send = { Handler = HandleConsoleNetUdpSend, ParameterCombinations = { { Params = "[Host] [Port] [Message]", Help = "Sends the message [\"hello\"] through UDP to the specified host [localhost] and port [1024]", }, }, } -- send }, -- Subcommands ("net udp") }, -- udp wasc = { HelpString = "Requests the webadmin homepage using https", Handler = HandleConsoleNetWasc, }, -- wasc }, -- Subcommands }, -- net }, }
apache-2.0
hooksta4/darkstar
scripts/zones/zones/Al_Zahbi/npcs/Yudi_Yolhbi.lua
53
2326
----------------------------------- -- Area: Al Zahbi -- NPC: Yudi Yolhbi -- Type: Woodworking Normal/Adv. Image Support -- @pos -71.584 -7 -56.018 48 ----------------------------------- package.loaded["scripts/zones/Al_Zahbi/TextIDs"] = nil; ----------------------------------- require("scripts/globals/status"); require("scripts/globals/crafting"); require("scripts/zones/Al_Zahbi/TextIDs"); ----------------------------------- -- onTrade Action ----------------------------------- function onTrade(player,npc,trade) local guildMember = isGuildMember(player,9); if (guildMember == 1) then if (trade:hasItemQty(2184,1) and trade:getItemCount() == 1) then if (player:hasStatusEffect(EFFECT_WOODWORKING_IMAGERY) == false) then player:tradeComplete(); player:startEvent(0x00EB,8,0,0,0,188,0,1,0); else npc:showText(npc, IMAGE_SUPPORT_ACTIVE); end end end end; ----------------------------------- -- onTrigger Action ----------------------------------- function onTrigger(player,npc) local guildMember = isGuildMember(player,9); local SkillLevel = player:getSkillLevel(SKILL_WOODWORKING); if (guildMember == 1) then if (player:hasStatusEffect(EFFECT_WOODWORKING_IMAGERY) == false) then player:startEvent(0x00EA,8,SkillLevel,0,511,188,0,1,2184); else player:startEvent(0x00EA,8,SkillLevel,0,511,188,7055,1,2184); end else player:startEvent(0x00EA,0,0,0,0,0,0,1,0); -- Standard Dialogue end end; ----------------------------------- -- onEventUpdate ----------------------------------- function onEventUpdate(player,csid,option) -- printf("CSID: %u",csid); -- printf("RESULT: %u",option); end; ----------------------------------- -- onEventFinish ----------------------------------- function onEventFinish(player,csid,option) -- printf("CSID: %u",csid); -- printf("RESULT: %u",option); if (csid == 0x00EA and option == 1) then player:messageSpecial(IMAGE_SUPPORT,0,1,1); player:addStatusEffect(EFFECT_WOODWORKING_IMAGERY,1,0,120); elseif (csid == 0x00EB) then player:messageSpecial(IMAGE_SUPPORT,0,1,0); player:addStatusEffect(EFFECT_WOODWORKING_IMAGERY,3,0,480); end end;
gpl-3.0
GreatBigBushyBeard/PAYDAY-2-BeardLib-Editor
Classes/Map/StaticEditor.lua
1
56379
--Clean this script by separating parts of it to different classes StaticEditor = StaticEditor or class(EditorPart) local Static = StaticEditor local Utils = BLE.Utils function Static:init(parent, menu) Static.super.init(self, parent, menu, "Selection", nil, {delay_align_items = true}) self._selected_units = {} self._nav_surfaces = {} self._ignore_raycast = {} self._ignored_collisions = {} self._set_units = {} self._set_elements = {} self._nav_surface = Idstring("core/units/nav_surface/nav_surface") self._widget_slot_mask = World:make_slot_mask(1) end function Static:enable() Static.super.enable(self) self:bind_opt("DeleteSelection", ClassClbk(self, "delete_selected_dialog")) self:bind_opt("CopyUnit", ClassClbk(self, "CopySelection")) self:bind_opt("PasteUnit", ClassClbk(self, "Paste")) self:bind_opt("TeleportToSelection", ClassClbk(self, "KeyFPressed")) local menu = self:GetPart("menu") self:bind_opt("ToggleRotationWidget", ClassClbk(menu, "toggle_widget", "rotation")) self:bind_opt("ToggleMoveWidget", ClassClbk(menu, "toggle_widget", "move")) end function Static:mouse_pressed(button, x, y) if not self:enabled() then return end if button == Idstring("2") then self:start_grabbing() end if button == Idstring("0") then if self:Val("EndlessSelection") then self._reset_raycast = TimerManager:game():time() + self:Val("EndlessSelectionReset") end if self._grabbed_unit then self:StorePreviousPosRot() local pos = self._grabbed_unit:position() self:finish_grabbing() self._parent:set_unit_positions(pos) return end self._widget_hold = true self._parent:reset_widget_values() local from = self._parent:get_cursor_look_point(0) local to = self._parent:get_cursor_look_point(100000) local unit = self._parent:widget_unit() if unit then if self._parent._move_widget:enabled() then local ray = World:raycast("ray", from, to, "ray_type", "widget", "target_unit", self._parent._move_widget:widget()) if ray and ray.body then if (alt() and not ctrl()) then self:Clone() end self:StorePreviousPosRot() self._parent._move_widget:add_move_widget_axis(ray.body:name():s()) self._parent._move_widget:set_move_widget_offset(unit, unit:rotation()) self._parent._using_move_widget = true end end if self._parent._rotate_widget:enabled() and not self._parent._using_move_widget then local ray = World:raycast("ray", from, to, "ray_type", "widget", "target_unit", self._parent._rotate_widget:widget()) if ray and ray.body then self:StorePreviousPosRot() self._parent._rotate_widget:set_rotate_widget_axis(ray.body:name():s()) self._parent._rotate_widget:set_world_dir(ray.position) self._parent._rotate_widget:set_rotate_widget_start_screen_position(self._parent:world_to_screen(ray.position):with_z(0)) self._parent._rotate_widget:set_rotate_widget_unit_rot(self._selected_units[1]:rotation()) self._parent._using_rotate_widget = true end end end if not self._parent._using_rotate_widget and not self._parent._using_move_widget then self:select_unit() end elseif button == Idstring("1") then if self._grabbed_unit then self._parent:set_unit_positions(self._grabbed_unit_original_pos) self:finish_grabbing() return end if self:Val("EndlessSelection") then self._reset_raycast = nil self._ignore_raycast = {} else self:set_drag_select() end self:select_unit(true) self._mouse_hold = true end end function Static:finish_grabbing() self._grabbed_unit = nil self:GetPart("menu"):set_tabs_enabled(true) local transform = self:GetItem('Transform') self:set_title(self._original_title) self._original_title = nil self:update_ignored_collisions() transform:SetEnabled(true) end function Static:update_grid_size() self:set_unit() end function Static:deselect_unit(item) self:set_unit(true) end function Static:mouse_released(button, x, y) if not self:enabled() then return end self._mouse_hold = false self._widget_hold = false self._drag_select = false self:remove_polyline() if self._drag_units and #self._drag_units > 0 then for _, unit in pairs(self._drag_units) do if ctrl() then self:set_selected_unit(unit, true, true) elseif alt() then table.delete(self._selected_units, unit) end end self:selection_to_menu() end self._drag_units = nil self:update_ignored_collisions() end function Static:update_ignored_collisions() for _, unit in pairs(self._ignored_collisions) do Utils:UpdateCollisionsAndVisuals(unit, true) end self._ignored_collisions = {} self:set_units() end function Static:set_units() for key, unit in pairs(self._set_units) do if alive(unit) then local ud = unit:unit_data() managers.worlddefinition:set_unit(ud.unit_id, unit, ud.continent, ud.continent) end end for _, me in pairs(self._set_elements) do local element = me.element if alive(me._unit) then element.values.position = me._unit:position() element.values.rotation = me._unit:rotation() managers.mission:set_element(element) else BLE:log('Something is wrong with element with ID %s', tostring(element.id)) end end self:update_positions() self._set_units = {} self._set_elements = {} end function Static:build_default() self._editors = {} self:set_title("Selection") self:divider("No selection >_<", {border_left = false}) self:button("World Menu", ClassClbk(self:GetPart("world"), "Switch")) end function Static:build_quick_buttons(cannot_be_saved, cannot_be_prefab) self:set_title("Selection") local quick = self:group("QuickButtons", {align_method = "grid"}) quick:s_btn("Deselect", ClassClbk(self, "deselect_unit")) quick:s_btn("DeleteSelection", ClassClbk(self, "delete_selected_dialog")) if not cannot_be_prefab then quick:s_btn("CreatePrefab", ClassClbk(self, "add_selection_to_prefabs")) end if not cannot_be_saved then quick:s_btn("AddToCurrentPortal", ClassClbk(self, "add_unit_to_portal")) quick:s_btn("RemoveFromCurrentPortal", ClassClbk(self, "remove_unit_from_portal")) self:group("Group", {align_method = "grid"}) --lmao self:build_group_options() end end function Static:build_group_options() local group = self:GetItem("Group") local selected_unit = self:selected_unit() if not group or not selected_unit then return end local selected_units = self:selected_units() local can_group = #selected_units > 1 local inside_group = false local is_unit = false local sud = selected_unit:unit_data() if can_group then for _, unit in pairs(selected_units) do local ud = unit:unit_data() if not ud.unit_id or not ud.continent or managers.worlddefinition:is_world_unit(unit) then can_group = false break end end else local unit = selected_units[1] if alive(unit) then local ud = unit:unit_data() if ud.unit_id and ud.continent then is_unit = true end end end group:ClearItems() if self._selected_group then group:divider("GroupToolTip", {text = "Hold ctrl and press mouse 2 to add units to/remove units from group"}) group:textbox("GroupName", ClassClbk(self, "set_group_name"), self._selected_group.name) group:s_btn("DestroyGroup", ClassClbk(self, "remove_group")) else if can_group or is_unit then group:s_btn("AddToGroup", ClassClbk(self, "open_addremove_group_dialog", false), {text = "Add Unit(s) To Group"}) group:s_btn("GroupUnits", ClassClbk(self, "add_group"), {text = (can_group and "Group Units" or "Make a Group")}) else group:Destroy() end end end function Static:unit_value(value_key, toggle) local selected_units = self._selected_units local selected_unit = selected_units[1] local value = selected_unit:unit_data()[value_key] if selected_unit then if #selected_units > 1 then local values_differ for _, unit in pairs(selected_units) do local ud = unit:unit_data() if ud[value_key] then if ud[value_key] ~= value then values_differ = true end elseif value ~= nil then values_differ = true end end return values_differ and "*" or value, values_differ else return value end end end function Static:build_unit_editor_menu() self:clear_menu() self:set_title("Selection") self:build_unit_main_values() self:build_positions_items() self:build_extension_items() end function Static:build_unit_main_values() local name = self:unit_value("name") local main = self:group("Main", {align_method = "grid", visible = not self._built_multi or name ~= nil}) if not self._built_multi then main:GetToolbar():lbl("ID", {text = "ID: 0000000", size_by_text = true, offset=0}) main:textbox("Name", ClassClbk(self, "set_unit_data"), nil, {help = "the name of the unit", control_slice = 0.8}) end main:pathbox("UnitPath", ClassClbk(self, "set_unit_data"), name, "unit", {control_slice = 0.75, check = function(unit) local t = Utils:GetUnitType(unit) return t ~= Idstring("being") and t ~= Idstring("brush") and t ~= Idstring("wpn") and t ~= Idstring("item") end}) local has_elements = false for _, unit in pairs(self:selected_units()) do if alive(unit) and unit:mission_element() then has_elements = true break end end if not has_elements then local continent, values_differ = self:unit_value("continent") local list = self._parent._continents if values_differ then list = table.list_add({"*", list}) end local con = main:combobox("Continent", ClassClbk(self, "set_unit_data"), list, 1, {visible = not self._built_multi or continent ~= nil}) con:SetSelectedItem(continent) end main:tickbox("Enabled", ClassClbk(self, "set_unit_data"), true, {size_by_text = true, help = "Setting the unit enabled or not[Debug purpose only]"}) main:tickbox("HideOnProjectionLight", ClassClbk(self, "set_unit_data"), self:unit_value("hide_on_projection_light") == true, {size_by_text = true}) main:tickbox("DisableShadows", ClassClbk(self, "set_unit_data"), self:unit_value("disable_shadows") == true, {size_by_text = true}) main:tickbox("DisableCollision", ClassClbk(self, "set_unit_data"), self:unit_value("disable_collision") == true, {size_by_text = true}) main:tickbox("DisableOnAIGraph", ClassClbk(self, "set_unit_data"), self:unit_value("disable_on_ai_graph") == true, {size_by_text = true}) main:tickbox("DelayLoading", ClassClbk(self, "set_unit_data"), self:unit_value("delayed_load") == true, {size_by_text = true}) end function Static:build_extension_items() self._editors = {} for k, v in pairs({ light = EditUnitLight, ladder = EditLadder, editable_gui = EditUnitEditableGui, zipline = EditZipLine, wire = EditWire, mesh_variation = EditMeshVariation }) do self._editors[k] = v:new():is_editable(self) end end function Static:build_grab_button(transform) transform:button("Grab", ClassClbk(self, "start_grabbing")) end function Static:start_grabbing() if self._grabbed_unit then return end local unit = self:selected_unit() self._grabbed_unit_original_pos = unit:position() self._grabbed_unit = unit self._original_title = self:get_title() self:set_title("Press: LMB to place, RMB to cancel") self:GetPart("menu"):set_tabs_enabled(false) self:GetItem("Transform"):SetEnabled(false) end function Static:build_positions_items(cannot_be_saved, cannot_be_prefab) self._editors = {} self:build_quick_buttons(cannot_be_saved, cannot_be_prefab) local transform = self:group("Transform") self:build_grab_button(transform) transform:button("IgnoreRaycastOnce", function() for _, unit in pairs(self:selected_units()) do if unit:unit_data().unit_id then self._ignore_raycast[unit:unit_data().unit_id] = true end end end) transform:Vec3Rot("", ClassClbk(self, "set_unit_data"), nil, nil, {on_click = ClassClbk(self, "StorePreviousPosRot"), step = self:GetPart("opt")._menu:GetItem("GridSize"):Value()}) end function StaticEditor:update_positions() local unit = self._selected_units[1] if alive(unit) then if #self._selected_units > 1 or not unit:mission_element() then self:GetItem("Position"):SetValue(unit:position()) self:GetItem("Rotation"):SetValue(unit:rotation()) self:GetPart("instances"):update_positions() self:GetPart("world"):update_positions() self:GetItem("Position"):SetStep(self._parent._grid_size) --self:GetItem("Rotation"):SetStep(self._parent._snap_rotation) elseif unit:mission_element() and self:GetPart("mission")._current_script then self:GetPart("mission")._current_script:update_positions(unit:position(), unit:rotation()) end for _, unit in pairs(self:selected_units()) do if alive(unit) and unit:editable_gui() then unit:editable_gui():set_blend_mode(unit:editable_gui():blend_mode()) end end for _, editor in pairs(self._editors) do if editor.update_positions then editor:update_positions(unit) end end if self._built_multi and not self._grabbed_unit then self:set_title("Selection - " .. tostring(#self._selected_units)) end end end function Static:open_addremove_group_dialog(remove) local list_groups = {} local continents = managers.worlddefinition._continent_definitions if remove then local groups = self:get_groups_from_unit(self._selected_units[1]) for _, group in pairs(groups) do if group.name then table.insert(list_groups, {name = group.name, group = group}) end end else for _, continent in pairs(self._parent._continents) do if continents[continent].editor_groups then for _, editor_group in pairs(continents[continent].editor_groups) do if editor_group.name then table.insert(list_groups, {name = editor_group.name, group = editor_group}) end end end end end local units = self._selected_units BLE.ListDialog:Show({ list = list_groups, force = true, callback = function(item) local group = item.group self:select_group(group) for _, unit in pairs(units) do if alive(unit) then if remove and table.contains(group.units, unit:unit_data().unit_id) then table.delete(group.units, unit:unit_data().unit_id) elseif not table.contains(group.units, unit:unit_data().unit_id) then table.insert(group.units, unit:unit_data().unit_id) self:set_selected_unit(unit, true) end if #group.units <= 1 then self:remove_group() end self:part("world"):refresh() end end BeardLibEditor.ListDialog:hide() end }) end function Static:set_unit_data() self._parent:set_unit_positions(self:GetItemValue("Position")) self._parent:set_unit_rotations(self:GetItemValue("Rotation")) if #self._selected_units == 1 then if not self:GetItem("Continent") then return end local unit = self._selected_units[1] local ud = unit:unit_data() if ud and ud.unit_id then local prev_id = ud.unit_id managers.worlddefinition:set_name_id(unit, self:GetItem("Name"):Value()) --ud.unit_id = self:GetItem("ID"):Value() for _, editor in pairs(self._editors) do if editor.set_unit_data and editor:editable(unit) then editor:set_unit_data() end end BeardLib.Utils:RemoveAllNumberIndexes(ud, true) ud.lights = Utils:LightData(unit) ud.triggers = Utils:TriggersData(unit) ud.editable_gui = Utils:EditableGuiData(unit) ud.ladder = Utils:LadderData(unit) ud.zipline = Utils:ZiplineData(unit) ud.cubemap = Utils:CubemapData(unit) local old_continent = ud.continent local new_continent = self:GetItem("Continent"):SelectedItem() if old_continent ~= new_continent then self:set_unit_continent(unit, old_continent, new_continent) self:GetItem("ID"):SetText("ID "..ud.unit_id) end self:set_unit_simple_values(unit) managers.worlddefinition:set_unit(prev_id, unit, old_continent, new_continent) self:set_unit_path(unit, self:GetItem("UnitPath"):Value()) end else local i = 0 for _, unit in pairs(self._selected_units) do local ud = unit:unit_data() if alive(unit) and ud.unit_id then i = i + 1 self:set_unit_simple_values(unit) local continent = self:GetItem("Continent") if continent then self:set_unit_continent(unit, ud.continent, continent:SelectedItem(), true) end self:set_unit_path(unit, self:GetItem("UnitPath"):Value(), i ~= 1) end end end --TODO: put in a different place self:GetPart("instances"):update_positions() self:GetPart("world"):update_positions() end function Static:set_unit_simple_values(unit) if not alive(unit) or not unit.unit_data then return end local ud = unit:unit_data() ud.disable_shadows = self:GetItem("DisableShadows"):Value() ud.disable_collision = self:GetItem("DisableCollision"):Value() ud.hide_on_projection_light = self:GetItem("HideOnProjectionLight"):Value() ud.disable_on_ai_graph = self:GetItem("DisableOnAIGraph"):Value() ud.delayed_load = self:GetItem("DelayLoading"):Value() for index = 0, unit:num_bodies() - 1 do local body = unit:body(index) if body then body:set_collisions_enabled(not ud.disable_collision) body:set_collides_with_mover(not ud.disable_collision) end end unit:set_enabled(self:GetItem("Enabled"):Value()) unit:set_shadows_disabled(ud.disable_shadows) end function Static:set_unit_path(unit, path, add) local ud = unit:unit_data() if ud.name == path then return end local new_unit = unit if path and path ~= "" and path ~= "*" and PackageManager:has(Idstring("unit"), path:id()) then ud.name = path new_unit = self._parent:SpawnUnit(ud.name, unit, add == true, ud.unit_id) self._parent:DeleteUnit(unit, true) end return new_unit end function Static:set_unit_continent(unit, old_continent, new_continent, set) local ud = unit:unit_data() local old_id = ud.unit_id if new_continent ~= "*" and old_continent ~= new_continent then ud.continent = new_continent managers.worlddefinition:ResetUnitID(unit, old_continent) self:set_unit_group(old_id, ud.unit_id, old_continent, new_continent) --Change all links to match the new ID. for _, link in pairs(managers.mission:get_links_paths_new(old_id, Utils.LinkTypes.Unit)) do link.tbl[link.key] = ud.unit_id end else new_continent = nil end if set then managers.worlddefinition:set_unit(old_id, unit, old_continent, new_continent) end end function Static:set_unit_group(old_id, new_id, old_continent, new_continent) for _, continent in pairs(managers.worlddefinition._continent_definitions) do continent.editor_groups = continent.editor_groups or {} for _, group in pairs(continent.editor_groups) do if type(group) == "table" and group.units then if group.reference == old_id then group.reference = new_id local continents = managers.worlddefinition._continent_definitions table.delete(continents[old_continent].editor_groups, group) continents[new_continent].editor_groups = continents[new_continent].editor_groups or {} table.insert(continents[new_continent].editor_groups, group) end for i, unit_id in pairs(group.units) do if unit_id == old_id then group.units[i] = new_id return end end return end end end end function Static:StorePreviousPosRot() for _, unit in pairs(self._selected_units) do unit:unit_data()._prev_pos = unit:position() unit:unit_data()._prev_rot = unit:rotation() end end function Static:set_group_name(item, group, name) local exists local continent = group and group.continent or self._selected_group.continent name = name or item:Value() for _, editor_group in pairs(managers.worlddefinition._continent_definitions[continent].editor_groups) do if editor_group.name == name then exists = true break end end if not exists then if item then self._selected_group.name = item:Value() self:part("world"):refresh() return end for _, editor_group in pairs(managers.worlddefinition._continent_definitions[continent].editor_groups) do if editor_group.name == group.name then editor_group.name = name end end end self:part("world"):refresh() end function Static:remove_group(item, group) group = group or self._selected_group if group then table.delete(managers.worlddefinition._continent_definitions[group.continent].editor_groups, group) if self._selected_group then self._selected_group = nil self:build_group_options() end end self:part("world"):refresh() end function Static:add_group(item) local unit = self:selected_unit() BeardLibEditor.InputDialog:Show({title = "Group Name", text = unit:unit_data().name_id, callback = function(name) local continent = managers.worlddefinition:get_continent_of_static(unit) local exists for _, group in pairs(continent.editor_groups) do if group.name == name then exists = true end end if not exists then local group = {continent = unit:unit_data().continent, reference = unit:unit_data().unit_id, name = name, units = {}, visible = true} for _, unit in pairs(self:selected_units()) do table.insert(group.units, unit:unit_data().unit_id) end table.insert(continent.editor_groups, group) self._selected_group = group self:build_group_options() end self:part("world"):refresh() end}) end function Static:build_group_links(unit) local function create_link(text, id, group, clbk) group:button(id, clbk, { text = text, font_size = 16, label = "groups" }) end local group = self:GetItem("InsideGroups") or self:group("InsideGroups", {max_height = 200, h = 200}) local editor_groups = self:get_groups_from_unit(unit) for _, editor_group in pairs(editor_groups) do create_link(editor_group.name, unit:unit_data().unit_id, group, ClassClbk(self, "select_group", editor_group)) end local group_buttons = self:GetItem("Group") if #group:Items() == 0 then group:Destroy() else group_buttons:SetVisible(true) group_buttons:button("RemoveFromGroup", ClassClbk(self, "open_addremove_group_dialog", true)) end end function Static:get_groups_from_unit(unit) local continent = managers.worlddefinition:get_continent_of_static(unit) if not continent or not continent.editor_groups then return {} end local groups = {} for _, editor_group in pairs(continent.editor_groups) do if editor_group.name then -- temp bandaid for nil groups for _, unit_id in pairs(editor_group.units) do if unit_id == unit:unit_data().unit_id then table.insert(groups, editor_group) end end end end return groups end function Static:select_group(editor_group) self:reset_selected_units() self._selected_group = editor_group self:build_positions_items(false) for _, unit_id in pairs(editor_group.units) do local unit = managers.worlddefinition:get_unit(unit_id) self:set_selected_unit(unit, true) end end function Static:toggle_group_visibility(editor_group) if editor_group.visible == nil then editor_group.visible = false end editor_group.visible = not editor_group.visible for _, unit_id in pairs(editor_group.units) do local unit = managers.worlddefinition:get_unit(unit_id) if alive(unit) then unit:set_visible(editor_group.visible) end end end function Static:delete_unit_group_data(unit) if unit:mission_element() or not unit:unit_data() then return end local groups = self:get_groups_from_unit(unit) if groups then for _, editor_group in pairs(groups) do table.delete(editor_group.units, unit:unit_data().unit_id) end end end function Static:add_selection_to_prefabs(item, prefab_name) local remove_old_links local name_id = self._selected_units[1]:unit_data().name_id BeardLibEditor.InputDialog:Show({title = "Prefab Name", text = #self._selected_units == 1 and name_id ~= "none" and name_id or prefab_name or "Prefab", callback = function(prefab_name, menu) if prefab_name:len() > 200 then BeardLibEditor.Dialog:Show({title = "ERROR!", message = "Prefab name is too long!", callback = function() self:add_selection_to_prefabs(item, prefab_name) end}) return end BeardLibEditor.Prefabs[prefab_name] = self:GetCopyData(NotNil(remove_old_links and remove_old_links:Value(), true)) FileIO:WriteScriptData(Path:Combine(BeardLibEditor.PrefabsDirectory, prefab_name..".prefab"), BeardLibEditor.Prefabs[prefab_name], "binary") end, create_items = function(input_menu) remove_old_links = input_menu:tickbox("RemoveOldLinks", nil, self:Val("RemoveOldLinks"), {text = "Remove Old Links Of Copied Elements"}) end}) end function Static:mouse_moved(x, y) if self._mouse_hold then if not self._drag_select then self:select_unit(true) else self:_update_drag_select() end end end function Static:widget_unit() if self:Enabled() then for _, editor in pairs(self._editors) do if editor.widget_unit then return editor:widget_unit() end end end return self:selected_unit() end function Static:recalc_all_locals() if alive(self._selected_units[1]) then local reference = self._selected_units[1] reference:unit_data().local_pos = Vector3() reference:unit_data().local_rot = Rotation() for _, unit in pairs(self._selected_units) do if alive(unit) and unit ~= reference then self:recalc_locals(unit, reference) end end end end function Static:recalc_locals(unit, reference) local pos = unit:position() local ref_pos = reference:position() local ref_rot = reference:rotation() unit:unit_data().local_pos = (pos - ref_pos):rotate_with(ref_rot:inverse()) unit:unit_data().local_rot = ref_rot:inverse() * unit:rotation() end function Static:check_unit_ok(unit) local ud = unit:unit_data() if not ud then return false end if self:Val("EndlessSelection") then if ud.unit_id and self._ignore_raycast[ud.unit_id] == true then return false else self._ignore_raycast[ud.unit_id] = true end else if ud.unit_id and self._ignore_raycast[ud.unit_id] == true then self._ignore_raycast[ud.unit_id] = nil return false end end local current_layer = self:GetPart("world")._current_layer if ud.env_unit and not (self:Val("EnvironmentUnits") or (self:Val("EnvironmentUnitsWhileMenu") and current_layer == "environment")) then return false end if ud.sound_unit and not (self:Val("SoundUnits") or (self:Val("SoundUnitsWhileMenu") and current_layer == "sound")) then return false end if ud.instance and not self:Val("SelectInstances") then return false end if ud.unit_id == 0 and ud.name_id == "none" and not ud.name and not ud.position then return false end local mission_element = unit:mission_element() and unit:mission_element().element local wanted_elements = self:GetPart("opt")._wanted_elements if mission_element then return BeardLibEditor.Options:GetValue("Map/ShowElements") and (#wanted_elements == 0 or table.get_key(wanted_elements, managers.mission:get_mission_element(mission_element).class)) else return unit:visible() end end function Static:set_selected_units(units) self._selected_units = units self:set_selected_unit() end function Static:reset_selected_units() self:GetPart("mission"):remove_script() self:GetPart("world"):reset_selected_units() for _, unit in pairs(self:selected_units()) do if alive(unit) and unit:mission_element() then unit:mission_element():unselect() end end self._selected_units = {} self._selected_group = nil end function Static:set_selected_unit(unit, add, skip_menu) add = add == true self:recalc_all_locals() local units = {unit} if alive(unit) then local ud = unit:unit_data() if ud and ud.instance then local instance = managers.world_instance:get_instance_data_by_name(ud.instance) local fake_unit for _, u in pairs(self:selected_units()) do if u:fake() and u:object().name == ud.instance then fake_unit = u break end end unit = fake_unit or FakeObject:new(instance) units[1] = unit end if add and self._selected_group and ctrl() then if not unit:fake() and not not ud.continent and not managers.worlddefinition:is_world_unit(unit) then if table.contains(self._selected_group.units, ud.unit_id) then table.delete(self._selected_group.units, ud.unit_id) else table.insert(self._selected_group.units, ud.unit_id) end if #self._selected_group.units <= 1 then self:remove_group() end end else if self:GetPart("opt"):get_value("SelectEditorGroups") then local continent = managers.worlddefinition:get_continent_of_static(unit) if not add then add = true self:reset_selected_units() end local found for _, continent in pairs(managers.worlddefinition._continent_definitions) do continent.editor_groups = continent.editor_groups or {} for _, group in pairs(continent.editor_groups) do if group.units then if table.contains(group.units, unit:unit_data().unit_id) then for _, unit_id in pairs(group.units) do local u = managers.worlddefinition:get_unit(unit_id) if alive(u) and not table.contains(units, u) then table.insert(units, u) end end if self._selected_group then self._selected_group = nil else self._selected_group = group end found = true break end end if found then break end end end end end end if add then for _, unit in pairs(self:selected_units()) do if unit:mission_element() then unit:mission_element():unselect() end end for _, u in pairs(units) do if not table.contains(self._selected_units, u) then table.insert(self._selected_units, u) elseif not self._mouse_hold then table.delete(self._selected_units, u) end end elseif alive(unit) then self:reset_selected_units() self._selected_units[1] = unit end if not skip_menu then self:selection_to_menu() end end function Static:selection_to_menu() self:StorePreviousPosRot() local unit = self:selected_unit() self._parent:use_widgets(unit and alive(unit) and unit:enabled()) for _, check_unit in pairs(self:selected_units()) do if check_unit:mission_element() then check_unit:mission_element():select() end end if #self._selected_units > 1 then self:set_multi_selected() if self:Val("SelectAndGoToMenu") then self:Switch() end else self._editors = {} if alive(unit) then if unit:mission_element() then self:GetPart("mission"):set_element(unit:mission_element().element) elseif self:GetPart("world"):is_world_unit(unit:name()) then self:GetPart("world"):build_unit_menu() elseif unit:fake() then self:GetPart("instances"):set_instance() else self:set_unit() end if self:Val("SelectAndGoToMenu") then self:Switch() end else self:set_unit() end end self:GetPart("world"):set_selected_unit() self:recalc_all_locals() end local bain_ids = Idstring("units/payday2/characters/fps_mover/bain") function Static:select_unit(mouse2) local rays = self._parent:select_unit_by_raycast(self._parent._editor_all, ClassClbk(self, "check_unit_ok")) self:recalc_all_locals() if rays then for _, ray in pairs(rays) do if alive(ray.unit) and ray.unit:name() ~= bain_ids then if not self._mouse_hold then self._parent:Log("Ray hit " .. tostring(ray.unit:unit_data().name_id).. " " .. ray.body:name()) end self:set_selected_unit(ray.unit, mouse2) end end end end function Static:set_multi_selected() self._built_multi = true self._editors = {} self:clear_menu() self:build_unit_main_values() self:build_positions_items() self:update_positions() self:build_group_options() end function Static:set_unit(reset) if reset then self:reset_selected_units() end self._built_multi = false local unit = self._selected_units[1] if alive(unit) and unit:unit_data() and not unit:mission_element() then if not reset then self:set_menu_unit(unit) return end end self:build_default_menu() end --Default menu for unit editing function Static:set_menu_unit(unit) self:build_unit_editor_menu() self:GetItem("Name"):SetValue(unit:unit_data().name_id, false, true) self:GetItem("Enabled"):SetValue(unit:enabled()) self:GetItem("UnitPath"):SetValue(unit:unit_data().name, false, true) self:GetItem("ID"):SetText("ID "..unit:unit_data().unit_id) local not_brush = not unit:unit_data().brush_unit local disable_shadows = self:GetItem("DisableShadows") local disable_collision = self:GetItem("DisableCollision") local hide_on_projection_light = self:GetItem("HideOnProjectionLight") local disable_on_ai_graph = self:GetItem("DisableOnAIGraph") local delayed_load = self:GetItem("DelayLoading") disable_shadows:SetVisible(not_brush) disable_collision:SetVisible(not_brush) hide_on_projection_light:SetVisible(not_brush) disable_on_ai_graph:SetVisible(not_brush) delayed_load:SetVisible(not_brush) disable_shadows:SetValue(unit:unit_data().disable_shadows, false, true) disable_collision:SetValue(unit:unit_data().disable_collision, false, true) hide_on_projection_light:SetValue(unit:unit_data().hide_on_projection_light, false, true) disable_on_ai_graph:SetValue(unit:unit_data().disable_on_ai_graph, false, true) delayed_load:SetValue(unit:unit_data().delayed_load, false, true) for _, editor in pairs(self._editors) do if editor.set_menu_unit then editor:set_menu_unit(unit) end end self:update_positions() self:GetItem("Continent"):SetSelectedItem(unit:unit_data().continent) local not_w_unit = not (unit:wire_data() or unit:ai_editor_data()) self:GetItem("Continent"):SetEnabled(not_w_unit) self:GetItem("UnitPath"):SetEnabled(not_w_unit) self:build_links(unit:unit_data().unit_id) self:build_group_links(unit) end local function element_link_text(element, link, warn) --ugly return tostring(element.editor_name) .. "\n" .. tostring(element.id) .. " | " .. (link and string.pretty2(link) .. " | " or "") .. tostring(element.class):gsub("Element", "") .. "\n" .. (warn or "") end local function unit_link_text(ud, link) return tostring(ud.name_id) .. "\n" .. tostring(ud.unit_id) .. link end local function portal_link_text(name) return "Inside portal " .. name end function Static:build_links(id, match, element) match = match or Utils.LinkTypes.Unit local function create_link(text, id, group, clbk) group:button(id, clbk, { text = text, font_size = 16, label = "elements" }) end local links = managers.mission:get_links_paths_new(id, match) local links_group = self:GetItem("LinkedBy") or self:group("LinkedBy", {max_height = 200}) local same_links = {} links_group:ClearItems() for _, link in pairs(links) do same_links[link.element.id] = true create_link(element_link_text(link.element, link.upper_k or link.key), link.id, links_group, ClassClbk(self._parent, "select_element", link.element)) end if match == Utils.LinkTypes.Unit then --Get portals that have the unit attached to - https://github.com/simon-wh/PAYDAY-2-BeardLib-Editor/issues/49 local portal_layer = self:GetLayer("portal") for _, portal in pairs(clone(managers.portal:unit_groups())) do local ids = portal._ids if ids and ids[id] then local name = portal:name() create_link(portal_link_text(name), name, links_group, ClassClbk(portal_layer, "select_portal", name, true)) end end end if match == Utils.LinkTypes.Element then local linking_group = self:GetItem("LinkingTo") or self:group("LinkingTo", {max_height = 200}) if alive(linking_group) then linking_group:ClearItems() end for _, script in pairs(managers.mission._missions) do for _, tbl in pairs(script) do if tbl.elements then for k, e in pairs(tbl.elements) do local eid = e.id for _, link in pairs(managers.mission:get_links_paths_new(eid, Utils.LinkTypes.Element, {{mission_element_data = element}})) do local warn if link.location == "on_executed" then if same_links[eid] and link.tbl.delay == 0 then warn = "Warning - link already exists and can cause an endless loop, increase the delay." end end same_links[eid] = true create_link(element_link_text(e, link.location, warn), eid, linking_group, ClassClbk(self._parent, "select_element", e)) end end end end end for uid, unit in pairs(managers.worlddefinition._all_units) do if alive(unit) then local ud = unit:unit_data() for _, link in pairs(managers.mission:get_links_paths_new(ud.unit_id, Utils.LinkTypes.Unit, {{mission_element_data = element}})) do local linking_from = link.location linking_from = linking_from and " | " .. string.pretty2(linking_from) or "" create_link(unit_link_text(ud, linking_from), uid, linking_group, ClassClbk(self, "set_selected_unit", unit)) end end end if #linking_group:Items() == 0 then linking_group:Destroy() end end if #links_group:Items() == 0 then links_group:Destroy() end return links end function Static:remove_unit_from_portal() local portal_layer = self:layer("portal") local count = 0 if portal_layer and portal_layer:selected_portal() then for _, unit in pairs(self._selected_units) do if unit:unit_data().unit_id then portal_layer:remove_unit_from_portal(unit) count = count + 1 end end if #self:selected_units() == 1 then self:build_links(self:selected_unit():unit_data().unit_id) end Utils:Notify("Success", string.format("Removed %d units to selected portal", count)) else Utils:Notify("Error", "No portal selected") end end function Static:add_unit_to_portal() local portal_layer = self:layer("portal") local count = 0 if portal_layer and portal_layer:selected_portal() then for _, unit in pairs(self._selected_units) do if unit:unit_data().unit_id then portal_layer:add_unit_to_portal(unit, true) count = count + 1 end end if #self:selected_units() == 1 then self:build_links(self:selected_unit():unit_data().unit_id) end portal_layer:load_portal_units() Utils:Notify("Success", string.format("Added %d units to selected portal", count)) else Utils:Notify("Error", "No portal selected") end end function Static:delete_selected(item) self:GetPart("undo_handler"):SaveUnitValues(self._selected_units, "delete") for _, unit in pairs(self._selected_units) do if alive(unit) then if unit:fake() then self:GetPart("instances"):delete_instance() else self:delete_unit_group_data(unit) self._parent:DeleteUnit(unit) end end end self:reset_selected_units() self:set_unit() end function Static:delete_selected_dialog(item) if not self:selected_unit() or self._grabbed_unit then return end Utils:YesNoQuestion("This will delete the selection", ClassClbk(self, "delete_selected")) end function Static:update(t, dt) self.super.update(self, t, dt) if self._reset_raycast and self._reset_raycast <= t then self._ignore_raycast = {} self._reset_raycast = nil end for _, unit in pairs(self._nav_surfaces) do Application:draw(unit, 0,0.8,1) end for _, editor in pairs(self._editors) do if editor.update then editor:update(t, dt) end end if alive(self._grabbed_unit) then self._parent:set_unit_positions(self._parent._spawn_position) Application:draw_line(self._parent._spawn_position - Vector3(0, 0, 2000), self._parent._spawn_position + Vector3(0, 0, 2000), 0, 1, 0) Application:draw_sphere(self._parent._spawn_position, 30, 0, 1, 0) end local color = BeardLibEditor.Options:GetValue("AccentColor"):with_alpha(1) self._pen:set(color) local draw_bodies = self:Val("DrawBodies") if managers.viewport:get_current_camera() then for _, unit in pairs(self._selected_units) do if alive(unit) and not unit:fake() then if draw_bodies then for i = 0, unit:num_bodies() - 1 do local body = unit:body(i) if self._parent:_should_draw_body(body) then self._pen:body(body) end end else Application:draw(unit, color:unpack()) end end end end self:_update_drag_select_draw() end function Static:_update_drag_select_draw() local r = 1 local g = 1 local b = 1 local brush = Draw:brush() if alt() then b = 0 g = 0 r = 1 end if ctrl() then b = 0 g = 1 r = 0 end brush:set_color(Color(0.15, 0.5 * r, 0.5 * g, 0.5 * b)) for _, unit in ipairs(self._drag_units or {}) do brush:draw(unit) Application:draw(unit, r * 0.75, g * 0.75, b * 0.75) end end function Static:GetCopyData(remove_old_links, keep_location) local copy_data = {} local element_type = Utils.LinkTypes.Element local unit_type = Utils.LinkTypes.Unit for _, unit in pairs(self._selected_units) do local typ = unit:mission_element() and "element" or not unit:fake() and "unit" or "unsupported" local copy = { type = typ, mission_element_data = typ == "element" and unit:mission_element().element and deep_clone(unit:mission_element().element) or nil, unit_data = typ == "unit" and unit:unit_data() and deep_clone(unit:unit_data()) or nil, wire_data = typ == "unit" and unit:wire_data() and deep_clone(unit:wire_data()) or nil, ai_editor_data = typ == "unit" and unit:ai_editor_data() and deep_clone(unit:ai_editor_data()) or nil } if typ ~= "unsupported" then table.insert(copy_data, copy) end end --The id is now used as the number it should add to the latest id before spawning the prefab --Why we need to save ids? so elements can function even after copy pasting local unit_id = 0 local world_unit_id = 0 local element_id = 0 for _, v in pairs(copy_data) do local typ = v.type if typ == "element" then if not keep_location then v.mission_element_data.script = nil end for _, link in pairs(managers.mission:get_links_paths_new(v.mission_element_data.id, element_type, copy_data)) do link.tbl[link.key] = element_id end v.mission_element_data.id = element_id element_id = element_id + 1 elseif typ == "unit" and v.unit_data.unit_id then local is_world = v.wire_data or v.ai_editor_data if not keep_location then v.unit_data.continent = nil end for _, link in pairs(managers.mission:get_links_paths_new(v.unit_data.unit_id, unit_type, copy_data)) do link.tbl[link.key] = is_world and world_unit_id or unit_id end v.unit_data.unit_id = is_world and world_unit_id or unit_id if is_world then world_unit_id = world_unit_id + 1 else unit_id = unit_id + 1 end end end --Remove old links if remove_old_links then for _, v in pairs(copy_data) do if v.type == "element" then local e = {v} for _, continent in pairs(managers.mission._ids) do for id, _ in pairs(continent) do managers.mission:delete_links(id, element_type, e) end end for id, _ in pairs(managers.worlddefinition._all_units) do managers.mission:delete_links(id, unit_type, e) end end end end return copy_data end function Static:CopySelection() if #self._selected_units > 0 and not self._parent._menu._highlighted then self._copy_data = self:GetCopyData(self:Val("RemoveOldLinks"), true) --Sadly thanks for ovk's "crash at all cost" coding I cannot use script converter because it would crash. if #self._copy_data == 0 then self._copy_data = nil end end end function Static:Paste() if not Global.editor_safe_mode and not self._grabbed_unit and not self._parent._menu._highlighted and self._copy_data then self:SpawnCopyData(self._copy_data) end end function Static:SpawnPrefab(prefab) self:SpawnCopyData(prefab, true) if self.x then local cam = managers.viewport:get_current_camera() self:GetItem("Position"):SetValue(cam:position() + cam:rotation():y()) self:set_unit_data() end end function Static:SpawnCopyData(copy_data, prefab) copy_data = deep_clone(copy_data) local project = BeardLibEditor.MapProject local missing_units = {} local missing local assets = self:GetPart("world")._assets_manager local mod, data = project:get_mod_and_config() local unit_ids = Idstring("unit") local add if data then add = project:get_level_by_id(data, Global.current_level_id).add end self:reset_selected_units() for _, v in pairs(copy_data) do local is_element = v.type == "element" local is_unit = v.type == "unit" if v.type == "element" then local c = managers.mission._scripts[v.mission_element_data.script] or nil c = c and c._continent or self._parent._current_continent local new_final_id = managers.mission:get_new_id(c) for _, link in pairs(managers.mission:get_links_paths_new(v.mission_element_data.id, Utils.LinkTypes.Element, copy_data)) do link.tbl[link.key] = new_final_id end v.mission_element_data.id = new_final_id elseif v.type == "unit" and v.unit_data.unit_id then local new_final_id = managers.worlddefinition:GetNewUnitID(v.unit_data.continent or self._parent._current_continent, (v.wire_data or v.ai_editor_data) and "wire" or "") for _, link in pairs(managers.mission:get_links_paths_new(v.unit_data.unit_id, Utils.LinkTypes.Unit, copy_data)) do link.tbl[link.key] = new_final_id end v.unit_data.unit_id = new_final_id local unit = v.unit_data.name if missing_units[unit] == nil then local is_preview_not_loaded = (not assets and not PackageManager:has(unit_ids, unit:id())) local not_loaded = not ((assets and assets:is_asset_loaded(unit, "unit") or (add and FileIO:Exists(Path:Combine(mod.ModPath, add.directory, unit..".unit"))))) if is_preview_not_loaded or not_loaded then missing_units[unit] = true missing = true else missing_units[unit] = false end end end end local function all_ok_spawn() local units = {} for _, v in pairs(copy_data) do if v.type == "element" then table.insert(units, self:GetPart("mission"):add_element(v.mission_element_data.class, nil, v.mission_element_data, true)) elseif v.unit_data then table.insert(units, self._parent:SpawnUnit(v.unit_data.name, v, nil, v.unit_data.unit_id, true)) end end --When all units are spawned properly you can select. for _, unit in pairs(units) do self:set_selected_unit(unit, true) end self:GetPart("undo_handler"):SaveUnitValues(units, "spawn") self:StorePreviousPosRot() end if missing then if assets then Utils:QuickDialog({title = ":(", message = "A unit or more are unloaded, to spawn the prefab/copy you have to load all of the units"}, {{"Load Units", function() local function find_packages() for unit, is_missing in pairs(missing_units) do if is_missing then if (assets:is_asset_loaded(unit, "unit") or add and FileIO:Exists(Path:Combine(mod.ModPath, add.directory, unit..".unit"))) then missing_units[unit] = nil end else missing_units[unit] = nil end end if table.size(missing_units) > 0 then assets:find_packages({unit = missing_units}, find_packages) else Utils:Notify("Nice!", "All units are now loaded, spawning prefab/copy..") all_ok_spawn() end end find_packages() end}}) else Utils:Notify("ERROR!", "Cannot spawn the prefab[Unloaded units]") end else all_ok_spawn() end end function Static:Clone() self:CopySelection() self:Paste() end function Static:KeyFPressed() if self._selected_units[1] then self._parent:set_camera(self._selected_units[1]:position()) end end function Static:set_unit_enabled(enabled) for _, unit in pairs(self._selected_units) do if alive(unit) then unit:set_enabled(enabled) end end end function Static:set_drag_select() if self._parent._using_rotate_widget or self._parent._using_move_widget then return end if alt() or ctrl() then self._drag_select = true self._polyline = self._parent._menu._panel:polyline({ color = Color(0.5, 1, 1, 1) }) self._polyline:set_closed(true) self._drag_start_pos = managers.editor:cursor_pos() end end function Static:_update_drag_select() if not self._drag_select then return end local end_pos = managers.editor:cursor_pos() if self._polyline then local p1 = managers.editor:screen_pos(self._drag_start_pos) local p3 = managers.editor:screen_pos(end_pos) local p2 = Vector3(p3.x, p1.y, 0) local p4 = Vector3(p1.x, p3.y, 0) self._polyline:set_points({ p1, p2, p3, p4 }) end local len = (end_pos - self._drag_start_pos):length() if len > 0.05 then local top_left = self._drag_start_pos local bottom_right = end_pos if bottom_right.y < top_left.y and top_left.x < bottom_right.x or top_left.y < bottom_right.y and bottom_right.x < top_left.x then top_left = Vector3(self._drag_start_pos.x, end_pos.y, 0) bottom_right = Vector3(end_pos.x, self._drag_start_pos.y, 0) end local units = World:find_units("camera_frustum", managers.editor:camera(), top_left, bottom_right, 500000, self._parent._editor_all) self._drag_units = {} for _, unit in ipairs(units) do if self:check_unit_ok(unit) then table.insert(self._drag_units, unit) end end end end function Static:remove_polyline() if self._polyline then managers.editor._menu._panel:remove(self._polyline) self._polyline = nil end end
mit
GreatBigBushyBeard/PAYDAY-2-BeardLib-Editor
Hooks/ElementAiGlobalEvent.lua
2
1516
if not Global.editor_mode then return end core:import("CoreMissionScriptElement") ElementAiGlobalEvent = ElementAiGlobalEvent or class(CoreMissionScriptElement.MissionScriptElement) --Report if outdated. function ElementAiGlobalEvent:_finalize_values(values) end function ElementAiGlobalEvent:on_executed(instigator) if not self._values.enabled then return end local wave_mode = self._values.wave_mode local blame = self._values.blame local AI_event = self._values.AI_event if wave_mode and wave_mode ~= "none" then managers.groupai:state():set_wave_mode(wave_mode) end if not blame or blame == "none" then Application:error("ElementAiGlobalEvent needs to be updated with blame parameter, and not none", blame) end if AI_event and AI_event ~= "none" then if AI_event == "police_called" then managers.groupai:state():on_police_called(managers.groupai:state().analyse_giveaway(blame, instigator, {"vo_cbt"})) elseif AI_event == "police_weapons_hot" then managers.groupai:state():on_police_weapons_hot(managers.groupai:state().analyse_giveaway(blame, instigator, {"vo_cbt"})) elseif AI_event == "gangsters_called" then managers.groupai:state():on_gangsters_called(managers.groupai:state().analyse_giveaway(blame, instigator, {"vo_cbt"})) elseif AI_event == "gangster_weapons_hot" then managers.groupai:state():on_gangster_weapons_hot(managers.groupai:state().analyse_giveaway(blame, instigator, {"vo_cbt"})) end end ElementAiGlobalEvent.super.on_executed(self, instigator) end
mit
hooksta4/darkstar
scripts/zones/zones/Southern_San_dOria/npcs/Ashene.lua
4
1977
----------------------------------- -- Area: Southern San d'Oria -- NPC: Ashene -- Standard Merchant NPC -- @zone 230 -- @pos 70 0 61 ----------------------------------- package.loaded["scripts/zones/Southern_San_dOria/TextIDs"] = nil; ----------------------------------- require("scripts/globals/settings"); require("scripts/globals/shop"); require("scripts/globals/quests"); require("scripts/zones/Southern_San_dOria/TextIDs"); ----------------------------------- -- onTrade Action ----------------------------------- function onTrade(player,npc,trade) -- "Flyers for Regine" conditional script FlyerForRegine = player:getQuestStatus(SANDORIA,FLYERS_FOR_REGINE); if (FlyerForRegine == 1) then count = trade:getItemCount(); MagicFlyer = trade:hasItemQty(532,1); if (MagicFlyer == true and count == 1) then player:messageSpecial(FLYER_REFUSED); end end end; ----------------------------------- -- onTrigger Action ----------------------------------- function onTrigger(player,npc) player:showText(npc,ASH_THADI_ENE_SHOP_DIALOG); local stock = {0x4047,4309,1, --Baselard 0x4094,16934,1, --Gladius 0x40a1,21067,1, --Broadsword 0x40c0,35769,1, --Hunting Sword 0x408c,13406,1, --Fleuret 0x4001,129,2, --Cesti 0x4042,1827,2, --Dagger 0x4098,7128,2, --Iron Sword 0x40b6,8294,2, --Longsword 0x4040,140,3, --Bronze Dagger 0x4041,837,3, --Brass Dagger 0x4093,3523,3, --Brass Xiphos 0x4097,241,3, --Bronze Sword 0x40b5,1674,3} --Spatha showNationShop(player, SANDORIA, stock); end; ----------------------------------- -- onEventUpdate ----------------------------------- function onEventUpdate(player,csid,option) --printf("CSID: %u",csid); --printf("RESULT: %u",option); end; ----------------------------------- -- onEventFinish ----------------------------------- function onEventFinish(player,csid,option) --printf("CSID: %u",csid); --printf("RESULT: %u",option); end;
gpl-3.0
hooksta4/darkstar
scripts/zones/The_Garden_of_RuHmet/mobs/Aw_zdei.lua
19
1909
----------------------------------- -- Area: The Garden of Ru'Hmet -- MOB: Aw'Zdei -- Animation Sub 0 Pot Form -- Animation Sub 1 Pot Form (reverse eye position) -- Animation Sub 2 Bar Form -- Animation Sub 3 Ring Form ----------------------------------- require("scripts/globals/status"); ----------------------------------- -- OnMobSpawn Action -- Set AnimationSub to 0, put it in pot form ----------------------------------- function onMobSpawn(mob) mob:AnimationSub(0); onPath(mob); end; function onPath(mob) local spawnPos = mob:getSpawnPos(); mob:pathThrough({spawnPos.x, spawnPos.y, spawnPos.z}); local pos = mob:getPos(); if (spawnPos.x == pos.x and spawnPos.z == pos.z) then mob:setPos(spawnPos.x, spawnPos.y, spawnPos.z, mob:getRotPos() + 16); end end; ----------------------------------- -- onMobFight Action -- Randomly change forms ----------------------------------- function onMobFight(mob) local randomTime = math.random(15,45); local changeTime = mob:getLocalVar("changeTime"); if (mob:AnimationSub() == 0 and mob:getBattleTime() - changeTime > randomTime) then mob:AnimationSub(math.random(2,3)); mob:setLocalVar("changeTime", mob:getBattleTime()); elseif (mob:AnimationSub() == 1 and mob:getBattleTime() - changeTime > randomTime) then mob:AnimationSub(math.random(2,3)); mob:setLocalVar("changeTime", mob:getBattleTime()); elseif (mob:AnimationSub() == 2 and mob:getBattleTime() - changeTime > randomTime) then local aniChance = math.random(0,1); if (aniChance == 0) then mob:AnimationSub(0); mob:setLocalVar("changeTime", mob:getBattleTime()); else mob:AnimationSub(3) mob:setLocalVar("changeTime", mob:getBattleTime()); end elseif (mob:AnimationSub() == 3 and mob:getBattleTime() - changeTime > randomTime) then mob:AnimationSub(math.random(0,2)); mob:setLocalVar("changeTime", mob:getBattleTime()); end end;
gpl-3.0
hooksta4/darkstar
scripts/zones/zones/Norg/npcs/Colleraie.lua
38
1028
----------------------------------- -- Area: Norg -- NPC: Colleraie -- Type: Event Scene Replayer -- @zone: 252 -- @pos -24.684 0.097 -39.409 -- -- Auto-Script: Requires Verification (Verified by Brawndo) ----------------------------------- package.loaded["scripts/zones/Norg/TextIDs"] = nil; ----------------------------------- ----------------------------------- -- onTrade Action ----------------------------------- function onTrade(player,npc,trade) end; ----------------------------------- -- onTrigger Action ----------------------------------- function onTrigger(player,npc) player:startEvent(0x00af); 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
hooksta4/darkstar
scripts/zones/Southern_San_dOria/npcs/Chanpau.lua
2
1979
----------------------------------- -- Area: Southern San d'Oria -- NPC: Chanpau -- Optional Involvement in Quest: A Squire's Test II -- @zone 230 -- @pos -152 -2 55 ------------------------------------- package.loaded["scripts/zones/Southern_San_dOria/TextIDs"] = nil; ----------------------------------- require("scripts/globals/settings"); require("scripts/globals/quests"); require("scripts/zones/Southern_San_dOria/TextIDs"); ----------------------------------- -- onTrade Action ----------------------------------- function onTrade(player,npc,trade) -- "Flyers for Regine" conditional script FlyerForRegine = player:getQuestStatus(SANDORIA,FLYERS_FOR_REGINE); if (FlyerForRegine == 1) then count = trade:getItemCount(); MagicFlyer = trade:hasItemQty(532,1); if (MagicFlyer == true and count == 1) then player:messageSpecial(FLYER_REFUSED); end end end; ----------------------------------- -- onTrigger Action ----------------------------------- function onTrigger(player,npc) if (player:getQuestStatus(SANDORIA,A_SQUIRE_S_TEST_II) == QUEST_ACCEPTED) then player:startEvent(0x275); elseif (player:getQuestStatus(SANDORIA, THE_BRUGAIRE_CONSORTIUM) == QUEST_COMPLETED) then Fired = player:getVar("Fired") if Fired == 1 then player:startEvent(0x0237) -- i got fired in a day else player:startEvent(0x01f9) -- theres work ill go check it out end else player:startEvent(0x0236); 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 == 0x01f9) then player:setVar("Fired", 1) end end; -------for future use -- player:startEvent(0x7fb3) -- starlight celebration
gpl-3.0
AnySDK/Sample_Lua
src/cocos/cocos2d/DrawPrimitives.lua
98
12024
local dp_initialized = false local dp_shader = nil local dp_colorLocation = -1 local dp_color = { 1.0, 1.0, 1.0, 1.0 } local dp_pointSizeLocation = -1 local dp_pointSize = 1.0 local SHADER_NAME_POSITION_U_COLOR = "ShaderPosition_uColor" local targetPlatform = cc.Application:getInstance():getTargetPlatform() local function lazy_init() if not dp_initialized then dp_shader = cc.ShaderCache:getInstance():getProgram(SHADER_NAME_POSITION_U_COLOR) --dp_shader:retain() if nil ~= dp_shader then dp_colorLocation = gl.getUniformLocation( dp_shader:getProgram(), "u_color") dp_pointSizeLocation = gl.getUniformLocation( dp_shader:getProgram(), "u_pointSize") dp_Initialized = true end end if nil == dp_shader then print("Error:dp_shader is nil!") return false end return true end local function setDrawProperty() gl.glEnableVertexAttribs( CCConstants.VERTEX_ATTRIB_FLAG_POSITION ) dp_shader:use() dp_shader:setUniformsForBuiltins() dp_shader:setUniformLocationWith4fv(dp_colorLocation, dp_color, 1) end function ccDrawInit() lazy_init() end function ccDrawFree() dp_initialized = false end function ccDrawColor4f(r,g,b,a) dp_color[1] = r dp_color[2] = g dp_color[3] = b dp_color[4] = a end function ccPointSize(pointSize) dp_pointSize = pointSize * cc.Director:getInstance():getContentScaleFactor() end function ccDrawColor4B(r,g,b,a) dp_color[1] = r / 255.0 dp_color[2] = g / 255.0 dp_color[3] = b / 255.0 dp_color[4] = a / 255.0 end function ccDrawPoint(point) if not lazy_init() then return end local vertexBuffer = { } local function initBuffer() vertexBuffer.buffer_id = gl.createBuffer() gl.bindBuffer(gl.ARRAY_BUFFER,vertexBuffer.buffer_id) local vertices = { point.x,point.y} gl.bufferData(gl.ARRAY_BUFFER,2,vertices,gl.STATIC_DRAW) gl.bindBuffer(gl.ARRAY_BUFFER, 0) end initBuffer() setDrawProperty() dp_shader:setUniformLocationWith1f(dp_pointSizeLocation, dp_pointSize) gl.bindBuffer(gl.ARRAY_BUFFER,vertexBuffer.buffer_id) gl.vertexAttribPointer(CCConstants.VERTEX_ATTRIB_POSITION, 2, gl.FLOAT, false, 0, 0) gl.drawArrays(gl.POINTS,0,1) gl.bindBuffer(gl.ARRAY_BUFFER,0) end function ccDrawPoints(points,numOfPoint) if not lazy_init() then return end local vertexBuffer = {} local i = 1 local function initBuffer() vertexBuffer.buffer_id = gl.createBuffer() gl.bindBuffer(gl.ARRAY_BUFFER, vertexBuffer.buffer_id) local vertices = {} for i = 1, numOfPoint do vertices[2 * i - 1] = points[i].x vertices[2 * i] = points[i].y end gl.bufferData(gl.ARRAY_BUFFER, numOfPoint * 2, vertices, gl.STATIC_DRAW) gl.bindBuffer(gl.ARRAY_BUFFER, 0) end initBuffer() setDrawProperty() dp_shader:setUniformLocationWith1f(dp_pointSizeLocation, dp_pointSize) gl.bindBuffer(gl.ARRAY_BUFFER,vertexBuffer.buffer_id) gl.vertexAttribPointer(CCConstants.VERTEX_ATTRIB_POSITION, 2, gl.FLOAT, false, 0, 0) gl.drawArrays(gl.POINTS,0,numOfPoint) gl.bindBuffer(gl.ARRAY_BUFFER,0) end function ccDrawLine(origin,destination) if not lazy_init() then return end local vertexBuffer = {} local function initBuffer() vertexBuffer.buffer_id = gl.createBuffer() gl.bindBuffer(gl.ARRAY_BUFFER, vertexBuffer.buffer_id) local vertices = { origin.x, origin.y, destination.x, destination.y} gl.bufferData(gl.ARRAY_BUFFER,4,vertices,gl.STATIC_DRAW) gl.bindBuffer(gl.ARRAY_BUFFER, 0) end initBuffer() setDrawProperty() gl.bindBuffer(gl.ARRAY_BUFFER,vertexBuffer.buffer_id) gl.vertexAttribPointer(CCConstants.VERTEX_ATTRIB_POSITION, 2, gl.FLOAT, false, 0, 0) gl.drawArrays(gl.LINES ,0,2) gl.bindBuffer(gl.ARRAY_BUFFER,0) end function ccDrawPoly(points,numOfPoints,closePolygon) if not lazy_init() then return end local vertexBuffer = {} local i = 1 local function initBuffer() vertexBuffer.buffer_id = gl.createBuffer() gl.bindBuffer(gl.ARRAY_BUFFER, vertexBuffer.buffer_id) local vertices = {} for i = 1, numOfPoints do vertices[2 * i - 1] = points[i].x vertices[2 * i] = points[i].y end gl.bufferData(gl.ARRAY_BUFFER, numOfPoints * 2, vertices, gl.STATIC_DRAW) gl.bindBuffer(gl.ARRAY_BUFFER, 0) end initBuffer() setDrawProperty() gl.bindBuffer(gl.ARRAY_BUFFER,vertexBuffer.buffer_id) gl.vertexAttribPointer(CCConstants.VERTEX_ATTRIB_POSITION, 2, gl.FLOAT, false, 0, 0) if closePolygon then gl.drawArrays(gl.LINE_LOOP , 0, numOfPoints) else gl.drawArrays(gl.LINE_STRIP, 0, numOfPoints) end gl.bindBuffer(gl.ARRAY_BUFFER,0) end function ccDrawSolidPoly(points,numOfPoints,color) if not lazy_init() then return end local vertexBuffer = {} local i = 1 local function initBuffer() vertexBuffer.buffer_id = gl.createBuffer() gl.bindBuffer(gl.ARRAY_BUFFER, vertexBuffer.buffer_id) local vertices = {} for i = 1, numOfPoints do vertices[2 * i - 1] = points[i].x vertices[2 * i] = points[i].y end gl.bufferData(gl.ARRAY_BUFFER, numOfPoints * 2, vertices, gl.STATIC_DRAW) gl.bindBuffer(gl.ARRAY_BUFFER, 0) end initBuffer() gl.glEnableVertexAttribs( CCConstants.VERTEX_ATTRIB_FLAG_POSITION ) dp_shader:use() dp_shader:setUniformsForBuiltins() dp_shader:setUniformLocationWith4fv(dp_colorLocation, color, 1) gl.bindBuffer(gl.ARRAY_BUFFER,vertexBuffer.buffer_id) gl.vertexAttribPointer(CCConstants.VERTEX_ATTRIB_POSITION, 2, gl.FLOAT, false, 0, 0) gl.drawArrays(gl.TRIANGLE_FAN , 0, numOfPoints) gl.bindBuffer(gl.ARRAY_BUFFER,0) end function ccDrawRect(origin,destination) ccDrawLine(CCPoint:__call(origin.x, origin.y), CCPoint:__call(destination.x, origin.y)) ccDrawLine(CCPoint:__call(destination.x, origin.y), CCPoint:__call(destination.x, destination.y)) ccDrawLine(CCPoint:__call(destination.x, destination.y), CCPoint:__call(origin.x, destination.y)) ccDrawLine(CCPoint:__call(origin.x, destination.y), CCPoint:__call(origin.x, origin.y)) end function ccDrawSolidRect( origin,destination,color ) local vertices = { origin, CCPoint:__call(destination.x, origin.y) , destination, CCPoint:__call(origin.x, destination.y) } ccDrawSolidPoly(vertices,4,color) end function ccDrawCircleScale( center, radius, angle, segments,drawLineToCenter,scaleX,scaleY) if not lazy_init() then return end local additionalSegment = 1 if drawLineToCenter then additionalSegment = additionalSegment + 1 end local vertexBuffer = { } local function initBuffer() local coef = 2.0 * math.pi / segments local i = 1 local vertices = {} vertexBuffer.buffer_id = gl.createBuffer() gl.bindBuffer(gl.ARRAY_BUFFER, vertexBuffer.buffer_id) for i = 1, segments + 1 do local rads = (i - 1) * coef local j = radius * math.cos(rads + angle) * scaleX + center.x local k = radius * math.sin(rads + angle) * scaleY + center.y vertices[i * 2 - 1] = j vertices[i * 2] = k end vertices[(segments + 2) * 2 - 1] = center.x vertices[(segments + 2) * 2] = center.y gl.bufferData(gl.ARRAY_BUFFER, (segments + 2) * 2, vertices, gl.STATIC_DRAW) gl.bindBuffer(gl.ARRAY_BUFFER, 0) end initBuffer() setDrawProperty() gl.bindBuffer(gl.ARRAY_BUFFER,vertexBuffer.buffer_id) gl.vertexAttribPointer(CCConstants.VERTEX_ATTRIB_POSITION, 2, gl.FLOAT, false, 0, 0) gl.drawArrays(gl.LINE_STRIP , 0, segments + additionalSegment) gl.bindBuffer(gl.ARRAY_BUFFER,0) end function ccDrawCircle(center, radius, angle, segments, drawLineToCenter) ccDrawCircleScale(center, radius, angle, segments, drawLineToCenter, 1.0, 1.0) end function ccDrawSolidCircle(center, radius, angle, segments,scaleX,scaleY) if not lazy_init() then return end local vertexBuffer = { } local function initBuffer() local coef = 2.0 * math.pi / segments local i = 1 local vertices = {} vertexBuffer.buffer_id = gl.createBuffer() gl.bindBuffer(gl.ARRAY_BUFFER, vertexBuffer.buffer_id) for i = 1, segments + 1 do local rads = (i - 1) * coef local j = radius * math.cos(rads + angle) * scaleX + center.x local k = radius * math.sin(rads + angle) * scaleY + center.y vertices[i * 2 - 1] = j vertices[i * 2] = k end vertices[(segments + 2) * 2 - 1] = center.x vertices[(segments + 2) * 2] = center.y gl.bufferData(gl.ARRAY_BUFFER, (segments + 2) * 2, vertices, gl.STATIC_DRAW) gl.bindBuffer(gl.ARRAY_BUFFER, 0) end initBuffer() setDrawProperty() gl.bindBuffer(gl.ARRAY_BUFFER,vertexBuffer.buffer_id) gl.vertexAttribPointer(CCConstants.VERTEX_ATTRIB_POSITION, 2, gl.FLOAT, false, 0, 0) gl.drawArrays(gl.TRIANGLE_FAN , 0, segments + 1) gl.bindBuffer(gl.ARRAY_BUFFER,0) end function ccDrawQuadBezier(origin, control, destination, segments) if not lazy_init() then return end local vertexBuffer = { } local function initBuffer() local vertices = { } local i = 1 local t = 0.0 for i = 1, segments do vertices[2 * i - 1] = math.pow(1 - t,2) * origin.x + 2.0 * (1 - t) * t * control.x + t * t * destination.x vertices[2 * i] = math.pow(1 - t,2) * origin.y + 2.0 * (1 - t) * t * control.y + t * t * destination.y t = t + 1.0 / segments end vertices[2 * (segments + 1) - 1] = destination.x vertices[2 * (segments + 1)] = destination.y vertexBuffer.buffer_id = gl.createBuffer() gl.bindBuffer(gl.ARRAY_BUFFER, vertexBuffer.buffer_id) gl.bufferData(gl.ARRAY_BUFFER, (segments + 1) * 2, vertices, gl.STATIC_DRAW) gl.bindBuffer(gl.ARRAY_BUFFER, 0) end initBuffer() setDrawProperty() gl.bindBuffer(gl.ARRAY_BUFFER,vertexBuffer.buffer_id) gl.vertexAttribPointer(CCConstants.VERTEX_ATTRIB_POSITION, 2, gl.FLOAT, false, 0, 0) gl.drawArrays(gl.LINE_STRIP , 0, segments + 1) gl.bindBuffer(gl.ARRAY_BUFFER,0) end function ccDrawCubicBezier(origin, control1, control2, destination, segments) if not lazy_init then return end local vertexBuffer = { } local function initBuffer() local vertices = { } local t = 0 local i = 1 for i = 1, segments do vertices[2 * i - 1] = math.pow(1 - t,3) * origin.x + 3.0 * math.pow(1 - t, 2) * t * control1.x + 3.0 * (1 - t) * t * t * control2.x + t * t * t * destination.x vertices[2 * i] = math.pow(1 - t,3) * origin.y + 3.0 * math.pow(1 - t, 2) * t * control1.y + 3.0 * (1 - t) * t * t * control2.y + t * t * t * destination.y t = t + 1.0 / segments end vertices[2 * (segments + 1) - 1] = destination.x vertices[2 * (segments + 1)] = destination.y vertexBuffer.buffer_id = gl.createBuffer() gl.bindBuffer(gl.ARRAY_BUFFER, vertexBuffer.buffer_id) gl.bufferData(gl.ARRAY_BUFFER, (segments + 1) * 2, vertices, gl.STATIC_DRAW) gl.bindBuffer(gl.ARRAY_BUFFER, 0) end initBuffer() setDrawProperty() gl.bindBuffer(gl.ARRAY_BUFFER,vertexBuffer.buffer_id) gl.vertexAttribPointer(CCConstants.VERTEX_ATTRIB_POSITION, 2, gl.FLOAT, false, 0, 0) gl.drawArrays(gl.LINE_STRIP , 0, segments + 1) gl.bindBuffer(gl.ARRAY_BUFFER,0) end
mit
hooksta4/darkstar
scripts/zones/zones/Aht_Urhgan_Whitegate/npcs/Tehf_Kimasnahya.lua
19
2969
----------------------------------- -- Area: Aht Urhgan Whitegate -- NPC: Tehf Kimasnahya -- Type: Standard NPC -- @pos -89.897 -1 6.199 50 ----------------------------------- package.loaded["scripts/zones/Aht_Urhgan_Whitegate/TextIDs"] = nil; ----------------------------------- require("scripts/globals/keyitems"); require("scripts/globals/settings"); require("scripts/globals/quests"); require("scripts/zones/Aht_Urhgan_Whitegate/TextIDs"); ----------------------------------- ----------------------------------- -- onTrade Action ----------------------------------- function onTrade(player,npc,trade) end; ----------------------------------- -- onTrigger Action ----------------------------------- function onTrigger(player,npc) local gotitall = player:getQuestStatus(AHT_URHGAN,GOT_IT_ALL); local gotItAllProg = player:getVar("gotitallCS"); local threeMenProg = player:getVar("threemenandaclosetCS"); if (gotitall == QUEST_AVAILABLE) then player:startEvent(0x0208); elseif (gotItAllProg == 4) then player:startEvent(0x020d); elseif (gotItAllProg == 6) then player:startEvent(0x020f); elseif (gotItAllProg >= 7 and player:getVar("Wait1DayForgotitallCS_date") < os.time() and player:needToZone() == false) then player:startEvent(0x0210); elseif (gotItAllProg >= 7) then player:startEvent(0x021b); elseif (gotItAllProg >= 1 and gotItAllProg <= 3) then player:startEvent(0x0209); elseif (threeMenProg == 5) then player:startEvent(0x034b); elseif (threeMenProg == 6) then player:startEvent(0x034c); else player:startEvent(0x0211); 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 == 0x0208) then player:addQuest(AHT_URHGAN,GOT_IT_ALL); player:setVar("gotitallCS",1); elseif (csid == 0x020d and option == 0) then player:setVar("gotitallCS",5); player:delKeyItem(VIAL_OF_LUMINOUS_WATER); elseif (csid == 0x020f) then player:setVar("gotitallCS",7); player:setVar("Wait1DayForgotitallCS_date", getMidnight()); player:needToZone(true); elseif (csid == 0x021b) then player:setVar("gotitallCS",8); elseif (csid == 0x0210) then if (player:getFreeSlotsCount() == 0) then player:messageSpecial(ITEM_CANNOT_BE_OBTAINED,18257); else player:setVar("Wait1DayForgotitallCS_date",0); player:setVar("gotitallCS",0); player:addItem(18257); -- Bibiki Seashell player:messageSpecial(ITEM_OBTAINED,18257); player:completeQuest(AHT_URHGAN,GOT_IT_ALL); end elseif (csid == 0x034b and option == 1) then player:setVar("threemenandaclosetCS",6); end end;
gpl-3.0
hooksta4/darkstar
scripts/zones/East_Ronfaure/npcs/Stone_Monument.lua
3
1236
----------------------------------- -- Area: East Ronfaure -- NPC: Stone Monument -- Involved in quest "An Explorer's Footsteps" -- @pos 77.277 -2.894 -517.376 101 ----------------------------------- package.loaded["scripts/zones/East_Ronfaure/TextIDs"] = nil; ----------------------------------- require("scripts/zones/East_Ronfaure/TextIDs"); ----------------------------------- -- onTrigger ----------------------------------- function onTrigger(player,npc) player:startEvent(0x0384); end; ----------------------------------- -- onTrade ----------------------------------- function onTrade(player,npc,trade) if (trade:getItemCount() == 1 and trade:hasItemQty(571,1)) then player:tradeComplete(); player:addItem(570); player:messageSpecial(ITEM_OBTAINED,570); player:setVar("anExplorer-CurrentTablet",0x00002); 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
hooksta4/darkstar
scripts/zones/zones/Phomiuna_Aqueducts/npcs/Wooden_Ladder.lua
2
3108
----------------------------------- -- Area: Phomiuna Aqueducts -- NPC: Wooden Ladder -- @pos 101.9 -1.5 -101.9 -- @pos 101.948 -1.5 -18.016 -- @pos -61.888 -1.5 -18.079 -- @pos -218.109 -1.499 18.081 -- @pos -61.903 -1.5 138.099 -- @pos 21.901 -1.5 138.096 -- @pos 101.902 -1.5 181.902 -- @pos -159.32 -2.5 60 -- @pos -159.38 -22.559 60 -- @pos 199.317 -2.5 60 -- @pos 199.38 -22.559 60 -- @pos -200.679 -8.57 60 ----------------------------------- 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 X = player:getXPos(); local Y = player:getYPos(); local Z = player:getZPos(); if ((X <= 107.9 and X >= 95.9) and (Y >= -1 and Y <= 1) and (Z >= -108.9 and Z <= -98)) then player:startEvent(0x0015); elseif ((X <= 107.9 and X >= 95.9) and (Y >= -1 and Y <= 1) and (Z >= -24 and Z <= -12)) then player:startEvent(0x0016); elseif ((X <= -55.888 and X >= -67.888) and (Y >= -1 and Y <= 1) and (Z >= -24 and Z <= -12)) then player:startEvent(0x0017); elseif ((X <= -212.1 and X >= -224.1) and (Y >= -1 and Y <= 1) and (Z >= 12 and Z <= 24)) then player:startEvent(0x0018); elseif ((X <= -55.9 and X >= -67.9) and (Y >= -1 and Y <= 1) and (Z >= 132 and Z <= 144)) then player:startEvent(0x0019); elseif ((X <= 27.9 and X >= 15.9) and (Y >= -1 and Y <= 1) and (Z >= 132 and Z <= 144)) then player:startEvent(0x001a); elseif ((X <= 107.9 and X >= 95.9) and (Y >= -1 and Y <= 1) and (Z >= 175.9 and Z <= 187.9)) then player:startEvent(0x001b); elseif ((X <= -153.3 and X >= -168.3) and (Y >= -2 and Y <= 0) and (Z >= 54 and Z <= 66)) then if (player:getCurrentMission(COP) == DISTANT_BELIEFS and player:getVar("PromathiaStatus") == 1) then player:setVar("PromathiaStatus",2); player:startEvent(0x0023); else player:startEvent(0x001c); end elseif ((X <= -153.3 and X >= -168.3) and (Y >= -24 and Y <= -22) and (Z >= 54 and Z <= 66)) then player:startEvent(0x001d); elseif ((X <= 205.3 and X >= 193.3) and (Y >= -2 and Y <= 0) and (Z >= 54 and Z <= 66)) then player:startEvent(0x001e); elseif ((X <= 205.3 and X >= 193.3) and (Y >= -24 and Y <= -22) and (Z >= 54 and Z <= 66)) then player:startEvent(0x001f); elseif ((X <= -194.6 and X >= -206.6) and (Y >= -8 and Y <= -6) and (Z >= 54 and Z <= 66)) then player:messageSpecial(DOOR_SEALED_SHUT); 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
4aiman/MultiCraft_game
mods/redstone/mesecons_compatibility/init.lua
1
5555
if not multicraft.get_modpath("check") then os.exit() end if not default.multicraft_is_variable_is_a_part_of_multicraft_subgame_and_copying_it_means_you_use_our_code_so_we_become_contributors_of_your_project then exit() end doors = {} -- Registers a door - REDEFINITION ONLY | DOORS MOD MUST HAVE BEEN LOADED BEFORE -- name: The name of the door -- def: a table with the folowing fields: -- description -- inventory_image -- groups -- tiles_bottom: the tiles of the bottom part of the door {front, side} -- tiles_top: the tiles of the bottom part of the door {front, side} -- If the following fields are not defined the default values are used -- node_box_bottom -- node_box_top -- selection_box_bottom -- selection_box_top -- only_placer_can_open: if true only the player who placed the door can -- open it function doors:register_door(name, def) def.groups.not_in_creative_inventory = 1 local box = {{-0.5, -0.5, -0.5, 0.5, 0.5, -0.5+1.5/16}} if not def.node_box_bottom then def.node_box_bottom = box end if not def.node_box_top then def.node_box_top = box end if not def.selection_box_bottom then def.selection_box_bottom= box end if not def.selection_box_top then def.selection_box_top = box end local tt = def.tiles_top local tb = def.tiles_bottom local function after_dig_node(pos, name) if multicraft.get_node(pos).name == name then multicraft.remove_node(pos) end end local function on_rightclick(pos, dir, check_name, replace, replace_dir, params) pos.y = pos.y+dir if not multicraft.get_node(pos).name == check_name then return end local p2 = multicraft.get_node(pos).param2 p2 = params[p2+1] local meta = multicraft.get_meta(pos):to_table() multicraft.set_node(pos, {name=replace_dir, param2=p2}) multicraft.get_meta(pos):from_table(meta) pos.y = pos.y-dir meta = multicraft.get_meta(pos):to_table() multicraft.set_node(pos, {name=replace, param2=p2}) multicraft.get_meta(pos):from_table(meta) end local function on_mesecons_signal_open (pos, node) on_rightclick(pos, 1, name.."_t_1", name.."_b_2", name.."_t_2", {1,2,3,0}) end local function on_mesecons_signal_close (pos, node) on_rightclick(pos, 1, name.."_t_2", name.."_b_1", name.."_t_1", {3,0,1,2}) end local function check_player_priv(pos, player) if not def.only_placer_can_open then return true end local meta = multicraft.get_meta(pos) local pn = player:get_player_name() return meta:get_string("doors_owner") == pn end multicraft.register_node(":"..name.."_b_1", { tiles = {tb[2], tb[2], tb[2], tb[2], tb[1], tb[1].."^[transformfx"}, paramtype = "light", paramtype2 = "facedir", drop = name, drawtype = "nodebox", node_box = { type = "fixed", fixed = def.node_box_bottom }, selection_box = { type = "fixed", fixed = def.selection_box_bottom }, groups = def.groups, after_dig_node = function(pos, oldnode, oldmetadata, digger) pos.y = pos.y+1 after_dig_node(pos, name.."_t_1") end, on_rightclick = function(pos, node, puncher) if check_player_priv(pos, puncher) then on_rightclick(pos, 1, name.."_t_1", name.."_b_2", name.."_t_2", {1,2,3,0}) end end, mesecons = {effector = { action_on = on_mesecons_signal_open }}, can_dig = check_player_priv, }) multicraft.register_node(":"..name.."_b_2", { tiles = {tb[2], tb[2], tb[2], tb[2], tb[1].."^[transformfx", tb[1]}, paramtype = "light", paramtype2 = "facedir", drop = name, drawtype = "nodebox", node_box = { type = "fixed", fixed = def.node_box_bottom }, selection_box = { type = "fixed", fixed = def.selection_box_bottom }, groups = def.groups, after_dig_node = function(pos, oldnode, oldmetadata, digger) pos.y = pos.y+1 after_dig_node(pos, name.."_t_2") end, on_rightclick = function(pos, node, puncher) if check_player_priv(pos, puncher) then on_rightclick(pos, 1, name.."_t_2", name.."_b_1", name.."_t_1", {3,0,1,2}) end end, mesecons = {effector = { action_off = on_mesecons_signal_close }}, can_dig = check_player_priv, }) end doors:register_door("doors:door_wood", { description = "Wooden Door", inventory_image = "door_wood.png", groups = {snappy=1,choppy=2,oddly_breakable_by_hand=2,flammable=2,door=1, mese = 1}, tiles_bottom = {"door_wood_b.png", "door_brown.png"}, tiles_top = {"door_wood_a.png", "door_brown.png"}, sounds = default.node_sound_wood_defaults(), }) doors:register_door("doors:door_steel", { description = "Steel Door", inventory_image = "door_steel.png", groups = {snappy=1,bendy=2,cracky=1,melty=2,level=2,door=1, mese = 1}, tiles_bottom = {"door_steel_b.png", "door_grey.png"}, tiles_top = {"door_steel_a.png", "door_grey.png"}, only_placer_can_open = true, sounds = default.node_sound_stone_defaults(), })
lgpl-3.0
SirFrancisBillard/assorted-gamemodes
prison/entities/weapons/lite_fiveseven.lua
2
1482
AddCSLuaFile() SWEP.Base = "lite_base" SWEP.PrintName = "FN Five-seveN" SWEP.Category = "Lite Weapons" SWEP.DrawWeaponInfoBox = false SWEP.IconLetter = "u" SWEP.Spawnable = true SWEP.AdminOnly = false SWEP.HoldType = "pistol" SWEP.WorldModel = Model( "models/weapons/w_pist_fiveseven.mdl" ) SWEP.ViewModel = Model( "models/weapons/cstrike/c_pist_fiveseven.mdl" ) SWEP.ViewModelFOV = 55 SWEP.UseHands = true SWEP.Slot = 1 SWEP.SlotPos = 1 SWEP.CSMuzzleFlashes = true SWEP.Primary.Sound = Sound( "Weapon_FiveSeven.Single" ) SWEP.Primary.Recoil = 0.8 SWEP.Primary.Damage = 10 SWEP.Primary.NumShots = 1 SWEP.Primary.Cone = 0.03 SWEP.Primary.Delay = 0.12 SWEP.Primary.Ammo = "pistol" SWEP.Primary.Automatic = false SWEP.Primary.ClipSize = 20 SWEP.Primary.DefaultClip = 20 SWEP.Secondary.Ammo = "none" SWEP.Secondary.Automatic = false SWEP.Secondary.ClipSize = -1 SWEP.Secondary.DefaultClip = -1 SWEP.Spread = {} SWEP.Spread.Min = 0 SWEP.Spread.Max = 0.25 SWEP.Spread.IronsightsMod = 0.2 SWEP.Spread.CrouchMod = 0.6 SWEP.Spread.AirMod = 1.2 SWEP.Spread.RecoilMod = 0.05 SWEP.Spread.VelocityMod = 0.5 SWEP.IronsightsPos = Vector( -5.9613, -3.3101, 2.706 ) SWEP.IronsightsAng = Angle( 0, 0, 0 ) SWEP.IronsightsFOV = 0.8 SWEP.IronsightsSensitivity = 0.8 SWEP.IronsightsCrosshair = false SWEP.LoweredPos = Vector( 0, -20, -10 ) SWEP.LoweredAng = Angle( 70, 0, 0 ) if CLIENT then killicon.AddFont( "lite_fiveseven", "CSKillIcons", SWEP.IconLetter, Color( 255, 80, 0, 255 ) ) end
gpl-3.0
gedadsbranch/Darkstar-Mission
scripts/zones/Rabao/npcs/Waylea.lua
38
1048
----------------------------------- -- Area: Rabao -- NPC: Waylea -- Type: Reputation -- @zone: 247 -- @pos 12.384 4.658 -32.392 -- -- Auto-Script: Requires Verification (Verified by Brawndo) ----------------------------------- package.loaded["scripts/zones/Rabao/TextIDs"] = nil; ----------------------------------- ----------------------------------- -- onTrade Action ----------------------------------- function onTrade(player,npc,trade) end; ----------------------------------- -- onTrigger Action ----------------------------------- function onTrigger(player,npc) player:startEvent(0x0039 + (player:getFameLevel(4) - 1)); end; ----------------------------------- -- onEventUpdate ----------------------------------- function onEventUpdate(player,csid,option) -- printf("CSID: %u",csid); -- printf("RESULT: %u",option); end; ----------------------------------- -- onEventFinish ----------------------------------- function onEventFinish(player,csid,option) -- printf("CSID: %u",csid); -- printf("RESULT: %u",option); end;
gpl-3.0
gflima/nclua
tests/test-canvas-api.lua
1
1683
--[[ Copyright (C) 2013-2018 PUC-Rio/Laboratorio TeleMidia This file is part of NCLua. NCLua 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. NCLua 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 NCLua. If not, see <https://www.gnu.org/licenses/>. ]]-- local tests = require ('tests') local ASSERT_CHECK_API = tests.ASSERT_CHECK_API local canvas = require ('nclua.canvas') _ENV = nil ASSERT_CHECK_API { canvas, __gc = 'function', __index = 'table', __metatable = 'string', _dump_to_file = 'function', _dump_to_memory = 'function', _resize = 'function', _surface = 'function', attrAntiAlias = 'function', attrClip = 'function', attrColor = 'function', attrCrop = 'function', attrFilter = 'function', attrFlip = 'function', attrFont = 'function', attrLineWidth = 'function', attrOpacity = 'function', attrRotation = 'function', attrScale = 'function', attrSize = 'function', clear = 'function', compose = 'function', drawEllipse = 'function', drawLine = 'function', drawPolygon = 'function', drawRect = 'function', drawRoundRect = 'function', drawText = 'function', flush = 'function', measureText = 'function', new = 'function', pixel = 'function', }
gpl-2.0
hooksta4/darkstar
scripts/zones/Gustav_Tunnel/MobIDs.lua
7
1533
----------------------------------- -- Area: Gustav Tunnel (212) -- Comments: -- posX, posY, posZ --(Taken from 'mob_spawn_points' table) ----------------------------------- Goblinsavior_Heronox=17645609; Goblinsavior_Heronox_PH={ [17645592] = '1', -- 153.000, -10.000, -53.000 [17645605] = '1', -- 152.325, -10.702, -77.007 [17645604] = '1', -- 165.558, -10.647, -68.537 }; -- Wyvernpoacher Drachlox Wyvernpoacher_Drachlox=17645640; Wyvernpoacher_Drachlox_PH={ [17645633] = '1', -- -100.000, 1.000, -44.000 [17645634] = '1', -- -101.000, 1.000, -29.000 [17645644] = '1', -- -165.598, 0.218, -21.966 [17645643] = '1', -- -150.673, -0.067, -20.914 }; -- Baobhan Sith Baobhan_Sith=17645719; Baobhan_Sith_PH={ [17645717] = '1', -- 171.000, 9.194, 55.000 [17645718] = '1', -- 187.000, 9.000, 105.000 }; -- Taxim Taxim=17645742; Taxim_PH={ [17645731] = '1', -- -172.941, -1.220, 55.577 [17645738] = '1', -- -137.334, -0.108, 48.105 [17645744] = '1', -- -125.000, 0.635, 59.000 [17645739] = '1', -- -118.000, -0.515, 79.000 }; -- Ungur Ungur=17645755; Ungur_PH={ [17645764] = '1', -- -242.000, -0.577, 120.000 [17645792] = '1', -- -88.000, 0.735, 190.000 [17645784] = '1', -- -123.856, 0.239, 223.303 [17645758] = '1', -- -277.000, -10.000, -34.000 [17645754] = '1', -- -316.000, -9.000, 3.000 }; -- Amikiri Amikiri=17645774; Amikiri_PH={ [17645763] = '1', -- -245.000, -0.045, 146.000 [17645768] = '1', -- -228.872, -0.264, 144.689 [17645772] = '1', -- -209.552, -0.257, 161.728 };
gpl-3.0
gedadsbranch/Darkstar-Mission
scripts/globals/items/bowl_of_seafood_stew.lua
35
1467
----------------------------------------- -- ID: 4561 -- Item: Bowl of Seafood Stew -- Food Effect: 180Min, All Races ----------------------------------------- -- Health 20 -- Dexterity 1 -- Vitality 5 -- Defense % 25 -- Defense Cap 120 ----------------------------------------- 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,4561); end; ----------------------------------- -- onEffectGain Action ----------------------------------- function onEffectGain(target,effect) target:addMod(MOD_HP, 20); target:addMod(MOD_DEX, 1); target:addMod(MOD_VIT, 5); target:addMod(MOD_FOOD_DEFP, 25); target:addMod(MOD_FOOD_DEF_CAP, 120); end; ----------------------------------------- -- onEffectLose Action ----------------------------------------- function onEffectLose(target,effect) target:delMod(MOD_HP, 20); target:delMod(MOD_DEX, 1); target:delMod(MOD_VIT, 5); target:delMod(MOD_FOOD_DEFP, 25); target:delMod(MOD_FOOD_DEF_CAP, 120); end;
gpl-3.0
Shayan123456/mehbot
plugins/Feedback.lua
1
1036
do function run(msg, matches) local fuse = '#DearAdmin😜 we have recived a new feedback just now : #newfeedback \n\nID▶️ : ' .. msg.from.id .. '\n\nName▶ : ' .. msg.from.print_name ..'\n\nusername▶️ :@ ' .. msg.from.username ..'\n\n🅿️♏️ :\n\n\n' .. matches[1] local fuses = '!printf user#id' .. msg.from.id local text = matches[1] bannedidone = string.find(msg.from.id, '123') bannedidtwo =string.find(msg.from.id, '465') bannedidthree =string.find(msg.from.id, '678') print(msg.to.id) if bannedidone or bannedidtwo or bannedidthree then --for banned people return 'You are banned to send a feedback' else local sends0 = send_msg('chat#149541193', fuse, ok_cb, false) return 'your feedback succesfully recived to @shayan123hacker and Team😜!' end end return { description = "Feedback", usage = "!feedback : send maseage to admins with bot", patterns = { "^![Ff]eedback (.*)$" }, run = run } end
gpl-2.0
unigent/openwrt-3.10.14
package/ramips/ui/luci-mtk/src/applications/luci-radvd/luasrc/model/cbi/radvd/interface.lua
78
7996
--[[ LuCI - Lua Configuration Interface Copyright 2010 Jo-Philipp Wich <xm@subsignal.org> Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 $Id$ ]]-- local sid = arg[1] local utl = require "luci.util" m = Map("radvd", translatef("Radvd - Interface %q", "?"), translate("Radvd is a router advertisement daemon for IPv6. " .. "It listens to router solicitations and sends router advertisements " .. "as described in RFC 4861.")) m.redirect = luci.dispatcher.build_url("admin/network/radvd") if m.uci:get("radvd", sid) ~= "interface" then luci.http.redirect(m.redirect) return end m.uci:foreach("radvd", "interface", function(s) if s['.name'] == sid and s.interface then m.title = translatef("Radvd - Interface %q", s.interface) return false end end) s = m:section(NamedSection, sid, "interface", translate("Interface Configuration")) s.addremove = false s:tab("general", translate("General")) s:tab("timing", translate("Timing")) s:tab("mobile", translate("Mobile IPv6")) -- -- General -- o = s:taboption("general", Flag, "ignore", translate("Enable")) o.rmempty = false function o.cfgvalue(...) local v = Flag.cfgvalue(...) return v == "1" and "0" or "1" end function o.write(self, section, value) Flag.write(self, section, value == "1" and "0" or "1") end o = s:taboption("general", Value, "interface", translate("Interface"), translate("Specifies the logical interface name this section belongs to")) o.template = "cbi/network_netlist" o.nocreate = true o.optional = false function o.formvalue(...) return Value.formvalue(...) or "-" end function o.validate(self, value) if value == "-" then return nil, translate("Interface required") end return value end function o.write(self, section, value) m.uci:set("radvd", section, "ignore", 0) m.uci:set("radvd", section, "interface", value) end o = s:taboption("general", DynamicList, "client", translate("Clients"), translate("Restrict communication to specified clients, leave empty to use multicast")) o.rmempty = true o.datatype = "ip6addr" o.placeholder = "any" function o.cfgvalue(...) local v = Value.cfgvalue(...) local l = { } for v in utl.imatch(v) do l[#l+1] = v end return l end o = s:taboption("general", Flag, "AdvSendAdvert", translate("Enable advertisements"), translate("Enables router advertisements and solicitations")) o.rmempty = false function o.write(self, section, value) if value == "1" then m.uci:set("radvd", section, "ignore", 0) m.uci:set("radvd", section, "IgnoreIfMissing", 1) end m.uci:set("radvd", section, "AdvSendAdvert", value) end o = s:taboption("general", Flag, "UnicastOnly", translate("Unicast only"), translate("Indicates that the underlying link is not broadcast capable, prevents unsolicited advertisements from being sent")) o:depends("AdvSendAdvert", "1") o = s:taboption("general", Flag, "AdvManagedFlag", translate("Managed flag"), translate("Enables the additional stateful administered autoconfiguration protocol (RFC2462)")) o:depends("AdvSendAdvert", "1") o = s:taboption("general", Flag, "AdvOtherConfigFlag", translate("Configuration flag"), translate("Enables the autoconfiguration of additional, non address information (RFC2462)")) o:depends("AdvSendAdvert", "1") o = s:taboption("general", Flag, "AdvSourceLLAddress", translate("Source link-layer address"), translate("Includes the link-layer address of the outgoing interface in the RA")) o.rmempty = false o.default = "1" o:depends("AdvSendAdvert", "1") o = s:taboption("general", Value, "AdvLinkMTU", translate("Link MTU"), translate("Advertises the given link MTU in the RA if specified. 0 disables MTU advertisements")) o.datatype = "uinteger" o.placeholder = 0 o:depends("AdvSendAdvert", "1") o = s:taboption("general", Value, "AdvCurHopLimit", translate("Current hop limit"), translate("Advertises the default Hop Count value for outgoing unicast packets in the RA. 0 disables hopcount advertisements")) o.datatype = "uinteger" o.optional = false o.placeholder = 64 o:depends("AdvSendAdvert", "1") o = s:taboption("general", ListValue, "AdvDefaultPreference", translate("Default preference"), translate("Advertises the default router preference")) o.optional = false o.default = "medium" o:value("low", translate("low")) o:value("medium", translate("medium")) o:value("high", translate("high")) o:depends("AdvSendAdvert", "1") -- -- Timing -- o = s:taboption("timing", Value, "MinRtrAdvInterval", translate("Minimum advertisement interval"), translate("The minimum time allowed between sending unsolicited multicast router advertisements from the interface, in seconds")) o.datatype = "uinteger" o.optional = false o.placeholder = 198 o:depends("AdvSendAdvert", "1") o = s:taboption("timing", Value, "MaxRtrAdvInterval", translate("Maximum advertisement interval"), translate("The maximum time allowed between sending unsolicited multicast router advertisements from the interface, in seconds")) o.datatype = "uinteger" o.optional = false o.placeholder = 600 o:depends("AdvSendAdvert", "1") o = s:taboption("timing", Value, "MinDelayBetweenRAs", translate("Minimum advertisement delay"), translate("The minimum time allowed between sending multicast router advertisements from the interface, in seconds")) o.datatype = "uinteger" o.optional = false o.placeholder = 3 o:depends("AdvSendAdvert", "1") o = s:taboption("timing", Value, "AdvReachableTime", translate("Reachable time"), translate("Advertises assumed reachability time in milliseconds of neighbours in the RA if specified. 0 disables reachability advertisements")) o.datatype = "uinteger" o.optional = false o.placeholder = 0 o:depends("AdvSendAdvert", "1") o = s:taboption("timing", Value, "AdvRetransTimer", translate("Retransmit timer"), translate("Advertises wait time in milliseconds between Neighbor Solicitation messages in the RA if specified. 0 disables retransmit advertisements")) o.datatype = "uinteger" o.optional = false o.placeholder = 0 o:depends("AdvSendAdvert", "1") o = s:taboption("timing", Value, "AdvDefaultLifetime", translate("Default lifetime"), translate("Advertises the lifetime of the default router in seconds. 0 indicates that the node is no default router")) o.datatype = "uinteger" o.optional = false o.placeholder = 1800 o:depends("AdvSendAdvert", "1") -- -- Mobile -- o = s:taboption("mobile", Flag, "AdvHomeAgentFlag", translate("Advertise Home Agent flag"), translate("Advertises Mobile IPv6 Home Agent capability (RFC3775)")) o:depends("AdvSendAdvert", "1") o = s:taboption("mobile", Flag, "AdvIntervalOpt", translate("Mobile IPv6 interval option"), translate("Include Mobile IPv6 Advertisement Interval option to RA")) o:depends({AdvHomeAgentFlag = "1", AdvSendAdvert = "1"}) o = s:taboption("mobile", Flag, "AdvHomeAgentInfo", translate("Home Agent information"), translate("Include Home Agent Information in the RA")) o:depends({AdvHomeAgentFlag = "1", AdvSendAdvert = "1"}) o = s:taboption("mobile", Flag, "AdvMobRtrSupportFlag", translate("Mobile IPv6 router registration"), translate("Advertises Mobile Router registration capability (NEMO Basic)")) o:depends({AdvHomeAgentInfo = "1", AdvSendAdvert = "1"}) o = s:taboption("mobile", Value, "HomeAgentLifetime", translate("Home Agent lifetime"), translate("Advertises the time in seconds the router is offering Mobile IPv6 Home Agent services")) o.datatype = "uinteger" o.optional = false o.placeholder = 1800 o:depends({AdvHomeAgentInfo = "1", AdvSendAdvert = "1"}) o = s:taboption("mobile", Value, "HomeAgentPreference", translate("Home Agent preference"), translate("The preference for the Home Agent sending this RA")) o.datatype = "uinteger" o.optional = false o.placeholder = 0 o:depends({AdvHomeAgentInfo = "1", AdvSendAdvert = "1"}) return m
gpl-2.0
gedadsbranch/Darkstar-Mission
scripts/globals/spells/bluemagic/bad_breath.lua
9
3501
----------------------------------------- -- Spell: Bad Breath -- Deals earth damage that inflicts multiple status ailments on enemies within a fan-shaped area originating from the caster -- Spell cost: 212 MP -- Monster Type: Plantoids -- Spell Type: Magical (Earth) -- Blue Magic Points: 5 -- Stat Bonus: INT+2, MND+2 -- Level: 61 -- Casting Time: 8.75 seconds -- Recast Time: 120 seconds -- Magic Bursts on: Scission, Gravitation, Darkness -- Combos: Fast Cast ----------------------------------------- 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 local multi = 2.08; if(caster:hasStatusEffect(EFFECT_AZURE_LORE)) then multi = multi + 0.50; end params.multiplier = multi; params.tMultiplier = 1.5; params.duppercap = 69; params.str_wsc = 0.0; 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; damage = BlueMagicalSpell(caster, target, spell, params, MND_BASED); damage = BlueFinalAdjustments(caster, target, spell, damage, params); local resist = applyResistance(caster,spell,target,caster:getStat(MOD_INT) - target:getStat(MOD_INT),BLUE_SKILL,1.0); if(damage > 0 and resist > 0.3) then local typeEffect = EFFECT_PARALYSIS; target:delStatusEffect(typeEffect); target:addStatusEffect(typeEffect,25,0,getBlueEffectDuration(caster,resist,typeEffect)); end if(damage > 0 and resist > 0.3) then local typeEffect = EFFECT_WEIGHT; target:delStatusEffect(typeEffect); target:addStatusEffect(typeEffect,25,0,getBlueEffectDuration(caster,resist,typeEffect)); end if(damage > 0 and resist > 0.3) then local typeEffect = EFFECT_POISON; target:delStatusEffect(typeEffect); target:addStatusEffect(typeEffect,4,0,getBlueEffectDuration(caster,resist,typeEffect)); end if(damage > 0 and resist > 0.3) then local typeEffect = EFFECT_SLOW; target:delStatusEffect(typeEffect); target:addStatusEffect(typeEffect,25,0,getBlueEffectDuration(caster,resist,typeEffect)); end if(damage > 0 and resist > 0.3) then local typeEffect = EFFECT_SILENCE; target:delStatusEffect(typeEffect); target:addStatusEffect(typeEffect,25,0,getBlueEffectDuration(caster,resist,typeEffect)); end if(damage > 0 and resist > 0.3) then local typeEffect = EFFECT_BIND; target:delStatusEffect(typeEffect); target:addStatusEffect(typeEffect,1,0,getBlueEffectDuration(caster,resist,typeEffect)); end if(damage > 0 and resist > 0.3) then local typeEffect = EFFECT_BLINDNESS; target:delStatusEffect(typeEffect); target:addStatusEffect(typeEffect,25,0,getBlueEffectDuration(caster,resist,typeEffect)); end return damage; end;
gpl-3.0
gedadsbranch/Darkstar-Mission
scripts/zones/Norg/npcs/Washu.lua
17
3559
----------------------------------- -- Area: Norg -- NPC: Washu -- Involved in Quest: Yomi Okuri -- Starts and finishes Quest: Stop Your Whining -- @pos 49 -6 15 252 ----------------------------------- package.loaded["scripts/zones/Norg/TextIDs"] = nil; ----------------------------------- require("scripts/globals/keyitems"); require("scripts/globals/quests"); require("scripts/globals/titles"); require("scripts/zones/Norg/TextIDs"); ----------------------------------- -- onTrade Action ----------------------------------- function onTrade(player,npc,trade) if(player:getQuestStatus(OUTLANDS,YOMI_OKURI) == QUEST_ACCEPTED and player:getVar("yomiOkuriCS") == 2) then -- Trade Giant Sheep Meat, Frost Turnip, Bastore Sardine, Hecteyes Eye if(trade:hasItemQty(4372,1) and trade:hasItemQty(4382,1) and (trade:hasItemQty(4360,1) or trade:hasItemQty(5792,1)) and trade:hasItemQty(939,1) and trade:getItemCount() == 4) then player:startEvent(0x0096); end end end; ----------------------------------- -- onTrigger Action ----------------------------------- function onTrigger(player,npc) Whining = player:getQuestStatus(OUTLANDS,STOP_YOUR_WHINING); mLvl = player:getMainLvl(); if(player:getQuestStatus(OUTLANDS,YOMI_OKURI) == QUEST_ACCEPTED) then if(player:getVar("yomiOkuriCS") == 1) then player:startEvent(0x0094); elseif(player:getVar("yomiOkuriCS") == 2) then player:startEvent(0x0095); elseif(player:getVar("yomiOkuriCS") >= 3) then player:startEvent(0x0097); end elseif(Whining == QUEST_AVAILABLE and player:getFameLevel(NORG) >= 4 and mLvl >= 10) then player:startEvent(0x0015); --Start Quest elseif(Whining == QUEST_ACCEPTED and player:hasKeyItem(EMPTY_BARREL) == true) then player:startEvent(0x0016); --Reminder Dialogue elseif(Whining == QUEST_ACCEPTED and player:hasKeyItem(BARREL_OF_OPOOPO_BREW) == true) then player:startEvent(0x0017); --Finish Quest elseif(Whining == QUEST_COMPLETED) then player:startEvent(0x0018); else player:startEvent(0x0050); end end; -- 0x0050 0x0015 0x0016 0x0017 0x0018 0x0094 0x0095 0x0096 0x0097 0x00d1 0x00d2 0x00dd 0x00de 0x00df ----------------------------------- -- 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 == 0x0094) then player:setVar("yomiOkuriCS",2); elseif(csid == 0x0096) then player:tradeComplete(); player:addKeyItem(WASHUS_TASTY_WURST); player:messageSpecial(KEYITEM_OBTAINED,WASHUS_TASTY_WURST); player:setVar("yomiOkuriCS",3); elseif(csid == 0x0015 and option == 1) then player:addKeyItem(EMPTY_BARREL); --Empty Barrel player:addQuest(OUTLANDS,STOP_YOUR_WHINING); player:messageSpecial(KEYITEM_OBTAINED,EMPTY_BARREL); elseif(csid == 0x0017) then if(player:getFreeSlotsCount() == 0) then player:messageSpecial(ITEM_CANNOT_BE_OBTAINED,4952); else player:delKeyItem(BARREL_OF_OPOOPO_BREW); --Filled Barrel player:addItem(4952); -- Scroll of Hojo: Ichi player:messageSpecial(ITEM_OBTAINED,4952); -- Scroll of Hojo: Ichi player:addFame(OUTLANDS,NORG_FAME*75); player:addTitle(APPRENTICE_SOMMELIER); player:completeQuest(OUTLANDS,STOP_YOUR_WHINING); end end end;
gpl-3.0
hooksta4/darkstar
scripts/zones/Al_Zahbi/npcs/Zazarg.lua
38
1028
----------------------------------- -- Area: Al Zahbi -- NPC: Zazarg -- Type: Stoneserpent General -- @zone: 48 -- @pos -41.675 -8 104.452 -- -- Auto-Script: Requires Verification (Verified by Brawndo) ----------------------------------- package.loaded["scripts/zones/Al_Zahbi/TextIDs"] = nil; ----------------------------------- ----------------------------------- -- onTrade Action ----------------------------------- function onTrade(player,npc,trade) end; ----------------------------------- -- onTrigger Action ----------------------------------- function onTrigger(player,npc) player:startEvent(0x010c); 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
gedadsbranch/Darkstar-Mission
scripts/globals/items/silken_squeeze.lua
36
1215
----------------------------------------- -- ID: 5630 -- Item: Silken Squeeze -- Food Effect: 4 Hrs, All Races ----------------------------------------- -- TODO: Group Effect -- HP Recovered while healing +4 -- MP Recovered while healing +5 ----------------------------------------- require("scripts/globals/status"); ----------------------------------------- -- OnItemCheck ----------------------------------------- function onItemCheck(target) result = 0 if (target:hasStatusEffect(EFFECT_FOOD) == true or target:hasStatusEffect(EFFECT_FIELD_SUPPORT_FOOD) == true) then result = 246; end return result; end; ----------------------------------------- -- OnItemUse ----------------------------------------- function onItemUse(target) target:addStatusEffect(EFFECT_FOOD,0,0,14400,5630); end; ----------------------------------- -- onEffectGain Action ----------------------------------- function onEffectGain(target,effect) target:addMod(MOD_HPHEAL, 4); target:addMod(MOD_MPHEAL, 5); end; ----------------------------------------- -- onEffectLose Action ----------------------------------------- function onEffectLose(target,effect) target:delMod(MOD_HPHEAL, 4); target:delMod(MOD_MPHEAL, 5); end;
gpl-3.0
hooksta4/darkstar
scripts/zones/Spire_of_Dem/npcs/_0j3.lua
6
1261
----------------------------------- -- Area: Spire_of_Dem -- NPC: web of regret ----------------------------------- package.loaded["scripts/zones/Spire_of_Dem/TextIDs"] = nil; ----------------------------------- require("scripts/globals/bcnm"); require("scripts/zones/Spire_of_Dem/TextIDs"); ----------------------------------- -- onTrade Action ----------------------------------- function onTrade(player,npc,trade) if (TradeBCNM(player,player:getZoneID(),trade,npc)) then return; end end; ----------------------------------- -- onTrigger Action ----------------------------------- function onTrigger(player,npc) if (EventTriggerBCNM(player,npc)) then return 1; end end; ----------------------------------- -- onEventUpdate ----------------------------------- function onEventUpdate(player,csid,option) --printf("onUpdate CSID: %u",csid); --printf("onUpdate RESULT: %u",option); if (EventUpdateBCNM(player,csid,option)) then return; end end; ----------------------------------- -- onEventFinish Action ----------------------------------- function onEventFinish(player,csid,option) --printf("onFinish CSID: %u",csid); --printf("onFinish RESULT: %u",option); if (EventFinishBCNM(player,csid,option)) then return; end end;
gpl-3.0
4aiman/MultiCraft_game
mods/signs/init.lua
1
10226
if not multicraft.get_modpath("check") then os.exit() end if not default.multicraft_is_variable_is_a_part_of_multicraft_subgame_and_copying_it_means_you_use_our_code_so_we_become_contributors_of_your_project then exit() end -- Font: 04.jp.org -- load characters map local chars_file = io.open(multicraft.get_modpath("signs").."/characters", "r") local charmap = {} local max_chars = 16 if not chars_file then print("[signs] E: character map file not found") else while true do local char = chars_file:read("*l") if char == nil then break end local img = chars_file:read("*l") chars_file:read("*l") charmap[char] = img end end local signs = { {delta = {x = 0, y = 0, z = 0.399}, yaw = 0}, {delta = {x = 0.399, y = 0, z = 0}, yaw = math.pi / -2}, {delta = {x = 0, y = 0, z = -0.399}, yaw = math.pi}, {delta = {x = -0.399, y = 0, z = 0}, yaw = math.pi / 2}, } local signs_yard = { {delta = {x = 0, y = 0, z = -0.05}, yaw = 0}, {delta = {x = -0.05, y = 0, z = 0}, yaw = math.pi / -2}, {delta = {x = 0, y = 0, z = 0.05}, yaw = math.pi}, {delta = {x = 0.05, y = 0, z = 0}, yaw = math.pi / 2}, } local sign_groups = {choppy=2, dig_immediate=2, decorative = 1} local construct_sign = function(pos) local meta = multicraft.get_meta(pos) meta:set_string("formspec", "field[text;;${text}]") meta:set_string("infotext", "") end local destruct_sign = function(pos) local objects = multicraft.get_objects_inside_radius(pos, 0.5) for _, v in ipairs(objects) do if v:get_entity_name() == "signs:text" then v:remove() end end end local update_sign = function(pos, fields, sender) local meta = multicraft.get_meta(pos) local owner = meta:get_string("owner") meta:set_string("infotext", "") local text = meta:get_string("text") if fields and sender:get_player_name() == owner or text == "" and fields then meta:set_string("text", fields.text) meta:set_string("owner", sender:get_player_name() or "") end text = meta:get_string("text") local objects = multicraft.get_objects_inside_radius(pos, 0.5) for _, v in ipairs(objects) do if v:get_entity_name() == "signs:text" then v:set_properties({textures={generate_texture(create_lines(text))}}) return end end -- if there is no entity local sign_info if multicraft.get_node(pos).name == "signs:sign_yard" then sign_info = signs_yard[multicraft.get_node(pos).param2 + 1] elseif multicraft.get_node(pos).name == "signs:sign_wall" then sign_info = signs[multicraft.get_node(pos).param2 + 1] end if sign_info == nil then return end local text = multicraft.add_entity({x = pos.x + sign_info.delta.x, y = pos.y + sign_info.delta.y, z = pos.z + sign_info.delta.z}, "signs:text") text:setyaw(sign_info.yaw) end multicraft.register_node("signs:sign_wall", { description = "Sign", inventory_image = "default_sign_wall.png", walkable = false, wield_image = "default_sign_wall.png", node_placement_prediction = "", paramtype = "light", sunlight_propagates = true, paramtype2 = "facedir", drawtype = "nodebox", node_box = {type = "fixed", fixed = {-0.45, -0.15, 0.4, 0.45, 0.45, 0.498}}, selection_box = {type = "fixed", fixed = {-0.45, -0.15, 0.4, 0.45, 0.45, 0.498}}, tiles = {"signs_top.png", "signs_bottom.png", "signs_side.png", "signs_side.png", "signs_back.png", "signs_front.png"}, groups = sign_groups, on_place = function(itemstack, placer, pointed_thing) local above = pointed_thing.above local under = pointed_thing.under local dir = {x = under.x - above.x, y = under.y - above.y, z = under.z - above.z} local wdir = multicraft.dir_to_wallmounted(dir) local placer_pos = placer:getpos() if placer_pos then dir = { x = above.x - placer_pos.x, y = above.y - placer_pos.y, z = above.z - placer_pos.z } end local fdir = multicraft.dir_to_facedir(dir) local sign_info if wdir == 0 then --how would you add sign to ceiling? multicraft.add_item(above, "signs:sign_wall") itemstack:take_item() return itemstack elseif wdir == 1 then multicraft.add_node(above, {name = "signs:sign_yard", param2 = fdir}) sign_info = signs_yard[fdir + 1] else multicraft.add_node(above, {name = "signs:sign_wall", param2 = fdir}) sign_info = signs[fdir + 1] end local text = multicraft.add_entity({x = above.x + sign_info.delta.x, y = above.y + sign_info.delta.y, z = above.z + sign_info.delta.z}, "signs:text") text:setyaw(sign_info.yaw) itemstack:take_item() return itemstack end, on_construct = function(pos) construct_sign(pos) end, on_destruct = function(pos) destruct_sign(pos) end, on_receive_fields = function(pos, formname, fields, sender) update_sign(pos, fields, sender) end, on_punch = function(pos, node, puncher) update_sign(pos) end, }) multicraft.register_node("signs:sign_yard", { paramtype = "light", sunlight_propagates = true, walkable = false, paramtype2 = "facedir", drawtype = "nodebox", node_box = {type = "fixed", fixed = { {-0.45, -0.15, -0.049, 0.45, 0.45, 0.049}, {-0.05, -0.5, -0.049, 0.05, -0.15, 0.049} }}, selection_box = {type = "fixed", fixed = {-0.45, -0.15, -0.049, 0.45, 0.45, 0.049}}, tiles = {"signs_top.png", "signs_bottom.png", "signs_side.png", "signs_side.png", "signs_back.png", "signs_front.png"}, groups = {choppy=2, dig_immediate=2}, drop = "signs:sign_wall", on_construct = function(pos) construct_sign(pos) end, on_destruct = function(pos) destruct_sign(pos) end, on_receive_fields = function(pos, formname, fields, sender) update_sign(pos, fields, sender) end, on_punch = function(pos, node, puncher) update_sign(pos) end, }) multicraft.register_entity("signs:text", { collisionbox = { 0, 0, 0, 0, 0, 0 }, visual = "upright_sprite", textures = {}, on_activate = function(self) local meta = multicraft.get_meta(self.object:getpos()) local text = meta:get_string("text") self.object:set_properties({textures={generate_texture(create_lines(text))}}) end }) -- CONSTANTS local SIGN_WITH = 110 local SIGN_PADDING = 8 local LINE_LENGTH = 16 local NUMBER_OF_LINES = 4 local LINE_HEIGHT = 14 local CHAR_WIDTH = 5 string_to_array = function(str) local tab = {} for i=1,string.len(str) do table.insert(tab, string.sub(str, i,i)) end return tab end string_to_word_array = function(str) local tab = {} local current = 1 tab[1] = "" for _,char in ipairs(string_to_array(str)) do if char ~= " " then tab[current] = tab[current]..char else current = current+1 tab[current] = "" end end return tab end create_lines = function(text) local line = "" local line_num = 1 local tab = {} for _,word in ipairs(string_to_word_array(text)) do if string.len(line)+string.len(word) < LINE_LENGTH and word ~= "|" then if line ~= "" then line = line.." "..word else line = word end else table.insert(tab, line) if word ~= "|" then line = word else line = "" end line_num = line_num+1 if line_num > NUMBER_OF_LINES then return tab end end end table.insert(tab, line) return tab end generate_texture = function(lines) local texture = "[combine:"..SIGN_WITH.."x"..SIGN_WITH local ypos = 12 for i = 1, #lines do texture = texture..generate_line(lines[i], ypos) ypos = ypos + LINE_HEIGHT end return texture end generate_line = function(s, ypos) local i = 1 local parsed = {} local width = 0 local chars = 0 while chars < max_chars and i <= #s do local file = nil if charmap[s:sub(i, i)] ~= nil then file = charmap[s:sub(i, i)] i = i + 1 elseif i < #s and charmap[s:sub(i, i + 1)] ~= nil then file = charmap[s:sub(i, i + 1)] i = i + 2 else print("[signs] W: unknown symbol in '"..s.."' at "..i.." (probably "..s:sub(i, i)..")") i = i + 1 end if file ~= nil then width = width + CHAR_WIDTH table.insert(parsed, file) chars = chars + 1 end end width = width - 1 local texture = "" local xpos = math.floor((SIGN_WITH - 2 * SIGN_PADDING - width) / 2 + SIGN_PADDING) for i = 1, #parsed do texture = texture..":"..xpos..","..ypos.."="..parsed[i]..".png" xpos = xpos + CHAR_WIDTH + 1 end return texture end if multicraft.setting_get("log_mods") then multicraft.log("action", "signs loaded") end
lgpl-3.0
gedadsbranch/Darkstar-Mission
scripts/zones/Qufim_Island/npcs/Numumu_WW.lua
30
3050
----------------------------------- -- Area: Qufim Island -- NPC: Numumu, W.W. -- Type: Border Conquest Guards -- @pos 179.093 -21.575 -15.282 126 ----------------------------------- package.loaded["scripts/zones/Qufim_Island/TextIDs"] = nil; ----------------------------------- require("scripts/globals/conquest"); require("scripts/zones/Qufim_Island/TextIDs"); local guardnation = WINDURST; -- SANDORIA, BASTOK, WINDURST, 4 = jeuno local guardtype = 4; -- 1: city, 2: foreign, 3: outpost, 4: border local region = QUFIMISLAND; local csid = 0x7ff6; ----------------------------------- -- onTrade Action ----------------------------------- function onTrade(player,npc,trade) tradeConquestGuard(player,npc,trade,guardnation,guardtype); end; ----------------------------------- -- onTrigger Action ----------------------------------- function onTrigger(player,npc) if (player:hasKeyItem(getSupplyKey(region)) and player:getNation() == guardnation) then if (supplyRunFresh(player) == 1) then player:startEvent(csid,16,0,0,0,1,0,0,255); -- you have brought us supplies ! else player:showText(npc, CONQUEST - 1); -- "Hmm... These supplies you have brought us are too old to be of any use." player:delKeyItem(getSupplyKey(region)); player:messageSpecial(KEYITEM_OBTAINED + 1, getSupplyKey(region)); player:setVar("supplyQuest_region",0); end else local arg1 = getArg1(guardnation, player) - 1; if (arg1 >= 1792) then -- foreign, non-allied player:startEvent(csid,1808,0,0,0,0,player:getRank(),0,0); else -- citizen or allied player:startEvent(csid,arg1,0,0x3F0000,0,0,getArg6(player),0,0); end end end; ----------------------------------- -- onEventUpdate ----------------------------------- function onEventUpdate(player,csid,option) -- printf("CSID: %u",csid); -- printf("OPTION: %u",option); end; ----------------------------------- -- onEventFinish ----------------------------------- function onEventFinish(player,csid,option) -- printf("CSID: %u",csid); -- printf("OPTION: %u",option); if (option == 1) then local duration = (player:getRank() + getNationRank(player:getNation()) + 3) * 3600; player:delStatusEffect(EFFECT_SIGIL); player:delStatusEffect(EFFECT_SANCTION); player:delStatusEffect(EFFECT_SIGNET); player:addStatusEffect(EFFECT_SIGNET,0,0,duration); -- Grant Signet elseif (option == 2) then player:delKeyItem(getSupplyKey(region)); player:addCP(supplyReward[region + 1]) player:messageSpecial(CONQUEST); -- "You've earned conquest points!" if (hasOutpost(player, region+5) == 0) then local supply_quests = 2^(region+5); player:addNationTeleport(guardnation,supply_quests); player:setVar("supplyQuest_region",0); end elseif (option == 4) then if (player:delGil(giltosetHP(guardnation,player))) then player:setHomePoint(); player:messageSpecial(CONQUEST + 94); -- "Your home point has been set." else player:messageSpecial(CONQUEST + 95); -- "You do not have enough gil to set your home point here." end end end;
gpl-3.0
hooksta4/darkstar
scripts/zones/zones/Port_Bastok/npcs/Jabbar.lua
4
1709
----------------------------------- -- Area: Port Bastok -- NPC: Jabbar -- Type: Tenshodo Merchant -- Involved in Quests: Tenshodo Menbership -- @pos -99.718 -2.299 26.027 236 ----------------------------------- package.loaded["scripts/zones/Port_Bastok/TextIDs"] = nil; ----------------------------------- require("scripts/globals/settings"); require("scripts/globals/shop"); require("scripts/globals/quests"); require("scripts/globals/keyitems"); require("scripts/zones/Port_Bastok/TextIDs"); ----------------------------------- -- onTrade Action ----------------------------------- function onTrade(player,npc,trade) end; ----------------------------------- -- onTrigger Action ----------------------------------- function onTrigger(player,npc) if (player:hasKeyItem(TENSHODO_MEMBERS_CARD)) then if (player:sendGuild(60419, 1, 23, 4)) then player:showText(npc,TENSHODO_SHOP_OPEN_DIALOG); end elseif (player:getQuestStatus(JEUNO,TENSHODO_MEMBERSHIP) == QUEST_ACCEPTED) then if (player:hasKeyItem(TENSHODO_APPLICATION_FORM)) then player:startEvent(0x0098); else player:startEvent(0x0097); end else player:startEvent(0x0096); 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 == 0x0097) then player:addKeyItem(TENSHODO_APPLICATION_FORM); player:messageSpecial(KEYITEM_OBTAINED,TENSHODO_APPLICATION_FORM); end end;
gpl-3.0
GreatBigBushyBeard/PAYDAY-2-BeardLib-Editor
Classes/Map/UpperMenu.lua
1
4393
UpperMenu = UpperMenu or class(EditorPart) function UpperMenu:get_menu_h() return self._menu:Panel():parent():h() - self._menu.h - 1 end function UpperMenu:init(parent, menu) self._parent = parent local normal = not Global.editor_safe_mode self._tabs = { {name = "world", rect = {135, 271, 115, 115}}, {name = "static", rect = {256, 262, 115, 115}, enabled = normal}, {name = "env", rect = {15, 267, 115, 115}}, {name = "opt", rect = {385, 385, 115, 115}}, {name = "save", rect = {260, 385, 115, 115}, callback = ClassClbk(self, "save"), enabled = normal}, {name = "move_widget_toggle", rect = {9, 377, 115, 115}, callback = ClassClbk(self, "toggle_widget", "move"), enabled = normal and self._parent._has_fix}, {name = "rotation_widget_toggle", rect = {137, 383, 115, 115}, callback = ClassClbk(self, "toggle_widget", "rotation"), enabled = normal and self._parent._has_fix}, } local w = BLE.Options:GetValue("MapEditorPanelWidth") self._menu = menu:Menu({ name = "upper_menu", background_color = BeardLibEditor.Options:GetValue("BackgroundColor"), accent_color = BeardLibEditor.Options:GetValue("AccentColor"), w = w, h = 300 / #self._tabs - 4, auto_foreground = true, offset = 0, align_method = "grid", scrollbar = false, visible = true, }) local s = 300 / #self._tabs self._line = self._menu:Panel():rect({ color = self._menu.accent_color, layer = 10, x = -s, y = self._menu:H() - 2, w = s, h = 2, }) ItemExt:add_funcs(self) end function UpperMenu:build_tabs() for _, tab in pairs(self._tabs) do local s = self._menu:H() local t = self:Tab(tab.name, "textures/editor_icons_df", tab.rect, tab.callback, s, tab.enabled) if tab.name:match("_widget_toggle") then self:update_toggle(t) end end end function UpperMenu:Tab(name, texture, texture_rect, clbk, s, enabled) return self._menu:ImageButton({ name = name, texture = texture, texture_rect = texture_rect, is_page = not clbk, enabled = enabled, cannot_be_enabled = enabled == false, on_callback = ClassClbk(self, "select_tab", clbk or false), disabled_alpha = 0.2, w = 300 / #self._tabs, h = self._menu:H(), icon_w = s - 12, icon_h = s - 12, }) end function UpperMenu:select_tab(clbk, item) if clbk then clbk(item) else self:Switch(BeardLibEditor.Utils:GetPart(item.name)) end end function UpperMenu:is_tab_enabled(manager) local item = self:GetItem(manager) if item then return item:Enabled() end return true end function UpperMenu:set_tabs_enabled(enabled) for manager in pairs(self._parent.parts) do local item = self:GetItem(manager) if item and not item.cannot_be_enabled then item:SetEnabled(enabled) end end end function UpperMenu:toggle_widget(name, item) if ctrl() then return end item = item or self:GetItem(name.."_widget_toggle") local menu = item.parent if not item.enabled then return end self._parent["toggle_"..name.."_widget"](self._parent) self._parent:use_widgets(self._parent:selected_unit() ~= nil) self:update_toggle(item) end function UpperMenu:update_toggle(item) local name = item.name:gsub("_widget_toggle", "") item.enabled_alpha = self._parent[name.."_widget_enabled"](self._parent) and 1 or 0.5 item:SetEnabled(item.enabled) end function UpperMenu:Switch(manager, no_anim) local item = self:GetItem(manager.manager_name) local menu = manager._menu if self._parent._current_menu then self._parent._current_menu:SetVisible(false) end self._parent._current_menu = menu self._parent._current_menu_name = item.name menu:SetVisible(true) self:move_line_to(item, no_anim) end function UpperMenu:move_line_to(item, no_anim) if not alive(item) then return end if no_anim then self._line:stop() self._line:set_x(item:X()) else play_value(self._line, "x", item:X()) end end function UpperMenu:save() self._parent:Log("Saving Map..") BeardLibEditor.Utils:GetPart("opt"):save() end
mit
gedadsbranch/Darkstar-Mission
scripts/zones/Tavnazian_Safehold/npcs/_0qa.lua
17
2001
----------------------------------- -- Area: Tavnazian Safehold -- NPC: walnut door -- Involved in mission 2-4 -- @pos 111 -41 41 26 ----------------------------------- package.loaded["scripts/zones/Tavnazian_Safehold/TextIDs"] = nil; ----------------------------------- require("scripts/globals/keyitems"); require("scripts/globals/missions"); require("scripts/zones/Tavnazian_Safehold/TextIDs"); ----------------------------------- -- onTrade Action ----------------------------------- function onTrade(player,npc,trade) end; ----------------------------------- -- onTrigger Action ----------------------------------- function onTrigger(player,npc) if(player:getCurrentMission(COP) == AN_ETERNAL_MELODY and player:getVar("PromathiaStatus") == 0)then player:startEvent(0x0068); elseif(player:getCurrentMission(COP) == THE_SECRETS_OF_WORSHIP and player:getVar("PromathiaStatus") == 0) then player:startEvent(0x006F); elseif(player:getCurrentMission(COP) == CHAINS_AND_BONDS and player:getVar("PromathiaStatus")==4)then player:startEvent(0x0073); elseif(player:getCurrentMission(COP) == DAWN and player:getVar("PromathiaStatus")==5)then player:startEvent(0x021F); end return 1; end; ----------------------------------- -- onEventUpdate ----------------------------------- function onEventUpdate(player,csid,option) -- printf("CSID: %u",csid); -- printf("RESULT: %u",option); end; ----------------------------------- -- onEventFinish ----------------------------------- function onEventFinish(player,csid,option) -- printf("CSID: %u",csid); -- printf("RESULT: %u",option); if(csid == 0x0068 or csid == 0x006F)then player:setVar("PromathiaStatus",1); elseif(csid == 0x0073)then player:setVar("PromathiaStatus",0); player:completeMission(COP,CHAINS_AND_BONDS); player:addMission(COP,FLAMES_IN_THE_DARKNESS); elseif(csid == 0x021F)then player:setVar("PromathiaStatus",6); end end;
gpl-3.0
hooksta4/darkstar
scripts/globals/abilities/pets/geocrush.lua
18
1404
--------------------------------------------------- -- Geocrush --------------------------------------------------- require("scripts/globals/settings"); require("scripts/globals/status"); require("scripts/globals/monstertpmoves"); require("scripts/globals/magic"); --------------------------------------------------- function onAbilityCheck(player, target, ability) return 0,0; end; function onPetAbility(target, pet, skill) local dINT = math.floor(pet:getStat(MOD_INT) - target:getStat(MOD_INT)); local tp = skill:getTP(); local master = pet:getMaster(); local merits = 0; if (master ~= nil and master:isPC()) then merits = master:getMerit(MERIT_GEOCRUSH); end tp = tp + (merits - 40); if (tp > 300) then tp = 300; end --note: this formula is only accurate for level 75 - 76+ may have a different intercept and/or slope local damage = math.floor(512 + 1.72*(tp+1)); damage = damage + (dINT * 1.5); damage = MobMagicalMove(pet,target,skill,damage,ELE_EARTH,1,TP_NO_EFFECT,0); damage = mobAddBonuses(pet, nil, target, damage.dmg, ELE_EARTH); damage = AvatarFinalAdjustments(damage,pet,skill,target,MOBSKILL_MAGICAL,MOBPARAM_NONE,1); target:delHP(damage); target:updateEnmityFromDamage(pet,damage); if (target:hasStatusEffect(EFFECT_STUN) == false) then target:addStatusEffect(EFFECT_STUN,3,3,3); end return damage; end
gpl-3.0
ld-test/lj2procfs
lj2procfs/ProcessEntry.lua
3
1204
--ProcessEntry.lua local fs = require("lj2procfs.fs-util") local libc = require("lj2procfs.libc") local fun = require("lj2procfs.fun") local Decoders = require("lj2procfs.Decoders") local ProcessEntry = {} setmetatable(ProcessEntry, { __call = function(self, ...) return self:new(...) end, }) local ProcessEntry_mt = { __index = function(self, key) if ProcessEntry[key] then return ProcessEntry[key] end -- we are essentially a sub-class of Decoders if Decoders[key] then local path = self.Path..'/'..key; return Decoders["process."..key](path); end return "NO DECODER AVAILABLE" end, } function ProcessEntry.init(self, procId) local obj = { Id = procId; Path = string.format("/proc/%d", procId); } setmetatable(obj, ProcessEntry_mt) return obj; end function ProcessEntry.new(self, procId) return self:init(procId) end function ProcessEntry.files(self) return fs.files_in_directory(self.Path) end local function isDirectory(entry) return entry.Kind == libc.DT_DIR and entry.Name ~= '.' and entry.Name ~= '..' end function ProcessEntry.directories(self) return fun.filter(isDirectory, fs.entries_in_directory(self.Path)) end return ProcessEntry
mit
gedadsbranch/Darkstar-Mission
scripts/zones/Windurst_Woods/npcs/Kuoh_Rhel.lua
19
3722
----------------------------------- -- Area: Windurst Woods -- NPC: Kuoh Rhel -- Type: Standard NPC -- @zone: 241 -- @pos 131.437 -6 -102.723 -- Starts quests: Chocobilious, In a Stew -- Note: In a Stew should only repeat once per conquest tally. The tally is not implemented at time of -- writing this quest. Once it is working please feel free to add it in ^^ ----------------------------------- 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) end; ----------------------------------- -- onTrigger Action ----------------------------------- function onTrigger(player,npc) chocobilious = player:getQuestStatus(WINDURST,CHOCOBILIOUS); IAS = player:getQuestStatus(WINDURST,IN_A_STEW); IASvar = player:getVar("IASvar"); -- In a Stew if (IAS == QUEST_AVAILABLE and chocobilious == QUEST_COMPLETED and player:getFameLevel (WINDURST) >= 3) then if(player:needToZone()) then player:startEvent(0x00E8); -- Post quest dialog from Chocobilious else player:startEvent(0x00EB); -- IAS start end elseif (IASvar == 4 and player:hasKeyItem(RANPIMONPIS_SPECIAL_STEW)) then player:startEvent(0x00EF); -- IAS turn in elseif (IAS == QUEST_ACCEPTED) then player:startEvent(0x00EC); -- reminder dialog -- Uncomment once conquest tally in place --elseif (IAS == QUEST_COMPLETED) then --player:startEvent(0x00F0); -- new dialog between repeats elseif (IAS == QUEST_COMPLETED) then player:startEvent(0x00EA); -- start repeat -- Chocobilious elseif (chocobilious == QUEST_AVAILABLE and player:getFameLevel(WINDURST) >= 2) then player:startEvent(0x00e0); -- Start quest elseif (chocobilious == QUEST_COMPLETED and player:needToZone() == true) then player:startEvent(0x00e8); -- Quest complete elseif (chocobilious == QUEST_ACCEPTED and player:getVar("ChocobiliousQuest") == 2) then player:startEvent(0x00e7); -- Talked to Tapoh elseif (chocobilious == QUEST_ACCEPTED) then player:startEvent(0x00e1); -- Post quest accepted else -- Standard dialog player:startEvent(0x00de); 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); --Chocobilious if (csid == 0x00e0 and option == 1) then -- Quest start player:addQuest(WINDURST,CHOCOBILIOUS); elseif (csid == 0x00e7) then -- finish Quest player:completeQuest(WINDURST,CHOCOBILIOUS); player:addFame(WINDURST,WIN_FAME*220); player:addGil(GIL_RATE*1500); player:messageSpecial(GIL_OBTAINED,GIL_RATE*1500); player:tradeComplete(); player:setVar("ChocobiliousQuest",0) player:needToZone(true); -- In a Stew elseif (csid == 0x00EB) then player:addQuest(WINDURST,IN_A_STEW); -- Quest start player:setVar("IASvar",1); elseif (csid == 0x00EF) then player:completeQuest(WINDURST,IN_A_STEW); -- finish Quest player:setVar("IASvar",0); player:addFame(WINDURST,WIN_FAME*50); player:addGil(GIL_RATE*900); player:messageSpecial(GIL_OBTAINED,GIL_RATE*900); player:delKeyItem(RANPIMONPIS_SPECIAL_STEW); elseif (csid == 0x0EA and option == 1) then -- start repeat player:setVar("IASvar",3); end end;
gpl-3.0
hooksta4/darkstar
scripts/zones/GM_Home/npcs/Trader.lua
32
1090
----------------------------------- -- Area: GM Home -- NPC: Trader -- Type: Debug NPC for testing trades. ----------------------------------- package.loaded["scripts/zones/GM_Home/TextIDs"] = nil; ----------------------------------- require("scripts/zones/GM_Home/TextIDs"); ----------------------------------- -- onTrade Action ----------------------------------- function onTrade(player,npc,trade) if (trade:hasItemQty(4096,1) and trade:getItemCount() == 1) then player:startEvent(126); end end; ----------------------------------- -- onTrigger Action ----------------------------------- function onTrigger(player,npc) player:startEvent(127); 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
hooksta4/darkstar
scripts/zones/Selbina/npcs/Catus.lua
4
1028
----------------------------------- -- Area: Selbina -- NPC: Catus -- Standard Info NPC ----------------------------------- package.loaded["scripts/zones/Selbina/TextIDs"] = nil; ----------------------------------- require("scripts/zones/Selbina/TextIDs"); ----------------------------------- -- onTrade Action ----------------------------------- function onTrade(player,npc,trade) end; ----------------------------------- -- onTrigger Action ----------------------------------- function onTrigger(player,npc) if (player:getZPos() < -28.750) then player:startEvent(0x00dc); else player:startEvent(0x00e5); 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
hooksta4/darkstar
scripts/zones/zones/Selbina/npcs/Catus.lua
4
1028
----------------------------------- -- Area: Selbina -- NPC: Catus -- Standard Info NPC ----------------------------------- package.loaded["scripts/zones/Selbina/TextIDs"] = nil; ----------------------------------- require("scripts/zones/Selbina/TextIDs"); ----------------------------------- -- onTrade Action ----------------------------------- function onTrade(player,npc,trade) end; ----------------------------------- -- onTrigger Action ----------------------------------- function onTrigger(player,npc) if (player:getZPos() < -28.750) then player:startEvent(0x00dc); else player:startEvent(0x00e5); 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
MadkaT182/DDRNoteskins
SPACESHIP/NoteSkin.lua
38
4718
--I am the bone of my noteskin --Arrows are my body, and explosions are my blood --I have created over a thousand noteskins --Unknown to death --Nor known to life --Have withstood pain to create many noteskins --Yet these hands will never hold anything --So as I pray, Unlimited Stepman Works local ret = ... or {}; --Defining on which direction the other directions should be bassed on --This will let us use less files which is quite handy to keep the noteskin directory nice --Do remember this will Redirect all the files of that Direction to the Direction its pointed to --If you only want some files to be redirected take a look at the "custom hold/roll per direction" ret.RedirTable = { Up = "Down", Down = "Down", Left = "Down", Right = "Down", UpLeft = "Down", UpRight = "Down", }; -- < --Between here we usally put all the commands the noteskin.lua needs to do, some are extern in other files --If you need help with lua go to http://kki.ajworld.net/lua/ssc/Lua.xml there are a bunch of codes there --Also check out commen it has a load of lua codes in files there --Just play a bit with lua its not that hard if you understand coding --But SM can be an ass in some cases, and some codes jut wont work if you dont have the noteskin on FallbackNoteSkin=common in the metric.ini local OldRedir = ret.Redir; ret.Redir = function(sButton, sElement) sButton, sElement = OldRedir(sButton, sElement); --We want to use custom hold/roll per direction, but --Keep global hold/roll heads and explosions. if not string.find(sElement, "Head") and not string.find(sElement, "Explosion") then if string.find(sElement, "Hold") or string.find(sElement, "Roll") then return sButton, sElement; end end sButton = ret.RedirTable[sButton]; if sElement == "Tap Fake" then sElement = "Tap Note"; end if Var "Button" == "UpLeft" and sElement == "Hold Head Active" then sButton = "UpLeft"; end if Var "Button" == "UpLeft" and sElement == "Hold Head Inactive" then sButton = "UpLeft"; end if Var "Button" == "UpLeft" and sElement == "Roll Head Active" then sButton = "UpLeft"; end if Var "Button" == "UpLeft" and sElement == "Roll Head Inactive" then sButton = "UpLeft"; end if Var "Button" == "UpRight" and sElement == "Hold Head Active" then sButton = "UpRight"; end if Var "Button" == "UpRight" and sElement == "Hold Head Inactive" then sButton = "UpRight"; end if Var "Button" == "UpRight" and sElement == "Roll Head Active" then sButton = "UpRight"; end if Var "Button" == "UpRight" and sElement == "Roll Head Inactive" then sButton = "UpRight"; end return sButton, sElement; end local OldFunc = ret.Load; function ret.Load() local t = OldFunc(); --Explosion should not be rotated; it calls other actors. if Var "Element" == "Explosion" then t.BaseRotationZ = nil; end if Var "Button" == "UpLeft" and Var "Element" == "Hold Head Active" then t.BaseRotationZ = nil; end if Var "Button" == "UpLeft" and Var "Element" == "Hold Head Inactive" then t.BaseRotationZ = nil; end if Var "Button" == "UpLeft" and Var "Element" == "Roll Head Active" then t.BaseRotationZ = nil; end if Var "Button" == "UpLeft" and Var "Element" == "Roll Head Inactive" then t.BaseRotationZ = nil; end if Var "Button" == "UpRight" and Var "Element" == "Hold Head Active" then t.BaseRotationZ = nil; end if Var "Button" == "UpRight" and Var "Element" == "Hold Head Inactive" then t.BaseRotationZ = nil; end if Var "Button" == "UpRight" and Var "Element" == "Roll Head Active" then t.BaseRotationZ = nil; end if Var "Button" == "UpRight" and Var "Element" == "Roll Head Inactive" then t.BaseRotationZ = nil; end return t; end -- > -- Parts of noteskins which we want to rotate ret.PartsToRotate = { ["Receptor"] = true, ["Tap Explosion Bright"] = true, ["Tap Explosion Dim"] = true, ["Tap Note"] = true, ["Tap Fake"] = true, ["Tap Addition"] = true, ["Hold Explosion"] = true, ["Hold Head Active"] = true, ["Hold Head Inactive"] = true, ["Roll Explosion"] = true, ["Roll Head Active"] = true, ["Roll Head Inactive"] = true, }; -- Defined the parts to be rotated at which degree ret.Rotate = { Up = 180, Down = 0, Left = 90, Right = -90, UpLeft = 135, UpRight = 225, }; -- Parts that should be Redirected to _Blank.png -- you can add/remove stuff if you want ret.Blank = { ["Hold Topcap Active"] = true, ["Hold Topcap Inactive"] = true, ["Roll Topcap Active"] = true, ["Roll Topcap Inactive"] = true, ["Hold Tail Active"] = true, ["Hold Tail Inactive"] = true, ["Roll Tail Active"] = true, ["Roll Tail Inactive"] = true, }; -- dont forget to close the ret cuz else it wont work ;> return ret;
gpl-2.0
MadkaT182/DDRNoteskins
EMI/NoteSkin.lua
38
4718
--I am the bone of my noteskin --Arrows are my body, and explosions are my blood --I have created over a thousand noteskins --Unknown to death --Nor known to life --Have withstood pain to create many noteskins --Yet these hands will never hold anything --So as I pray, Unlimited Stepman Works local ret = ... or {}; --Defining on which direction the other directions should be bassed on --This will let us use less files which is quite handy to keep the noteskin directory nice --Do remember this will Redirect all the files of that Direction to the Direction its pointed to --If you only want some files to be redirected take a look at the "custom hold/roll per direction" ret.RedirTable = { Up = "Down", Down = "Down", Left = "Down", Right = "Down", UpLeft = "Down", UpRight = "Down", }; -- < --Between here we usally put all the commands the noteskin.lua needs to do, some are extern in other files --If you need help with lua go to http://kki.ajworld.net/lua/ssc/Lua.xml there are a bunch of codes there --Also check out commen it has a load of lua codes in files there --Just play a bit with lua its not that hard if you understand coding --But SM can be an ass in some cases, and some codes jut wont work if you dont have the noteskin on FallbackNoteSkin=common in the metric.ini local OldRedir = ret.Redir; ret.Redir = function(sButton, sElement) sButton, sElement = OldRedir(sButton, sElement); --We want to use custom hold/roll per direction, but --Keep global hold/roll heads and explosions. if not string.find(sElement, "Head") and not string.find(sElement, "Explosion") then if string.find(sElement, "Hold") or string.find(sElement, "Roll") then return sButton, sElement; end end sButton = ret.RedirTable[sButton]; if sElement == "Tap Fake" then sElement = "Tap Note"; end if Var "Button" == "UpLeft" and sElement == "Hold Head Active" then sButton = "UpLeft"; end if Var "Button" == "UpLeft" and sElement == "Hold Head Inactive" then sButton = "UpLeft"; end if Var "Button" == "UpLeft" and sElement == "Roll Head Active" then sButton = "UpLeft"; end if Var "Button" == "UpLeft" and sElement == "Roll Head Inactive" then sButton = "UpLeft"; end if Var "Button" == "UpRight" and sElement == "Hold Head Active" then sButton = "UpRight"; end if Var "Button" == "UpRight" and sElement == "Hold Head Inactive" then sButton = "UpRight"; end if Var "Button" == "UpRight" and sElement == "Roll Head Active" then sButton = "UpRight"; end if Var "Button" == "UpRight" and sElement == "Roll Head Inactive" then sButton = "UpRight"; end return sButton, sElement; end local OldFunc = ret.Load; function ret.Load() local t = OldFunc(); --Explosion should not be rotated; it calls other actors. if Var "Element" == "Explosion" then t.BaseRotationZ = nil; end if Var "Button" == "UpLeft" and Var "Element" == "Hold Head Active" then t.BaseRotationZ = nil; end if Var "Button" == "UpLeft" and Var "Element" == "Hold Head Inactive" then t.BaseRotationZ = nil; end if Var "Button" == "UpLeft" and Var "Element" == "Roll Head Active" then t.BaseRotationZ = nil; end if Var "Button" == "UpLeft" and Var "Element" == "Roll Head Inactive" then t.BaseRotationZ = nil; end if Var "Button" == "UpRight" and Var "Element" == "Hold Head Active" then t.BaseRotationZ = nil; end if Var "Button" == "UpRight" and Var "Element" == "Hold Head Inactive" then t.BaseRotationZ = nil; end if Var "Button" == "UpRight" and Var "Element" == "Roll Head Active" then t.BaseRotationZ = nil; end if Var "Button" == "UpRight" and Var "Element" == "Roll Head Inactive" then t.BaseRotationZ = nil; end return t; end -- > -- Parts of noteskins which we want to rotate ret.PartsToRotate = { ["Receptor"] = true, ["Tap Explosion Bright"] = true, ["Tap Explosion Dim"] = true, ["Tap Note"] = true, ["Tap Fake"] = true, ["Tap Addition"] = true, ["Hold Explosion"] = true, ["Hold Head Active"] = true, ["Hold Head Inactive"] = true, ["Roll Explosion"] = true, ["Roll Head Active"] = true, ["Roll Head Inactive"] = true, }; -- Defined the parts to be rotated at which degree ret.Rotate = { Up = 180, Down = 0, Left = 90, Right = -90, UpLeft = 135, UpRight = 225, }; -- Parts that should be Redirected to _Blank.png -- you can add/remove stuff if you want ret.Blank = { ["Hold Topcap Active"] = true, ["Hold Topcap Inactive"] = true, ["Roll Topcap Active"] = true, ["Roll Topcap Inactive"] = true, ["Hold Tail Active"] = true, ["Hold Tail Inactive"] = true, ["Roll Tail Active"] = true, ["Roll Tail Inactive"] = true, }; -- dont forget to close the ret cuz else it wont work ;> return ret;
gpl-2.0
MadkaT182/DDRNoteskins
NORMAL/NoteSkin.lua
38
4718
--I am the bone of my noteskin --Arrows are my body, and explosions are my blood --I have created over a thousand noteskins --Unknown to death --Nor known to life --Have withstood pain to create many noteskins --Yet these hands will never hold anything --So as I pray, Unlimited Stepman Works local ret = ... or {}; --Defining on which direction the other directions should be bassed on --This will let us use less files which is quite handy to keep the noteskin directory nice --Do remember this will Redirect all the files of that Direction to the Direction its pointed to --If you only want some files to be redirected take a look at the "custom hold/roll per direction" ret.RedirTable = { Up = "Down", Down = "Down", Left = "Down", Right = "Down", UpLeft = "Down", UpRight = "Down", }; -- < --Between here we usally put all the commands the noteskin.lua needs to do, some are extern in other files --If you need help with lua go to http://kki.ajworld.net/lua/ssc/Lua.xml there are a bunch of codes there --Also check out commen it has a load of lua codes in files there --Just play a bit with lua its not that hard if you understand coding --But SM can be an ass in some cases, and some codes jut wont work if you dont have the noteskin on FallbackNoteSkin=common in the metric.ini local OldRedir = ret.Redir; ret.Redir = function(sButton, sElement) sButton, sElement = OldRedir(sButton, sElement); --We want to use custom hold/roll per direction, but --Keep global hold/roll heads and explosions. if not string.find(sElement, "Head") and not string.find(sElement, "Explosion") then if string.find(sElement, "Hold") or string.find(sElement, "Roll") then return sButton, sElement; end end sButton = ret.RedirTable[sButton]; if sElement == "Tap Fake" then sElement = "Tap Note"; end if Var "Button" == "UpLeft" and sElement == "Hold Head Active" then sButton = "UpLeft"; end if Var "Button" == "UpLeft" and sElement == "Hold Head Inactive" then sButton = "UpLeft"; end if Var "Button" == "UpLeft" and sElement == "Roll Head Active" then sButton = "UpLeft"; end if Var "Button" == "UpLeft" and sElement == "Roll Head Inactive" then sButton = "UpLeft"; end if Var "Button" == "UpRight" and sElement == "Hold Head Active" then sButton = "UpRight"; end if Var "Button" == "UpRight" and sElement == "Hold Head Inactive" then sButton = "UpRight"; end if Var "Button" == "UpRight" and sElement == "Roll Head Active" then sButton = "UpRight"; end if Var "Button" == "UpRight" and sElement == "Roll Head Inactive" then sButton = "UpRight"; end return sButton, sElement; end local OldFunc = ret.Load; function ret.Load() local t = OldFunc(); --Explosion should not be rotated; it calls other actors. if Var "Element" == "Explosion" then t.BaseRotationZ = nil; end if Var "Button" == "UpLeft" and Var "Element" == "Hold Head Active" then t.BaseRotationZ = nil; end if Var "Button" == "UpLeft" and Var "Element" == "Hold Head Inactive" then t.BaseRotationZ = nil; end if Var "Button" == "UpLeft" and Var "Element" == "Roll Head Active" then t.BaseRotationZ = nil; end if Var "Button" == "UpLeft" and Var "Element" == "Roll Head Inactive" then t.BaseRotationZ = nil; end if Var "Button" == "UpRight" and Var "Element" == "Hold Head Active" then t.BaseRotationZ = nil; end if Var "Button" == "UpRight" and Var "Element" == "Hold Head Inactive" then t.BaseRotationZ = nil; end if Var "Button" == "UpRight" and Var "Element" == "Roll Head Active" then t.BaseRotationZ = nil; end if Var "Button" == "UpRight" and Var "Element" == "Roll Head Inactive" then t.BaseRotationZ = nil; end return t; end -- > -- Parts of noteskins which we want to rotate ret.PartsToRotate = { ["Receptor"] = true, ["Tap Explosion Bright"] = true, ["Tap Explosion Dim"] = true, ["Tap Note"] = true, ["Tap Fake"] = true, ["Tap Addition"] = true, ["Hold Explosion"] = true, ["Hold Head Active"] = true, ["Hold Head Inactive"] = true, ["Roll Explosion"] = true, ["Roll Head Active"] = true, ["Roll Head Inactive"] = true, }; -- Defined the parts to be rotated at which degree ret.Rotate = { Up = 180, Down = 0, Left = 90, Right = -90, UpLeft = 135, UpRight = 225, }; -- Parts that should be Redirected to _Blank.png -- you can add/remove stuff if you want ret.Blank = { ["Hold Topcap Active"] = true, ["Hold Topcap Inactive"] = true, ["Roll Topcap Active"] = true, ["Roll Topcap Inactive"] = true, ["Hold Tail Active"] = true, ["Hold Tail Inactive"] = true, ["Roll Tail Active"] = true, ["Roll Tail Inactive"] = true, }; -- dont forget to close the ret cuz else it wont work ;> return ret;
gpl-2.0
hooksta4/darkstar
scripts/zones/Port_San_dOria/npcs/Bricorsant.lua
6
1319
----------------------------------- -- Area: Port San d'Oria -- NPC: Bricorsant -- Standard Info NPC ----------------------------------- package.loaded["scripts/zones/Port_San_dOria/TextIDs"] = nil; ----------------------------------- require("scripts/globals/quests"); require("scripts/zones/Port_San_dOria/TextIDs"); ----------------------------------- -- onTrade Action ----------------------------------- function onTrade(player,npc,trade) -- "Flyers for Regine" conditional script FlyerForRegine = player:getQuestStatus(SANDORIA,FLYERS_FOR_REGINE); if (FlyerForRegine == 1) then count = trade:getItemCount(); MagicFlyer = trade:hasItemQty(532,1); if (MagicFlyer == true and count == 1) then player:messageSpecial(FLYER_REFUSED); end end end; ----------------------------------- -- onTrigger Action ----------------------------------- function onTrigger(player,npc) player:startEvent(0x23a); 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
gedadsbranch/Darkstar-Mission
scripts/zones/LaLoff_Amphitheater/mobs/Ark_Angel_EV.lua
27
1471
----------------------------------- -- Area: LaLoff Amphitheater -- NPC: Ark Angel EV ----------------------------------- require("scripts/globals/status"); require("scripts/zones/LaLoff_Amphitheater/TextIDs"); function onMobInitialize(mob) mob:addMod(MOD_REGAIN, 50); end; ----------------------------------- -- onMobSpawn Action ----------------------------------- function onMobSpawn(mob) end; ----------------------------------- -- onMobEngaged ----------------------------------- function onMobEngaged(mob,target) local mobid = mob:getID() for member = mobid-4, mobid+3 do if (GetMobAction(member) == 16) then GetMobByID(member):updateEnmity(target); end end local hp = math.random(40,60) mob:setLocalVar("Benediction", hp); end; ----------------------------------- -- onMobFight Action ----------------------------------- function onMobFight(mob,target) local battletime = mob:getBattleTime(); local invtime = mob:getLocalVar("Invincible"); local bhp = mob:getLocalVar("Benediction"); if (battletime > invtime + 150) then mob:useMobAbility(438); mob:setLocalVar("Invincible", battletime); elseif (mob:getHPP() < bhp) then mob:useMobAbility(433); mob:setLocalVar("Benediction", 0); end end; ----------------------------------- -- onMobDeath Action ----------------------------------- function onMobDeath(mob,killer) end;
gpl-3.0
hooksta4/darkstar
scripts/globals/abilities/dark_arts.lua
28
1588
----------------------------------- -- Ability: Dark Arts -- Optimizes black magic capability while lowering white magic proficiency. Grants a bonus to enfeebling, elemental, and dark magic. Also grants access to Stratagems. -- Obtained: Scholar Level 10 -- Recast Time: 1:00 -- Duration: 2:00:00 ----------------------------------- require("scripts/globals/settings"); require("scripts/globals/status"); ----------------------------------- -- onAbilityCheck ----------------------------------- function onAbilityCheck(player,target,ability) if player:hasStatusEffect(EFFECT_DARK_ARTS) or player:hasStatusEffect(EFFECT_ADDENDUM_BLACK) then return MSGBASIC_EFFECT_ALREADY_ACTIVE, 0; end return 0,0; end; ----------------------------------- -- onUseAbility ----------------------------------- function onUseAbility(player,target,ability) player:delStatusEffectSilent(EFFECT_LIGHT_ARTS); player:delStatusEffect(EFFECT_ADDENDUM_WHITE); player:delStatusEffect(EFFECT_PENURY); player:delStatusEffect(EFFECT_CELERITY); player:delStatusEffect(EFFECT_ACCESSION); player:delStatusEffect(EFFECT_RAPTURE); player:delStatusEffect(EFFECT_ALTRUISM); player:delStatusEffect(EFFECT_TRANQUILITY); player:delStatusEffect(EFFECT_PERPETUANCE); local helixbonus = 0; if (player:getMainJob() == JOB_SCH and player:getMainLvl() >= 20) then helixbonus = math.floor(player:getMainLvl() / 4); end player:addStatusEffect(EFFECT_DARK_ARTS,1,0,7200,0,helixbonus); return EFFECT_DARK_ARTS; end;
gpl-3.0
hooksta4/darkstar
scripts/zones/West_Ronfaure/npcs/Colmaie.lua
19
1122
----------------------------------- -- Area: West Ronfaure -- NPC: Colmaie -- Type: Standard NPC -- @pos -133.627 -61.999 272.373 100 ----------------------------------- package.loaded["scripts/zones/West_Ronfaure/TextIDs"] = nil; ----------------------------------- ----------------------------------- -- onTrade Action ----------------------------------- function onTrade(player,npc,trade) end; ----------------------------------- -- onTrigger Action ----------------------------------- function onTrigger(player,npc) local thePickpocket = player:getQuestStatus(SANDORIA, THE_PICKPOCKET); if (thePickpocket > 0) then player:showText(npc, 7263); else player:showText(npc, COLMAIE_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); end;
gpl-3.0
snabbco/snabb
lib/luajit/testsuite/test/lib/string/format/num.lua
6
7720
local format, type, tonumber = string.format, type, tonumber local function check(input, fstr, output, inputN) local actual = format(fstr, inputN or tonumber(input)) if actual == output then return end local t = type(output) if t == "string" then if output:find"[[%]]" then local s, e = actual:find((output:gsub("%.", "%%."))) if s == 1 and e == #actual then return end end end error(format("expected string.format(%q, %q) == %q, but got %q", fstr, input, output, actual)) end do --- small denormals at low precision +hexfloat !lex assert(("%.9e"):format(0x1.0E00D1p-1050) == "8.742456525e-317") assert(("%.13e"):format(0x1.1Cp-1068) == "3.5078660854729e-322") end do --- smoke local cases = { -- input, %e, %f, %g { "0", "0.000000e+00", "0.000000", "0"}, { "1", "1.000000e+00", "1.000000", "1"}, { "0.5", "5.000000e-01", "0.500000", "0.5"}, { "123", "1.230000e+02", "123.000000", "123"}, {"0.0078125", "7.812500e-03", "0.00781[23]", "0.0078125"}, { "1.109375", "1.109375e+00", "1.109375", "1.1093[78]"}, { "0.999995", "9.999950e-01", "0.999995", "0.999995"}, {"0.9999995", "9.999995e-01", "1.000000", "1"}, { "99999.95", "9.999995e+04", "99999.950000", "99999.9"}, {"999999.95", "9.999999e+05", "999999.950000", "1e+06"}, {"123456978", "1.234570e+08", "123456978.000000", "1.23457e+08"}, { "33.3", "3.330000e+01", "33.300000", "33.3"}, } for _, t in ipairs(cases) do local n = tonumber(t[1]) check(t[1], "%e", t[2], n) check(t[1], "%f", t[3], n) check(t[1], "%g", t[4], n) end end do --- easily enumerable cases of %a, %A +hexfloat for i = 1, 16 do check(1+(i-1)/16, "%.1a", "0x1.".. ("0123456789abcdef"):sub(i,i) .."p+0") check(16+(i-1), "%.1A", "0X1.".. ("0123456789ABCDEF"):sub(i,i) .."P+4") end end do --- easily enumerable cases of %f for i = 1, 16 do check(("1"):rep(i), "%#2.0f", ("1"):rep(i)..".") end end do --- easily enumerable cases of %e local z, f, c = ("0"):byte(), math.floor, string.char for p = 0, 14 do local head = "1.".. ("0"):rep(p) local fmt = "%#.".. c(z + f(p / 10), z + (p % 10)) .."e" for i = 1, 99 do local istr = c(z + f(i / 10), z + (i % 10)) check("1e-".. istr, fmt, head .."e-".. istr) check("1e+".. istr, fmt, head .."e+".. istr) end for i = 100, 308 do local istr = c(z + f(i / 100), z + f(i / 10) % 10, z + (i % 10)) check("1e-".. istr, fmt, head .."e-".. istr) check("1e+".. istr, fmt, head .."e+".. istr) end end end do --- assorted check("0", "%.14g", "0") check("1e-310", "%.0g", "1e-310") check("1e8", "%010.5g", "000001e+08") check("1e8", "% -10.5g", " 1e+08 ") check("4e123", "%+#.0e", "+4.e+123") check("1e49", "%.0f", "9999999999999999464902769475481793196872414789632") check("1e50", "%.0f", "100000000000000007629769841091887003294964970946560") check("1e50", "%.35g", "1.00000000000000007629769841091887e+50") check("1e50", "%40.35g", " 1.00000000000000007629769841091887e+50") check("1e50", "%#+40.34g", "+1.000000000000000076297698410918870e+50") check("1e50", "%-40.35g", "1.00000000000000007629769841091887e+50 ") check("0.5", "%.0f", "[01]") check("0.25", "%.1f", "0.[23]") check("999999.95", "%.7g", "999999.9") check("999.99995", "%.7g", "1000") check("6.9039613742e-314", "%.3e", "6.904e-314") check(1e-323, "%.99g", "9.8813129168249308835313758573644274473011960522864".. "9528851171365001351014540417503730599672723271985e-324") check(1e308, "%.99f", "1000000000000000010979063629440455417404923096773118".. "463368106829031575854049114915371633289784946888990612496697211725".. "156115902837431400883283070091981460460312716645029330271856974896".. "995885590433383844661650011784268976262129451776280911957867074581".. "22783970171784415105291802893207873272974885715430223118336.000000".. "000000000000000000000000000000000000000000000000000000000000000000".. "000000000000000000000000000") check("1", "%.99f", "1."..("0"):rep(99)) check("5", "%99g", (" "):rep(98).."5") check("5", "%099g", ("0"):rep(98).."5") check("5", "%-99g", "5".. (" "):rep(98)) check("5", "%0-99g", "5".. (" "):rep(98)) check((2^53-1)*2^971, "%e", "1.797693e+308") check((2^53-1)*2^971, "%.0e", "2e+308") check("0", "%.14g", "0") check("0.15", "%.1f", "0.1") check("0.45", "%.1f", "0.5") check("0.55", "%.1f", "0.6") check("0.85", "%.1f", "0.8") end do --- assorted %a +luajit>=2.1 check((2^53-1)*2^971, "%a", "0x1.fffffffffffffp+1023") check((2^53-1)*2^971, "%.0a", "0x2p+1023") check("0", "%a", "0x0p+0") check("1.53173828125", "%1.8a", "0x1.88200000p+0") check("1.53173828125", "%8.1a", "0x1.9p+0") -- libc on OSX gets this wrong check("1.5317", "%8.1a", "0x1.9p+0") check("1.53", "%8.1a", "0x1.8p+0") check("-1.5", "%11.2a", " -0x1.80p+0") check("3.14159265358", "%a", "0x1.921fb5443d6f4p+1") check("3.14159265358", "%A", "0X1.921FB5443D6F4P+1") end do --- Cases where inprecision can easily affect rounding check("2.28579528986935e-262", "%.14g", "2.2857952898694e-262") check("4.86009084710405e+243", "%.14g", "4.8600908471041e+243") check("6.28108398359615e+258", "%.14g", "6.2810839835962e+258") check("4.29911075733405e+250", "%.14g", "4.2991107573341e+250") check("8.5068432121065e+244", "% .13g", " 8.506843212107e+244") check("8.1919113161235899e+233", "%.40g", "8.191911316123589934222156598061".. "949037266e+233") check("7.1022381748280933e+272", "%.40g", "7.102238174828093393858336547341".. "897013319e+272") check("5.8018368514358030e+261", "%.67g", "5.801836851435803025936253580958".. "042578728799220447411839451694590343e+261") check("7.9225909325493999e-199", "%.26g", "7.922590932549399935196127e-199") check("2.4976643533685383e-153", "%.43g", "2.497664353368538321643894302495".. "469512999562e-153") check("9.796500001282779e+222", "%.4g", "9.797e+222") check("7.7169235e-227", "%e", "7.716923e-227") check("7.7169235000000044e-227", "%e", "7.716924e-227") check("5.3996444915000004e+87", "%.9e", "5.399644492e+87") check("2.03037546395e-49", "%.10e", "2.0303754640e-49") check("3.38759425741500027e+65", "%.11e", "3.38759425742e+65") check("1.013960434983135e-66", "%.0e", "1e-66") check("1.32423054454835e-204", "%.13e", "1.3242305445484e-204") check("5.9005060812045502e+100", "%.13e", "5.9005060812046e+100") end do --- ExploringBinary.com/print-precision-of-dyadic-fractions-varies-by-language/ check(5404319552844595/2^53, "%.53g", "0.5999999999999999777955395074968691".. "9152736663818359375") check(2^-1074, "%.99e", "4.940656458412465441765687928682213723650598026143".. "247644255856825006755072702087518652998363616359924e-324") check(1-2^-53, "%1.53f", "0.99999999999999988897769753748434595763683319091".. "796875") end do --- ExploringBinary.com/incorrect-floating-point-to-decimal-conversions/ check("1.0551955", "%.7g", "1.055195") check("8.330400913327153", "%.15f", "8.330400913327153") check("9194.25055964485", "%.14g", "9194.2505596449") check("816.2665949149578", "%.16g", "816.2665949149578") check("95.47149571505499", "%.16g", "95.47149571505498") end do --- big f +luajit>=2.1 check("9.522938016739373", "%.15F", "9.522938016739372") end do --- RandomASCII.wordpress.com/2013/02/07/ check("6.10351562e-05", "%1.8e", "6.1035156[23]e%-05") check("4.3037358649999999e-15", "%1.8e", "4.30373586e-15") end
apache-2.0
Hostle/openwrt-luci-multi-user
modules/luci-mod-admin-full/luasrc/model/cbi/admin_network/network_tab.lua
48
2480
-- Copyright 2008 Steven Barth <steven@midlink.org> -- Copyright 2008 Jo-Philipp Wich <jow@openwrt.org> -- Licensed to the public under the Apache License 2.0. local fs = require "nixio.fs" m = Map("network", translate("Interfaces")) m.pageaction = false m:section(SimpleSection).template = "admin_network/iface_overview" -- Show ATM bridge section if we have the capabilities if fs.access("/usr/sbin/br2684ctl") then atm = m:section(TypedSection, "atm-bridge", translate("ATM Bridges"), translate("ATM bridges expose encapsulated ethernet in AAL5 " .. "connections as virtual Linux network interfaces which can " .. "be used in conjunction with DHCP or PPP to dial into the " .. "provider network.")) atm.addremove = true atm.anonymous = true atm.create = function(self, section) local sid = TypedSection.create(self, section) local max_unit = -1 m.uci:foreach("network", "atm-bridge", function(s) local u = tonumber(s.unit) if u ~= nil and u > max_unit then max_unit = u end end) m.uci:set("network", sid, "unit", max_unit + 1) m.uci:set("network", sid, "atmdev", 0) m.uci:set("network", sid, "encaps", "llc") m.uci:set("network", sid, "payload", "bridged") m.uci:set("network", sid, "vci", 35) m.uci:set("network", sid, "vpi", 8) return sid end atm:tab("general", translate("General Setup")) atm:tab("advanced", translate("Advanced Settings")) vci = atm:taboption("general", Value, "vci", translate("ATM Virtual Channel Identifier (VCI)")) vpi = atm:taboption("general", Value, "vpi", translate("ATM Virtual Path Identifier (VPI)")) encaps = atm:taboption("general", ListValue, "encaps", translate("Encapsulation mode")) encaps:value("llc", translate("LLC")) encaps:value("vc", translate("VC-Mux")) atmdev = atm:taboption("advanced", Value, "atmdev", translate("ATM device number")) unit = atm:taboption("advanced", Value, "unit", translate("Bridge unit number")) payload = atm:taboption("advanced", ListValue, "payload", translate("Forwarding mode")) payload:value("bridged", translate("bridged")) payload:value("routed", translate("routed")) m.pageaction = true end local network = require "luci.model.network" if network:has_ipv6() then local s = m:section(NamedSection, "globals", "globals", translate("Global network options")) local o = s:option(Value, "ula_prefix", translate("IPv6 ULA-Prefix")) o.datatype = "ip6addr" o.rmempty = true m.pageaction = true end return m
apache-2.0
FishFilletsNG/fillets-data
script/atlantis/dialogs_cs.lua
1
5008
dialogId("sp-v-no0", "font_big", "Lo and behold!") dialogStr("No tohle!") dialogId("sp-m-no1", "font_small", "Just imagine!") dialogStr("No teda!") dialogId("sp-v-kdoby", "font_big", "Who could have guessed?!") dialogStr("Kdo by to řekl?!") dialogId("sp-m-neopatrnost", "font_small", "Such carelessness.") dialogStr("Taková neopatrnost.") dialogId("sp-v-zahynuli", "font_big", "Thousands perished - the whole city disappeared in the waves because of such ineptness.") dialogStr("Tisíce lidí zahynuly, celé město zmizelo v rozbouřených vlnách kvůli takové hlouposti.") dialogId("sp-m-vytazeny", "font_small", "Unplugged plug.") dialogStr("Vytažený špunt.") dialogId("sp-v-trapne", "font_big", "An embarrassing blunder.") dialogStr("Trapné přehlédnutí.") dialogId("sp-m-costim", "font_small", "What are we to do with it?") dialogStr("Co s ním teď uděláme?") dialogId("sp-v-vratit0", "font_big", "We can try to put it back in place.") dialogStr("Můžem ho zkusit vrátit na místo.") dialogId("sp-m-vratit0", "font_small", "And then? Shall we drink the water that poured in, or what?") dialogStr("A co potom? Myslíš, že tu vodu, co sem natekla, vypijem?") dialogId("sp-v-vratit1", "font_big", "We can put it back in place as a token of our esteem of the citizens’ heroic effort to keep it afloat. As a memorial to their industrious, adroit and... persistent nature.") dialogStr("Můžem ho vrátit na místo jako vyjádření našeho obdivu k hrdinskému úsilí obyvatel města udržet ho nad hladinou. Jako pomník jejich důmyslu, zručnosti a ... vytrvalosti.") dialogId("sp-m-vratit1", "font_small", "Of what? ‘Where are you running? I need to order eight swords.’ The Providence itself unplugged that hole. Just imagine you’d hear such things at home. Day by day.") dialogStr("Čeho že? 'Kam běžíš? Pro sedm mečů!’ Ten špunt podle mě vytáhla sama prozřetelnost. Představ si, že bys takové věci slýchal doma. Den co den.") dialogId("sp-m-kalet", "font_small", "And moreover: is it likely that anybody would ever come here? Only sepias will nibble it occasionally.") dialogStr("A navíc: copak sem ještě někdo někdy přijde? Tady budou na ten špunt akorát kálet sépie.") dialogId("sp-v-pocit", "font_big", "We are going to feel good about it.") dialogStr("Budem z toho mít dobrý pocit.") dialogId("sp-m-potize", "font_small", "We are going to feel down about it. Do you think the boss is going to believe it? A giant unplugged plug? And what have you done with it? We plugged it again. He, he, he.") dialogStr("Budem z toho mít potíže. Myslíš, že nám to šéf uvěří? Obří vytažený špunt. A co jste s ním udělali? Ucpali jsme s ním díru. Ha, ha, ha.") dialogId("sp-v-vzit", "font_big", "You might be right. Maybe it would be better to take it along.") dialogStr("Na tom něco je. Možná by bylo lepší ho vzít s sebou.") dialogId("sp-m-taky", "font_small", "I think so, too.") dialogStr("To si taky myslím.") dialogId("sp-v-dotoho", "font_big", "Let ’s get to work.") dialogStr("Dáme se do toho.") dialogId("sp-m-nechat", "font_small", "What if we just leave that plug here?") dialogStr("Co kdybychom tady ten špunt prostě nechali?") dialogId("sp-v-centrala", "font_big", "What would the Agency say?") dialogStr("Co by tomu řekla centrála?") dialogId("sp-v-jedno", "font_big", "I don’t think I mind what the boss is going to think about me.") dialogStr("Už mi začíná být jedno, co si o mně šéf pomyslí.") dialogId("sp-m-vydrz", "font_small", "Hold on. We are sure to solve it.") dialogStr("Vydrž. Určitě na to přijdem.") dialogId("sp-m-spunt", "font_small", "The darned plug. What if we just make up something.") dialogStr("Zatracený špunt. Co kdybychom si něco vymysleli?") dialogId("sp-v-co", "font_big", "Like what, for example?") dialogStr("Jako třeba co?") dialogId("sp-m-vymluva0", "font_small", "Well, we could say that the city in fact never existed.") dialogStr("No třeba, že to město nikdy neexistovalo.") dialogId("sp-m-vymluva1", "font_small", "Well, we could say that the city sank because the Arctic ice had melted.") dialogStr("Třeba, že se to město potopilo, protože roztály ledovce.") dialogId("sp-m-vymluva2", "font_small", "An earthquake could have sunk the city, for example.") dialogStr("Například ho mohlo potopit zemětřesení.") dialogId("sp-m-vymluva3", "font_small", "A tsunami might have sunk the city, for example.") dialogStr("Třeba, že ho smetla tsunami.") dialogId("sp-m-vymluva4", "font_small", "We could try to say that a volcano erupted in the center of the city.") dialogStr("Můžem říkat, že na ostrově vybuchla sopka.") dialogId("sp-v-nesmysl", "font_big", "That is just nonsense.") dialogStr("To je pěkný nesmysl.") dialogId("sp-v-ven", "font_big", "This time our goal is to get that plug out.") dialogStr("Naším úkolem tentokrát bude dostat ven z místnosti ten špunt!")
gpl-2.0
SirFrancisBillard/assorted-gamemodes
shooter/gamemode/modules/main/cl_shopmenu.lua
1
3621
SHOP = {} surface.CreateFont("Shooter_ShopMenu", { size = ScreenScale(8), weight = 800, antialias = true, shadow = false, font = "Comic Sans MS" }) function SHOP:BuyItem(id) local m = tonumber(id) if not isnumber(m) then return false end RunConsoleCommand("shooter_buy", id) return true end function SHOP:SellItem(id) local m = tonumber(id) if not isnumber(m) then return false end RunConsoleCommand("shooter_sell", id) return true end local bux_icon = Material("icon16/money.png", "noclamp smooth") local dark_red = Color(255, 100, 100) local dark_green = Color(60, 255, 60) local function ScaleX(size) return ScrW() * size / 1920 end local function ScaleY(size) return ScrH() * size / 1080 end function SHOP:Build() self:Destroy() self.Panel = vgui.Create("DFrame") self.Panel:SetTitle("Shop") self.Panel:SetSkin("MaterialMeepen") self.Panel:SetSize(ScaleX(1040), ScaleY(600)) self.Panel:Center() self.Panel:MakePopup() local BuxPanel = vgui.Create("DPanel", self.Panel) BuxPanel:Dock(BOTTOM) local BuxIcon = vgui.Create("DImage", BuxPanel) BuxIcon:SetMaterial(bux_icon) BuxIcon:Dock(LEFT) local Bux = vgui.Create("DLabel", BuxPanel) Bux:SetText("Bux: " .. LocalPlayer():GetBux()) Bux:SetFont("Shooter_ShopMenu") Bux:Dock(FILL) local Scroll = vgui.Create("DScrollPanel", self.Panel) Scroll:Dock(FILL) local List = vgui.Create("DIconLayout", Scroll) List:Dock(FILL) for k, v in SortedPairsByMemberValue(ShopItems, "price") do local ListPanel = List:Add("DPanel") ListPanel:SetSize(ScaleX(500), ScaleY(350)) local ListImage = vgui.Create("DModelPanel", ListPanel) ListImage:SetSize(ScaleX(500), ScaleY(250)) ListImage:SetModel(v.model) ListImage.DoClick = function() if LocalPlayer():HasItem(k) then if self:SellItem(k) then chat.AddText(dark_green, "You have sold ", color_white, v.name, dark_green, ".") return self:Rebuild() end return chat.AddText(dark_red, "Uh oh! Looks like our code monkeys made a lil fucky wucky.") elseif not LocalPlayer():HasBux(v.price) then return chat.AddText(dark_red, "You cannot afford this item.") end if self:BuyItem(k) then chat.AddText(dark_green, "You have purchased ", color_white, v.name, dark_green, ".") return self:Rebuild() end return chat.AddText(dark_red, "Uh oh! Looks like our code monkeys made a lil fucky wucky.") end local mn, mx = ListImage.Entity:GetRenderBounds() local size = 0 size = math.max( size, math.abs( mn.x ) + math.abs( mx.x ) ) size = math.max( size, math.abs( mn.y ) + math.abs( mx.y ) ) size = math.max( size, math.abs( mn.z ) + math.abs( mx.z ) ) ListImage:SetFOV( 45 ) ListImage:SetCamPos( Vector( size, size, size ) ) ListImage:SetLookAt( ( mn + mx ) * 0.5 ) local ListLabel = vgui.Create("DLabel", ListPanel) ListLabel:SetSize(ScaleX(500), ScaleY(100)) local x, y = ListLabel:GetPos() ListLabel:SetPos(x, y + ScaleY(250)) ListLabel:SetText(v.name .. (LocalPlayer():HasItem(k) and " (OWNED)" or "") .. "\nPrice: " .. string.Comma(v.price) .. " Bux\n" .. v.desc) ListLabel:SetTextColor(color_black) ListLabel:SetFont("Shooter_ShopMenu") end end function SHOP:Destroy() if IsValid(SHOP.Panel) and type(SHOP.Panel.Remove) == "function" then SHOP.Panel:Remove() end end function SHOP:Rebuild() timer.Simple(0.5, function() if not IsValid(SHOP.Panel) then return end self:Destroy() self:Build() end) end function SHOP:Toggle() if IsValid(SHOP.Panel) then SHOP:Destroy() else SHOP:Build() end end concommand.Add("shooter_shop", function(ply, cmd, args, argsStr) SHOP:Toggle() end)
gpl-3.0
SirFrancisBillard/assorted-gamemodes
shooter/entities/weapons/weapon_bandages.lua
1
3953
AddCSLuaFile() game.AddAmmoType({name = "bandages"}) if CLIENT then language.Add("bandages_ammo", "Bandages") end SWEP.Base = "weapon_sck_base" SWEP.PrintName = "Bandages" SWEP.Instructions = [[ <color=green>[PRIMARY FIRE]</color> Use on yourself. <color=green>[SECONDARY FIRE]</color> Use on someone else. Bandages stop bleeding and restore health.]] SWEP.Spawnable = true SWEP.Slot = 3 SWEP.SlotPos = 100 SWEP.Primary.ClipSize = -1 SWEP.Primary.DefaultClip = 1 SWEP.Primary.Automatic = false SWEP.Primary.Ammo = "bandages" SWEP.Secondary.ClipSize = -1 SWEP.Secondary.DefaultClip = -1 SWEP.Secondary.Automatic = false SWEP.Secondary.Ammo = "none" SWEP.HoldType = "slam" SWEP.ViewModelFOV = 70 SWEP.ViewModelFlip = false SWEP.UseHands = true SWEP.ViewModel = "models/weapons/c_grenade.mdl" SWEP.WorldModel = "models/weapons/w_grenade.mdl" SWEP.ShowViewModel = true SWEP.ShowWorldModel = false SWEP.ViewModelBoneMods = { ["ValveBiped.Grenade_body"] = {scale = Vector(0, 0, 0), pos = Vector(0, 0, 0), angle = Angle(0, 0, 0)} } SWEP.VElements = { ["bandage"] = {type = "Model", model = "models/props/cs_office/Paper_towels.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "", pos = Vector(2.43, 4.143, 0), angle = Angle(-95.865, 7.394, -18.122), size = Vector(0.5, 0.5, 0.5), color = Color(255, 255, 255, 255), surpresslightning = false, material = "", skin = 0, bodygroup = {}} } SWEP.WElements = { ["bandage"] = {type = "Model", model = "models/props/cs_office/Paper_towels.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "", pos = Vector(2.012, 2.647, -2.123), angle = Angle(-69.766, 5.291, 9.59), size = Vector(0.5, 0.5, 0.5), color = Color(255, 255, 255, 255), surpresslightning = false, material = "", skin = 0, bodygroup = {}} } local function IsGood(ent) return IsValid(ent) and IsValid(ent.Owner) and ent.Owner:IsPlayer() and ent.Owner:Alive() and IsValid(ent.Owner:GetActiveWeapon()) and ent.Owner:GetActiveWeapon():GetClass() == ent.ClassName end function SWEP:Deploy() self:SendWeaponAnim(ACT_VM_DRAW) self:SetNextPrimaryFire(CurTime() + 1) self:SetHoldType(self.HoldType) return self.BaseClass.Deploy(self) end function SWEP:CanPrimaryAttack() return IsGood(self) and self.Owner:Health() < self.Owner:GetMaxHealth() end function SWEP:PrimaryAttack() if CLIENT or not self:CanPrimaryAttack() then return end self:SetNextPrimaryFire(CurTime() + 0.8) self:SetNextSecondaryFire(CurTime() + 0.8) self:SendWeaponAnim(ACT_VM_PULLBACK_LOW) timer.Simple(0.3, function() if not IsGood(self) then return end self.Owner:SetHealth(math.min(self.Owner:Health() + 5, self.Owner:GetMaxHealth())) self.Owner:RemoveAmmo(1, self.Primary.Ammo) if self.Owner:GetAmmoCount(self.Primary.Ammo) > 0 then self:SendWeaponAnim(ACT_VM_DRAW) else self.Owner:ConCommand("lastinv") self.Owner:StripWeapon(self.ClassName) end end) end function SWEP:CanSecondaryAttack() self.Owner:LagCompensation(true) local tr = self.Owner:GetEyeTrace() self.Owner:LagCompensation(false) if IsValid(tr.Entity) and tr.Entity:IsPlayer() and tr.Entity:Health() < tr.Entity:GetMaxHealth() and tr.Entity:GetShootPos():DistToSqr(self.Owner:GetShootPos()) < 62500 then return true, tr.Entity end return false, NULL end function SWEP:SecondaryAttack() local can, ply = self:CanSecondaryAttack() if CLIENT or not can then return end self:SetNextPrimaryFire(CurTime() + 0.8) self:SetNextSecondaryFire(CurTime() + 0.8) self:SendWeaponAnim(ACT_VM_THROW) timer.Simple(0.3, function() if not IsGood(self) or not IsValid(ply) or not ply:IsPlayer() or not (self.Owner:GetShootPos():DistToSqr(ply:GetShootPos()) < 62500) then return end ply:SetHealth(math.min(ply:Health() + 5, ply:GetMaxHealth())) self.Owner:RemoveAmmo(1, self.Primary.Ammo) if self.Owner:GetAmmoCount(self.Primary.Ammo) > 0 then self:SendWeaponAnim(ACT_VM_DRAW) else self.Owner:ConCommand("lastinv") self.Owner:StripWeapon(self.ClassName) end end) end
gpl-3.0
gedadsbranch/Darkstar-Mission
scripts/globals/spells/rasp.lua
11
1577
----------------------------------------- -- Spell: Rasp -- Deals earth damage that lowers an enemy's dexterity and gradually reduces its HP. ----------------------------------------- require("scripts/globals/settings"); require("scripts/globals/status"); require("scripts/globals/magic"); ----------------------------------------- -- OnSpellCast ----------------------------------------- function onMagicCastingCheck(caster,target,spell) return 0; end; function onSpellCast(caster,target,spell) if(target:getStatusEffect(EFFECT_CHOKE) ~= nil) then spell:setMsg(75); -- no effect else local dINT = caster:getStat(MOD_INT) - target:getStat(MOD_INT); local resist = applyResistance(caster,spell,target,dINT,36,0); if(resist <= 0.125) then spell:setMsg(85); else if(target:getStatusEffect(EFFECT_SHOCK) ~= nil) then target:delStatusEffect(EFFECT_SHOCK); end; local sINT = caster:getStat(MOD_INT); local DOT = getElementalDebuffDOT(sINT); local effect = target:getStatusEffect(EFFECT_RASP); local noeffect = false; if(effect ~= nil) then if(effect:getPower() >= DOT) then noeffect = true; end; end; if(noeffect) then spell:setMsg(75); -- no effect else if(effect ~= nil) then target:delStatusEffect(EFFECT_RASP); end; spell:setMsg(237); local duration = math.floor(ELEMENTAL_DEBUFF_DURATION * resist); target:addStatusEffect(EFFECT_RASP,DOT, 3, ELEMENTAL_DEBUFF_DURATION,FLAG_ERASBLE); end; end; end; return EFFECT_RASP; end;
gpl-3.0
zielmicha/freeciv-mirror
data/classic/script.lua
1
2666
-- Freeciv - Copyright (C) 2007 - The Freeciv Project -- 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, 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. function city_destroyed_callback(city, loser, destroyer) city.tile:create_base("Ruins", NIL) -- continue processing return false end signal.connect("city_destroyed", "city_destroyed_callback") function place_map_labels() local mountains = 0 local deep_oceans = 0 local deserts = 0 local glaciers = 0 local selected for place in whole_map_iterate() do local terr = place.terrain local tname = terr:rule_name() if tname == "Mountains" then mountains = mountains + 1 end if tname == "Deep Ocean" then deep_oceans = deep_oceans + 1 end if tname == "Desert" then deserts = deserts + 1 end if tname == "Glacier" then glaciers = glaciers + 1 end end if random(1, 100) <= 75 then selected = random(1, mountains) for place in whole_map_iterate() do local terr = place.terrain if terr:rule_name() == "Mountains" then selected = selected - 1 if selected == 0 then place:set_label("Highest Peak") end end end end if random(1, 100) <= 75 then selected = random(1, deep_oceans) for place in whole_map_iterate() do local terr = place.terrain if terr:rule_name() == "Deep Ocean" then selected = selected - 1 if selected == 0 then place:set_label("Deep Trench") end end end end if random(1, 100) <= 75 then selected = random(1, deserts) for place in whole_map_iterate() do local terr = place.terrain if terr:rule_name() == "Desert" then selected = selected - 1 if selected == 0 then place:set_label("Scorched spot") end end end end if random(1, 100) <= 75 then selected = random(1, glaciers) for place in whole_map_iterate() do local terr = place.terrain if terr:rule_name() == "Glacier" then selected = selected - 1 if selected == 0 then place:set_label("Frozen lake") end end end end return false end signal.connect("map_generated", "place_map_labels")
gpl-2.0
FishFilletsNG/fillets-data
script/reef/dialogs_en.lua
1
1477
dialogId("uts-m-otresy", "font_small", "My goodness, the impact created cave-in!") dialogId("uts-v-projet0", "font_big", "I can’t go through this cave-in, we have to find another exit.") dialogId("uts-v-projet1", "font_big", "This is not the way.") dialogId("uts-v-sam", "font_big", "I won’t make it alone.") dialogId("uts-m-lastura", "font_small", "I probably should have had lifted that shell first.") dialogId("uts-v-poradi", "font_big", "Maybe we have to switch these objects.") dialogId("uts-m-matrace", "font_small", "A mattress. The best thing you can get under water.") dialogId("uts-m-snek", "font_small", "Now we can drop the snail on the mattress.") dialogId("uts-m-nezvedneme", "font_small", "It will be difficult to pick up that snail from there.") dialogId("uts-v-konecne", "font_big", "Finally, it’s there.") dialogId("uts-m-chudak", "font_small", "The poor snail...") dialogId("uts-v-koraly", "font_big", "We should search the coral reefs.") dialogId("uts-m-tvorove", "font_small", "There are going to be many interesting beings to investigate there.") dialogId("uts-v-mikroskop", "font_big", "Don’t we need a microscope to investigate corals?") dialogId("uts-m-zivocich", "font_small", "Yes, they are small. But there can be other life forms.") dialogId("uts-m-zelvy", "font_small", "Coral turtles, for example.") dialogId("uts-m-batyskaf", "font_small", "And moreover I have a suspicion that there’s a microscope in a bathyscaph.")
gpl-2.0
hooksta4/darkstar
scripts/zones/Port_Jeuno/npcs/Horst.lua
29
3441
----------------------------------- -- Area: Port Jeuno -- NPC: Horst -- Type: Abyssea Warp NPC -- @pos -54.379 0.001 -10.061 246 ----------------------------------- package.loaded["scripts/zones/Port_Jeuno/TextIDs"] = nil; ----------------------------------- require("scripts/zones/Port_Jeuno/TextIDs"); ----------------------------------- -- onTrade Action ----------------------------------- function onTrade(player,npc,trade) end; ----------------------------------- -- onTrigger Action ----------------------------------- function onTrigger(player,npc) local CRUOR = player:getCurrency("cruor"); if (player:getQuestStatus(ABYSSEA, THE_TRUTH_BECKONS) == QUEST_ACCEPTED) then player:startEvent(0x0153,1,CRUOR,7,7,7); -- Temp activated all locations till param handling sorted out. elseif (player:getQuestStatus(ABYSSEA, THE_TRUTH_BECKONS) == QUEST_COMPLETED) then player:startEvent(0x0153,2,CRUOR,7,7,7); -- Temp activated all locations till param handling sorted out. else player:startEvent(0x0153, 0); 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); local CRUOR = player:getCurrency("cruor"); if (csid == 0x0153) then if (option == 260) then if (CRUOR >= 200) then player:delCurrency("cruor", 200); player:setPos(-562,0.001,640,26,102); -- La Theine Plateau end elseif (option == 264) then if (CRUOR >= 200) then player:delCurrency("cruor", 200); player:setPos(91,-68,-582,237,108); -- Konshtat Highlands end elseif (option == 268) then if (CRUOR >= 200) then player:delCurrency("cruor", 200); player:setPos(-28,46,-680,76,117); -- Tahrongi Canyon end elseif (option == 272) then if (CRUOR >= 200) then player:delCurrency("cruor", 200); player:setPos(241,0.001,11,42,104); -- Jugner Forest end elseif (option == 276) then if (CRUOR >= 200) then player:delCurrency("cruor", 200); player:setPos(362,0.001,-119,4,103); -- Valkrum end elseif (option == 280) then if (CRUOR >= 200) then player:delCurrency("cruor", 200); player:setPos(-338,-23,47,167,118); -- Buburimu Peninsula end elseif (option == 288) then if (CRUOR >= 200) then player:delCurrency("cruor", 200); player:setPos(269,-7,-75,192,112); -- Xarcabard end elseif (option == 284) then if (CRUOR >= 200) then player:delCurrency("cruor", 200); player:setPos(337,0.001,-675,52,107); -- South Gustaberg end elseif (option == 292) then if (CRUOR >= 200) then player:delCurrency("cruor", 200); player:setPos(-71,0.001,601,126,106); -- North Gustaberg end end end end;
gpl-3.0
warrenseine/premake
tests/actions/make/cpp/test_objects.lua
3
2963
-- -- tests/actions/make/cpp/test_objects.lua -- Validate the list of objects for a makefile. -- Copyright (c) 2009-2013 Jason Perkins and the Premake project -- local suite = test.declare("make_cpp_objects") local make = premake.make local project = premake.project -- -- Setup -- local sln, prj function suite.setup() sln = test.createsolution() end local function prepare() prj = premake.solution.getproject(sln, 1) make.cppObjects(prj) end -- -- If a file is listed at the project level, it should get listed in -- the project level objects list. -- function suite.listFileInProjectObjects() files { "src/hello.cpp" } prepare() test.capture [[ OBJECTS := \ $(OBJDIR)/hello.o \ ]] end -- -- Only buildable files should be listed. -- function suite.onlyListBuildableFiles() files { "include/gl.h", "src/hello.cpp" } prepare() test.capture [[ OBJECTS := \ $(OBJDIR)/hello.o \ ]] end -- -- A file should only be listed in the configurations to which it belongs. -- function suite.configFilesAreConditioned() configuration "Debug" files { "src/hello_debug.cpp" } configuration "Release" files { "src/hello_release.cpp" } prepare() test.capture [[ OBJECTS := \ RESOURCES := \ ifeq ($(config),debug) OBJECTS += \ $(OBJDIR)/hello_debug.o \ endif ifeq ($(config),release) OBJECTS += \ $(OBJDIR)/hello_release.o \ endif ]] end -- -- Two files with the same base name should have different object files. -- function suite.uniqueObjNames_onBaseNameCollision() files { "src/hello.cpp", "src/greetings/hello.cpp" } prepare() test.capture [[ OBJECTS := \ $(OBJDIR)/hello.o \ $(OBJDIR)/hello1.o \ ]] end -- -- If a custom rule builds to an object file, include it in the -- link automatically to match the behavior of Visual Studio -- function suite.customBuildRule() files { "hello.x" } configuration "**.x" buildmessage "Compiling %{file.name}" buildcommands { 'cxc -c "%{file.path}" -o "%{cfg.objdir}/%{file.basename}.xo"', 'c2o -c "%{cfg.objdir}/%{file.basename}.xo" -o "%{cfg.objdir}/%{file.basename}.obj"' } buildoutputs { "%{cfg.objdir}/%{file.basename}.obj" } prepare() test.capture [[ OBJECTS := \ RESOURCES := \ ifeq ($(config),debug) OBJECTS += \ obj/Debug/hello.obj \ endif ]] end -- -- If a file is excluded from a configuration, it should not be listed. -- function suite.excludedFromBuild_onExcludedFile() files { "hello.cpp" } configuration "Debug" removefiles { "hello.cpp" } prepare() test.capture [[ OBJECTS := \ RESOURCES := \ ifeq ($(config),release) OBJECTS += \ $(OBJDIR)/hello.o \ endif ]] end function suite.excludedFromBuild_onExcludeFlag() files { "hello.cpp" } configuration { "Debug", "hello.cpp" } flags { "ExcludeFromBuild" } prepare() test.capture [[ OBJECTS := \ RESOURCES := \ ifeq ($(config),release) OBJECTS += \ $(OBJDIR)/hello.o \ endif ]] end
bsd-3-clause
hooksta4/darkstar
scripts/zones/zones/Riverne-Site_A01/npcs/HomePoint#1.lua
19
1189
----------------------------------- -- Area: Riverne-Site A01 -- NPC: HomePoint#1 -- @pos ----------------------------------- package.loaded["scripts/zones/Riverne-Site_A01/TextIDs"] = nil; require("scripts/globals/settings"); require("scripts/zones/Riverne-Site_A01/TextIDs"); require("scripts/globals/homepoint"); ----------------------------------- -- onTrade Action ----------------------------------- function onTrade(player,npc,trade) end; ----------------------------------- -- onTrigger Action ----------------------------------- function onTrigger(player,npc) homepointMenu( player, 0x21fc, 84); 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 == 0x21fc) then if (option == 1) then player:setHomePoint(); player:messageSpecial(HOMEPOINT_SET); else hpTeleport( player, option); end end end;
gpl-3.0
hooksta4/darkstar
scripts/zones/Sauromugue_Champaign/Zone.lua
15
4529
----------------------------------- -- -- Zone: Sauromugue_Champaign (120) -- ----------------------------------- package.loaded["scripts/zones/Sauromugue_Champaign/TextIDs"] = nil; package.loaded["scripts/globals/chocobo_digging"] = nil; ----------------------------------- require("scripts/zones/Sauromugue_Champaign/TextIDs"); require( "scripts/globals/icanheararainbow"); require("scripts/globals/zone"); require("scripts/globals/chocobo_digging"); ----------------------------------- -- Chocobo Digging vars ----------------------------------- local itemMap = { -- itemid, abundance, requirement { 880, 224, DIGREQ_NONE }, { 887, 39, DIGREQ_NONE }, { 645, 14, DIGREQ_NONE }, { 893, 105, DIGREQ_NONE }, { 737, 17, DIGREQ_NONE }, { 643, 64, DIGREQ_NONE }, { 17296, 122, DIGREQ_NONE }, { 942, 6, DIGREQ_NONE }, { 642, 58, DIGREQ_NONE }, { 864, 22, DIGREQ_NONE }, { 843, 4, DIGREQ_NONE }, { 4096, 100, DIGREQ_NONE }, -- all crystals { 656, 95, DIGREQ_BURROW }, { 749, 26, DIGREQ_BURROW }, { 751, 33, DIGREQ_BURROW }, { 750, 89, DIGREQ_BURROW }, { 902, 6, DIGREQ_BORE }, { 886, 3, DIGREQ_BORE }, { 867, 3, DIGREQ_BORE }, { 1587, 19, DIGREQ_BORE }, { 888, 25, DIGREQ_BORE }, { 1586, 8, DIGREQ_BORE }, { 885, 10, DIGREQ_BORE }, { 866, 3, DIGREQ_BORE }, { 4570, 10, DIGREQ_MODIFIER }, { 4487, 11, DIGREQ_MODIFIER }, { 4409, 12, DIGREQ_MODIFIER }, { 1188, 10, DIGREQ_MODIFIER }, { 4532, 12, DIGREQ_MODIFIER }, }; local messageArray = { DIG_THROW_AWAY, FIND_NOTHING, ITEM_OBTAINED }; ----------------------------------- -- onChocoboDig ----------------------------------- function onChocoboDig(player, precheck) return chocoboDig(player, itemMap, precheck, messageArray); end; ----------------------------------- -- onInitialize ----------------------------------- function onInitialize(zone) local manuals = {17269257,17269258}; SetFieldManual(manuals); -- Roc SetRespawnTime(17269106, 900, 10800); end; ----------------------------------- -- onZoneIn ----------------------------------- function onZoneIn( player, prevZone) local cs = -1; if ( player:getXPos() == 0 and player:getYPos() == 0 and player:getZPos() == 0) then player:setPos( -103.991, -25.956, -425.221, 190); end if (triggerLightCutscene(player)) then -- Quest: I Can Hear A Rainbow cs = 0x0003; elseif (player:getCurrentMission(WINDURST) == VAIN and player:getVar("MissionStatus") ==1) then cs = 0x0005; end return cs; 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; ----------------------------------- -- onRegionEnter ----------------------------------- function onRegionEnter( player, region) end; ----------------------------------- -- onEventUpdate ----------------------------------- function onEventUpdate( player, csid, option) -- printf("CSID: %u",csid); -- printf("RESULT: %u",option); if (csid == 0x0003) then lightCutsceneUpdate(player); -- Quest: I Can Hear A Rainbow elseif (csid == 0x0005) then if (player:getPreviousZone() == 200) then player:updateEvent(0,0,0,0,0,2); elseif (player:getPreviousZone() == 119) then player:updateEvent(0,0,0,0,0,4); elseif (player:getPreviousZone() == 110 or player:getPreviousZone() == 246 ) then player:updateEvent(0,0,0,0,0,3); end end end; ----------------------------------- -- onEventFinish ----------------------------------- function onEventFinish( player, csid, option) -- printf("CSID: %u",csid); -- printf("RESULT: %u",option); if (csid == 0x0003) then lightCutsceneFinish(player); -- Quest: I Can Hear A Rainbow end end;
gpl-3.0
gedadsbranch/Darkstar-Mission
scripts/zones/Aht_Urhgan_Whitegate/npcs/Sajaaya.lua
59
1060
----------------------------------- -- Area: Aht Urhgan Whitegate -- NPC: Sajaaya -- Type: Weather Reporter ----------------------------------- package.loaded["scripts/zones/Aht_Urhgan_Whitegate/TextIDs"] = nil; ----------------------------------- require("scripts/globals/settings"); require("scripts/zones/Aht_Urhgan_Whitegate/TextIDs"); ----------------------------------- -- onTrade Action ----------------------------------- function onTrade(player,npc,trade) end; ----------------------------------- -- onTrigger Action ----------------------------------- function onTrigger(player,npc) player:startEvent(0x01F6,0,0,0,0,0,0,0,VanadielTime()); end; ----------------------------------- -- onEventUpdate ----------------------------------- function onEventUpdate(player,csid,option) -- printf("CSID: %u",csid); -- printf("RESULT: %u",option); end; ----------------------------------- -- onEventFinish ----------------------------------- function onEventFinish(player,csid,option) -- printf("CSID: %u",csid); -- printf("RESULT: %u",option); end;
gpl-3.0
hooksta4/darkstar
scripts/zones/zones/Aht_Urhgan_Whitegate/npcs/Sajaaya.lua
59
1060
----------------------------------- -- Area: Aht Urhgan Whitegate -- NPC: Sajaaya -- Type: Weather Reporter ----------------------------------- package.loaded["scripts/zones/Aht_Urhgan_Whitegate/TextIDs"] = nil; ----------------------------------- require("scripts/globals/settings"); require("scripts/zones/Aht_Urhgan_Whitegate/TextIDs"); ----------------------------------- -- onTrade Action ----------------------------------- function onTrade(player,npc,trade) end; ----------------------------------- -- onTrigger Action ----------------------------------- function onTrigger(player,npc) player:startEvent(0x01F6,0,0,0,0,0,0,0,VanadielTime()); end; ----------------------------------- -- onEventUpdate ----------------------------------- function onEventUpdate(player,csid,option) -- printf("CSID: %u",csid); -- printf("RESULT: %u",option); end; ----------------------------------- -- onEventFinish ----------------------------------- function onEventFinish(player,csid,option) -- printf("CSID: %u",csid); -- printf("RESULT: %u",option); end;
gpl-3.0
hooksta4/darkstar
scripts/zones/Aht_Urhgan_Whitegate/npcs/Sajaaya.lua
59
1060
----------------------------------- -- Area: Aht Urhgan Whitegate -- NPC: Sajaaya -- Type: Weather Reporter ----------------------------------- package.loaded["scripts/zones/Aht_Urhgan_Whitegate/TextIDs"] = nil; ----------------------------------- require("scripts/globals/settings"); require("scripts/zones/Aht_Urhgan_Whitegate/TextIDs"); ----------------------------------- -- onTrade Action ----------------------------------- function onTrade(player,npc,trade) end; ----------------------------------- -- onTrigger Action ----------------------------------- function onTrigger(player,npc) player:startEvent(0x01F6,0,0,0,0,0,0,0,VanadielTime()); end; ----------------------------------- -- onEventUpdate ----------------------------------- function onEventUpdate(player,csid,option) -- printf("CSID: %u",csid); -- printf("RESULT: %u",option); end; ----------------------------------- -- onEventFinish ----------------------------------- function onEventFinish(player,csid,option) -- printf("CSID: %u",csid); -- printf("RESULT: %u",option); end;
gpl-3.0