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
The-HalcyonDays/darkstar
scripts/globals/items/cluster_of_paprika.lua
36
1233
----------------------------------------- -- ID: 5740 -- Item: Cluster of Paprika -- Food Effect: 5Min, All Races ----------------------------------------- -- Agility 1 -- Vitality -3 -- Defense -1 ----------------------------------------- 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,300,5740); end; ----------------------------------------- -- onEffectGain Action ----------------------------------------- function onEffectGain(target,effect) target:addMod(MOD_AGI, 1); target:addMod(MOD_VIT, -3); target:addMod(MOD_DEF, -1); end; ----------------------------------------- -- onEffectLose Action ----------------------------------------- function onEffectLose(target,effect) target:delMod(MOD_AGI, 1); target:delMod(MOD_VIT, -3); target:delMod(MOD_DEF, -1); end;
gpl-3.0
reza-sec/reza-sec
plugins/anti_spam.lua
191
5291
--An empty table for solving multiple kicking problem(thanks to @topkecleon ) kicktable = {} do local TIME_CHECK = 2 -- seconds -- Save stats, ban user local function pre_process(msg) -- Ignore service msg if msg.service then return msg end if msg.from.id == our_id then return msg end -- Save user on Redis if msg.from.type == 'user' then local hash = 'user:'..msg.from.id print('Saving user', hash) if msg.from.print_name then redis:hset(hash, 'print_name', msg.from.print_name) end if msg.from.first_name then redis:hset(hash, 'first_name', msg.from.first_name) end if msg.from.last_name then redis:hset(hash, 'last_name', msg.from.last_name) end end -- Save stats on Redis if msg.to.type == 'chat' then -- User is on chat local hash = 'chat:'..msg.to.id..':users' redis:sadd(hash, msg.from.id) end -- Save stats on Redis if msg.to.type == 'channel' then -- User is on channel local hash = 'channel:'..msg.to.id..':users' redis:sadd(hash, msg.from.id) end if msg.to.type == 'user' then -- User is on chat local hash = 'PM:'..msg.from.id redis:sadd(hash, msg.from.id) end -- Total user msgs local hash = 'msgs:'..msg.from.id..':'..msg.to.id redis:incr(hash) --Load moderation data local data = load_data(_config.moderation.data) if data[tostring(msg.to.id)] then --Check if flood is on or off if data[tostring(msg.to.id)]['settings']['flood'] == 'no' then return msg end end -- Check flood if msg.from.type == 'user' then local hash = 'user:'..msg.from.id..':msgs' local msgs = tonumber(redis:get(hash) or 0) local data = load_data(_config.moderation.data) local NUM_MSG_MAX = 5 if data[tostring(msg.to.id)] then if data[tostring(msg.to.id)]['settings']['flood_msg_max'] then NUM_MSG_MAX = tonumber(data[tostring(msg.to.id)]['settings']['flood_msg_max'])--Obtain group flood sensitivity end end local max_msg = NUM_MSG_MAX * 1 if msgs > max_msg then local user = msg.from.id local chat = msg.to.id local whitelist = "whitelist" local is_whitelisted = redis:sismember(whitelist, user) -- Ignore mods,owner and admins if is_momod(msg) then return msg end if is_whitelisted == true then return msg end local receiver = get_receiver(msg) if msg.to.type == 'user' then local max_msg = 7 * 1 print(msgs) if msgs >= max_msg then print("Pass2") send_large_msg("user#id"..msg.from.id, "User ["..msg.from.id.."] blocked for spam.") savelog(msg.from.id.." PM", "User ["..msg.from.id.."] blocked for spam.") block_user("user#id"..msg.from.id,ok_cb,false)--Block user if spammed in private end end if kicktable[user] == true then return end delete_msg(msg.id, ok_cb, false) kick_user(user, chat) local username = msg.from.username local print_name = user_print_name(msg.from):gsub("‮", "") local name_log = print_name:gsub("_", "") if msg.to.type == 'chat' or msg.to.type == 'channel' then if username then savelog(msg.to.id, name_log.." @"..username.." ["..msg.from.id.."] kicked for #spam") send_large_msg(receiver , "Flooding is not allowed here\n@"..username.."["..msg.from.id.."]\nStatus: User kicked") else savelog(msg.to.id, name_log.." ["..msg.from.id.."] kicked for #spam") send_large_msg(receiver , "Flooding is not allowed here\nName:"..name_log.."["..msg.from.id.."]\nStatus: User kicked") end end -- incr it on redis local gbanspam = 'gban:spam'..msg.from.id redis:incr(gbanspam) local gbanspam = 'gban:spam'..msg.from.id local gbanspamonredis = redis:get(gbanspam) --Check if user has spammed is group more than 4 times if gbanspamonredis then if tonumber(gbanspamonredis) == 4 and not is_owner(msg) then --Global ban that user banall_user(msg.from.id) local gbanspam = 'gban:spam'..msg.from.id --reset the counter redis:set(gbanspam, 0) if msg.from.username ~= nil then username = msg.from.username else username = "---" end local print_name = user_print_name(msg.from):gsub("‮", "") local name = print_name:gsub("_", "") --Send this to that chat send_large_msg("chat#id"..msg.to.id, "User [ "..name.." ]"..msg.from.id.." globally banned (spamming)") send_large_msg("channel#id"..msg.to.id, "User [ "..name.." ]"..msg.from.id.." globally banned (spamming)") local GBan_log = 'GBan_log' local GBan_log = data[tostring(GBan_log)] for k,v in pairs(GBan_log) do log_SuperGroup = v gban_text = "User [ "..name.." ] ( @"..username.." )"..msg.from.id.." Globally banned from ( "..msg.to.print_name.." ) [ "..msg.to.id.." ] (spamming)" --send it to log group/channel send_large_msg(log_SuperGroup, gban_text) end end end kicktable[user] = true msg = nil end redis:setex(hash, TIME_CHECK, msgs+1) end return msg end local function cron() --clear that table on the top of the plugins kicktable = {} end return { patterns = {}, cron = cron, pre_process = pre_process } end
gpl-2.0
The-HalcyonDays/darkstar
scripts/zones/Western_Altepa_Desert/npcs/_3h0.lua
17
1175
----------------------------------- -- Area: Western Altepa Desert -- NPC: _3h0 (Altepa Gate) -- @pos -19 12 131 125 ----------------------------------- package.loaded["scripts/zones/Western_Altepa_Desert/TextIDs"] = nil; ----------------------------------- require("scripts/zones/Western_Altepa_Desert/TextIDs"); ----------------------------------- -- onTrade Action ----------------------------------- function onTrade(player,npc,trade) end; ----------------------------------- -- onTrigger Action ----------------------------------- function onTrigger(player,npc) if(npc:getAnimation() == 9) then if(player:getZPos() > 137) then npc:openDoor(3.2); else player:messageSpecial(THE_DOOR_IS_LOCKED); 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
The-HalcyonDays/darkstar
scripts/globals/magic.lua
1
54584
require("scripts/globals/magicburst") require("scripts/globals/status") require("scripts/globals/weather") require("scripts/globals/utils") MMSG_BUFF_FAIL = 75; DIVINE_MAGIC_SKILL = 32; HEALING_MAGIC_SKILL = 33; ENHANCING_MAGIC_SKILL = 34; ENFEEBLING_MAGIC_SKILL = 35; ELEMENTAL_MAGIC_SKILL = 36; DARK_MAGIC_SKILL = 37; NINJUTSU_SKILL = 39; SUMMONING_SKILL = 38; SINGING_SKILL = 40; STRING_SKILL = 41; WIND_SKILL = 42; BLUE_SKILL = 43; FIRESDAY = 0; EARTHSDAY = 1; WATERSDAY = 2; WINDSDAY = 3; ICEDAY = 4; LIGHTNINGDAY = 5; LIGHTSDAY = 6; DARKSDAY = 7; ELE_NONE = 0; ELE_FIRE = 1; ELE_EARTH = 2; ELE_WATER = 3; ELE_WIND = 4; ELE_ICE = 5; ELE_LIGHTNING = 6; -- added both because monsterstpmoves calls it thunder ELE_THUNDER = 6; ELE_LIGHT = 7; ELE_DARK = 8; dayStrong = {FIRESDAY, EARTHSDAY, WATERSDAY, WINDSDAY, ICEDAY, LIGHTNINGDAY, LIGHTSDAY, DARKSDAY}; dayWeak = {WATERSDAY, WINDSDAY, LIGHTNINGDAY, ICEDAY, FIRESDAY, EARTHSDAY, DARKSDAY, LIGHTSDAY}; singleWeatherStrong = {WEATHER_HOT_SPELL, WEATHER_DUST_STORM, WEATHER_RAIN, WEATHER_WIND, WEATHER_SNOW, WEATHER_THUNDER, WEATHER_AURORAS, WEATHER_GLOOM}; doubleWeatherStrong = {WEATHER_HEAT_WAVE, WEATHER_SAND_STORM, WEATHER_SQUALL, WEATHER_GALES, WEATHER_BLIZZARDS, WEATHER_THUNDERSTORMS, WEATHER_STELLAR_GLARE, WEATHER_DARKNESS}; singleWeatherWeak = {WEATHER_RAIN, WEATHER_WIND, WEATHER_THUNDER, WEATHER_SNOW, WEATHER_HOT_SPELL, WEATHER_DUST_STORM, WEATHER_GLOOM, WEATHER_AURORAS}; doubleWeatherWeak = {WEATHER_SQUALL, WEATHER_GALES, WEATHER_THUNDERSTORMS, WEATHER_BLIZZARDS, WEATHER_HEAT_WAVE, WEATHER_SAND_STORM, WEATHER_DARKNESS, WEATHER_STELLAR_GLARE}; elementalObi = {15435, 15438, 15440, 15437, 15436, 15439, 15441, 15442}; elementalObiWeak = {15440, 15437, 15439, 15436, 15435, 15438, 15442, 15441}; spellAcc = {MOD_FIREACC, MOD_EARTHACC, MOD_WATERACC, MOD_WINDACC, MOD_ICEACC, MOD_THUNDERACC, MOD_LIGHTACC, MOD_DARKACC}; strongAffinity = {MOD_FIRE_AFFINITY, MOD_EARTH_AFFINITY, MOD_WATER_AFFINITY, MOD_WIND_AFFINITY, MOD_ICE_AFFINITY, MOD_THUNDER_AFFINITY, MOD_LIGHT_AFFINITY, MOD_DARK_AFFINITY}; weakAffinity = {MOD_WATER_AFFINITY, MOD_WIND_AFFINITY, MOD_THUNDER_AFFINITY, MOD_ICE_AFFINITY, MOD_FIRE_AFFINITY, MOD_EARTH_AFFINITY, MOD_DARK_AFFINITY, MOD_LIGHT_AFFINITY}; resistMod = {MOD_FIRERES, MOD_EARTHRES, MOD_WATERRES, MOD_WINDRES, MOD_ICERES, MOD_THUNDERRES, MOD_LIGHTRES, MOD_DARKRES}; defenseMod = {MOD_FIREDEF, MOD_EARTHDEF, MOD_WATERDEF, MOD_WINDDEF, MOD_ICEDEF, MOD_THUNDERDEF, MOD_LIGHTDEF, MOD_DARKDEF}; absorbMod = {MOD_FIRE_ABSORB, MOD_EARTH_ABSORB, MOD_WATER_ABSORB, MOD_WIND_ABSORB, MOD_ICE_ABSORB, MOD_LTNG_ABSORB, MOD_LIGHT_ABSORB, MOD_DARK_ABSORB}; nullMod = {MOD_FIRE_NULL, MOD_EARTH_NULL, MOD_WATER_NULL, MOD_WIND_NULL, MOD_ICE_NULL, MOD_LTNG_NULL, MOD_LIGHT_NULL, MOD_DARK_NULL}; blmMerit = {MERIT_FIRE_MAGIC_POTENCY, MERIT_EARTH_MAGIC_POTENCY, MERIT_WATER_MAGIC_POTENCY, MERIT_WIND_MAGIC_POTENCY, MERIT_ICE_MAGIC_POTENCY, MERIT_LIGHTNING_MAGIC_POTENCY}; rdmMerit = {MERIT_FIRE_MAGIC_ACCURACY, MERIT_EARTH_MAGIC_ACCURACY, MERIT_WATER_MAGIC_ACCURACY, MERIT_WIND_MAGIC_ACCURACY, MERIT_ICE_MAGIC_ACCURACY, MERIT_LIGHTNING_MAGIC_ACCURACY}; -- USED FOR DAMAGING MAGICAL SPELLS (Stages 1 and 2 in Calculating Magic Damage on wiki) --Calculates magic damage using the standard magic damage calc. --Does NOT handle resistance. -- Inputs: -- V - The base damage of the spell -- M - The INT multiplier of the spell -- skilltype - The skill ID of the spell. -- atttype - The attribute type (usually MOD_INT , except for things like Banish which is MOD_MND) -- hasMultipleTargetReduction - true ifdamage is reduced on AoE. False otherwise (e.g. Charged Whisker vs -ga3 spells) -- -- Output: -- The total damage, before resistance and before equipment (so no HQ staff bonus worked out here). SOFT_CAP = 60; --guesstimated HARD_CAP = 120; --guesstimated function calculateMagicDamage(V,M,player,spell,target,skilltype,atttype,hasMultipleTargetReduction) local dint = player:getStat(atttype) - target:getStat(atttype); local dmg = V; if(dint<=0) then --ifdINT penalises, it's always M=1 dmg = dmg + dint; if(dmg <= 0) then --dINT penalty cannot result in negative damage (target absorption) return 0; end elseif(dint > 0 and dint <= SOFT_CAP) then --The standard calc, most spells hit this dmg = dmg + (dint*M); elseif(dint > 0 and dint > SOFT_CAP and dint < HARD_CAP) then --After SOFT_CAP, INT is only half effective dmg = dmg + SOFT_CAP*M + ((dint-SOFT_CAP)*M)/2; elseif(dint > 0 and dint > SOFT_CAP and dint >= HARD_CAP) then --After HARD_CAP, INT has no effect. dmg = dmg + HARD_CAP*M; end if(skilltype == DIVINE_MAGIC_SKILL and target:isUndead()) then -- 150% bonus damage dmg = dmg * 1.5; end -- printf("dmg: %d dint: %d\n", dmg, dint); return dmg; end; function doBoostGain(caster,target,spell,effect) local duration = 300; if (caster:hasStatusEffect(EFFECT_COMPOSURE) == true and caster:getID() == target:getID()) then duration = duration * 3; end --calculate potency local magicskill = target:getSkillLevel(ENHANCING_MAGIC_SKILL); local potency = math.floor((magicskill - 300) / 10) + 5; if(potency > 25) then potency = 25; elseif(potency < 5) then potency = 5; end --printf("BOOST-GAIN: POTENCY = %d", potency); --Only one Boost Effect can be active at once, so if the player has any we have to cancel & overwrite local effectOverwrite = {80, 81, 82, 83, 84, 85, 86}; for i, effect in ipairs(effectOverwrite) do --printf("BOOST-GAIN: CHECKING FOR EFFECT %d...",effect); if(caster:hasStatusEffect(effect)) then --printf("BOOST-GAIN: HAS EFFECT %d, DELETING...",effect); caster:delStatusEffect(effect); end end if(target:addStatusEffect(effect,potency,0,duration)) then spell:setMsg(230); else spell:setMsg(75); end end; function doEnspell(caster,target,spell,effect) if(effect==EFFECT_BLOOD_WEAPON) then target:addStatusEffect(EFFECT_BLOOD_WEAPON,1,0,30); return; end local duration = 180; if (caster:hasStatusEffect(EFFECT_COMPOSURE) == true and caster:getID() == target:getID()) then duration = duration * 3; end --calculate potency local magicskill = target:getSkillLevel(ENHANCING_MAGIC_SKILL); local potency = 3 + math.floor((6*magicskill)/100); if(magicskill>200) then potency = 5 + math.floor((5*magicskill)/100); end if(target:addStatusEffect(effect,potency,0,duration)) then spell:setMsg(230); else spell:setMsg(75); end end; --------------------------------- -- Author: ZeDingo -- getCurePower returns the caster's cure power -- getCureFinal returns the final cure amount -- Source: http://members.shaw.ca/pizza_steve/cure/Cure_Calculator.html --------------------------------- function getCurePower(caster,isBlueMagic) local MND = caster:getStat(MOD_MND); local VIT = caster:getStat(MOD_VIT); local skill = caster:getSkillLevel(HEALING_MAGIC_SKILL) + caster:getMod(MOD_HEALING); local power = math.floor(MND/2) + math.floor(VIT/4) + skill; return power; end; function getCurePowerOld(caster) local MND = caster:getStat(MOD_MND); local VIT = caster:getStat(MOD_VIT); local skill = caster:getSkillLevel(HEALING_MAGIC_SKILL) + caster:getMod(MOD_HEALING);--it's healing magic skill for the BLU cures as well local power = ((3 * MND) + VIT + (3 * math.floor(skill/5))); return power; end; function getBaseCure(power,divisor,constant,basepower) return ((power - basepower) / divisor) + constant; end; function getBaseCureOld(power,divisor,constant) return (power / 2) / divisor + constant; end; function getCureFinal(caster,spell,basecure,minCure,isBlueMagic) if(basecure < minCure) then basecure = minCure; end local potency = 1 + (caster:getMod(MOD_CURE_POTENCY) / 100); if(potency > 1.5) then potency = 1.5; end local dSeal = 1; if (caster:hasStatusEffect(EFFECT_DIVINE_SEAL)) then dSeal = 2; end local rapture = 1; if(isBlueMagic == false) then --rapture doesn't affect BLU cures as they're not white magic if (caster:hasStatusEffect(EFFECT_RAPTURE)) then local equippedHead = caster:getEquipID(SLOT_HEAD); if(equippedHead == 11183) then rapture = 1.55; --savant's bonnet +1 elseif(equippedHead == 11083) then rapture = 1.6; --savant's bonnet +2 else rapture = 1.5; end caster:delStatusEffectSilent(EFFECT_RAPTURE); end end local dayWeatherBonus = 1; local ele = spell:getElement(); local castersWeather = caster:getWeather(); local equippedMain = caster:getEquipID(SLOT_MAIN); local equippedWaist = caster:getEquipID(SLOT_WAIST); if(castersWeather == singleWeatherStrong[ele]) then if(equippedMain == 18632 or equippedMain == 18633) then if(math.random() < 0.33 or equippedWaist == elementalObi[ele]) then dayWeatherBonus = dayWeatherBonus + 0.10; end end if(math.random() < 0.33 or equippedWaist == elementalObi[ele]) then dayWeatherBonus = dayWeatherBonus + 0.10; end elseif(castersWeather == singleWeatherWeak[ele]) then if(math.random() < 0.33 or equippedWaist == elementalObi[ele]) then dayWeatherBonus = dayWeatherBonus - 0.10; end elseif(castersWeather == doubleWeatherStrong[ele]) then if(equippedMain == 18632 or equippedMain == 18633) then if(math.random() < 0.33 or equippedWaist == elementalObi[ele]) then dayWeatherBonus = dayWeatherBonus + 0.10; end end if(math.random() < 0.33 or equippedWaist == elementalObi[ele]) then dayWeatherBonus = dayWeatherBonus + 0.25; end elseif(castersWeather == doubleWeatherWeak[ele]) then if(math.random() < 0.33 or equippedWaist == elementalObi[ele]) then dayWeatherBonus = dayWeatherBonus - 0.25; end end local dayElement = VanadielDayElement(); if(dayElement == dayStrong[ele]) then if(math.random() < 0.33 or equippedWaist == elementalObi[ele]) then dayWeatherBonus = dayWeatherBonus + 0.10; end elseif(dayElement == dayWeak[ele]) then if(math.random() < 0.33 or equippedWaist == elementalObi[ele]) then dayWeatherBonus = dayWeatherBonus - 0.10; end end if(dayWeatherBonus > 1.35) then dayWeatherBonus = 1.35; end local final = math.floor(math.floor(math.floor(math.floor(basecure) * potency) * dayWeatherBonus) * rapture) * dSeal; return final; end; function getCureAsNukeFinal(caster,spell,power,divisor,constant,basepower) return getCureFinal(caster,spell,power,divisor,constant,basepower); end; ----------------------------------- -- Author: ReaperX -- Returns the staff bonus for the caster and spell. ----------------------------------- -- affinities that strengthen/weaken the index element function AffinityBonus(caster,ele) local bonus = 1.00; local affinity = caster:getMod(strongAffinity[ele]) - caster:getMod(weakAffinity[ele]); -- Iridal and Chatoyant will return affinity for strong and weak, cancelling their bonus out, so they need to be specifically checked. -- Could do an if strong == weak, but that would cause problems once/if augments or magian gear is added. local equippedMain = caster:getEquipID(SLOT_MAIN); if (equippedMain == 18632) then affinity = affinity + 1; elseif (equippedMain == 18633) then affinity = affinity + 2; end if(affinity > 0) then bonus = bonus + 0.05 + 0.05 * affinity; elseif(affinity < 0) then bonus = bonus - 0.05 + 0.05 * affinity; end return bonus; end; -- USED FOR DAMAGING MAGICAL SPELLS. Stage 3 of Calculating Magic Damage on wiki -- Reduces damage ifit resists. -- -- Output: -- The factor to multiply down damage (1/2 1/4 1/8 1/16) - In this format so this func can be used for enfeebs on duration. function applyResistance(player,spell,target,diff,skill,bonus) local resist = 1.0; local magicaccbonus = 0; local element = spell:getElement(); if(bonus ~= nil) then magicaccbonus = magicaccbonus + bonus; end if (skill == SINGING_SKILL and player:hasStatusEffect(EFFECT_TROUBADOUR)) then if (math.random(0,99) < player:getMerit(MERIT_TROUBADOUR)-25) then return 1.0; end end --get the base acc (just skill plus magic acc mod) local magicacc = player:getSkillLevel(skill) + player:getMod(79 + skill) + player:getMod(MOD_MACC) + player:getILvlMacc(); if player:hasStatusEffect(EFFECT_ALTRUISM) and spell:getSpellGroup() == SPELLGROUP_WHITE then magicacc = magicacc + player:getStatusEffect(EFFECT_ALTRUISM):getPower(); end if player:hasStatusEffect(EFFECT_FOCALIZATION) and spell:getSpellGroup() == SPELLGROUP_BLACK then magicacc = magicacc + player:getStatusEffect(EFFECT_FOCALIZATION):getPower(); end --difference in int/mnd if(diff > 10) then magicacc = magicacc + 10 + (diff - 10)/2; else magicacc = magicacc + diff; end --add acc for ele/dark seal if(player:getStatusEffect(EFFECT_DARK_SEAL) ~= nil and skill == DARK_MAGIC_SKILL) then magicaccbonus = magicaccbonus + 256; end if (element > ELE_NONE) then -- Add acc for staves local affinityBonus = AffinityBonus(player, element); magicaccbonus = magicaccbonus + (affinityBonus-1) * 200; end --add acc for RDM group 1 merits if (spell:getElement() > 0 and spell:getElement() <= 6) then magicaccbonus = magicaccbonus + player:getMerit(rdmMerit[spell:getElement()]); end local skillchainTier, skillchainCount = FormMagicBurst(element, target); --add acc for skillchains if(skillchainTier > 0) then magicaccbonus = magicaccbonus + 25; end local resMod = 0; -- Some spells may possibly be non elemental, but could be resisted via meva. if (element > ELE_NONE) then resMod = target:getMod(resistMod[element]); end -- Base magic evasion (base magic evasion plus resistances(players), plus elemental defense(mobs) local magiceva = target:getMod(MOD_MEVA) + resMod; --get the difference of acc and eva, scale with level (3.33 at 10 to 0.44 at 75) local multiplier = 0; if player:getMainLvl() < 40 then multiplier = 100 / 120; else multiplier = 100 / (player:getMainLvl() * 3); end; local p = (magicacc * multiplier) - (magiceva * 0.45); magicaccbonus = magicaccbonus / 2; --add magicacc bonus p = p + magicaccbonus; -- printf("acc: %f, eva: %f, bonus: %f, element: %u", magicacc, magiceva, magicaccbonus, element); --double any acc over 50 if it's over 50 if(p > 5) then p = 5 + (p - 5) * 2; end --add a flat bonus that won't get doubled in the previous step p = p + 45; --add a scaling bonus or penalty based on difference of targets level from caster local leveldiff = player:getMainLvl() - target:getMainLvl(); if(leveldiff < 0) then p = p - (25 * ( (player:getMainLvl()) / 75 )) + leveldiff; else p = p + (25 * ( (player:getMainLvl()) / 75 )) + leveldiff; end --cap accuracy if(p > 95) then p = 95; elseif(p < 5) then p = 5; end p = p / 100; -- Resistance thresholds based on p. A higher p leads to lower resist rates, and a lower p leads to higher resist rates. local half = (1 - p); local quart = ((1 - p)^2); local eighth = ((1 - p)^3); local sixteenth = ((1 - p)^4); -- print("HALF:",half); -- print("QUART:",quart); -- print("EIGHTH:",eighth); -- print("SIXTEENTH:",sixteenth); local resvar = math.random(); -- Determine final resist based on which thresholds have been crossed. if(resvar <= sixteenth) then resist = 0.0625; --printf("Spell resisted to 1/16!!! Threshold = %u",sixteenth); elseif(resvar <= eighth) then resist = 0.125; --printf("Spell resisted to 1/8! Threshold = %u",eighth); elseif(resvar <= quart) then resist = 0.25; --printf("Spell resisted to 1/4. Threshold = %u",quart); elseif(resvar <= half) then resist = 0.5; --printf("Spell resisted to 1/2. Threshold = %u",half); else resist = 1.0; --printf("1.0"); end return resist; end; -- USED FOR Status Effect Enfeebs (blind, slow, para, etc.) -- Output: -- The factor to multiply down duration (1/2 1/4 1/8 1/16) function applyResistanceEffect(player,spell,target,diff,skill,bonus,effect) -- resist everything if magic shield is active if(target:hasStatusEffect(EFFECT_MAGIC_SHIELD, 0)) then return 0; end -- If Stymie is active, as long as the mob is not immune then the effect is not resisted if(player:hasStatusEffect(EFFECT_STYMIE) and target:canGainStatusEffect(effect)) then player:delStatusEffect(EFFECT_STYMIE); return 1; end local resist = 1.0; local magicaccbonus = 0; local element = spell:getElement(); if(bonus ~= nil) then magicaccbonus = magicaccbonus + bonus; end if (skill == SINGING_SKILL and player:hasStatusEffect(EFFECT_TROUBADOUR)) then if (math.random(0,99) < player:getMerit(MERIT_TROUBADOUR)-25) then return 1.0; end end -- Get the base acc (just skill + skill mod (79 + skillID = ModID) + magic acc mod) local magicacc = player:getSkillLevel(skill) + player:getMod(79 + skill) + player:getMod(MOD_MACC); if player:hasStatusEffect(EFFECT_ALTRUISM) and spell:getSpellGroup() == SPELLGROUP_WHITE then magicacc = magicacc + player:getStatusEffect(EFFECT_ALTRUISM):getPower(); end if player:hasStatusEffect(EFFECT_FOCALIZATION) and spell:getSpellGroup() == SPELLGROUP_BLACK then magicacc = magicacc + player:getStatusEffect(EFFECT_FOCALIZATION):getPower(); end --difference in int/mnd if(diff > 10) then magicacc = magicacc + 10 + (diff - 10)/2; else magicacc = magicacc + diff; end --add acc for ele/dark seal if(player:getStatusEffect(EFFECT_DARK_SEAL) ~= nil and skill == DARK_MAGIC_SKILL) then magicaccbonus = magicaccbonus + 256; end if (element > ELE_NONE) then -- Add acc for staves local affinityBonus = AffinityBonus(player, element); magicaccbonus = magicaccbonus + (affinityBonus-1) * 200; end --add acc for RDM group 1 merits if(player:getMainJob() == JOB_RDM and player:getMainLvl() >= 75) then if(element == ELE_FIRE) then magicaccbonus = magicaccbonus + player:getMerit(MERIT_FIRE_MAGIC_ACCURACY); elseif(element == ELE_EARTH) then magicaccbonus = magicaccbonus + player:getMerit(MERIT_EARTH_MAGIC_ACCURACY); elseif(element == ELE_WATER) then magicaccbonus = magicaccbonus + player:getMerit(MERIT_WATER_MAGIC_ACCURACY); elseif(element == ELE_WIND) then magicaccbonus = magicaccbonus + player:getMerit(MERIT_WIND_MAGIC_ACCURACY); elseif(element == ELE_ICE) then magicaccbonus = magicaccbonus + player:getMerit(MERIT_ICE_MAGIC_ACCURACY); elseif(element == ELE_LIGHTNING) then magicaccbonus = magicaccbonus + player:getMerit(MERIT_LIGHTNING_MAGIC_ACCURACY); end end local skillchainTier, skillchainCount = FormMagicBurst(element, target); --add acc for skillchains if(skillchainTier > 0) then magicaccbonus = magicaccbonus + 25; end local resMod = 0; -- Some spells may possibly be non elemental, but have status effects. if (element > ELE_NONE) then resMod = target:getMod(resistMod[element]); end -- Base magic evasion (base magic evasion plus resistances(players), plus elemental defense(mobs) local magiceva = target:getMod(MOD_MEVA) + resMod; --get the difference of acc and eva, scale with level (3.33 at 10 to 0.44 at 75) local multiplier = 0; if player:getMainLvl() < 40 then multiplier = 100 / 120; else multiplier = 100 / (player:getMainLvl() * 3); end; local p = (magicacc * multiplier) - (magiceva * 0.45); magicaccbonus = magicaccbonus / 2; --add magicacc bonus p = p + magicaccbonus; -- printf("acc: %f, eva: %f, bonus: %f, element: %u", magicacc, magiceva, magicaccbonus, element); --double any acc over 50 if it's over 50 if(p > 5) then p = 5 + (p - 5) * 2; end --add a flat bonus that won't get doubled in the previous step p = p + 45; --add a scaling bonus or penalty based on difference of targets level from caster local leveldiff = player:getMainLvl() - target:getMainLvl(); if(leveldiff < 0) then p = p - (25 * ( (player:getMainLvl()) / 75 )) + leveldiff; else p = p + (25 * ( (player:getMainLvl()) / 75 )) + leveldiff; end -- add effect resistence if(effect ~= nil and effect > 0) then local effectres = 0; if(effect == EFFECT_SLEEP_I or effect == EFFECT_SLEEP_II or effect == EFFECT_LULLABY) then effectres = MOD_SLEEPRES; elseif(effect == EFFECT_POISON) then effectres = MOD_POISONRES; elseif(effect == EFFECT_PARALYZE) then effectres = MOD_PARALYZERES; elseif(effect == EFFECT_BLINDNESS) then effectres = MOD_BLINDRES elseif(effect == EFFECT_SILENCE) then effectres = MOD_SILENCERES; elseif(effect == EFFECT_PLAGUE or effect == EFFECT_DISEASE) then effectres = MOD_VIRUSRES; elseif(effect == EFFECT_PETRIFICATION) then effectres = MOD_PETRIFYRES; elseif(effect == EFFECT_BIND) then effectres = MOD_BINDRES; elseif(effect == EFFECT_CURSE_I or effect == EFFECT_CURSE_II or effect == EFFECT_BANE) then effectres = MOD_CURSERES; elseif(effect == EFFECT_WEIGHT) then effectres = MOD_GRAVITYRES; elseif(effect == EFFECT_SLOW) then effectres = MOD_SLOWRES; elseif(effect == EFFECT_STUN) then effectres = MOD_STUNRES; elseif(effect == EFFECT_CHARM) then effectres = MOD_CHARMRES; elseif(effect == EFFECT_AMNESIA) then effectres = MOD_AMNESIARES; end if(effectres > 0) then p = p - target:getMod(effectres); end end --cap accuracy if(p > 95) then p = 95; elseif(p < 5) then p = 5; end p = p / 100; -- Resistance thresholds based on p. A higher p leads to lower resist rates, and a lower p leads to higher resist rates. half = (1 - p); quart = half^2; eighth = half^3; sixteenth = half^4; -- printf("HALF: %f", half); -- printf("QUART: %f", quart); -- printf("EIGHTH: %f", eighth); -- printf("SIXTEENTH: %f", sixteenth); local resvar = math.random(); -- Determine final resist based on which thresholds have been crossed. if(resvar <= sixteenth) then resist = 0.0625; --printf("Spell resisted to 1/16!!! Threshold = %u",sixteenth); elseif(resvar <= eighth) then resist = 0.125; --printf("Spell resisted to 1/8! Threshold = %u",eighth); elseif(resvar <= quart) then resist = 0.25; --printf("Spell resisted to 1/4. Threshold = %u",quart); elseif(resvar <= half) then resist = 0.5; --printf("Spell resisted to 1/2. Threshold = %u",half); else resist = 1.0; --printf("1.0"); end return resist; end; --Applies resistance for things that may not be spells - ie. Quick Draw function applyResistanceAbility(player,target,element,skill,bonus) local resist = 1.0; local magicaccbonus = 0; if(bonus ~= nil) then magicaccbonus = magicaccbonus + bonus; end --get the base acc (just skill plus magic acc mod) local magicacc = player:getSkillLevel(skill) + player:getMod(79 + skill) + player:getMod(MOD_MACC); if(element > ELE_NONE) then --add acc for staves local affinityBonus = AffinityBonus(player, element); magicaccbonus = magicaccbonus + (affinityBonus-1) * 200; end --base magic evasion (base magic evasion plus resistances(players), plus elemental defense(mobs) local magiceva = target:getMod(MOD_MEVA); if(element > ELE_NONE) then magiceva = magiceva + target:getMod(resistMod[element]); end --get the difference of acc and eva, scale with level (3.33 at 10 to 0.44 at 75) local multiplier = 0; if player:getMainLvl() < 40 then multiplier = 100 / 120; else multiplier = 100 / (player:getMainLvl() * 3); end; local p = (magicacc * multiplier) - (magiceva * 0.45); magicaccbonus = magicaccbonus / 2; --add magicacc bonus p = p + magicaccbonus; -- printf("acc: %f, eva: %f, bonus: %f", magicacc, magiceva, magicaccbonus); --double any acc over 50 if it's over 50 if(p > 5) then p = 5 + (p - 5) * 2; end --add a flat bonus that won't get doubled in the previous step p = p + 45; --add a scaling bonus or penalty based on difference of targets level from caster local leveldiff = player:getMainLvl() - target:getMainLvl(); if(leveldiff < 0) then p = p - (25 * ( (player:getMainLvl()) / 75 )) + leveldiff; else p = p + (25 * ( (player:getMainLvl()) / 75 )) + leveldiff; end --cap accuracy if(p > 95) then p = 95; elseif(p < 5) then p = 5; end p = p / 100; -- Resistance thresholds based on p. A higher p leads to lower resist rates, and a lower p leads to higher resist rates. local half = (1 - p); local quart = ((1 - p)^2); local eighth = ((1 - p)^3); local sixteenth = ((1 - p)^4); -- print("HALF:",half); -- print("QUART:",quart); -- print("EIGHTH:",eighth); -- print("SIXTEENTH:",sixteenth); local resvar = math.random(); -- Determine final resist based on which thresholds have been crossed. if(resvar <= sixteenth) then resist = 0.0625; --printf("Spell resisted to 1/16!!! Threshold = %u",sixteenth); elseif(resvar <= eighth) then resist = 0.125; --printf("Spell resisted to 1/8! Threshold = %u",eighth); elseif(resvar <= quart) then resist = 0.25; --printf("Spell resisted to 1/4. Threshold = %u",quart); elseif(resvar <= half) then resist = 0.5; --printf("Spell resisted to 1/2. Threshold = %u",half); else resist = 1.0; --printf("1.0"); end return resist; end; --Applies resistance for additional effects function applyResistanceAddEffect(player,target,element,bonus) local resist = 1.0; local magicaccbonus = 0; if(bonus ~= nil) then magicaccbonus = magicaccbonus + bonus; end --get the base acc (just skill plus magic acc mod) local magicacc = 0; --add acc for staves local affinityBonus = AffinityBonus(player, element); magicaccbonus = magicaccbonus + (affinityBonus-1) * 200; --base magic evasion (base magic evasion plus resistances(players), plus elemental defense(mobs) local magiceva = target:getMod(resistMod[element]); --get the difference of acc and eva, scale with level (3.33 at 10 to 0.44 at 75) local multiplier = 0; if player:getMainLvl() < 40 then multiplier = 100 / 120; else multiplier = 100 / (player:getMainLvl() * 3); end; local p = (magicacc * multiplier) - (magiceva * 0.45); magicaccbonus = magicaccbonus / 2; --add magicacc bonus p = p + magicaccbonus; --printf("acc: %f, eva: %f, bonus: %f", magicacc, magiceva, magicaccbonus); --add a flat bonus that won't get doubled in the previous step p = p + 75; --add a scaling bonus or penalty based on difference of targets level from caster local leveldiff = player:getMainLvl() - target:getMainLvl(); --[[if(leveldiff < 0) then p = p - (25 * ( (player:getMainLvl()) / 75 )) + leveldiff; else p = p + (25 * ( (player:getMainLvl()) / 75 )) + leveldiff; end]] p = p + leveldiff*2; --cap accuracy if(p > 95) then p = 95; elseif(p < 5) then p = 5; end p = p / 100; -- Resistance thresholds based on p. A higher p leads to lower resist rates, and a lower p leads to higher resist rates. local half = (1 - p); local quart = ((1 - p)^2); local eighth = ((1 - p)^3); local sixteenth = ((1 - p)^4); --print("HALF: "..half); --print("QUART: "..quart); --print("EIGHTH: "..eighth); --print("SIXTEENTH: "..sixteenth); local resvar = math.random(); -- Determine final resist based on which thresholds have been crossed. if(resvar <= sixteenth) then resist = 0.0625; --printf("Spell resisted to 1/16!!! Threshold = %u",sixteenth); elseif(resvar <= eighth) then resist = 0.125; --printf("Spell resisted to 1/8! Threshold = %u",eighth); elseif(resvar <= quart) then resist = 0.25; --printf("Spell resisted to 1/4. Threshold = %u",quart); elseif(resvar <= half) then resist = 0.5; --printf("Spell resisted to 1/2. Threshold = %u",half); else resist = 1.0; --printf("1.0"); end return resist; end; ----------------------------------- -- Author: Tenjou -- SKILL LEVEL CALCULATOR -- Returns a skill level based on level and rating. -- -- See the translation of aushacho's work by Themanii: -- http://home.comcast.net/~themanii/skill.html -- -- The arguments are skill rank (numerical), and level. 1 is A+, 2 is A-, and so on. ----------------------------------- function getSkillLvl(rank,level) local skill = 0; --Failsafe if(level <= 50) then --Levels 1-50 if(rank == 1 or rank == 2) then --A-Rated Skill skill = (((level-1)*3)+6); elseif(rank == 3 or rank == 4 or rank == 5) then --B-Rated Skill skill = (((level-1)*2.9)+5); elseif(rank == 6 or rank == 7 or rank == 8) then --C-Rated Skill skill = (((level-1)*2.8)+5); elseif(rank == 9) then --D-Rated Skill skill = (((level-1)*2.7)+4); elseif(rank == 10) then --E-Rated Skill skill = (((level-1)*2.5)+4); elseif(rank == 11) then --F-Rated Skill skill = (((level-1)*2.3)+4); end elseif(level > 50 and level <= 60) then --Levels 51-60 if(rank == 1 or rank == 2) then --A-Rated Skill skill = (((level-50)*5)+153); elseif(rank == 3 or rank == 4 or rank == 5) then --B-Rated Skill skill = (((level-50)*4.9)+147); elseif(rank == 6 or rank == 7 or rank == 8) then --C-Rated Skill skill = (((level-50)*4.8)+142); elseif(rank == 9) then --D-Rated Skill skill = (((level-50)*4.7)+136); elseif(rank == 10) then --E-Rated Skill skill = (((level-50)*4.5)+126); elseif(rank == 11) then --F-Rated Skill skill = (((level-50)*4.3)+116); end elseif(level > 60 and level <= 70) then --Levels 61-70 if(rank == 1) then --A+ Rated Skill skill = (((level-60)*4.85)+203); elseif(rank == 2) then --A- Rated Skill skill = (((level-60)*4.10)+203); elseif(rank == 3) then --B+ Rated Skill skill = (((level-60)*3.70)+196); elseif(rank == 4) then --B Rated Skill skill = (((level-60)*3.23)+196); elseif(rank == 5) then --B- Rated Skill skill = (((level-60)*2.70)+196); elseif(rank == 6) then --C+ Rated Skill skill = (((level-60)*2.50)+190); elseif(rank == 7) then --C Rated Skill skill = (((level-60)*2.25)+190); elseif(rank == 8) then --C- Rated Skill skill = (((level-60)*2.00)+190); elseif(rank == 9) then --D Rated Skill skill = (((level-60)*1.85)+183); elseif(rank == 10) then --E Rated Skill skill = (((level-60)*1.95)+171); elseif(rank == 11) then --F Rated Skill skill = (((level-60)*2.05)+159); end else --Level 71 and above if(rank == 1) then --A+ Rated Skill skill = (((level-70)*5)+251); elseif(rank == 2) then --A- Rated Skill skill = (((level-70)*5)+244); elseif(rank == 3) then --B+ Rated Skill skill = (((level-70)*3.70)+233); elseif(rank == 4) then --B Rated Skill skill = (((level-70)*3.23)+228); elseif(rank == 5) then --B- Rated Skill skill = (((level-70)*2.70)+223); elseif(rank == 6) then --C+ Rated Skill skill = (((level-70)*3)+215); elseif(rank == 7) then --C Rated Skill skill = (((level-70)*2.6)+212); elseif(rank == 8) then --C- Rated Skill skill = (((level-70)*2.00)+210); elseif(rank == 9) then --D Rated Skill skill = (((level-70)*1.85)+201); elseif(rank == 10) then --E Rated Skill skill = (((level-70)*1.95)+190); elseif(rank == 11) then --F Rated Skill skill = (((level-70)*2)+179); end end return skill; end; function handleAfflatusMisery(caster, spell, dmg) if(caster:hasStatusEffect(EFFECT_AFFLATUS_MISERY)) then local misery = caster:getMod(MOD_AFFLATUS_MISERY); --BGwiki puts the boost capping at 200% bonus at around 300hp if(misery > 300) then misery = 300; end; --So, if wee capped at 300, we'll make the boost it boost 2x (200% damage) local boost = 1 + (misery / 300); local preboost = dmg; dmg = math.floor(dmg * boost); --printf("AFFLATUS MISERY: Boosting %d -> %f, Final %d", preboost, boost, dmg); --Afflatus Mod is Used Up... caster:setMod(MOD_AFFLATUS_MISERY, 0) end return dmg; end; function finalMagicAdjustments(caster,target,spell,dmg) --Handles target's HP adjustment and returns UNSIGNED dmg (absorb message is set in this function) -- handle multiple targets if(caster:isSpellAoE(spell:getID())) then local total = spell:getTotalTargets(); if(total > 9) then -- ga spells on 10+ targets = 0.4 dmg = dmg * 0.4; elseif(total > 1) then -- -ga spells on 2 to 9 targets = 0.9 - 0.05T where T = number of targets dmg = dmg * (0.9 - 0.05 * total); end -- kill shadows -- target:delStatusEffect(EFFECT_COPY_IMAGE); -- target:delStatusEffect(EFFECT_BLINK); else -- this logic will eventually be moved here -- dmg = utils.takeShadows(target, dmg, 1); -- if(dmg == 0) then -- spell:setMsg(31); -- return 1; -- end end dmg = target:magicDmgTaken(dmg); if (dmg > 0) then dmg = dmg - target:getMod(MOD_PHALANX); utils.clamp(dmg, 0, 99999); end --handling stoneskin dmg = utils.stoneskin(target, dmg); dmg = utils.clamp(dmg, -99999, 99999); if (dmg < 0) then dmg = target:addHP(-dmg); spell:setMsg(7); else target:delHP(dmg); target:updateEnmityFromDamage(caster,dmg); -- Only add TP if the target is a mob if (target:getObjType() ~= TYPE_PC) then target:addTP(10); end end return dmg; end; function finalMagicNonSpellAdjustments(caster,target,ele,dmg) --Handles target's HP adjustment and returns SIGNED dmg (negative values on absorb) dmg = target:magicDmgTaken(dmg); if (dmg > 0) then dmg = dmg - target:getMod(MOD_PHALANX); utils.clamp(dmg, 0, 99999); end --handling stoneskin dmg = utils.stoneskin(target, dmg); dmg = utils.clamp(dmg, -99999, 99999); if (dmg < 0) then dmg = -(target:addHP(-dmg)); else target:delHP(dmg); end --Not updating enmity from damage, as this is primarily used for additional effects (which don't generate emnity) -- in the case that updating enmity is needed, do it manually after calling this --target:updateEnmityFromDamage(caster,dmg); return dmg; end; function adjustForTarget(target,dmg,ele) if (dmg > 0 and math.random(0,99) < target:getMod(absorbMod[ele])) then return -dmg; end if (math.random(0,99) < target:getMod(nullMod[ele])) then return 0; end --Moved non element specific absorb and null mod checks to core --TODO: update all lua calls to magicDmgTaken with appropriate element and remove this function return dmg; end; function calculateMagicBurst(caster, spell, target) local burst = 1.0; if (spell:getSpellGroup() == 3 and not caster:hasStatusEffect(EFFECT_BURST_AFFINITY)) then return burst; end local skillchainTier, skillchainCount = FormMagicBurst(spell:getElement(), target); if(skillchainTier > 0) then if(skillchainCount == 1) then burst = 1.3; elseif(skillchainCount == 2) then burst = 1.35; elseif(skillchainCount == 3) then burst = 1.40; elseif(skillchainCount == 4) then burst = 1.45; elseif(skillchainCount == 5) then burst = 1.50; else -- Something strange is going on if this occurs. burst = 1.0; end -- TODO: This should be getting the spell ID, and checking -- if it is an Ancient Magic II spell. Add 0.03 -- to burstBonus for each merit the caster has for -- the given spell. -- AM 2 get magic burst bonuses --id = spell:getID(); --if(id == 207 or id == 209 or id == 211 or id == 213 or id == 215 or id == 205) then -- if(AM2 Merit 1) then -- burstBonus = burstBonus + 0.03; -- elseif(AM2 Merit 2) then -- burstBonus += 0.06; -- elseif(AM2 Merit 3) then -- burstBonus += 0.09; -- elseif(AM2 Merit 4) then -- burstBonus += 0.12; -- end --end -- if AM2+ end -- Add in Magic Burst Bonus Modifier if (burst > 1) then burst = burst + (caster:getMod(MOD_MAG_BURST_BONUS) / 100); end return burst; end; function addBonuses(caster, spell, target, dmg, bonusmab) local ele = spell:getElement(); local affinityBonus = AffinityBonus(caster, spell:getElement()); dmg = math.floor(dmg * affinityBonus); if (bonusmab == nil) then bonusmab = 0; end local speciesReduction = target:getMod(defenseMod[ele]); speciesReduction = 1.00 - (speciesReduction/1000); dmg = math.floor(dmg * speciesReduction); local dayWeatherBonus = 1.00; local equippedMain = caster:getEquipID(SLOT_MAIN); local equippedWaist = caster:getEquipID(SLOT_WAIST); local weather = caster:getWeather(); if(weather == singleWeatherStrong[ele]) then -- Iridescence if(equippedMain == 18632 or equippedMain == 18633) then if(math.random() < 0.33 or equippedWaist == elementalObi[ele] or isHelixSpell(spell)) then dayWeatherBonus = dayWeatherBonus + 0.10; end end if(math.random() < 0.33 or equippedWaist == elementalObi[ele] or isHelixSpell(spell)) then dayWeatherBonus = dayWeatherBonus + 0.10; end elseif(caster:getWeather() == singleWeatherWeak[ele]) then if(math.random() < 0.33 or equippedWaist == elementalObiWeak[ele] or isHelixSpell(spell)) then dayWeatherBonus = dayWeatherBonus - 0.10; end elseif(weather == doubleWeatherStrong[ele]) then -- Iridescence if(equippedMain == 18632 or equippedMain == 18633) then if(math.random() < 0.33 or equippedWaist == elementalObi[ele] or isHelixSpell(spell)) then dayWeatherBonus = dayWeatherBonus + 0.10; end end if(math.random() < 0.33 or equippedWaist == elementalObi[ele] or isHelixSpell(spell)) then dayWeatherBonus = dayWeatherBonus + 0.25; end elseif(weather == doubleWeatherWeak[ele]) then if(math.random() < 0.33 or equippedWaist == elementalObiWeak[ele] or isHelixSpell(spell)) then dayWeatherBonus = dayWeatherBonus - 0.25; end end local dayElement = VanadielDayElement(); if(dayElement == dayStrong[ele]) then local equippedLegs = caster:getEquipID(SLOT_LEGS); if(equippedLegs == 15120 or equippedLegs == 15583) then dayWeatherBonus = dayWeatherBonus + 0.05; end if(math.random() < 0.33 or equippedWaist == elementalObi[ele] or isHelixSpell(spell)) then dayWeatherBonus = dayWeatherBonus + 0.10; end elseif(dayElement == dayWeak[ele]) then if(math.random() < 0.33 or equippedWaist == elementalObiWeak[ele] or isHelixSpell(spell)) then dayWeatherBonus = dayWeatherBonus + 0.10; end end if dayWeatherBonus > 1.35 then dayWeatherBonus = 1.35; end dmg = math.floor(dmg * dayWeatherBonus); local burst = calculateMagicBurst(caster, spell, target); if(burst > 1.0) then spell:setMsg(spell:getMagicBurstMessage()); -- "Magic Burst!" end dmg = math.floor(dmg * burst); local mabbonus = 0; if(spell:getID() >= 245 and spell:getID() <= 248) then mabbonus = 1 else local mab = caster:getMod(MOD_MATT) + bonusmab; if (spell:getElement() > 0 and spell:getElement() <= 6) then mab = mab + caster:getMerit(blmMerit[spell:getElement()]); end mabbonus = (100 + mab) / (100 + target:getMod(MOD_MDEF)); end if(mabbonus < 0) then mabbonus = 0; end dmg = math.floor(dmg * mabbonus); if (caster:hasStatusEffect(EFFECT_EBULLIENCE)) then local equippedHead = caster:getEquipID(SLOT_HEAD); if(equippedHead == 11183) then dmg = dmg * 1.25; --savant's bonnet +1 elseif(equippedHead == 11083) then dmg = dmg * 1.3; --savant's bonnet +2 else dmg = dmg * 1.2; end caster:delStatusEffectSilent(EFFECT_EBULLIENCE); end dmg = math.floor(dmg); -- print(affinityBonus); -- print(speciesReduction); -- print(dayWeatherBonus); -- print(burst); -- print(mab); -- print(magicDmgMod); return dmg; end; function addBonusesAbility(caster, ele, target, dmg, params) local affinityBonus = AffinityBonus(caster, ele); dmg = math.floor(dmg * affinityBonus); local speciesReduction = target:getMod(defenseMod[ele]); speciesReduction = 1.00 - (speciesReduction/1000); dmg = math.floor(dmg * speciesReduction); local dayWeatherBonus = 1.00; local equippedMain = caster:getEquipID(SLOT_MAIN); local equippedWaist = caster:getEquipID(SLOT_WAIST); local weather = caster:getWeather(); if(weather == singleWeatherStrong[ele]) then -- Iridescence if(equippedMain == 18632 or equippedMain == 18633) then if(math.random() < 0.33 or equippedWaist == elementalObi[ele] ) then dayWeatherBonus = dayWeatherBonus + 0.10; end end if(math.random() < 0.33 or equippedWaist == elementalObi[ele] ) then dayWeatherBonus = dayWeatherBonus + 0.10; end elseif(caster:getWeather() == singleWeatherWeak[ele]) then if(math.random() < 0.33 or equippedWaist == elementalObiWeak[ele] ) then dayWeatherBonus = dayWeatherBonus - 0.10; end elseif(weather == doubleWeatherStrong[ele]) then -- Iridescence if(equippedMain == 18632 or equippedMain == 18633) then if(math.random() < 0.33 or equippedWaist == elementalObi[ele] ) then dayWeatherBonus = dayWeatherBonus + 0.10; end end if(math.random() < 0.33 or equippedWaist == elementalObi[ele] ) then dayWeatherBonus = dayWeatherBonus + 0.25; end elseif(weather == doubleWeatherWeak[ele]) then if(math.random() < 0.33 or equippedWaist == elementalObiWeak[ele] ) then dayWeatherBonus = dayWeatherBonus - 0.25; end end local dayElement = VanadielDayElement(); if(dayElement == dayStrong[ele]) then local equippedLegs = caster:getEquipID(SLOT_LEGS); if(equippedLegs == 15120 or equippedLegs == 15583) then dayWeatherBonus = dayWeatherBonus + 0.05; end if(math.random() < 0.33 or equippedWaist == elementalObi[ele] ) then dayWeatherBonus = dayWeatherBonus + 0.10; end elseif(dayElement == dayWeak[ele]) then if(math.random() < 0.33 or equippedWaist == elementalObiWeak[ele] ) then dayWeatherBonus = dayWeatherBonus + 0.10; end end if dayWeatherBonus > 1.35 then dayWeatherBonus = 1.35; end dmg = math.floor(dmg * dayWeatherBonus); local mab = 1; if (params ~= nil and params.bonusmab ~= nil and params.includemab == true) then mab = (100 + caster:getMod(MOD_MATT) + params.bonusmab) / (100 + target:getMod(MOD_MDEF)); elseif (params == nil or (params ~= nil and params.includemab == true)) then mab = (100 + caster:getMod(MOD_MATT)) / (100 + target:getMod(MOD_MDEF)); end if(mab < 0) then mab = 0; end dmg = math.floor(dmg * mab); -- print(affinityBonus); -- print(speciesReduction); -- print(dayWeatherBonus); -- print(burst); -- print(mab); -- print(magicDmgMod); return dmg; end; --------------------------------------------------------------------- -- Author: ReaperX -- Elemental Debuff Potency functions --------------------------------------------------------------------- function getElementalDebuffDOT(INT) local DOT = 0; if (INT<= 39) then DOT = 1; elseif (INT <= 69) then DOT = 2; elseif (INT <= 99) then DOT = 3; elseif (INT <= 149) then DOT = 4; else DOT = 5; end return DOT; end; function getElementalDebuffStatDownFromDOT(dot) local stat_down = 0; if (dot == 1) then stat_down = 5; elseif (dot == 2) then stat_down = 7; elseif (dot == 3) then stat_down = 9; elseif (dot == 4) then stat_down = 11; else stat_down = 13; end return stat_down; end; function getHelixDuration(caster) --Dark Arts will further increase Helix duration, but testing is ongoing. local casterLevel = caster:getMainLvl(); local duration = 30; --fallthrough if(casterLevel <= 39) then duration = 30; elseif(casterLevel <= 59) then duration = 60; elseif(casterLevel <= 99) then duration = 90; end return duration; end; function isHelixSpell(spell) --Dark Arts will further increase Helix duration, but testing is ongoing. local id = spell:getID(); if id >= 278 and id <= 285 then return true; end return false; end; function handleThrenody(caster, target, spell, basePower, baseDuration, modifier) -- Process resitances local staff = AffinityBonus(caster, spell:getElement()); -- print("staff=" .. staff); local dCHR = (caster:getStat(MOD_CHR) - target:getStat(MOD_CHR)); -- print("dCHR=" .. dCHR); local resm = applyResistance(caster, spell, target, dCHR, SINGING_SKILL, staff); -- print("rsem=" .. resm); if(resm < 0.5) then -- print("resm resist"); spell:setMsg(85); return EFFECT_THRENODY; end -- Remove previous Threnody target:delStatusEffect(EFFECT_THRENODY); local iBoost = caster:getMod(MOD_THRENODY_EFFECT) + caster:getMod(MOD_ALL_SONGS_EFFECT); local power = basePower + iBoost*5; local duration = baseDuration * ((iBoost * 0.1) + (caster:getMod(MOD_SONG_DURATION_BONUS)/100) + 1); if (caster:hasStatusEffect(EFFECT_SOUL_VOICE)) then power = power * 2; elseif (caster:hasStatusEffect(EFFECT_MARCATO)) then power = power * 1.5; end if (caster:hasStatusEffect(EFFECT_TROUBADOUR)) then duration = duration * 2; end -- Set spell message and apply status effect target:addStatusEffect(EFFECT_THRENODY, power, 0, duration, 0, modifier, 0); return EFFECT_THRENODY; end; function handleNinjutsuDebuff(caster, target, spell, basePower, baseDuration, modifier) -- Add new target:addStatusEffectEx(EFFECT_NINJUTSU_ELE_DEBUFF, 0, basePower, 0, baseDuration, 0, modifier, 0); return EFFECT_NINJUTSU_ELE_DEBUFF; end; -- Returns true if you can overwrite the effect -- Example: canOverwrite(target, EFFECT_SLOW, 25) function canOverwrite(target, effect, power, mod) mod = mod or 1; local statusEffect = target:getStatusEffect(effect); -- effect not found so overwrite if(statusEffect == nil) then return true; end -- overwrite if its weaker if(statusEffect:getPower()*mod > power) then return false; end return true; end function doElementalNuke(caster, spell, target, spellParams) local DMG = 0; local V = 0; local M = 0; local dINT = caster:getStat(MOD_INT) - target:getStat(MOD_INT); local hasMultipleTargetReduction = spellParams.hasMultipleTargetReduction; --still unused!!! local resistBonus = spellParams.resistBonus; local mDMG = caster:getMod(MOD_MAGIC_DAMAGE); --[[ Calculate base damage: D = mDMG + V + (dINT × M) D is then floored For dINT reduce by amount factored into the V value (example: at 134 INT, when using V100 in the calculation, use dINT = 134-100 = 34) ]] if (dINT <= 49) then V = spellParams.V0; M = spellParams.M0; DMG = math.floor(DMG + mDMG + V + (dINT * M)); if (DMG <= 0) then return 0; end elseif (dINT >= 50 and dINT <= 99) then V = spellParams.V50; M = spellParams.M50; DMG = math.floor(DMG + mDMG + V + ((dINT - 50) * M)); elseif (dINT >= 100 and dINT <= 199) then V = spellParams.V100; M = spellParams.M100; DMG = math.floor(DMG + mDMG + V + ((dINT - 100) * M)); elseif (dINT > 199) then V = spellParams.V200; M = spellParams.M200; DMG = math.floor(DMG + mDMG + V + ((dINT - 200) * M)); end --get resist multiplier (1x if no resist) local diff = caster:getStat(MOD_INT) - target:getStat(MOD_INT); local resist = applyResistance(caster, spell, target, diff, ELEMENTAL_MAGIC_SKILL, resistBonus); --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 local ele = spell:getElement(); DMG = adjustForTarget(target, DMG, ele); --add in final adjustments DMG = finalMagicAdjustments(caster, target, spell, DMG); return DMG; end function doDivineNuke(V,M,caster,spell,target,hasMultipleTargetReduction,resistBonus) return doNuke(V,M,caster,spell,target,hasMultipleTargetReduction,resistBonus,DIVINE_MAGIC_SKILL,MOD_MND); end function doNinjutsuNuke(V,M,caster,spell,target,hasMultipleTargetReduction,resistBonus) return doNuke(V,M,caster,spell,target,hasMultipleTargetReduction,resistBonus,NINJUTSU_SKILL,MOD_INT); end function doNuke(V,M,caster,spell,target,hasMultipleTargetReduction,resistBonus,skill,modStat) --calculate raw damage local dmg = calculateMagicDamage(V,M,caster,spell,target,skill,modStat,hasMultipleTargetReduction); --get resist multiplier (1x if no resist) local resist = applyResistance(caster,spell,target,caster:getStat(modStat)-target:getStat(modStat),skill,resistBonus); --get the resisted damage dmg = dmg*resist; if(skill == NINJUTSU_SKILL) then -- boost ninjitsu damage -- 5% ninjitsu damage local head = caster:getEquipID(SLOT_HEAD); if(head == 15084) then dmg = math.floor(dmg * 1.05); end -- boost with Futae if(caster:hasStatusEffect(EFFECT_FUTAE)) then dmg = math.floor(dmg * 1.50); caster:delStatusEffect(EFFECT_FUTAE); end end --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 dmg = finalMagicAdjustments(caster,target,spell,dmg); return dmg; end function doDivineBanishNuke(V,M,caster,spell,target,hasMultipleTargetReduction,resistBonus) local skill = DIVINE_MAGIC_SKILL; local modStat = MOD_MND; --calculate raw damage local dmg = calculateMagicDamage(V,M,caster,spell,target,skill,modStat,hasMultipleTargetReduction); --get resist multiplier (1x if no resist) local resist = applyResistance(caster,spell,target,caster:getStat(modStat)-target:getStat(modStat),skill,resistBonus); --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()); --handling afflatus misery dmg = handleAfflatusMisery(caster, spell, dmg); --add in final adjustments dmg = finalMagicAdjustments(caster,target,spell,dmg); return dmg; end function calculateDurationForLvl(duration, spellLvl, targetLvl) if(targetLvl < spellLvl) then return duration * targetLvl / spellLvl; end return duration; end function calculateBarspellPower(caster,enhanceSkill) local meritBonus = caster:getMerit(MERIT_BAR_SPELL_EFFECT); --printf("Barspell: Merit Bonus +%d", meritBonus); if (enhanceSkill == nil or enhanceSkill < 0) then enhanceSkill = 0; end local power = 40 + 0.2 * enhanceSkill + meritBonus; local equippedLegs = caster:getEquipID(SLOT_LEGS); if(equippedLegs == 15119) then power = power + 20; elseif(equippedLegs == 15582) then power = power + 22; elseif(equippedLegs == 10712) then power = power + 25; end return power; end
gpl-3.0
The-HalcyonDays/darkstar
scripts/zones/Selbina/npcs/Gabwaleid.lua
17
1506
----------------------------------- -- Area: Selbina -- NPC: Gabwaleid -- Involved in Quest: Riding on the Clouds -- @pos -17 -7 11 248 ----------------------------------- package.loaded["scripts/zones/Selbina/TextIDs"] = nil; ----------------------------------- require("scripts/zones/Selbina/TextIDs"); require("scripts/globals/keyitems"); require("scripts/globals/quests"); ----------------------------------- -- onTrade Action ----------------------------------- function onTrade(player,npc,trade) if(player:getQuestStatus(JEUNO,RIDING_ON_THE_CLOUDS) == QUEST_ACCEPTED and player:getVar("ridingOnTheClouds_3") == 4) then if(trade:hasItemQty(1127,1) and trade:getItemCount() == 1) then -- Trade Kindred seal player:setVar("ridingOnTheClouds_3",0); player:tradeComplete(); player:addKeyItem(SOMBER_STONE); player:messageSpecial(KEYITEM_OBTAINED,SOMBER_STONE); end end end; ----------------------------------- -- onTrigger Action ----------------------------------- function onTrigger(player,npc) player:startEvent(0x0258); 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
The-HalcyonDays/darkstar
scripts/zones/Gusgen_Mines/npcs/Treasure_Chest.lua
12
3222
----------------------------------- -- Area: Gusgen Mines -- NPC: Treasure Chest -- Involved In Quest: The Goblin Tailor -- @zone 196 ----------------------------------- package.loaded["scripts/zones/Gusgen_Mines/TextIDs"] = nil; ----------------------------------- require("scripts/globals/keyitems"); require("scripts/globals/quests"); require("scripts/globals/settings"); require("scripts/globals/treasure"); require("scripts/zones/Gusgen_Mines/TextIDs"); local TreasureType = "Chest"; local TreasureLvL = 43; local TreasureMinLvL = 33; ----------------------------------- -- onTrade Action ----------------------------------- function onTrade(player,npc,trade) --trade:hasItemQty(1031,1); -- Treasure Key --trade:hasItemQty(1115,1); -- Skeleton Key --trade:hasItemQty(1023,1); -- Living Key --trade:hasItemQty(1022,1); -- Thief's Tools local questItemNeeded = 0; -- Player traded a key. if((trade:hasItemQty(1031,1) or trade:hasItemQty(1115,1) or trade:hasItemQty(1023,1) or trade:hasItemQty(1022,1)) and trade:getItemCount() == 1) then local zone = player:getZoneID(); -- IMPORTANT ITEM: The Goblin Tailor Quest ----------- if(player:getQuestStatus(JEUNO,THE_GOBLIN_TAILOR) >= QUEST_ACCEPTED and VanadielRSELocation() == 1 and VanadielRSERace() == player:getRace() and player:hasKeyItem(MAGICAL_PATTERN) == false) then questItemNeeded = 1; end -------------------------------------- local pack = openChance(player,npc,trade,TreasureType,TreasureLvL,TreasureMinLvL,questItemNeeded); local success = 0; if(pack[2] ~= nil) then player:messageSpecial(pack[2]); success = pack[1]; else success = pack[1]; end if(success ~= -2) then player:tradeComplete(); if(math.random() <= success) then local respawn = false; -- Succeded to open the coffer player:messageSpecial(CHEST_UNLOCKED); if(questItemNeeded == 1) then respawn = true; player:addKeyItem(MAGICAL_PATTERN); player:messageSpecial(KEYITEM_OBTAINED,MAGICAL_PATTERN); else player:setVar("["..zone.."]".."Treasure_"..TreasureType,os.time() + math.random(CHEST_MIN_ILLUSION_TIME,CHEST_MAX_ILLUSION_TIME)); local loot = chestLoot(zone,npc); -- print("loot array: "); -- debug -- print("[1]", loot[1]); -- debug -- print("[2]", loot[2]); -- debug if(loot[1]=="gil") then player:addGil(loot[2]*GIL_RATE); player:messageSpecial(GIL_OBTAINED,loot[2]*GIL_RATE); else -- Item player:addItem(loot[2]); player:messageSpecial(ITEM_OBTAINED,loot[2]); end end UpdateTreasureSpawnPoint(npc:getID(),respawn); end end end end; ----------------------------------- -- onTrigger Action ----------------------------------- function onTrigger(player,npc) player:messageSpecial(CHEST_LOCKED,1031); 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
areski/cookiecutter-lua
{{cookiecutter.repo_name}}/src/{{cookiecutter.repo_name}}.lua
1
1840
-- -- {{ cookiecutter.repo_name }}-{{ cookiecutter.version }} -- -- The MIT License (MIT) -- -- Copyright (c) {{ cookiecutter.year }}, {{ cookiecutter.full_name }} -- -- Permission is hereby granted, free of charge, to any person obtaining a copy of -- this software and associated documentation files (the "Software"), to deal in -- the Software without restriction, including without limitation the rights to -- use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of -- the Software, and to permit persons to whom the Software is furnished to do so, -- subject to the following conditions: -- The above copyright notice and this permission notice shall be included in all -- copies or substantial portions of the Software. -- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS -- FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR -- COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER -- IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -- CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -- local PKG_AUTHOR = '{{ cookiecutter.full_name }}' local PKG_EMAIL = '{{ cookiecutter.email }}' local PKG_VERSION = '{{ cookiecutter.version }}-1' local {{ cookiecutter.repo_name }} = { _VERSION = '{{ cookiecutter.version }}-1', } function {{ cookiecutter.repo_name }}:new (o) o = o or {} -- create object if user does not provide one setmetatable(o, self) self.__index = self return o end function {{ cookiecutter.repo_name }}:method(text) -- docstring if string.len(text) == 0 then return false end return true end return {{ cookiecutter.repo_name }}
mit
sinavafa/xzy
plugins/plugmanager.lua
22
3691
do local function run(msg, matches) if not is_sudo(msg) then return "you have not accsess to filemanager" end local receiver = get_receiver(msg) if matches[1] == 'بفرس' then local file = matches[3] if matches[2] == 'sticker' and not matches[4] then send_document(receiver, "./media/"..file..".webp", ok_cb, false) end if matches[2] == 'photo' then send_photo(receiver, "./media/"..file..".jpeg", ok_cb, false) send_photo(receiver, "./media/"..file..".jpg", ok_cb, false) send_photo(receiver, "./media/"..file..".png", ok_cb, false) end if matches[2] == 'GIF' and not matches[4] then send_photo(receiver, "./media/"..file..".gif", ok_cb, false) end if matches[2] == 'music' then send_audio(receiver, "./media/"..file..".mp3", ok_cb, false) send_audio(receiver, "./media/"..file..".flac", ok_cb, false) send_audio(receiver, "./media/"..file..".aac", ok_cb, false) end if matches[2] == 'video' then send_photo(receiver, "./media/"..file..".avi", ok_cb, false) send_photo(receiver, "./media/"..file..".mpeg", ok_cb, false) send_photo(receiver, "./media/"..file..".mp4", ok_cb, false) end if matches[2] == 'file' then local extension = matches[4] send_document(receiver, "./media/"..file..'.'..extension, ok_cb, false) end if matches[2] == 'plugin' then send_document(receiver, "./plugins/"..file..".lua", ok_cb, false) end if matches[2] == 'dev' or matches[2] == 'm4ster' or matches[2] == 'master' or matches[2] == 'developer' or matches[2] == 'creator'then local extension = matches[4] if matches[3] == 'file' then send_document(receiver, "./media/M4STER.png", ok_cb, false) elseif matches[3] ~= 'file' or not matches[3] then send_photo(receiver, "./media/M4STER.png", ok_cb, false) end end if matches[2] == 'manual' and is_admin(msg) then local ruta = matches[3] local document = matches[4] send_document(receiver, "./"..ruta.."/"..document, ok_cb, false) end end if matches[1] == 'extensions' then return 'No disponible actualmente' end if matches[1] == 'list' and matches[2] == 'files' then return 'No disponible actualmente' --send_document(receiver, "./media/files/files.txt", ok_cb, false) end end return { description = "Kicking ourself (bot) from unmanaged groups.", usage = { "!list files : Envía un archivo con los nombres de todo lo que se puede enviar", "!extensions : Envía un mensaje con las extensiones para cada tipo de archivo permitidas", "➖➖➖➖➖➖➖➖➖➖", "!send sticker <nombre del sticker> : Envía ese sticker del servidor", "!send photo <nombre de la foto> <extension de la foto> : Envía esa foto del servidor", "!send GIF <nombre del GIF> : Envía ese GIF del servidor", "!send music <nombre de la canción <extension de la canción> : Envía esa canción del servidor", "!send video <nombre del video> <extension del video> : Envía ese video del servidor", "!send file <nombre del archivo> <extension del archivo> : Envía ese archivo del servidor", "!send plugin <Nombre del plugin> : Envía ese archivo del servidor", "!send manual <Ruta de archivo> <Nombre del plugin> : Envía un archivo desde el directorio TeleSeed", "!send dev : Envía una foto del desarrollador" }, patterns = { "^(بفرس) (.*) (.*) (.*)$", "^(بفرس) (.*) (.*)$", "^(بفرس) (.*)$", "^[!/](list) (files)$", "^[!/](extensions)$" }, run = run } end --MODDED by @M4STER_ANGEL
gpl-2.0
The-HalcyonDays/darkstar
scripts/zones/Windurst_Waters/npcs/Zelala.lua
38
1035
----------------------------------- -- Area: Windurst Waters -- NPC: Zelala -- Type: Map Marker -- @zone: 238 -- @pos 169.855 -1.295 -3.238 -- -- Auto-Script: Requires Verification (Verfied By Brawndo) ----------------------------------- package.loaded["scripts/zones/Windurst_Waters/TextIDs"] = nil; ----------------------------------- ----------------------------------- -- onTrade Action ----------------------------------- function onTrade(player,npc,trade) end; ----------------------------------- -- onTrigger Action ----------------------------------- function onTrigger(player,npc) player:startEvent(0x03c0); 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
hxw804781317/MT7620N
package/ralink/ui/luci-mtk/src/applications/luci-asterisk/luasrc/model/cbi/asterisk-mod-format.lua
80
3636
--[[ LuCI - Lua Configuration Interface Copyright 2008 Steven Barth <steven@midlink.org> Copyright 2008 Jo-Philipp Wich <xm@leipzig.freifunk.net> Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 $Id$ ]]-- cbimap = Map("asterisk", "asterisk", "") module = cbimap:section(TypedSection, "module", "Modules", "") module.anonymous = true format_au = module:option(ListValue, "format_au", "Sun Microsystems AU format (signed linear)", "") format_au:value("yes", "Load") format_au:value("no", "Do Not Load") format_au:value("auto", "Load as Required") format_au.rmempty = true format_g723 = module:option(ListValue, "format_g723", "G.723.1 Simple Timestamp File Format", "") format_g723:value("yes", "Load") format_g723:value("no", "Do Not Load") format_g723:value("auto", "Load as Required") format_g723.rmempty = true format_g726 = module:option(ListValue, "format_g726", "Raw G.726 (16/24/32/40kbps) data", "") format_g726:value("yes", "Load") format_g726:value("no", "Do Not Load") format_g726:value("auto", "Load as Required") format_g726.rmempty = true format_g729 = module:option(ListValue, "format_g729", "Raw G729 data", "") format_g729:value("yes", "Load") format_g729:value("no", "Do Not Load") format_g729:value("auto", "Load as Required") format_g729.rmempty = true format_gsm = module:option(ListValue, "format_gsm", "Raw GSM data", "") format_gsm:value("yes", "Load") format_gsm:value("no", "Do Not Load") format_gsm:value("auto", "Load as Required") format_gsm.rmempty = true format_h263 = module:option(ListValue, "format_h263", "Raw h263 data", "") format_h263:value("yes", "Load") format_h263:value("no", "Do Not Load") format_h263:value("auto", "Load as Required") format_h263.rmempty = true format_jpeg = module:option(ListValue, "format_jpeg", "JPEG (Joint Picture Experts Group) Image", "") format_jpeg:value("yes", "Load") format_jpeg:value("no", "Do Not Load") format_jpeg:value("auto", "Load as Required") format_jpeg.rmempty = true format_pcm = module:option(ListValue, "format_pcm", "Raw uLaw 8khz Audio support (PCM)", "") format_pcm:value("yes", "Load") format_pcm:value("no", "Do Not Load") format_pcm:value("auto", "Load as Required") format_pcm.rmempty = true format_pcm_alaw = module:option(ListValue, "format_pcm_alaw", "load => .so ; Raw aLaw 8khz PCM Audio support", "") format_pcm_alaw:value("yes", "Load") format_pcm_alaw:value("no", "Do Not Load") format_pcm_alaw:value("auto", "Load as Required") format_pcm_alaw.rmempty = true format_sln = module:option(ListValue, "format_sln", "Raw Signed Linear Audio support (SLN)", "") format_sln:value("yes", "Load") format_sln:value("no", "Do Not Load") format_sln:value("auto", "Load as Required") format_sln.rmempty = true format_vox = module:option(ListValue, "format_vox", "Dialogic VOX (ADPCM) File Format", "") format_vox:value("yes", "Load") format_vox:value("no", "Do Not Load") format_vox:value("auto", "Load as Required") format_vox.rmempty = true format_wav = module:option(ListValue, "format_wav", "Microsoft WAV format (8000hz Signed Line", "") format_wav:value("yes", "Load") format_wav:value("no", "Do Not Load") format_wav:value("auto", "Load as Required") format_wav.rmempty = true format_wav_gsm = module:option(ListValue, "format_wav_gsm", "Microsoft WAV format (Proprietary GSM)", "") format_wav_gsm:value("yes", "Load") format_wav_gsm:value("no", "Do Not Load") format_wav_gsm:value("auto", "Load as Required") format_wav_gsm.rmempty = true return cbimap
gpl-2.0
The-HalcyonDays/darkstar
scripts/zones/Lower_Jeuno/npcs/Vola.lua
17
3168
----------------------------------- -- Area: Lower Jeuno -- NPC: Vola -- Starts and Finishes Quest: Fistful of Fury -- Involved in Quests: Beat Around the Bushin (before the quest) -- @zone 245 -- @pos 43 3 -45 ----------------------------------- package.loaded["scripts/zones/Lower_Jeuno/TextIDs"] = nil; package.loaded["scripts/globals/settings"] = nil; ----------------------------------- require("scripts/globals/settings"); require("scripts/globals/titles"); require("scripts/globals/shop"); require("scripts/globals/quests"); require("scripts/zones/Lower_Jeuno/TextIDs"); ----------------------------------- -- onTrade Action ----------------------------------- function onTrade(player,npc,trade) FistfulOfFury = player:getQuestStatus(JEUNO,FISTFUL_OF_FURY); if(FistfulOfFury == QUEST_ACCEPTED and trade:hasItemQty(1012,1) == true and trade:hasItemQty(1013,1) == true and trade:hasItemQty(1014,1) == true and trade:getItemCount() == 3) then player:startEvent(0x00D5); -- Finish Quest "Fistful of Fury" end end; ----------------------------------- -- onTrigger Action ----------------------------------- function onTrigger(player,npc) FistfulOfFury = player:getQuestStatus(JEUNO,FISTFUL_OF_FURY); BeatAroundTheBushin = player:getQuestStatus(JEUNO,BEAT_AROUND_THE_BUSHIN); if(player:getFameLevel(NORG) >= 3 and FistfulOfFury == QUEST_AVAILABLE and player:getQuestStatus(BASTOK,SILENCE_OF_THE_RAMS) == QUEST_COMPLETED) then player:startEvent(0x00D8); -- Start Quest "Fistful of Fury" elseif(FistfulOfFury == QUEST_ACCEPTED) then player:startEvent(0x00D7); -- During Quest "Fistful of Fury" elseif(BeatAroundTheBushin == QUEST_AVAILABLE and player:getMainJob() == 2 and player:getMainLvl() >= 71 and player:getFameLevel(NORG) >= 6) then player:startEvent(0x00a0); -- Start Quest "Beat Around the Bushin" elseif(BeatAroundTheBushin ~= QUEST_AVAILABLE) then player:startEvent(0x00D6); -- During & After Quest "Beat Around the Bushin" else player:startEvent(0x00D4); -- Standard dialog end end; ----------------------------------- -- onEventUpdate ----------------------------------- function onEventUpdate(player,csid,option) --printf("CSID: %u",csid); --printf("RESULT: %u",option); end; ----------------------------------- -- onEventFinish ----------------------------------- function onEventFinish(player,csid,option) --printf("CSID: %u",csid); --printf("RESULT: %u",option); if(csid == 0x00D8 and option == 1) then player:addQuest(JEUNO,FISTFUL_OF_FURY); elseif(csid == 0x00D5) then if (player:getFreeSlotsCount() == 0) then player:messageSpecial(ITEM_CANNOT_BE_OBTAINED,13202); else player:addTitle(BROWN_BELT); player:addItem(13202); player:messageSpecial(ITEM_OBTAINED,13202); player:addFame(NORG,NORG_FAME*125); player:tradeComplete(); player:completeQuest(JEUNO,FISTFUL_OF_FURY); end elseif(csid == 0x00a0 and player:getQuestStatus(JEUNO,BEAT_AROUND_THE_BUSHIN) == QUEST_AVAILABLE) then player:setVar("BeatAroundTheBushin",1); -- For the next quest "Beat around the Bushin" end end;
gpl-3.0
The-HalcyonDays/darkstar
scripts/zones/Rabao/npcs/HomePoint#1.lua
12
1234
----------------------------------- -- Area: Rabao -- NPC: HomePoint#1 -- @pos -29.276 0.001 -76.585 247 ----------------------------------- package.loaded["scripts/zones/Rabao/TextIDs"] = nil; require("scripts/globals/settings"); require("scripts/zones/Rabao/TextIDs"); require("scripts/globals/homepoint"); ----------------------------------- -- onTrade Action ----------------------------------- function onTrade(player,npc,trade) end; ----------------------------------- -- onTrigger Action ----------------------------------- function onTrigger(player,npc) homepointMenu( player, 0x21fc, 42); 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
Giorox/AngelionOT-Repo
data/npc/scripts/Grof, the guard.lua
1
1617
local keywordHandler = KeywordHandler:new() local npcHandler = NpcHandler:new(keywordHandler) NpcSystem.parseParameters(npcHandler) local talkState = {} function onCreatureAppear(cid) npcHandler:onCreatureAppear(cid) end function onCreatureDisappear(cid) npcHandler:onCreatureDisappear(cid) end function onCreatureSay(cid, type, msg) npcHandler:onCreatureSay(cid, type, msg) end function onThink() npcHandler:onThink() end function creatureSayCallback(cid, type, msg) if(not npcHandler:isFocused(cid)) then return false end local talkUser = NPCHANDLER_CONVBEHAVIOR == CONVERSATION_DEFAULT and 0 or cid local storage = getPlayerStorageValue(cid, 1889) if msgcontains(msg, 'trouble') then if storage == 16 then npcHandler:say("I think it'll rain soon and I left some laundry out for drying.", cid) setPlayerStorageValue(cid, 1889, 17) else npcHandler:say("I don't feel like chatting.", cid) end elseif msgcontains(msg, 'authorities') then if storage == 17 then npcHandler:say("Yes I'm pretty sure they have failed to send the laundry police to take care of it, you fool.", cid) setPlayerStorageValue(cid, 1889, 18) doSendMagicEffect(getCreaturePosition(cid), CONST_ME_HOLYAREA) else npcHandler:say("I don't feel like chatting.", cid) end end return TRUE end npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback) npcHandler:addModule(FocusModule:new())
gpl-3.0
aqasaeed/w
plugins/stats.lua
7
4000
do -- Returns a table with `name` and `msgs` local function get_msgs_user_chat(user_id, chat_id) local user_info = {} local uhash = 'user:'..user_id local user = redis:hgetall(uhash) local um_hash = 'msgs:'..user_id..':'..chat_id user_info.msgs = tonumber(redis:get(um_hash) or 0) user_info.name = user_print_name(user)..' ['..user_id..']' return user_info end local function chat_stats(chat_id) -- Users on chat local hash = 'chat:'..chat_id..':users' local users = redis:smembers(hash) local users_info = {} -- Get user info for i = 1, #users do local user_id = users[i] local user_info = get_msgs_user_chat(user_id, chat_id) table.insert(users_info, user_info) end -- Sort users by msgs number table.sort(users_info, function(a, b) if a.msgs and b.msgs then return a.msgs > b.msgs end end) local text = 'users in this chat \n' for k,user in pairs(users_info) do text = text..user.name..' = '..user.msgs..'\n' end local file = io.open("./groups/lists/"..chat_id.."stats.txt", "w") file:write(text) file:flush() file:close() send_document("chat#id"..chat_id,"./groups/lists/"..chat_id.."stats.txt", ok_cb, false) return --text end local function chat_stats2(chat_id) -- Users on chat local hash = 'chat:'..chat_id..':users' local users = redis:smembers(hash) local users_info = {} -- Get user info for i = 1, #users do local user_id = users[i] local user_info = get_msgs_user_chat(user_id, chat_id) table.insert(users_info, user_info) end -- Sort users by msgs number table.sort(users_info, function(a, b) if a.msgs and b.msgs then return a.msgs > b.msgs end end) local text = 'users in this chat \n' for k,user in pairs(users_info) do text = text..user.name..' = '..user.msgs..'\n' end return text end -- Save stats, ban user local function bot_stats() local redis_scan = [[ local cursor = '0' local count = 0 repeat local r = redis.call("SCAN", cursor, "MATCH", KEYS[1]) cursor = r[1] count = count + #r[2] until cursor == '0' return count]] -- Users local hash = 'msgs:*:'..our_id local r = redis:eval(redis_scan, 1, hash) local text = 'Users: '..r hash = 'chat:*:users' r = redis:eval(redis_scan, 1, hash) text = text..'\nGroups: '..r return text end local function run(msg, matches) if matches[1]:lower() == 'teleseed' then -- Put everything you like :) local about = _config.about_text local name = user_print_name(msg.from) savelog(msg.to.id, name.." ["..msg.from.id.."] used /teleseed ") return about end if matches[1]:lower() == "statslist" then if not is_momod(msg) then return "For mods only !" end local chat_id = msg.to.id local name = user_print_name(msg.from) savelog(msg.to.id, name.." ["..msg.from.id.."] requested group stats ") return chat_stats2(chat_id) end if matches[1]:lower() == "stats" then if not matches[2] then if not is_momod(msg) then return "For mods only !" end if msg.to.type == 'chat' then local chat_id = msg.to.id local name = user_print_name(msg.from) savelog(msg.to.id, name.." ["..msg.from.id.."] requested group stats ") return chat_stats(chat_id) else return end end if matches[2] == "teleseed" then -- Put everything you like :) if not is_admin(msg) then return "For admins only !" else return bot_stats() end end if matches[2] == "group" then if not is_admin(msg) then return "For admins only !" else return chat_stats(matches[3]) end end end end return { patterns = { "^[!/]([Ss]tats)$", "^[!/]([Ss]tatslist)$", "^[!/]([Ss]tats) (group) (%d+)", "^[!/]([Ss]tats) (teleseed)",-- Put everything you like :) "^[!/]([Tt]eleseed)"-- Put everything you like : }, run = run } end
gpl-2.0
DarkstarProject/darkstar
scripts/globals/mobskills/spirit_tap.lua
11
1292
--------------------------------------------- -- Spirit Tap -- Attempts to absorb one buff from a single target, or otherwise steals HP. -- Type: Magical -- Utsusemi/Blink absorb: Ignores Shadows -- Range: Melee -- Notes: Can be any (positive) buff, including food. Will drain about 100HP if it can't take any buffs --------------------------------------------- require("scripts/globals/monstertpmoves") require("scripts/globals/settings") require("scripts/globals/status") require("scripts/globals/msg") --------------------------------------------- function onMobSkillCheck(target,mob,skill) if (mob:isMobType(MOBTYPE_NOTORIOUS)) then return 1 end return 0 end function onMobWeaponSkill(target, mob, skill) -- try to drain buff local effect = mob:stealStatusEffect(target, dsp.effectFlag.DISPELABLE+dsp.effectFlag.FOOD) local dmg = 0 if (effect ~= 0) then skill:setMsg(dsp.msg.basic.EFFECT_DRAINED) return 1 else -- time to drain HP. 50-100 local power = math.random(0, 51) + 50 dmg = MobFinalAdjustments(power,mob,skill,target,dsp.attackType.MAGICAL,dsp.damageType.DARK,MOBPARAM_IGNORE_SHADOWS) skill:setMsg(MobPhysicalDrainMove(mob, target, skill, MOBDRAIN_HP, dmg)) end return dmg end
gpl-3.0
DarkstarProject/darkstar
scripts/globals/mobskills/glacial_breath.lua
11
1300
--------------------------------------------- -- Glacial Breath -- -- Description: Deals Ice damage to enemies within a fan-shaped area. -- Type: Breath -- Utsusemi/Blink absorb: Ignores shadows -- Range: Unknown cone -- Notes: Used only by Jormungand and Isgebind --------------------------------------------- require("scripts/globals/settings") require("scripts/globals/status") require("scripts/globals/monstertpmoves") require("scripts/globals/utils") --------------------------------------------- function onMobSkillCheck(target,mob,skill) if (mob:hasStatusEffect(dsp.effect.BLOOD_WEAPON)) then return 1 elseif (target:isBehind(mob, 48) == true) then return 1 elseif (mob:AnimationSub() == 1) then return 1 end return 0 end function onMobWeaponSkill(target, mob, skill) local dmgmod = MobBreathMove(mob, target, 0.2, 1.25, dsp.magic.ele.ICE, 1400) local angle = mob:getAngle(target) angle = mob:getRotPos() - angle dmgmod = dmgmod * ((128-math.abs(angle))/128) dmgmod = utils.clamp(dmgmod, 50, 1600) local dmg = MobFinalAdjustments(dmgmod,mob,skill,target,dsp.attackType.BREATH,dsp.damageType.ICE,MOBPARAM_IGNORE_SHADOWS) target:takeDamage(dmg, mob, dsp.attackType.BREATH, dsp.damageType.ICE) return dmg end
gpl-3.0
misterdustinface/Beyond-the-Wheel
Beyond-the-Wheel/src/hump/signal.lua
27
2769
--[[ Copyright (c) 2012-2013 Matthias Richter Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. Except as contained in this notice, the name(s) of the above copyright holders shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ]]-- local Registry = {} Registry.__index = function(self, key) return Registry[key] or (function() local t = {} rawset(self, key, t) return t end)() end function Registry:register(s, f) self[s][f] = f return f end function Registry:emit(s, ...) for f in pairs(self[s]) do f(...) end end function Registry:remove(s, ...) local f = {...} for i = 1,select('#', ...) do self[s][f[i]] = nil end end function Registry:clear(...) local s = {...} for i = 1,select('#', ...) do self[s[i]] = {} end end function Registry:emit_pattern(p, ...) for s in pairs(self) do if s:match(p) then self:emit(s, ...) end end end function Registry:remove_pattern(p, ...) for s in pairs(self) do if s:match(p) then self:remove(s, ...) end end end function Registry:clear_pattern(p) for s in pairs(self) do if s:match(p) then self[s] = {} end end end -- the module local function new() local registry = setmetatable({}, Registry) return setmetatable({ new = new, register = function(...) return registry:register(...) end, emit = function(...) registry:emit(...) end, remove = function(...) registry:remove(...) end, clear = function(...) registry:clear(...) end, emit_pattern = function(...) registry:emit_pattern(...) end, remove_pattern = function(...) registry:remove_pattern(...) end, clear_pattern = function(...) registry:clear_pattern(...) end, }, {__call = new}) end return new()
gpl-2.0
marcel-sch/luci
contrib/luasrcdiet/lua/optlex.lua
125
31588
--[[-------------------------------------------------------------------- optlex.lua: does lexer-based optimizations This file is part of LuaSrcDiet. Copyright (c) 2008 Kein-Hong Man <khman@users.sf.net> The COPYRIGHT file describes the conditions under which this software may be distributed. See the ChangeLog for more information. ----------------------------------------------------------------------]] --[[-------------------------------------------------------------------- -- NOTES: -- * For more lexer-based optimization ideas, see the TODO items or -- look at technotes.txt. -- * TODO: general string delimiter conversion optimizer -- * TODO: (numbers) warn if overly significant digit ----------------------------------------------------------------------]] local base = _G local string = require "string" module "optlex" local match = string.match local sub = string.sub local find = string.find local rep = string.rep local print ------------------------------------------------------------------------ -- variables and data structures ------------------------------------------------------------------------ -- error function, can override by setting own function into module error = base.error warn = {} -- table for warning flags local stoks, sinfos, stoklns -- source lists local is_realtoken = { -- significant (grammar) tokens TK_KEYWORD = true, TK_NAME = true, TK_NUMBER = true, TK_STRING = true, TK_LSTRING = true, TK_OP = true, TK_EOS = true, } local is_faketoken = { -- whitespace (non-grammar) tokens TK_COMMENT = true, TK_LCOMMENT = true, TK_EOL = true, TK_SPACE = true, } local opt_details -- for extra information ------------------------------------------------------------------------ -- true if current token is at the start of a line -- * skips over deleted tokens via recursion ------------------------------------------------------------------------ local function atlinestart(i) local tok = stoks[i - 1] if i <= 1 or tok == "TK_EOL" then return true elseif tok == "" then return atlinestart(i - 1) end return false end ------------------------------------------------------------------------ -- true if current token is at the end of a line -- * skips over deleted tokens via recursion ------------------------------------------------------------------------ local function atlineend(i) local tok = stoks[i + 1] if i >= #stoks or tok == "TK_EOL" or tok == "TK_EOS" then return true elseif tok == "" then return atlineend(i + 1) end return false end ------------------------------------------------------------------------ -- counts comment EOLs inside a long comment -- * in order to keep line numbering, EOLs need to be reinserted ------------------------------------------------------------------------ local function commenteols(lcomment) local sep = #match(lcomment, "^%-%-%[=*%[") local z = sub(lcomment, sep + 1, -(sep - 1)) -- remove delims local i, c = 1, 0 while true do local p, q, r, s = find(z, "([\r\n])([\r\n]?)", i) if not p then break end -- if no matches, done i = p + 1 c = c + 1 if #s > 0 and r ~= s then -- skip CRLF or LFCR i = i + 1 end end return c end ------------------------------------------------------------------------ -- compares two tokens (i, j) and returns the whitespace required -- * important! see technotes.txt for more information -- * only two grammar/real tokens are being considered -- * if "", no separation is needed -- * if " ", then at least one whitespace (or EOL) is required ------------------------------------------------------------------------ local function checkpair(i, j) local match = match local t1, t2 = stoks[i], stoks[j] -------------------------------------------------------------------- if t1 == "TK_STRING" or t1 == "TK_LSTRING" or t2 == "TK_STRING" or t2 == "TK_LSTRING" then return "" -------------------------------------------------------------------- elseif t1 == "TK_OP" or t2 == "TK_OP" then if (t1 == "TK_OP" and (t2 == "TK_KEYWORD" or t2 == "TK_NAME")) or (t2 == "TK_OP" and (t1 == "TK_KEYWORD" or t1 == "TK_NAME")) then return "" end if t1 == "TK_OP" and t2 == "TK_OP" then -- for TK_OP/TK_OP pairs, see notes in technotes.txt local op, op2 = sinfos[i], sinfos[j] if (match(op, "^%.%.?$") and match(op2, "^%.")) or (match(op, "^[~=<>]$") and op2 == "=") or (op == "[" and (op2 == "[" or op2 == "=")) then return " " end return "" end -- "TK_OP" + "TK_NUMBER" case local op = sinfos[i] if t2 == "TK_OP" then op = sinfos[j] end if match(op, "^%.%.?%.?$") then return " " end return "" -------------------------------------------------------------------- else-- "TK_KEYWORD" | "TK_NAME" | "TK_NUMBER" then return " " -------------------------------------------------------------------- end end ------------------------------------------------------------------------ -- repack tokens, removing deletions caused by optimization process ------------------------------------------------------------------------ local function repack_tokens() local dtoks, dinfos, dtoklns = {}, {}, {} local j = 1 for i = 1, #stoks do local tok = stoks[i] if tok ~= "" then dtoks[j], dinfos[j], dtoklns[j] = tok, sinfos[i], stoklns[i] j = j + 1 end end stoks, sinfos, stoklns = dtoks, dinfos, dtoklns end ------------------------------------------------------------------------ -- number optimization -- * optimization using string formatting functions is one way of doing -- this, but here, we consider all cases and handle them separately -- (possibly an idiotic approach...) -- * scientific notation being generated is not in canonical form, this -- may or may not be a bad thing, feedback welcome -- * note: intermediate portions need to fit into a normal number range -- * optimizations can be divided based on number patterns: -- * hexadecimal: -- (1) no need to remove leading zeros, just skip to (2) -- (2) convert to integer if size equal or smaller -- * change if equal size -> lose the 'x' to reduce entropy -- (3) number is then processed as an integer -- (4) note: does not make 0[xX] consistent -- * integer: -- (1) note: includes anything with trailing ".", ".0", ... -- (2) remove useless fractional part, if present, e.g. 123.000 -- (3) remove leading zeros, e.g. 000123 -- (4) switch to scientific if shorter, e.g. 123000 -> 123e3 -- * with fraction: -- (1) split into digits dot digits -- (2) if no integer portion, take as zero (can omit later) -- (3) handle degenerate .000 case, after which the fractional part -- must be non-zero (if zero, it's matched as an integer) -- (4) remove trailing zeros for fractional portion -- (5) p.q where p > 0 and q > 0 cannot be shortened any more -- (6) otherwise p == 0 and the form is .q, e.g. .000123 -- (7) if scientific shorter, convert, e.g. .000123 -> 123e-6 -- * scientific: -- (1) split into (digits dot digits) [eE] ([+-] digits) -- (2) if significand has ".", shift it out so it becomes an integer -- (3) if significand is zero, just use zero -- (4) remove leading zeros for significand -- (5) shift out trailing zeros for significand -- (6) examine exponent and determine which format is best: -- integer, with fraction, scientific ------------------------------------------------------------------------ local function do_number(i) local before = sinfos[i] -- 'before' local z = before -- working representation local y -- 'after', if better -------------------------------------------------------------------- if match(z, "^0[xX]") then -- hexadecimal number local v = base.tostring(base.tonumber(z)) if #v <= #z then z = v -- change to integer, AND continue else return -- no change; stick to hex end end -------------------------------------------------------------------- if match(z, "^%d+%.?0*$") then -- integer or has useless frac z = match(z, "^(%d+)%.?0*$") -- int portion only if z + 0 > 0 then z = match(z, "^0*([1-9]%d*)$") -- remove leading zeros local v = #match(z, "0*$") local nv = base.tostring(v) if v > #nv + 1 then -- scientific is shorter z = sub(z, 1, #z - v).."e"..nv end y = z else y = "0" -- basic zero end -------------------------------------------------------------------- elseif not match(z, "[eE]") then -- number with fraction part local p, q = match(z, "^(%d*)%.(%d+)$") -- split if p == "" then p = 0 end -- int part zero if q + 0 == 0 and p == 0 then y = "0" -- degenerate .000 case else -- now, q > 0 holds and p is a number local v = #match(q, "0*$") -- remove trailing zeros if v > 0 then q = sub(q, 1, #q - v) end -- if p > 0, nothing else we can do to simplify p.q case if p + 0 > 0 then y = p.."."..q else y = "."..q -- tentative, e.g. .000123 local v = #match(q, "^0*") -- # leading spaces local w = #q - v -- # significant digits local nv = base.tostring(#q) -- e.g. compare 123e-6 versus .000123 if w + 2 + #nv < 1 + #q then y = sub(q, -w).."e-"..nv end end end -------------------------------------------------------------------- else -- scientific number local sig, ex = match(z, "^([^eE]+)[eE]([%+%-]?%d+)$") ex = base.tonumber(ex) -- if got ".", shift out fractional portion of significand local p, q = match(sig, "^(%d*)%.(%d*)$") if p then ex = ex - #q sig = p..q end if sig + 0 == 0 then y = "0" -- basic zero else local v = #match(sig, "^0*") -- remove leading zeros sig = sub(sig, v + 1) v = #match(sig, "0*$") -- shift out trailing zeros if v > 0 then sig = sub(sig, 1, #sig - v) ex = ex + v end -- examine exponent and determine which format is best local nex = base.tostring(ex) if ex == 0 then -- it's just an integer y = sig elseif ex > 0 and (ex <= 1 + #nex) then -- a number y = sig..rep("0", ex) elseif ex < 0 and (ex >= -#sig) then -- fraction, e.g. .123 v = #sig + ex y = sub(sig, 1, v).."."..sub(sig, v + 1) elseif ex < 0 and (#nex >= -ex - #sig) then -- e.g. compare 1234e-5 versus .01234 -- gives: #sig + 1 + #nex >= 1 + (-ex - #sig) + #sig -- -> #nex >= -ex - #sig v = -ex - #sig y = "."..rep("0", v)..sig else -- non-canonical scientific representation y = sig.."e"..ex end end--if sig end -------------------------------------------------------------------- if y and y ~= sinfos[i] then if opt_details then print("<number> (line "..stoklns[i]..") "..sinfos[i].." -> "..y) opt_details = opt_details + 1 end sinfos[i] = y end end ------------------------------------------------------------------------ -- string optimization -- * note: works on well-formed strings only! -- * optimizations on characters can be summarized as follows: -- \a\b\f\n\r\t\v -- no change -- \\ -- no change -- \"\' -- depends on delim, other can remove \ -- \[\] -- remove \ -- \<char> -- general escape, remove \ -- \<eol> -- normalize the EOL only -- \ddd -- if \a\b\f\n\r\t\v, change to latter -- if other < ascii 32, keep ddd but zap leading zeros -- if >= ascii 32, translate it into the literal, then also -- do escapes for \\,\",\' cases -- <other> -- no change -- * switch delimiters if string becomes shorter ------------------------------------------------------------------------ local function do_string(I) local info = sinfos[I] local delim = sub(info, 1, 1) -- delimiter used local ndelim = (delim == "'") and '"' or "'" -- opposite " <-> ' local z = sub(info, 2, -2) -- actual string local i = 1 local c_delim, c_ndelim = 0, 0 -- "/' counts -------------------------------------------------------------------- while i <= #z do local c = sub(z, i, i) ---------------------------------------------------------------- if c == "\\" then -- escaped stuff local j = i + 1 local d = sub(z, j, j) local p = find("abfnrtv\\\n\r\"\'0123456789", d, 1, true) ------------------------------------------------------------ if not p then -- \<char> -- remove \ z = sub(z, 1, i - 1)..sub(z, j) i = i + 1 ------------------------------------------------------------ elseif p <= 8 then -- \a\b\f\n\r\t\v\\ i = i + 2 -- no change ------------------------------------------------------------ elseif p <= 10 then -- \<eol> -- normalize EOL local eol = sub(z, j, j + 1) if eol == "\r\n" or eol == "\n\r" then z = sub(z, 1, i).."\n"..sub(z, j + 2) elseif p == 10 then -- \r case z = sub(z, 1, i).."\n"..sub(z, j + 1) end i = i + 2 ------------------------------------------------------------ elseif p <= 12 then -- \"\' -- remove \ for ndelim if d == delim then c_delim = c_delim + 1 i = i + 2 else c_ndelim = c_ndelim + 1 z = sub(z, 1, i - 1)..sub(z, j) i = i + 1 end ------------------------------------------------------------ else -- \ddd -- various steps local s = match(z, "^(%d%d?%d?)", j) j = i + 1 + #s -- skip to location local cv = s + 0 local cc = string.char(cv) local p = find("\a\b\f\n\r\t\v", cc, 1, true) if p then -- special escapes s = "\\"..sub("abfnrtv", p, p) elseif cv < 32 then -- normalized \ddd s = "\\"..cv elseif cc == delim then -- \<delim> s = "\\"..cc c_delim = c_delim + 1 elseif cc == "\\" then -- \\ s = "\\\\" else -- literal character s = cc if cc == ndelim then c_ndelim = c_ndelim + 1 end end z = sub(z, 1, i - 1)..s..sub(z, j) i = i + #s ------------------------------------------------------------ end--if p ---------------------------------------------------------------- else-- c ~= "\\" -- <other> -- no change i = i + 1 if c == ndelim then -- count ndelim, for switching delimiters c_ndelim = c_ndelim + 1 end ---------------------------------------------------------------- end--if c end--while -------------------------------------------------------------------- -- switching delimiters, a long-winded derivation: -- (1) delim takes 2+2*c_delim bytes, ndelim takes c_ndelim bytes -- (2) delim becomes c_delim bytes, ndelim becomes 2+2*c_ndelim bytes -- simplifying the condition (1)>(2) --> c_delim > c_ndelim if c_delim > c_ndelim then i = 1 while i <= #z do local p, q, r = find(z, "([\'\"])", i) if not p then break end if r == delim then -- \<delim> -> <delim> z = sub(z, 1, p - 2)..sub(z, p) i = p else-- r == ndelim -- <ndelim> -> \<ndelim> z = sub(z, 1, p - 1).."\\"..sub(z, p) i = p + 2 end end--while delim = ndelim -- actually change delimiters end -------------------------------------------------------------------- z = delim..z..delim if z ~= sinfos[I] then if opt_details then print("<string> (line "..stoklns[I]..") "..sinfos[I].." -> "..z) opt_details = opt_details + 1 end sinfos[I] = z end end ------------------------------------------------------------------------ -- long string optimization -- * note: warning flagged if trailing whitespace found, not trimmed -- * remove first optional newline -- * normalize embedded newlines -- * reduce '=' separators in delimiters if possible ------------------------------------------------------------------------ local function do_lstring(I) local info = sinfos[I] local delim1 = match(info, "^%[=*%[") -- cut out delimiters local sep = #delim1 local delim2 = sub(info, -sep, -1) local z = sub(info, sep + 1, -(sep + 1)) -- lstring without delims local y = "" local i = 1 -------------------------------------------------------------------- while true do local p, q, r, s = find(z, "([\r\n])([\r\n]?)", i) -- deal with a single line local ln if not p then ln = sub(z, i) elseif p >= i then ln = sub(z, i, p - 1) end if ln ~= "" then -- flag a warning if there are trailing spaces, won't optimize! if match(ln, "%s+$") then warn.lstring = "trailing whitespace in long string near line "..stoklns[I] end y = y..ln end if not p then -- done if no more EOLs break end -- deal with line endings, normalize them i = p + 1 if p then if #s > 0 and r ~= s then -- skip CRLF or LFCR i = i + 1 end -- skip first newline, which can be safely deleted if not(i == 1 and i == p) then y = y.."\n" end end end--while -------------------------------------------------------------------- -- handle possible deletion of one or more '=' separators if sep >= 3 then local chk, okay = sep - 1 -- loop to test ending delimiter with less of '=' down to zero while chk >= 2 do local delim = "%]"..rep("=", chk - 2).."%]" if not match(y, delim) then okay = chk end chk = chk - 1 end if okay then -- change delimiters sep = rep("=", okay - 2) delim1, delim2 = "["..sep.."[", "]"..sep.."]" end end -------------------------------------------------------------------- sinfos[I] = delim1..y..delim2 end ------------------------------------------------------------------------ -- long comment optimization -- * note: does not remove first optional newline -- * trim trailing whitespace -- * normalize embedded newlines -- * reduce '=' separators in delimiters if possible ------------------------------------------------------------------------ local function do_lcomment(I) local info = sinfos[I] local delim1 = match(info, "^%-%-%[=*%[") -- cut out delimiters local sep = #delim1 local delim2 = sub(info, -sep, -1) local z = sub(info, sep + 1, -(sep - 1)) -- comment without delims local y = "" local i = 1 -------------------------------------------------------------------- while true do local p, q, r, s = find(z, "([\r\n])([\r\n]?)", i) -- deal with a single line, extract and check trailing whitespace local ln if not p then ln = sub(z, i) elseif p >= i then ln = sub(z, i, p - 1) end if ln ~= "" then -- trim trailing whitespace if non-empty line local ws = match(ln, "%s*$") if #ws > 0 then ln = sub(ln, 1, -(ws + 1)) end y = y..ln end if not p then -- done if no more EOLs break end -- deal with line endings, normalize them i = p + 1 if p then if #s > 0 and r ~= s then -- skip CRLF or LFCR i = i + 1 end y = y.."\n" end end--while -------------------------------------------------------------------- -- handle possible deletion of one or more '=' separators sep = sep - 2 if sep >= 3 then local chk, okay = sep - 1 -- loop to test ending delimiter with less of '=' down to zero while chk >= 2 do local delim = "%]"..rep("=", chk - 2).."%]" if not match(y, delim) then okay = chk end chk = chk - 1 end if okay then -- change delimiters sep = rep("=", okay - 2) delim1, delim2 = "--["..sep.."[", "]"..sep.."]" end end -------------------------------------------------------------------- sinfos[I] = delim1..y..delim2 end ------------------------------------------------------------------------ -- short comment optimization -- * trim trailing whitespace ------------------------------------------------------------------------ local function do_comment(i) local info = sinfos[i] local ws = match(info, "%s*$") -- just look from end of string if #ws > 0 then info = sub(info, 1, -(ws + 1)) -- trim trailing whitespace end sinfos[i] = info end ------------------------------------------------------------------------ -- returns true if string found in long comment -- * this is a feature to keep copyright or license texts ------------------------------------------------------------------------ local function keep_lcomment(opt_keep, info) if not opt_keep then return false end -- option not set local delim1 = match(info, "^%-%-%[=*%[") -- cut out delimiters local sep = #delim1 local delim2 = sub(info, -sep, -1) local z = sub(info, sep + 1, -(sep - 1)) -- comment without delims if find(z, opt_keep, 1, true) then -- try to match return true end end ------------------------------------------------------------------------ -- main entry point -- * currently, lexer processing has 2 passes -- * processing is done on a line-oriented basis, which is easier to -- grok due to the next point... -- * since there are various options that can be enabled or disabled, -- processing is a little messy or convoluted ------------------------------------------------------------------------ function optimize(option, toklist, semlist, toklnlist) -------------------------------------------------------------------- -- set option flags -------------------------------------------------------------------- local opt_comments = option["opt-comments"] local opt_whitespace = option["opt-whitespace"] local opt_emptylines = option["opt-emptylines"] local opt_eols = option["opt-eols"] local opt_strings = option["opt-strings"] local opt_numbers = option["opt-numbers"] local opt_keep = option.KEEP opt_details = option.DETAILS and 0 -- upvalues for details display print = print or base.print if opt_eols then -- forced settings, otherwise won't work properly opt_comments = true opt_whitespace = true opt_emptylines = true end -------------------------------------------------------------------- -- variable initialization -------------------------------------------------------------------- stoks, sinfos, stoklns -- set source lists = toklist, semlist, toklnlist local i = 1 -- token position local tok, info -- current token local prev -- position of last grammar token -- on same line (for TK_SPACE stuff) -------------------------------------------------------------------- -- changes a token, info pair -------------------------------------------------------------------- local function settoken(tok, info, I) I = I or i stoks[I] = tok or "" sinfos[I] = info or "" end -------------------------------------------------------------------- -- processing loop (PASS 1) -------------------------------------------------------------------- while true do tok, info = stoks[i], sinfos[i] ---------------------------------------------------------------- local atstart = atlinestart(i) -- set line begin flag if atstart then prev = nil end ---------------------------------------------------------------- if tok == "TK_EOS" then -- end of stream/pass break ---------------------------------------------------------------- elseif tok == "TK_KEYWORD" or -- keywords, identifiers, tok == "TK_NAME" or -- operators tok == "TK_OP" then -- TK_KEYWORD and TK_OP can't be optimized without a big -- optimization framework; it would be more of an optimizing -- compiler, not a source code compressor -- TK_NAME that are locals needs parser to analyze/optimize prev = i ---------------------------------------------------------------- elseif tok == "TK_NUMBER" then -- numbers if opt_numbers then do_number(i) -- optimize end prev = i ---------------------------------------------------------------- elseif tok == "TK_STRING" or -- strings, long strings tok == "TK_LSTRING" then if opt_strings then if tok == "TK_STRING" then do_string(i) -- optimize else do_lstring(i) -- optimize end end prev = i ---------------------------------------------------------------- elseif tok == "TK_COMMENT" then -- short comments if opt_comments then if i == 1 and sub(info, 1, 1) == "#" then -- keep shbang comment, trim whitespace do_comment(i) else -- safe to delete, as a TK_EOL (or TK_EOS) always follows settoken() -- remove entirely end elseif opt_whitespace then -- trim whitespace only do_comment(i) end ---------------------------------------------------------------- elseif tok == "TK_LCOMMENT" then -- long comments if keep_lcomment(opt_keep, info) then ------------------------------------------------------------ -- if --keep, we keep a long comment if <msg> is found; -- this is a feature to keep copyright or license texts if opt_whitespace then -- trim whitespace only do_lcomment(i) end prev = i elseif opt_comments then local eols = commenteols(info) ------------------------------------------------------------ -- prepare opt_emptylines case first, if a disposable token -- follows, current one is safe to dump, else keep a space; -- it is implied that the operation is safe for '-', because -- current is a TK_LCOMMENT, and must be separate from a '-' if is_faketoken[stoks[i + 1]] then settoken() -- remove entirely tok = "" else settoken("TK_SPACE", " ") end ------------------------------------------------------------ -- if there are embedded EOLs to keep and opt_emptylines is -- disabled, then switch the token into one or more EOLs if not opt_emptylines and eols > 0 then settoken("TK_EOL", rep("\n", eols)) end ------------------------------------------------------------ -- if optimizing whitespaces, force reinterpretation of the -- token to give a chance for the space to be optimized away if opt_whitespace and tok ~= "" then i = i - 1 -- to reinterpret end ------------------------------------------------------------ else -- disabled case if opt_whitespace then -- trim whitespace only do_lcomment(i) end prev = i end ---------------------------------------------------------------- elseif tok == "TK_EOL" then -- line endings if atstart and opt_emptylines then settoken() -- remove entirely elseif info == "\r\n" or info == "\n\r" then -- normalize the rest of the EOLs for CRLF/LFCR only -- (note that TK_LCOMMENT can change into several EOLs) settoken("TK_EOL", "\n") end ---------------------------------------------------------------- elseif tok == "TK_SPACE" then -- whitespace if opt_whitespace then if atstart or atlineend(i) then -- delete leading and trailing whitespace settoken() -- remove entirely else ------------------------------------------------------------ -- at this point, since leading whitespace have been removed, -- there should be a either a real token or a TK_LCOMMENT -- prior to hitting this whitespace; the TK_LCOMMENT case -- only happens if opt_comments is disabled; so prev ~= nil local ptok = stoks[prev] if ptok == "TK_LCOMMENT" then -- previous TK_LCOMMENT can abut with anything settoken() -- remove entirely else -- prev must be a grammar token; consecutive TK_SPACE -- tokens is impossible when optimizing whitespace local ntok = stoks[i + 1] if is_faketoken[ntok] then -- handle special case where a '-' cannot abut with -- either a short comment or a long comment if (ntok == "TK_COMMENT" or ntok == "TK_LCOMMENT") and ptok == "TK_OP" and sinfos[prev] == "-" then -- keep token else settoken() -- remove entirely end else--is_realtoken -- check a pair of grammar tokens, if can abut, then -- delete space token entirely, otherwise keep one space local s = checkpair(prev, i + 1) if s == "" then settoken() -- remove entirely else settoken("TK_SPACE", " ") end end end ------------------------------------------------------------ end end ---------------------------------------------------------------- else error("unidentified token encountered") end ---------------------------------------------------------------- i = i + 1 end--while repack_tokens() -------------------------------------------------------------------- -- processing loop (PASS 2) -------------------------------------------------------------------- if opt_eols then i = 1 -- aggressive EOL removal only works with most non-grammar tokens -- optimized away because it is a rather simple scheme -- basically -- it just checks 'real' token pairs around EOLs if stoks[1] == "TK_COMMENT" then -- first comment still existing must be shbang, skip whole line i = 3 end while true do tok, info = stoks[i], sinfos[i] -------------------------------------------------------------- if tok == "TK_EOS" then -- end of stream/pass break -------------------------------------------------------------- elseif tok == "TK_EOL" then -- consider each TK_EOL local t1, t2 = stoks[i - 1], stoks[i + 1] if is_realtoken[t1] and is_realtoken[t2] then -- sanity check local s = checkpair(i - 1, i + 1) if s == "" then settoken() -- remove entirely end end end--if tok -------------------------------------------------------------- i = i + 1 end--while repack_tokens() end -------------------------------------------------------------------- if opt_details and opt_details > 0 then print() end -- spacing return stoks, sinfos, stoklns end
apache-2.0
Fenix-XI/Fenix
scripts/commands/togglegm.lua
50
1876
--------------------------------------------------------------------------------------------------- -- func: togglegm -- desc: Toggles a GMs nameflags/icon. --------------------------------------------------------------------------------------------------- cmdprops = { permission = 1, parameters = "" }; function onTrigger(player) -- GM Flag Definitions local FLAG_GM = 0x04000000; local FLAG_GM_SENIOR = 0x05000000; local FLAG_GM_LEAD = 0x06000000; local FLAG_GM_PRODUCER = 0x07000000; local FLAG_SENIOR = 0x01000000; -- Do NOT set these flags. These are here to local FLAG_LEAD = 0x02000000; -- ensure all GM status is removed. -- Configurable Options local MINLVL_GM = 1; -- For "whitelisting" players to have some commands, but not GM tier commands. local MINLVL_GM_SENIOR = 2; -- These are configurable so that commands may be restricted local MINLVL_GM_LEAD = 3; -- between different levels of GM's with the same icon. local MINLVL_GM_PRODUCER = 4; if (player:checkNameFlags(FLAG_GM)) then if (player:checkNameFlags(FLAG_GM)) then player:setFlag(FLAG_GM); end if (player:checkNameFlags(FLAG_SENIOR)) then player:setFlag(FLAG_SENIOR); end if (player:checkNameFlags(FLAG_LEAD)) then player:setFlag(FLAG_LEAD); end else local gmlvl = player:getGMLevel(); if (gmlvl >= MINLVL_GM_PRODUCER) then player:setFlag(FLAG_GM_PRODUCER); elseif (gmlvl >= MINLVL_GM_LEAD) then player:setFlag(FLAG_GM_LEAD); elseif (gmlvl >= MINLVL_GM_SENIOR) then player:setFlag(FLAG_GM_SENIOR); elseif (gmlvl >= MINLVL_GM) then player:setFlag(FLAG_GM); end end end
gpl-3.0
Fenix-XI/Fenix
scripts/globals/effects/warcry.lua
34
1037
----------------------------------- -- -- EFFECT_WARCRY -- -- Notes: -- Savagery TP bonus not cut in half like ffxclopedia says. -- ffxiclopedia is wrong, bg wiki right. See link where testing was done. -- http://www.bluegartr.com/threads/108199-Random-Facts-Thread-Other?p=5367464&viewfull=1#post5367464 ----------------------------------- require("scripts/globals/settings"); require("scripts/globals/status"); ----------------------------------- -- onEffectGain Action ----------------------------------- function onEffectGain(target,effect) target:addMod(MOD_ATTP,effect:getPower()); target:addMod(MOD_TP_BONUS,effect:getSubPower()); end; ----------------------------------- -- onEffectTick Action ----------------------------------- function onEffectTick(target,effect) end; ----------------------------------- -- onEffectLose Action ----------------------------------- function onEffectLose(target,effect) target:delMod(MOD_ATTP,effect:getPower()); target:delMod(MOD_TP_BONUS,effect:getSubPower()); end;
gpl-3.0
Fenix-XI/Fenix
scripts/zones/Crawlers_Nest/npcs/qm12.lua
57
2120
----------------------------------- -- Area: Crawlers' Nest -- NPC: qm12 (??? - Exoray Mold Crumbs) -- Involved in Quest: In Defiant Challenge -- @pos 99.326 -0.126 -188.869 197 ----------------------------------- package.loaded["scripts/zones/Crawlers_Nest/TextIDs"] = nil; ----------------------------------- require("scripts/globals/quests"); require("scripts/globals/keyitems"); require("scripts/globals/settings"); require("scripts/zones/Crawlers_Nest/TextIDs"); ----------------------------------- -- onTrade Action ----------------------------------- function onTrade(player,npc,trade) end; ----------------------------------- -- onTrigger Action ----------------------------------- function onTrigger(player,npc) if (OldSchoolG1 == false) then if (player:hasItem(1089) == false and player:hasKeyItem(EXORAY_MOLD_CRUMB3) == false and player:getQuestStatus(JEUNO,IN_DEFIANT_CHALLENGE) == QUEST_ACCEPTED) then player:addKeyItem(EXORAY_MOLD_CRUMB3); player:messageSpecial(KEYITEM_OBTAINED,EXORAY_MOLD_CRUMB3); end if (player:hasKeyItem(EXORAY_MOLD_CRUMB1) and player:hasKeyItem(EXORAY_MOLD_CRUMB2) and player:hasKeyItem(EXORAY_MOLD_CRUMB3)) then if (player:getFreeSlotsCount() >= 1) then player:addItem(1089, 1); player:messageSpecial(ITEM_OBTAINED, 1089); else player:messageSpecial(ITEM_CANNOT_BE_OBTAINED, 1089); end end if (player:hasItem(1089)) then player:delKeyItem(EXORAY_MOLD_CRUMB1); player:delKeyItem(EXORAY_MOLD_CRUMB2); player:delKeyItem(EXORAY_MOLD_CRUMB3); end end end; ----------------------------------- -- onEventUpdate ----------------------------------- function onEventUpdate(player,csid,option) -- printf("CSID2: %u",csid); -- printf("RESULT2: %u",option); end; ----------------------------------- -- onEventFinish ----------------------------------- function onEventFinish(player,csid,option) -- printf("CSID: %u",csid); -- printf("RESULT: %u",option); end;
gpl-3.0
DarkstarProject/darkstar
scripts/zones/Bastok_Markets/npcs/Ulrike.lua
6
1348
----------------------------------- -- Area: Bastok Markets -- NPC: Ulrike -- Type: Goldsmithing Synthesis Image Support -- !pos -218.399 -7.824 -56.203 235 ----------------------------------- local ID = require("scripts/zones/Bastok_Markets/IDs") require("scripts/globals/status") require("scripts/globals/crafting") ----------------------------------- function onTrade(player,npc,trade) end function onTrigger(player,npc) local guildMember = isGuildMember(player, 6) local SkillCap = getCraftSkillCap(player, dsp.skill.GOLDSMITHING) local SkillLevel = player:getSkillLevel(dsp.skill.GOLDSMITHING) if guildMember == 1 then if player:hasStatusEffect(dsp.effect.GOLDSMITHING_IMAGERY) == false then player:startEvent(304, SkillCap, SkillLevel, 2, 201, player:getGil(), 0, 9, 0) else player:startEvent(304, SkillCap, SkillLevel, 2, 201, player:getGil(), 6975, 9, 0) end else player:startEvent(304) end end function onEventUpdate(player,csid,option) end function onEventFinish(player,csid,option) if csid == 304 and option == 1 then player:delStatusEffectsByFlag(dsp.effectFlag.SYNTH_SUPPORT, true) player:addStatusEffect(dsp.effect.GOLDSMITHING_IMAGERY, 1, 0, 120) player:messageSpecial(ID.text.GOLDSMITHING_SUPPORT, 0, 3, 2) end end
gpl-3.0
crunchuser/prosody-modules
mod_mam/mod_mam.lua
7
8099
-- XEP-0313: Message Archive Management for Prosody -- Copyright (C) 2011-2014 Kim Alvefur -- -- This file is MIT/X11 licensed. local xmlns_mam = "urn:xmpp:mam:0"; local xmlns_delay = "urn:xmpp:delay"; local xmlns_forward = "urn:xmpp:forward:0"; local st = require "util.stanza"; local rsm = module:require "rsm"; local get_prefs = module:require"mamprefs".get; local set_prefs = module:require"mamprefs".set; local prefs_to_stanza = module:require"mamprefsxml".tostanza; local prefs_from_stanza = module:require"mamprefsxml".fromstanza; local jid_bare = require "util.jid".bare; local jid_split = require "util.jid".split; local dataform = require "util.dataforms".new; local host = module.host; local rm_load_roster = require "core.rostermanager".load_roster; local getmetatable = getmetatable; local function is_stanza(x) return getmetatable(x) == st.stanza_mt; end local tostring = tostring; local time_now = os.time; local m_min = math.min; local timestamp, timestamp_parse = require "util.datetime".datetime, require "util.datetime".parse; local default_max_items, max_max_items = 20, module:get_option_number("max_archive_query_results", 50); local global_default_policy = module:get_option("default_archive_policy", false); if global_default_policy ~= "roster" then global_default_policy = module:get_option_boolean("default_archive_policy", global_default_policy); end local archive_store = "archive2"; local archive = module:open_store(archive_store, "archive"); if not archive or archive.name == "null" then module:log("error", "Could not open archive storage"); return elseif not archive.find then module:log("error", "mod_%s does not support archiving, switch to mod_storage_sql2", archive._provided_by); return end -- Handle prefs. module:hook("iq/self/"..xmlns_mam..":prefs", function(event) local origin, stanza = event.origin, event.stanza; local user = origin.username; if stanza.attr.type == "get" then local prefs = prefs_to_stanza(get_prefs(user)); local reply = st.reply(stanza):add_child(prefs); return origin.send(reply); else -- type == "set" local new_prefs = stanza:get_child("prefs", xmlns_mam); local prefs = prefs_from_stanza(new_prefs); local ok, err = set_prefs(user, prefs); if not ok then return origin.send(st.error_reply(stanza, "cancel", "internal-server-error", "Error storing preferences: "..tostring(err))); end return origin.send(st.reply(stanza)); end end); local query_form = dataform { { name = "FORM_TYPE"; type = "hidden"; value = xmlns_mam; }; { name = "with"; type = "jid-single"; }; { name = "start"; type = "text-single" }; { name = "end"; type = "text-single"; }; }; -- Serve form module:hook("iq-get/self/"..xmlns_mam..":query", function(event) local origin, stanza = event.origin, event.stanza; return origin.send(st.reply(stanza):add_child(query_form:form())); end); -- Handle archive queries module:hook("iq-set/self/"..xmlns_mam..":query", function(event) local origin, stanza = event.origin, event.stanza; local query = stanza.tags[1]; local qid = query.attr.queryid; -- Search query parameters local qwith, qstart, qend; local form = query:get_child("x", "jabber:x:data"); if form then local err; form, err = query_form:data(form); if err then return origin.send(st.error_reply(stanza, "modify", "bad-request", select(2, next(err)))) end qwith, qstart, qend = form["with"], form["start"], form["end"]; qwith = qwith and jid_bare(qwith); -- dataforms does jidprep end if qstart or qend then -- Validate timestamps local vstart, vend = (qstart and timestamp_parse(qstart)), (qend and timestamp_parse(qend)) if (qstart and not vstart) or (qend and not vend) then origin.send(st.error_reply(stanza, "modify", "bad-request", "Invalid timestamp")) return true end qstart, qend = vstart, vend; end module:log("debug", "Archive query, id %s with %s from %s until %s)", tostring(qid), qwith or "anyone", qstart or "the dawn of time", qend or "now"); -- RSM stuff local qset = rsm.get(query); local qmax = m_min(qset and qset.max or default_max_items, max_max_items); local reverse = qset and qset.before or false; local before, after = qset and qset.before, qset and qset.after; if type(before) ~= "string" then before = nil; end -- Load all the data! local data, err = archive:find(origin.username, { start = qstart; ["end"] = qend; -- Time range with = qwith; limit = qmax; before = before; after = after; reverse = reverse; total = true; }); if not data then return origin.send(st.error_reply(stanza, "cancel", "internal-server-error", err)); end local count = err; origin.send(st.reply(stanza)) local msg_reply_attr = { to = stanza.attr.from, from = stanza.attr.to }; -- Wrap it in stuff and deliver local fwd_st, first, last; for id, item, when in data do fwd_st = st.message(msg_reply_attr) :tag("result", { xmlns = xmlns_mam, queryid = qid, id = id }) :tag("forwarded", { xmlns = xmlns_forward }) :tag("delay", { xmlns = xmlns_delay, stamp = timestamp(when) }):up(); if not is_stanza(item) then item = st.deserialize(item); end item.attr.xmlns = "jabber:client"; fwd_st:add_child(item); if not first then first = id; end last = id; origin.send(fwd_st); end -- That's all folks! module:log("debug", "Archive query %s completed", tostring(qid)); if reverse then first, last = last, first; end return origin.send(st.message(msg_reply_attr) :tag("fin", { xmlns = xmlns_mam, queryid = qid }) :add_child(rsm.generate { first = first, last = last, count = count })); end); local function has_in_roster(user, who) local roster = rm_load_roster(user, host); module:log("debug", "%s has %s in roster? %s", user, who, roster[who] and "yes" or "no"); return roster[who]; end local function shall_store(user, who) -- TODO Cache this? local prefs = get_prefs(user); local rule = prefs[who]; module:log("debug", "%s's rule for %s is %s", user, who, tostring(rule)) if rule ~= nil then return rule; else -- Below could be done by a metatable local default = prefs[false]; module:log("debug", "%s's default rule is %s", user, tostring(default)) if default == nil then default = global_default_policy; module:log("debug", "Using global default rule, %s", tostring(default)) end if default == "roster" then return has_in_roster(user, who); end return default; end end -- Handle messages local function message_handler(event, c2s) local origin, stanza = event.origin, event.stanza; local orig_type = stanza.attr.type or "normal"; local orig_from = stanza.attr.from; local orig_to = stanza.attr.to or orig_from; -- Stanza without 'to' are treated as if it was to their own bare jid -- We don't store messages of these types if orig_type == "error" or orig_type == "headline" or orig_type == "groupchat" -- or that don't have a <body/> or not stanza:get_child("body") -- or if hints suggest we shouldn't or stanza:get_child("no-permanent-store", "urn:xmpp:hints") or stanza:get_child("no-store", "urn:xmpp:hints") then module:log("debug", "Not archiving stanza: %s (content)", stanza:top_tag()); return; end -- Whos storage do we put it in? local store_user = c2s and origin.username or jid_split(orig_to); -- And who are they chatting with? local with = jid_bare(c2s and orig_to or orig_from); -- Check with the users preferences if shall_store(store_user, with) then module:log("debug", "Archiving stanza: %s", stanza:top_tag()); -- And stash it local ok, id = archive:append(store_user, nil, time_now(), with, stanza); else module:log("debug", "Not archiving stanza: %s (prefs)", stanza:top_tag()); end end local function c2s_message_handler(event) return message_handler(event, true); end -- Stanzas sent by local clients module:hook("pre-message/bare", c2s_message_handler, 2); module:hook("pre-message/full", c2s_message_handler, 2); -- Stanszas to local clients module:hook("message/bare", message_handler, 2); module:hook("message/full", message_handler, 2); module:add_feature(xmlns_mam);
mit
DarkstarProject/darkstar
scripts/zones/Temenos/mobs/Pee_Qoho_the_Python.lua
9
1224
----------------------------------- -- Area: Temenos -- Mob: Pee Qoho the Python ----------------------------------- require("scripts/globals/limbus"); ----------------------------------- function onMobEngaged(mob,target) if (IsMobDead(16929023)==true and IsMobDead(16929024)==true and IsMobDead(16929025)==true and IsMobDead(16929026)==true and IsMobDead(16929027)==true and IsMobDead(16929028)==true ) then mob:setMod(dsp.mod.SLASHRES,1400); mob:setMod(dsp.mod.PIERCERES,1400); mob:setMod(dsp.mod.IMPACTRES,1400); mob:setMod(dsp.mod.HTHRES,1400); else mob:setMod(dsp.mod.SLASHRES,300); mob:setMod(dsp.mod.PIERCERES,300); mob:setMod(dsp.mod.IMPACTRES,300); mob:setMod(dsp.mod.HTHRES,300); end GetMobByID(16929005):updateEnmity(target); GetMobByID(16929006):updateEnmity(target); end; function onMobDeath(mob, player, isKiller) if (IsMobDead(16929005)==true and IsMobDead(16929006)==true and IsMobDead(16929007)==true) then GetNPCByID(16928768+78):setPos(-280,-161,-440); GetNPCByID(16928768+78):setStatus(dsp.status.NORMAL); GetNPCByID(16928768+473):setStatus(dsp.status.NORMAL); end end;
gpl-3.0
Giorox/AngelionOT-Repo
data/actions/scripts/quests/annihilator.lua
1
6241
local room = { -- room with demons fromX = 33217, fromY = 31655, fromZ = 13, toX = 33224, toY = 31663, toZ = 13 } local monster_pos = { [1] = {pos = {33220, 31657, 13}, monster = "Demon"}, [2] = {pos = {33222, 31657, 13}, monster = "Demon"}, [3] = {pos = {33219, 31661, 13}, monster = "Demon"}, [4] = {pos = {33221, 31661, 13}, monster = "Demon"}, [5] = {pos = {33223, 31659, 13}, monster = "Demon"}, [6] = {pos = {33224, 31659, 13}, monster = "Demon"} } local players_pos = { {x = 33225, y =31671, z = 13, stackpos = 253}, {x = 33224, y =31671, z = 13, stackpos = 253}, {x = 33223, y =31671, z = 13, stackpos = 253}, {x = 33222, y =31671, z = 13, stackpos = 253} } local new_player_pos = { {x = 33222, y = 31659, z = 13}, {x = 33221, y = 31659, z = 13}, {x = 33220, y = 31659, z = 13}, {x = 33219, y = 31659, z = 13} } local playersOnly = "yes" local questLevel = 100 function onUse(cid, item, fromPosition, itemEx, toPosition) local all_ready, monsters, player, level = 0, 0, {}, 0 if item.itemid == 1945 then for i = 1, #players_pos do table.insert(player, 0) end for i = 1, #players_pos do player[i] = getThingfromPos(players_pos[i]) if player[i].itemid > 0 then if string.lower(playersOnly) == "yes" then if isPlayer(player[i].uid) == TRUE then all_ready = all_ready+1 else monsters = monsters+1 end else all_ready = all_ready+1 end end end if all_ready == #players_pos then for i = 1, #players_pos do player[i] = getThingfromPos(players_pos[i]) if isPlayer(player[i].uid) == TRUE then if getPlayerLevel(player[i].uid) >= questLevel then level = level+1 end else level = level+1 end end if level == #players_pos then if string.lower(playersOnly) == "yes" and monsters == 0 or string.lower(playersOnly) == "no" then local door = getTileItemById({x=33225, y=31659, z=13}, 5109).uid if door > 0 then doTransformItem(door, 5108) end for _, area in pairs(monster_pos) do doSummonCreature(area.monster,{x=area.pos[1],y=area.pos[2],z=area.pos[3]}) end for i = 1, #players_pos do doSendMagicEffect(players_pos[i], CONST_ME_POFF) doTeleportThing(player[i].uid, new_player_pos[i], FALSE) doSendMagicEffect(new_player_pos[i], CONST_ME_ENERGYAREA) doTransformItem(item.uid,1946) end else doPlayerSendTextMessage(cid,19,"Only players can do this quest.") end else doPlayerSendTextMessage(cid,19,"All Players have to be level "..questLevel.." to do this quest.") end else doPlayerSendTextMessage(cid,19,"You need "..table.getn(players_pos).." players to do this quest.") end elseif item.itemid == 1946 then local player_room = 0 for x = room.fromX, room.toX do for y = room.fromY, room.toY do for z = room.fromZ, room.toZ do local pos = {x=x, y=y, z=z,stackpos = 253} local thing = getThingfromPos(pos) if thing.itemid > 0 then if isPlayer(thing.uid) == TRUE then player_room = player_room+1 end end end end end if player_room >= 1 then doPlayerSendTextMessage(cid,19,"There is already a team in the quest room.") elseif player_room == 0 then for x = room.fromX, room.toX do for y = room.fromY, room.toY do for z = room.fromZ, room.toZ do local pos = {x=x, y=y, z=z,stackpos = 253} local thing = getThingfromPos(pos) if thing.itemid > 0 then doRemoveCreature(thing.uid) end end end end doTransformItem(item.uid,1945) end end return TRUE end
gpl-3.0
Giorox/AngelionOT-Repo
data/npc/scripts/blindorc.lua
2
5164
local keywordHandler = KeywordHandler:new() local npcHandler = NpcHandler:new(keywordHandler) NpcSystem.parseParameters(npcHandler) local Topic = {} local Amount = {} local Price = {} local Type = {} function onCreatureAppear(cid) npcHandler:onCreatureAppear(cid) end function onCreatureDisappear(cid) npcHandler:onCreatureDisappear(cid) end function onCreatureSay(cid, type, msg) npcHandler:onCreatureSay(cid, type, msg) end function onThink() npcHandler:onThink() end function creatureSayCallback(cid, type, msg) local talkUser = NPCHANDLER_CONVBEHAVIOR == CONVERSATION_DEFAULT and 0 or cid if msgcontains(msg, "charach") and (not npcHandler:isFocused(cid)) then selfSay("Ikem Charach maruk.", cid, TRUE) npcHandler:addFocus(cid) Topic[talkUser] = 0 Amount[talkUser] = 0 Price[talkUser] = 0 Type[talkUser] = 0 return true elseif (not npcHandler:isFocused(cid)) then npcHandler:say("Buta humak!", cid, TRUE) elseif msgcontains(msg, "futchi") then selfSay("Futchi.", cid, TRUE) npcHandler:releaseFocus(cid) Topic[talkUser] = 0 Amount[talkUser] = 0 Price[talkUser] = 0 Type[talkUser] = 0 elseif msgcontains(msg, "ikem") and msgcontains(msg, "goshak") then npcHandler:say("Ikem pashak porak, bata, dora. Ba goshak maruk?", cid) Topic[talkUser] = 0 Amount[talkUser] = 0 Price[talkUser] = 0 Type[talkUser] = 0 elseif msgcontains(msg, "goshak") and msgcontains(msg, "porak") then npcHandler:say("Ikem pashak charcha, burka, burka bata, hakhak. Ba goshak maruk?", cid) Topic[talkUser] = 0 Amount[talkUser] = 0 Price[talkUser] = 0 Type[talkUser] = 0 elseif msgcontains(msg, "goshak") and msgcontains(msg, "charcha") then npcHandler:say("Maruk goshak ta?", cid) Topic[talkUser] = 1 Amount[talkUser] = 1 Price[talkUser] = 25 Type[talkUser] = 2385 elseif msgcontains(msg, "goshak") and msgcontains(msg, "burka") and msgcontains(msg, "bata") then npcHandler:say("Maruk goshak ta?", cid) Topic[talkUser] = 1 Amount[talkUser] = 1 Price[talkUser] = 85 Type[talkUser] = 2376 elseif msgcontains(msg, "goshak") and msgcontains(msg, "burka") then npcHandler:say("Maruk goshak ta?", cid) Topic[talkUser] = 1 Amount[talkUser] = 1 Price[talkUser] = 30 Type[talkUser] = 2406 elseif msgcontains(msg, "goshak") and msgcontains(msg, "hakhak") then npcHandler:say("Maruk goshak ta?", cid) Topic[talkUser] = 1 Amount[talkUser] = 1 Price[talkUser] = 85 Type[talkUser] = 2388 elseif msgcontains(msg, "goshak") and msgcontains(msg, "bata") then npcHandler:say("Ikem pashak aka bora, tulak bora, grofa. Ba goshak maruk?", cid) Topic[talkUser] = 0 Amount[talkUser] = 0 Price[talkUser] = 0 Type[talkUser] = 0 elseif msgcontains(msg, "goshak") and msgcontains(msg, "tulak") and msgcontains(msg, "bora") then npcHandler:say("Maruk goshak ta?", cid) Topic[talkUser] = 1 Amount[talkUser] = 1 Price[talkUser] = 90 Type[talkUser] = 2484 elseif msgcontains(msg, "goshak") and msgcontains(msg, "bora") then npcHandler:say("Maruk goshak ta?", cid) Topic[talkUser] = 1 Amount[talkUser] = 1 Price[talkUser] = 25 Type[talkUser] = 2467 elseif msgcontains(msg, "goshak") and msgcontains(msg, "grofa") then npcHandler:say("Maruk goshak ta?", cid) Topic[talkUser] = 1 Amount[talkUser] = 1 Price[talkUser] = 60 Type[talkUser] = 2482 elseif msgcontains(msg, "goshak") and msgcontains(msg, "dora") then npcHandler:say("Ikem pashak donga. Ba goshak maruk?", cid) Topic[talkUser] = 0 Amount[talkUser] = 0 Price[talkUser] = 0 Type[talkUser] = 0 elseif msgcontains(msg, "goshak") and msgcontains(msg, "donga") then npcHandler:say("Maruk goshak ta?", cid) Topic[talkUser] = 1 Amount[talkUser] = 1 Price[talkUser] = 65 Type[talkUser] = 2511 elseif msgcontains(msg, "goshak") and msgcontains(msg, "batuk") then npcHandler:say("Ahhhh, maruk goshak batuk?", cid) Topic[talkUser] = 1 Amount[talkUser] = 1 Price[talkUser] = 400 Type[talkUser] = 2456 elseif msgcontains(msg, "goshak") and msgcontains(msg, "pixo") then npcHandler:say("Maruk goshak tefar pixo ul batuk?", cid) Topic[talkUser] = 1 Amount[talkUser] = 10 Price[talkUser] = 30 Type[talkUser] = 2544 elseif Topic[talkUser] == 1 then if msgcontains(msg, "mok") then if getPlayerMoney(cid) >= Price[talkUser] then npcHandler:say("Maruk rambo zambo!", cid) doPlayerRemoveMoney(cid, Price[talkUser]) doPlayerAddItem(cid, Type[talkUser], Amount[talkUser]) Topic[talkUser] = 0 Amount[talkUser] = 0 Price[talkUser] = 0 Type[talkUser] = 0 else npcHandler:say("Maruk nixda!", cid) Topic[talkUser] = 0 Amount[talkUser] = 0 Price[talkUser] = 0 Type[talkUser] = 0 end else npcHandler:say("Buta maruk klamuk!", cid) Topic[talkUser] = 0 Amount[talkUser] = 0 Price[talkUser] = 0 Type[talkUser] = 0 end elseif msgcontains(msg, "trade") then npcHandler:say("Uh?", cid) Topic[talkUser] = 0 Amount[talkUser] = 0 Price[talkUser] = 0 Type[talkUser] = 0 end return TRUE end npcHandler:setMessage(MESSAGE_WALKAWAY, "Futchi.") npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
gpl-3.0
DarkstarProject/darkstar
scripts/zones/Al_Zahbi/npcs/Numaaf.lua
12
1736
----------------------------------- -- Area: Al Zahbi -- NPC: Numaaf -- Type: Cooking Normal/Adv. Image Support -- !pos 54.966 -7 8.328 48 ----------------------------------- require("scripts/globals/status") require("scripts/globals/crafting") local ID = require("scripts/zones/Al_Zahbi/IDs") ----------------------------------- function onTrade(player,npc,trade) local guildMember = isGuildMember(player,4) if guildMember == 1 then if trade:hasItemQty(2184,1) and trade:getItemCount() == 1 then if player:hasStatusEffect(dsp.effect.COOKING_IMAGERY) == false then player:tradeComplete() player:startEvent(223,8,0,0,0,188,0,8,0) else npc:showText(npc, ID.text.IMAGE_SUPPORT_ACTIVE) end end end end function onTrigger(player,npc) local guildMember = isGuildMember(player,4) local SkillLevel = player:getSkillLevel(dsp.skill.COOKING) if guildMember == 1 then if player:hasStatusEffect(dsp.effect.COOKING_IMAGERY) == false then player:startEvent(222,8,SkillLevel,0,511,188,0,8,2184) else player:startEvent(222,8,SkillLevel,0,511,188,7121,8,2184) end else player:startEvent(222,0,0,0,0,0,0,8,0) -- Standard Dialogue end end function onEventUpdate(player,csid,option) end function onEventFinish(player,csid,option) if csid == 222 and option == 1 then player:messageSpecial(ID.text.IMAGE_SUPPORT,0,8,1) player:addStatusEffect(dsp.effect.COOKING_IMAGERY,1,0,120) elseif csid == 223 then player:messageSpecial(ID.text.IMAGE_SUPPORT,0,8,0) player:addStatusEffect(dsp.effect.COOKING_IMAGERY,3,0,480) end end
gpl-3.0
DarkstarProject/darkstar
scripts/globals/items/dish_of_hydra_kofte_+1.lua
11
1613
----------------------------------------- -- ID: 5603 -- Item: dish_of_hydra_kofte_+1 -- Food Effect: 240Min, All Races ----------------------------------------- -- Strength 8 -- Intelligence -4 -- Attack % 20 -- Attack Cap 160 -- Defense % 25 -- Defense Cap 75 -- Ranged ATT % 20 -- Ranged ATT Cap 160 -- Poison Resist 5 ----------------------------------------- require("scripts/globals/status") require("scripts/globals/msg") ----------------------------------------- function onItemCheck(target) local result = 0 if target:hasStatusEffect(dsp.effect.FOOD) or target:hasStatusEffect(dsp.effect.FIELD_SUPPORT_FOOD) then result = dsp.msg.basic.IS_FULL end return result end function onItemUse(target) target:addStatusEffect(dsp.effect.FOOD,0,0,14400,5603) end function onEffectGain(target, effect) target:addMod(dsp.mod.STR, 8) target:addMod(dsp.mod.INT, -4) target:addMod(dsp.mod.FOOD_ATTP, 20) target:addMod(dsp.mod.FOOD_ATT_CAP, 160) target:addMod(dsp.mod.FOOD_DEFP, 25) target:addMod(dsp.mod.FOOD_DEF_CAP, 75) target:addMod(dsp.mod.FOOD_RATTP, 20) target:addMod(dsp.mod.FOOD_RATT_CAP, 160) target:addMod(dsp.mod.POISONRES, 5) end function onEffectLose(target, effect) target:delMod(dsp.mod.STR, 8) target:delMod(dsp.mod.INT, -4) target:delMod(dsp.mod.FOOD_ATTP, 20) target:delMod(dsp.mod.FOOD_ATT_CAP, 160) target:delMod(dsp.mod.FOOD_DEFP, 25) target:delMod(dsp.mod.FOOD_DEF_CAP, 75) target:delMod(dsp.mod.FOOD_RATTP, 20) target:delMod(dsp.mod.FOOD_RATT_CAP, 160) target:delMod(dsp.mod.POISONRES, 5) end
gpl-3.0
sprcpu/F80-V3.0
setwlc.lua
1
1923
do local function run(msg, matches, callback, extra) local data = load_data(_config.moderation.data) local rules = data[tostring(msg.to.id)]['rules'] local about = data[tostring(msg.to.id)]['description'] local hash = 'group:'..msg.to.id local group_welcome = redis:hget(hash,'welcome') if matches[1]:lower() == 'dw' and not matches[2] and is_owner(msg) then redis:hdel(hash,'welcome') return 'down 🗑' end local url , res = http.request('http://api.gpmod.ir/time/') if res ~= 200 then return "No connection" end local jdat = json:decode(url) if matches[1]:lower() == 'sw' and is_owner(msg) then redis:hset(hash,'welcome',matches[2]) return 'wlc seted to : ✋\n'..matches[2] end if matches[1] == 'chat_add_user' or 'chat_add_user_link' or 'channel_invite' and msg.service then group_welcome = string.gsub(group_welcome, '{gpname}', msg.to.title) group_welcome = string.gsub(group_welcome, '{firstname}', ""..(msg.action.user.first_name or '').."") group_welcome = string.gsub(group_welcome, '{lastname}', ""..(msg.action.user.last_name or '').."") group_welcome = string.gsub(group_welcome, '{username}', "@"..(msg.action.user.username or '').."") group_welcome = string.gsub(group_welcome, '{fatime}', ""..(jdat.FAtime).."") group_welcome = string.gsub(group_welcome, '{entime}', ""..(jdat.ENtime).."") group_welcome = string.gsub(group_welcome, '{fadate}', ""..(jdat.FAdate).."") group_welcome = string.gsub(group_welcome, '{endate}', ""..(jdat.ENdate).."") group_welcome = string.gsub(group_welcome, '{rules}', ""..(rules or '').."") group_welcome = string.gsub(group_welcome, '{about}', ""..(about or '').."") end return group_welcome end return { patterns = { "^[!#/](sw) +(.*)$", "^[!#/](dw)$", "^([Ss]w) +(.*)$", "^([Dd]w)$", "^!!tgservice (chat_add_user)$", "^!!tgservice (channel_invite)$", "^!!tgservice (chat_add_user_link)$", }, run = run } end
gpl-2.0
vlinhd11/vlinhd11-android-scripting
lua/luasocket/src/ftp.lua
144
9120
----------------------------------------------------------------------------- -- FTP support for the Lua language -- LuaSocket toolkit. -- Author: Diego Nehab -- RCS ID: $Id: ftp.lua,v 1.45 2007/07/11 19:25:47 diego Exp $ ----------------------------------------------------------------------------- ----------------------------------------------------------------------------- -- Declare module and import dependencies ----------------------------------------------------------------------------- local base = _G local table = require("table") local string = require("string") local math = require("math") local socket = require("socket") local url = require("socket.url") local tp = require("socket.tp") local ltn12 = require("ltn12") module("socket.ftp") ----------------------------------------------------------------------------- -- Program constants ----------------------------------------------------------------------------- -- timeout in seconds before the program gives up on a connection TIMEOUT = 60 -- default port for ftp service PORT = 21 -- this is the default anonymous password. used when no password is -- provided in url. should be changed to your e-mail. USER = "ftp" PASSWORD = "anonymous@anonymous.org" ----------------------------------------------------------------------------- -- Low level FTP API ----------------------------------------------------------------------------- local metat = { __index = {} } function open(server, port, create) local tp = socket.try(tp.connect(server, port or PORT, TIMEOUT, create)) local f = base.setmetatable({ tp = tp }, metat) -- make sure everything gets closed in an exception f.try = socket.newtry(function() f:close() end) return f end function metat.__index:portconnect() self.try(self.server:settimeout(TIMEOUT)) self.data = self.try(self.server:accept()) self.try(self.data:settimeout(TIMEOUT)) end function metat.__index:pasvconnect() self.data = self.try(socket.tcp()) self.try(self.data:settimeout(TIMEOUT)) self.try(self.data:connect(self.pasvt.ip, self.pasvt.port)) end function metat.__index:login(user, password) self.try(self.tp:command("user", user or USER)) local code, reply = self.try(self.tp:check{"2..", 331}) if code == 331 then self.try(self.tp:command("pass", password or PASSWORD)) self.try(self.tp:check("2..")) end return 1 end function metat.__index:pasv() self.try(self.tp:command("pasv")) local code, reply = self.try(self.tp:check("2..")) local pattern = "(%d+)%D(%d+)%D(%d+)%D(%d+)%D(%d+)%D(%d+)" local a, b, c, d, p1, p2 = socket.skip(2, string.find(reply, pattern)) self.try(a and b and c and d and p1 and p2, reply) self.pasvt = { ip = string.format("%d.%d.%d.%d", a, b, c, d), port = p1*256 + p2 } if self.server then self.server:close() self.server = nil end return self.pasvt.ip, self.pasvt.port end function metat.__index:port(ip, port) self.pasvt = nil if not ip then ip, port = self.try(self.tp:getcontrol():getsockname()) self.server = self.try(socket.bind(ip, 0)) ip, port = self.try(self.server:getsockname()) self.try(self.server:settimeout(TIMEOUT)) end local pl = math.mod(port, 256) local ph = (port - pl)/256 local arg = string.gsub(string.format("%s,%d,%d", ip, ph, pl), "%.", ",") self.try(self.tp:command("port", arg)) self.try(self.tp:check("2..")) return 1 end function metat.__index:send(sendt) self.try(self.pasvt or self.server, "need port or pasv first") -- if there is a pasvt table, we already sent a PASV command -- we just get the data connection into self.data if self.pasvt then self:pasvconnect() end -- get the transfer argument and command local argument = sendt.argument or url.unescape(string.gsub(sendt.path or "", "^[/\\]", "")) if argument == "" then argument = nil end local command = sendt.command or "stor" -- send the transfer command and check the reply self.try(self.tp:command(command, argument)) local code, reply = self.try(self.tp:check{"2..", "1.."}) -- if there is not a a pasvt table, then there is a server -- and we already sent a PORT command if not self.pasvt then self:portconnect() end -- get the sink, source and step for the transfer local step = sendt.step or ltn12.pump.step local readt = {self.tp.c} local checkstep = function(src, snk) -- check status in control connection while downloading local readyt = socket.select(readt, nil, 0) if readyt[tp] then code = self.try(self.tp:check("2..")) end return step(src, snk) end local sink = socket.sink("close-when-done", self.data) -- transfer all data and check error self.try(ltn12.pump.all(sendt.source, sink, checkstep)) if string.find(code, "1..") then self.try(self.tp:check("2..")) end -- done with data connection self.data:close() -- find out how many bytes were sent local sent = socket.skip(1, self.data:getstats()) self.data = nil return sent end function metat.__index:receive(recvt) self.try(self.pasvt or self.server, "need port or pasv first") if self.pasvt then self:pasvconnect() end local argument = recvt.argument or url.unescape(string.gsub(recvt.path or "", "^[/\\]", "")) if argument == "" then argument = nil end local command = recvt.command or "retr" self.try(self.tp:command(command, argument)) local code = self.try(self.tp:check{"1..", "2.."}) if not self.pasvt then self:portconnect() end local source = socket.source("until-closed", self.data) local step = recvt.step or ltn12.pump.step self.try(ltn12.pump.all(source, recvt.sink, step)) if string.find(code, "1..") then self.try(self.tp:check("2..")) end self.data:close() self.data = nil return 1 end function metat.__index:cwd(dir) self.try(self.tp:command("cwd", dir)) self.try(self.tp:check(250)) return 1 end function metat.__index:type(type) self.try(self.tp:command("type", type)) self.try(self.tp:check(200)) return 1 end function metat.__index:greet() local code = self.try(self.tp:check{"1..", "2.."}) if string.find(code, "1..") then self.try(self.tp:check("2..")) end return 1 end function metat.__index:quit() self.try(self.tp:command("quit")) self.try(self.tp:check("2..")) return 1 end function metat.__index:close() if self.data then self.data:close() end if self.server then self.server:close() end return self.tp:close() end ----------------------------------------------------------------------------- -- High level FTP API ----------------------------------------------------------------------------- local function override(t) if t.url then local u = url.parse(t.url) for i,v in base.pairs(t) do u[i] = v end return u else return t end end local function tput(putt) putt = override(putt) socket.try(putt.host, "missing hostname") local f = open(putt.host, putt.port, putt.create) f:greet() f:login(putt.user, putt.password) if putt.type then f:type(putt.type) end f:pasv() local sent = f:send(putt) f:quit() f:close() return sent end local default = { path = "/", scheme = "ftp" } local function parse(u) local t = socket.try(url.parse(u, default)) socket.try(t.scheme == "ftp", "wrong scheme '" .. t.scheme .. "'") socket.try(t.host, "missing hostname") local pat = "^type=(.)$" if t.params then t.type = socket.skip(2, string.find(t.params, pat)) socket.try(t.type == "a" or t.type == "i", "invalid type '" .. t.type .. "'") end return t end local function sput(u, body) local putt = parse(u) putt.source = ltn12.source.string(body) return tput(putt) end put = socket.protect(function(putt, body) if base.type(putt) == "string" then return sput(putt, body) else return tput(putt) end end) local function tget(gett) gett = override(gett) socket.try(gett.host, "missing hostname") local f = open(gett.host, gett.port, gett.create) f:greet() f:login(gett.user, gett.password) if gett.type then f:type(gett.type) end f:pasv() f:receive(gett) f:quit() return f:close() end local function sget(u) local gett = parse(u) local t = {} gett.sink = ltn12.sink.table(t) tget(gett) return table.concat(t) end command = socket.protect(function(cmdt) cmdt = override(cmdt) socket.try(cmdt.host, "missing hostname") socket.try(cmdt.command, "missing command") local f = open(cmdt.host, cmdt.port, cmdt.create) f:greet() f:login(cmdt.user, cmdt.password) f.try(f.tp:command(cmdt.command, cmdt.argument)) if cmdt.check then f.try(f.tp:check(cmdt.check)) end f:quit() return f:close() end) get = socket.protect(function(gett) if base.type(gett) == "string" then return sget(gett) else return tget(gett) end end)
apache-2.0
DarkstarProject/darkstar
scripts/zones/Tahrongi_Canyon/npcs/Shattered_Telepoint.lua
9
1913
----------------------------------- -- Area: Tahrongi_Canyon -- NPC: Shattered Telepoint -- !pos 179 35 255 117 ----------------------------------- local ID = require("scripts/zones/Tahrongi_Canyon/IDs") require("scripts/globals/keyitems") require("scripts/globals/missions") ----------------------------------- function onTrade(player, npc, trade) end function onTrigger(player, npc) if player:getCurrentMission(COP) == dsp.mission.id.cop.BELOW_THE_ARKS and player:getCharVar("PromathiaStatus") == 1 then player:startEvent(913, 0, 0, 1) -- first time in promy -> have you made your preparations cs elseif player:getCurrentMission(COP) == dsp.mission.id.cop.THE_MOTHERCRYSTALS and (player:hasKeyItem(dsp.ki.LIGHT_OF_HOLLA) or player:hasKeyItem(dsp.ki.LIGHT_OF_DEM)) then if player:getCharVar("cspromy2") == 1 then player:startEvent(912) -- cs you get nearing second promyvion else player:startEvent(913) end elseif player:getCurrentMission(COP) > dsp.mission.id.cop.THE_MOTHERCRYSTALS or player:hasCompletedMission(COP, dsp.mission.id.cop.THE_LAST_VERSE) or (player:getCurrentMission(COP) == dsp.mission.id.cop.BELOW_THE_ARKS and player:getCharVar("PromathiaStatus") > 1) then player:startEvent(913) -- normal cs (third promyvion and each entrance after having that promyvion visited or mission completed) else player:messageSpecial(ID.text.TELEPOINT_HAS_BEEN_SHATTERED) end end function onEventUpdate(player, csid, option) end function onEventFinish(player, csid, option) if csid == 912 then player:setCharVar("cspromy2", 0) player:setCharVar("cs2ndpromy", 1) player:setPos(280.066, -80.635, -67.096, 191, 14) -- To Hall of Transference {R} elseif csid == 913 and option == 0 then player:setPos(280.066, -80.635, -67.096, 191, 14) -- To Hall of Transference {R} end end
gpl-3.0
Fenix-XI/Fenix
scripts/zones/Aht_Urhgan_Whitegate/npcs/Rytaal.lua
24
4539
----------------------------------- -- Area: Aht Urhgan Whitegate -- NPC: Rytaal -- Type: Standard NPC -- @pos 112.002 -1.338 -45.038 50 ----------------------------------- package.loaded["scripts/zones/Aht_Urhgan_Whitegate/TextIDs"] = nil; ----------------------------------- require("scripts/zones/Aht_Urhgan_Whitegate/TextIDs"); require("scripts/globals/keyitems"); require("scripts/globals/missions"); require("scripts/globals/besieged"); ----------------------------------- -- onTrade Action ----------------------------------- function onTrade(player,npc,trade) end; ----------------------------------- -- onTrigger Action ----------------------------------- function onTrigger(player,npc) local currentday = tonumber(os.date("%j")); local lastIDtag = player:getVar("LAST_IMPERIAL_TAG"); local tagCount = player:getCurrency("id_tags"); local diffday = currentday - lastIDtag ; local currentAssault = player:getCurrentAssault(); local haveimperialIDtag; if (player:getCurrentMission(TOAU) == PRESIDENT_SALAHEEM and player:getVar("AhtUrganStatus") == 0) then player:startEvent(269,0,0,0,0,0,0,0,0,0); elseif (player:getCurrentMission(TOAU) <= IMMORTAL_SENTRIES or player:getMainLvl() <= 49) then player:startEvent(270); elseif (currentAssault ~= 0 and hasAssaultOrders(player) == 0) then if (player:getVar("AssaultComplete") == 1) then player:messageText(player,RYTAAL_MISSION_COMPLETE); player:completeAssault(currentAssault); else player:messageText(player,RYTAAL_MISSION_FAILED); player:addAssault(0); end player:setVar("AssaultComplete",0); elseif ((player:getCurrentMission(TOAU) > PRESIDENT_SALAHEEM) or (player:getCurrentMission(TOAU) == PRESIDENT_SALAHEEM and player:getVar("AhtUrganStatus") >= 1)) then if (lastIDtag == 0) then -- first time you get the tag tagCount = 1; player:setCurrency("id_tags", tagCount); player:setVar("LAST_IMPERIAL_TAG",currentday); elseif (diffday > 0) then tagCount = tagCount + diffday ; if (tagCount > 3) then -- store 3 TAG max tagCount = 3; end player:setCurrency("id_tags", tagCount); player:setVar("LAST_IMPERIAL_TAG",currentday); end if (player:hasKeyItem(IMPERIAL_ARMY_ID_TAG)) then haveimperialIDtag = 1; else haveimperialIDtag = 0; end player:startEvent(268,IMPERIAL_ARMY_ID_TAG,tagCount,currentAssault,haveimperialIDtag); 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 tagCount = player:getCurrency("id_tags"); local currentAssault = player:getCurrentAssault(); if (csid == 269) then player:setVar("AhtUrganStatus",1); elseif (csid == 268 and option == 1 and player:hasKeyItem(IMPERIAL_ARMY_ID_TAG) == false and tagCount > 0) then player:addKeyItem(IMPERIAL_ARMY_ID_TAG); player:messageSpecial(KEYITEM_OBTAINED,IMPERIAL_ARMY_ID_TAG); player:setCurrency("id_tags", tagCount - 1); elseif (csid == 268 and option == 2 and player:hasKeyItem(IMPERIAL_ARMY_ID_TAG) == false and hasAssaultOrders(player) ~= 0) then if (player:hasKeyItem(LEUJAOAM_ASSAULT_ORDERS)) then player:delKeyItem(LEUJAOAM_ASSAULT_ORDERS); elseif (player:hasKeyItem(MAMOOL_JA_ASSAULT_ORDERS)) then player:delKeyItem(MAMOOL_JA_ASSAULT_ORDERS); elseif (player:hasKeyItem(LEBROS_ASSAULT_ORDERS)) then player:delKeyItem(LEBROS_ASSAULT_ORDERS); elseif (player:hasKeyItem(PERIQIA_ASSAULT_ORDERS)) then player:delKeyItem(PERIQIA_ASSAULT_ORDERS); elseif (player:hasKeyItem(ILRUSI_ASSAULT_ORDERS )) then player:delKeyItem(ILRUSI_ASSAULT_ORDERS); elseif (player:hasKeyItem(NYZUL_ISLE_ASSAULT_ORDERS)) then player:delKeyItem(NYZUL_ISLE_ASSAULT_ORDERS); end player:addKeyItem(IMPERIAL_ARMY_ID_TAG); player:messageSpecial(KEYITEM_OBTAINED,IMPERIAL_ARMY_ID_TAG); player:delAssault(currentAssault); end end;
gpl-3.0
Fenix-XI/Fenix
scripts/globals/abilities/box_step.lua
11
7890
----------------------------------- -- Ability: Box Step -- Lowers target's defense. If successful, you will earn two Finishing Moves. -- Obtained: Dancer Level 30 -- TP Required: 10% -- Recast Time: 00:05 -- Duration: First Step lasts 1 minute, each following Step extends its current duration by 30 seconds. ----------------------------------- require("scripts/globals/settings"); require("scripts/globals/status"); require("scripts/globals/weaponskills"); ----------------------------------- -- onAbilityCheck ----------------------------------- function onAbilityCheck(player,target,ability) if (player:getAnimation() ~= 1) then return MSGBASIC_REQUIRES_COMBAT,0; else if (player:hasStatusEffect(EFFECT_TRANCE)) then return 0,0; elseif (player:getTP() < 100) then return MSGBASIC_NOT_ENOUGH_TP,0; else return 0,0; end end end; ----------------------------------- -- onUseAbility ----------------------------------- function onUseAbility(player,target,ability,action) -- Only remove TP if the player doesn't have Trance. if not player:hasStatusEffect(EFFECT_TRANCE) then player:delTP(100); end; local hit = 2; local effect = 1; if math.random() <= getHitRate(player,target,true,player:getMod(MOD_STEP_ACCURACY)) then hit = 6; local mjob = player:getMainJob(); local daze = 1; if (mjob == 19) then if (target:hasStatusEffect(EFFECT_SLUGGISH_DAZE_1)) then local duration = target:getStatusEffect(EFFECT_SLUGGISH_DAZE_1):getDuration(); target:delStatusEffectSilent(EFFECT_SLUGGISH_DAZE_1); if (player:hasStatusEffect(EFFECT_PRESTO)) then target:addStatusEffect(EFFECT_SLUGGISH_DAZE_3,1,0,duration+30); daze = 3; effect = 3; else target:addStatusEffect(EFFECT_SLUGGISH_DAZE_2,1,0,duration+30); daze = 2; effect = 2; end elseif (target:hasStatusEffect(EFFECT_SLUGGISH_DAZE_2)) then local duration = target:getStatusEffect(EFFECT_SLUGGISH_DAZE_2):getDuration(); target:delStatusEffectSilent(EFFECT_SLUGGISH_DAZE_2); if (player:hasStatusEffect(EFFECT_PRESTO)) then target:addStatusEffect(EFFECT_SLUGGISH_DAZE_4,1,0,duration+30); daze = 3; effect = 4; else target:addStatusEffect(EFFECT_SLUGGISH_DAZE_3,1,0,duration+30); daze = 2; effect = 3; end elseif (target:hasStatusEffect(EFFECT_SLUGGISH_DAZE_3)) then local duration = target:getStatusEffect(EFFECT_SLUGGISH_DAZE_3):getDuration(); target:delStatusEffectSilent(EFFECT_SLUGGISH_DAZE_3); if (player:hasStatusEffect(EFFECT_PRESTO)) then target:addStatusEffect(EFFECT_SLUGGISH_DAZE_5,1,0,duration+30); daze = 3; effect = 5; else target:addStatusEffect(EFFECT_SLUGGISH_DAZE_4,1,0,duration+30); daze = 2; effect = 4; end elseif (target:hasStatusEffect(EFFECT_SLUGGISH_DAZE_4)) then local duration = target:getStatusEffect(EFFECT_SLUGGISH_DAZE_4):getDuration(); target:delStatusEffectSilent(EFFECT_SLUGGISH_DAZE_4); if (player:hasStatusEffect(EFFECT_PRESTO)) then daze = 3; else daze = 2; end target:addStatusEffect(EFFECT_SLUGGISH_DAZE_2,1,0,duration+30); effect = 5; elseif (target:hasStatusEffect(EFFECT_SLUGGISH_DAZE_5)) then local duration = target:getStatusEffect(EFFECT_SLUGGISH_DAZE_5):getDuration(); target:delStatusEffectSilent(EFFECT_SLUGGISH_DAZE_5); target:addStatusEffect(EFFECT_SLUGGISH_DAZE_3,1,0,duration+30); daze = 1; effect = 5; else if (player:hasStatusEffect(EFFECT_PRESTO)) then target:addStatusEffect(EFFECT_SLUGGISH_DAZE_2,1,0,60); daze = 3; effect = 2; else target:addStatusEffect(EFFECT_SLUGGISH_DAZE_1,1,0,60); daze = 2; effect = 1; end end; else if (target:hasStatusEffect(EFFECT_SLUGGISH_DAZE_1)) then local duration = target:getStatusEffect(EFFECT_SLUGGISH_DAZE_1):getDuration(); target:delStatusEffectSilent(EFFECT_SLUGGISH_DAZE_1); target:addStatusEffect(EFFECT_SLUGGISH_DAZE_2,1,0,duration+30); effect = 2; elseif (target:hasStatusEffect(EFFECT_SLUGGISH_DAZE_2)) then local duration = target:getStatusEffect(EFFECT_SLUGGISH_DAZE_2):getDuration(); target:delStatusEffectSilent(EFFECT_SLUGGISH_DAZE_2); target:addStatusEffect(EFFECT_SLUGGISH_DAZE_3,1,0,duration+30); effect = 3; elseif (target:hasStatusEffect(EFFECT_SLUGGISH_DAZE_3)) then local duration = target:getStatusEffect(EFFECT_SLUGGISH_DAZE_3):getDuration(); target:delStatusEffectSilent(EFFECT_SLUGGISH_DAZE_3); target:addStatusEffect(EFFECT_SLUGGISH_DAZE_4,1,0,duration+30); effect = 4; elseif (target:hasStatusEffect(EFFECT_SLUGGISH_DAZE_4)) then local duration = target:getStatusEffect(EFFECT_SLUGGISH_DAZE_4):getDuration(); target:delStatusEffectSilent(EFFECT_SLUGGISH_DAZE_4); target:addStatusEffect(EFFECT_SLUGGISH_DAZE_5,1,0,duration+30); effect = 5; elseif (target:hasStatusEffect(EFFECT_SLUGGISH_DAZE_5)) then local duration = target:getStatusEffect(EFFECT_SLUGGISH_DAZE_5):getDuration(); target:delStatusEffectSilent(EFFECT_SLUGGISH_DAZE_5); target:addStatusEffect(EFFECT_SLUGGISH_DAZE_5,1,0,duration+30); effect = 5; else target:addStatusEffect(EFFECT_SLUGGISH_DAZE_1,1,0,60); effect = 1; end; end if (player:hasStatusEffect(EFFECT_FINISHING_MOVE_1)) then player:delStatusEffectSilent(EFFECT_FINISHING_MOVE_1); player:addStatusEffect(EFFECT_FINISHING_MOVE_1+daze,1,0,7200); elseif (player:hasStatusEffect(EFFECT_FINISHING_MOVE_2)) then player:delStatusEffectSilent(EFFECT_FINISHING_MOVE_2); player:addStatusEffect(EFFECT_FINISHING_MOVE_2+daze,1,0,7200); elseif (player:hasStatusEffect(EFFECT_FINISHING_MOVE_3)) then player:delStatusEffectSilent(EFFECT_FINISHING_MOVE_3); if (daze > 2) then daze = 2; end; player:addStatusEffect(EFFECT_FINISHING_MOVE_3+daze,1,0,7200); elseif (player:hasStatusEffect(EFFECT_FINISHING_MOVE_4)) then player:delStatusEffectSilent(EFFECT_FINISHING_MOVE_4); player:addStatusEffect(EFFECT_FINISHING_MOVE_5,1,0,7200); elseif (player:hasStatusEffect(EFFECT_FINISHING_MOVE_5)) then else player:addStatusEffect(EFFECT_FINISHING_MOVE_1 - 1 + daze,1,0,7200); end; else ability:setMsg(158); end action:animation(target:getID(), getStepAnimation(player:getWeaponSkillType(SLOT_MAIN))) action:speceffect(target:getID(), hit) return effect end;
gpl-3.0
Fenix-XI/Fenix
scripts/zones/Windurst_Waters/npcs/Ranpi-Monpi.lua
12
5859
----------------------------------- -- Area: Windurst Waters -- NPC: Ranpi-Monpi -- Starts and Finishes Quest: A Crisis in the Making -- Involved in quest: In a Stew, For Want of a Pot, The Dawn of Delectability -- @zone = 238 -- @pos = -116 -3 52 (outside the shop he is in) ----------------------------------- 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) IASvar = player:getVar("IASvar"); -- In a Stew if (IASvar == 3) then count = trade:getItemCount(); if (trade:hasItemQty(4373,3) and count == 3) then player:startEvent(0x022C); -- Correct items given, advance quest else player:startEvent(0x022B,0,4373); -- incorrect or not enough, play reminder dialog end end end; ----------------------------------- -- onTrigger Action ----------------------------------- function onTrigger(player,npc) crisisstatus = player:getQuestStatus(WINDURST,A_CRISIS_IN_THE_MAKING); IAS = player:getQuestStatus(WINDURST,IN_A_STEW); IASvar = player:getVar("IASvar"); -- In a Stew if (IAS == QUEST_ACCEPTED and IASvar == 2) then player:startEvent(0x022A,0,4373); -- start fetch portion of quest elseif (IAS == QUEST_ACCEPTED and IASvar == 3) then player:startEvent(0x022B,0,4373); -- reminder dialog elseif (IAS == QUEST_ACCEPTED and IASvar == 4) then player:startEvent(0x022D); -- new dialog before finish of quest -- A Crisis in the Making elseif (crisisstatus == QUEST_AVAILABLE and player:getFameLevel(WINDURST) >= 2 and player:needToZone() == false) then -- A Crisis in the Making + ITEM: Quest Offer player:startEvent(0x0102,0,625); elseif (crisisstatus == QUEST_ACCEPTED) then prog = player:getVar("QuestCrisisMaking_var"); if (prog == 1) then -- A Crisis in the Making: Quest Objective Reminder player:startEvent(0x0106,0,625); elseif (prog == 2) then -- A Crisis in the Making: Quest Finish player:startEvent(0x010b); end elseif (crisisstatus == QUEST_COMPLETED and player:needToZone() == false and player:getVar("QuestCrisisMaking_var") == 0) then -- A Crisis in the Making + ITEM: Repeatable Quest Offer player:startEvent(0x0103,0,625); elseif (crisisstatus == QUEST_COMPLETED and player:getVar("QuestCrisisMaking_var") == 1) then -- A Crisis in the Making: Quest Objective Reminder player:startEvent(0x0106,0,625); elseif (crisisstatus == QUEST_COMPLETED and player:getVar("QuestCrisisMaking_var") == 2) then -- A Crisis in the Making: Repeatable Quest Finish player:startEvent(0x010c); else --Standard dialogs rand = math.random(1,3); if (rand == 1) then -- STANDARD CONVO: sings song about ingredients player:startEvent(0x00f9); elseif (rand == 2) then -- STANDARD CONVO 2: sings song about ingredients player:startEvent(0x00fb); elseif (rand == 3) then -- STANDARD CONVO 3: player:startEvent(0x0100); 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); -- A Crisis in the Making if (csid == 0x0102 and option == 1) then -- A Crisis in the Making + ITEM: Quest Offer - ACCEPTED player:addQuest(WINDURST,A_CRISIS_IN_THE_MAKING); player:setVar("QuestCrisisMaking_var",1); player:needToZone(true); elseif (csid == 0x0102 and option == 2) then -- A Crisis in the Making + ITEM: Quest Offer - REFUSED player:needToZone(true); elseif (csid == 0x0103 and option == 1) then -- A Crisis in the Making + ITEM: Repeatable Quest Offer - ACCEPTED player:setVar("QuestCrisisMaking_var",1); player:needToZone(true); elseif (csid == 0x0103 and option == 2) then -- A Crisis in the Making + ITEM: Repeatable Quest Offer - REFUSED player:needToZone(true); elseif (csid == 0x010b) then -- A Crisis in the Making: Quest Finish player:addGil(GIL_RATE*400); player:messageSpecial(GIL_OBTAINED,GIL_RATE*400); player:setVar("QuestCrisisMaking_var",0); player:delKeyItem(OFF_OFFERING); player:addFame(WINDURST,75); player:completeQuest(WINDURST,A_CRISIS_IN_THE_MAKING); player:needToZone(true); elseif (csid == 0x010c) then -- A Crisis in the Making: Repeatable Quest Finish player:addGil(GIL_RATE*400); player:messageSpecial(GIL_OBTAINED,GIL_RATE*400); player:setVar("QuestCrisisMaking_var",0); player:delKeyItem(OFF_OFFERING); player:addFame(WINDURST,8); player:needToZone(true); -- In a Stew elseif (csid == 0x022A) then -- start fetch portion player:setVar("IASvar",3); elseif (csid == 0x022C) then player:tradeComplete(); player:setVar("IASvar",4); player:addKeyItem(RANPIMONPIS_SPECIAL_STEW); player:messageSpecial(KEYITEM_OBTAINED,RANPIMONPIS_SPECIAL_STEW); end end;
gpl-3.0
gwlim/openwrt_mr3420_8M
feeds/xwrt/webif-iw-lua/files/usr/lib/lua/lua-xwrt/xwrt/init.lua
18
1593
old_require = require function exists(file) local f = io.open( file, "r" ) if f then io.close( f ) return true else return false end end function require (str) local fstr = string.gsub(str,"[.]","/") for path in string.gmatch(package.path,"[^;]+") do local path = string.gsub(path,"?",fstr) if exists(path) then return old_require(str) end end for path in string.gmatch(package.cpath,"[^;]+") do local path = string.gsub(path,"?",fstr) if exists(path) then return old_require(str) end end return nil end __WORK_STATE = {"Warning... WORK NOT DONE... Not usefull...","Warning... Work in progress...","Warning... Work Not Tested","Warning... Work in Test"} __WIP = 0 __ERROR = {} -- __ERROR[#__ERROR][var_name], __ERROR[#__ERROR][msg] __TOCHECK = {} -- __TOCHECK[#__TOCHECK] __UCI_CMD = {} -- __UCI_CMD[#__UCI_CMD]["command"], __UCI_CMD[#__UCI_CMD_]["varname"] __UCI_MSG = {} -- __ERROR = {} __ENV = {} __FORM = {} __MENU = {} require("lua-xwrt.xwrt.cgi_env") require("lua-xwrt.xwrt.validate") require("lua-xwrt.addon.uci") require("lua-xwrt.xwrt.changes_uci") uci_changed = changes_uciClass.new() require("lua-xwrt.xwrt.translator") tr_load() util = require("lua-xwrt.xwrt.util") require("lua-xwrt.xwrt.page") page = xwrtpageClass.new("X-Wrt Page") require("lua-xwrt.html.form") -- __MENU.permission() if __FORM.__ACTION=="clear_changes" then uci_changed:clear() end if __FORM.__ACTION=="apply_changes" then uci_changed:apply() end if __FORM.__ACTION=="review_changes" then uci_changed:show() end
gpl-2.0
Fenix-XI/Fenix
scripts/zones/Valley_of_Sorrows/mobs/Adamantoise.lua
1
1603
----------------------------------- -- Area: Valley of Sorrows -- HNM: Adamantoise ----------------------------------- require("scripts/globals/settings"); require("scripts/globals/titles"); require("scripts/globals/status"); ----------------------------------- -- onMobInitialize ----------------------------------- function onMobInitialize(mob) end; ----------------------------------- -- onMobDeath ----------------------------------- function onMobDeath(mob, killer, ally) ally:addTitle(TORTOISE_TORTURER); ally:addCurrency("bayld",100); ally:PrintToPlayer( "You earned 100 Bayld!"); end; ----------------------------------- -- onMobDespawn ----------------------------------- function onMobDespawn(mob) local Adamantoise = mob:getID(); local Aspidochelone = mob:getID()+1; local ToD = GetServerVariable("[POP]Aspidochelone"); local kills = GetServerVariable("[PH]Aspidochelone"); local popNow = (math.random(1,5) == 3 or kills > 6); if (LandKingSystem_HQ ~= 1 and ToD <= os.time(t) and popNow == true) then -- 0 = timed spawn, 1 = force pop only, 2 = BOTH if (LandKingSystem_NQ == 0) then DeterMob(Adamantoise, true); end DeterMob(Aspidochelone, false); UpdateNMSpawnPoint(Aspidochelone); GetMobByID(Aspidochelone):setRespawnTime(math.random(75600,86400)); else if (LandKingSystem_NQ ~= 1) then UpdateNMSpawnPoint(Adamantoise); mob:setRespawnTime(math.random(75600,86400)); SetServerVariable("[PH]Aspidochelone", kills + 1); end end end;
gpl-3.0
elapuestojoe/survive
build_temp/deployments/default/android/release/arm/intermediate_files/assets/quicklua/lua_socket/ltn12.lua
127
8177
----------------------------------------------------------------------------- -- LTN12 - Filters, sources, sinks and pumps. -- LuaSocket toolkit. -- Author: Diego Nehab -- RCS ID: $Id: ltn12.lua,v 1.31 2006/04/03 04:45:42 diego Exp $ ----------------------------------------------------------------------------- ----------------------------------------------------------------------------- -- Declare module ----------------------------------------------------------------------------- local string = require("string") local table = require("table") local base = _G module("ltn12") filter = {} source = {} sink = {} pump = {} -- 2048 seems to be better in windows... BLOCKSIZE = 2048 _VERSION = "LTN12 1.0.1" ----------------------------------------------------------------------------- -- Filter stuff ----------------------------------------------------------------------------- -- returns a high level filter that cycles a low-level filter function filter.cycle(low, ctx, extra) base.assert(low) return function(chunk) local ret ret, ctx = low(ctx, chunk, extra) return ret end end -- chains a bunch of filters together -- (thanks to Wim Couwenberg) function filter.chain(...) local n = table.getn(arg) local top, index = 1, 1 local retry = "" return function(chunk) retry = chunk and retry while true do if index == top then chunk = arg[index](chunk) if chunk == "" or top == n then return chunk elseif chunk then index = index + 1 else top = top+1 index = top end else chunk = arg[index](chunk or "") if chunk == "" then index = index - 1 chunk = retry elseif chunk then if index == n then return chunk else index = index + 1 end else base.error("filter returned inappropriate nil") end end end end end ----------------------------------------------------------------------------- -- Source stuff ----------------------------------------------------------------------------- -- create an empty source local function empty() return nil end function source.empty() return empty end -- returns a source that just outputs an error function source.error(err) return function() return nil, err end end -- creates a file source function source.file(handle, io_err) if handle then return function() local chunk = handle:read(BLOCKSIZE) if not chunk then handle:close() end return chunk end else return source.error(io_err or "unable to open file") end end -- turns a fancy source into a simple source function source.simplify(src) base.assert(src) return function() local chunk, err_or_new = src() src = err_or_new or src if not chunk then return nil, err_or_new else return chunk end end end -- creates string source function source.string(s) if s then local i = 1 return function() local chunk = string.sub(s, i, i+BLOCKSIZE-1) i = i + BLOCKSIZE if chunk ~= "" then return chunk else return nil end end else return source.empty() end end -- creates rewindable source function source.rewind(src) base.assert(src) local t = {} return function(chunk) if not chunk then chunk = table.remove(t) if not chunk then return src() else return chunk end else table.insert(t, chunk) end end end function source.chain(src, f) base.assert(src and f) local last_in, last_out = "", "" local state = "feeding" local err return function() if not last_out then base.error('source is empty!', 2) end while true do if state == "feeding" then last_in, err = src() if err then return nil, err end last_out = f(last_in) if not last_out then if last_in then base.error('filter returned inappropriate nil') else return nil end elseif last_out ~= "" then state = "eating" if last_in then last_in = "" end return last_out end else last_out = f(last_in) if last_out == "" then if last_in == "" then state = "feeding" else base.error('filter returned ""') end elseif not last_out then if last_in then base.error('filter returned inappropriate nil') else return nil end else return last_out end end end end end -- creates a source that produces contents of several sources, one after the -- other, as if they were concatenated -- (thanks to Wim Couwenberg) function source.cat(...) local src = table.remove(arg, 1) return function() while src do local chunk, err = src() if chunk then return chunk end if err then return nil, err end src = table.remove(arg, 1) end end end ----------------------------------------------------------------------------- -- Sink stuff ----------------------------------------------------------------------------- -- creates a sink that stores into a table function sink.table(t) t = t or {} local f = function(chunk, err) if chunk then table.insert(t, chunk) end return 1 end return f, t end -- turns a fancy sink into a simple sink function sink.simplify(snk) base.assert(snk) return function(chunk, err) local ret, err_or_new = snk(chunk, err) if not ret then return nil, err_or_new end snk = err_or_new or snk return 1 end end -- creates a file sink function sink.file(handle, io_err) if handle then return function(chunk, err) if not chunk then handle:close() return 1 else return handle:write(chunk) end end else return sink.error(io_err or "unable to open file") end end -- creates a sink that discards data local function null() return 1 end function sink.null() return null end -- creates a sink that just returns an error function sink.error(err) return function() return nil, err end end -- chains a sink with a filter function sink.chain(f, snk) base.assert(f and snk) return function(chunk, err) if chunk ~= "" then local filtered = f(chunk) local done = chunk and "" while true do local ret, snkerr = snk(filtered, err) if not ret then return nil, snkerr end if filtered == done then return 1 end filtered = f(done) end else return 1 end end end ----------------------------------------------------------------------------- -- Pump stuff ----------------------------------------------------------------------------- -- pumps one chunk from the source to the sink function pump.step(src, snk) local chunk, src_err = src() local ret, snk_err = snk(chunk, src_err) if chunk and ret then return 1 else return nil, src_err or snk_err end end -- pumps all data from a source to a sink, using a step function function pump.all(src, snk, step) base.assert(src and snk) step = step or pump.step while true do local ret, err = step(src, snk) if not ret then if err then return nil, err else return 1 end end end end
mit
Fenix-XI/Fenix
scripts/globals/weaponskills/gate_of_tartarus.lua
1
2033
----------------------------------- -- Gate Of Tartarus -- Staff weapon skill -- Skill Level: N/A -- Lowers target's attack. Additional effect: Refresh -- Refresh effect is 8mp/tick for 20 sec per 100 TP. -- Available only when equipped with the Relic Weapons Thyrus (Dynamis use only) and Claustrum, or the Chthonic Staff once the Latent Effect has been activated. -- These Relic Weapons are only available to Black Mages and Summoners. As such, only these jobs may use this Weapon Skill. -- Aligned with the Aqua Gorget & Snow Gorget. -- Aligned with the Aqua Belt & Snow Belt. -- Element: None -- Modifiers: CHR:60% -- 100%TP 200%TP 300%TP -- 3.00 3.00 3.00 ----------------------------------- require("scripts/globals/status"); require("scripts/globals/settings"); require("scripts/globals/weaponskills"); ----------------------------------- function onUseWeaponSkill(player, target, wsID, tp, primary) local params = {}; params.numHits = 1; params.ftp100 = 3; params.ftp200 = 3; params.ftp300 = 3; 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.0; params.chr_wsc = 0.6; params.crit100 = 0.0; params.crit200 = 0.0; params.crit300 = 0.0; params.canCrit = false; params.acc100 = 0.0; params.acc200= 0.0; params.acc300= 0.0; params.atkmulti = 1; if (USE_ADOULIN_WEAPON_SKILL_CHANGES == true) then params.int_wsc = 0.8; params.chr_wsc = 0.0; end local damage, criticalHit, tpHits, extraHits = doPhysicalWeaponskill(player, target, wsID, params, tp, primary); -- TODO: Whoever codes those level 85 weapons with the latent that grants this WS needs to code a check to not give the aftermath effect. if (damage > 0) then local amDuration = 20 * math.floor(tp/100); player:addStatusEffect(EFFECT_AFTERMATH, 8, 0, amDuration, 0, 10); target:addStatusEffect(EFFECT_ATTACK_DOWN, 20, 0, 60); end return tpHits, extraHits, criticalHit, damage; end
gpl-3.0
Fenix-XI/Fenix
scripts/zones/Selbina/npcs/Tilala.lua
13
1151
----------------------------------- -- Area: Selbina -- NPC: Tilala -- Guild Merchant NPC: Clothcrafting Guild -- @pos 14.344 -7.912 10.276 248 ----------------------------------- package.loaded["scripts/zones/Selbina/TextIDs"] = nil; ----------------------------------- require("scripts/globals/settings"); require("scripts/globals/shop"); require("scripts/zones/Selbina/TextIDs"); ----------------------------------- -- onTrade Action ----------------------------------- function onTrade(player,npc,trade) end; ----------------------------------- -- onTrigger Action ----------------------------------- function onTrigger(player,npc) if (player:sendGuild(516,6,21,0)) then player:showText(npc,CLOTHCRAFT_SHOP_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
Fenix-XI/Fenix
scripts/zones/West_Sarutabaruta/TextIDs.lua
13
2666
-- Variable TextID Description text -- General Texts ITEM_CANNOT_BE_OBTAINED = 6379; -- You cannot obtain the item <item> come back again after sorting your inventory. ITEM_OBTAINED = 6384; -- Obtained: <item>. GIL_OBTAINED = 6385; -- Obtained <number> gil. KEYITEM_OBTAINED = 6387; -- Obtained key item: <keyitem>. FISHING_MESSAGE_OFFSET = 7045; -- You can't fish here. -- Fields of Valor Texts REGIME_ACCEPTED = 10175; -- New training regime registered! DONT_SWAP_JOBS = 10176; -- your job will result in the cancellation of your current training regime. REGIME_CANCELED = 10177; -- Training regime canceled. -- Conquest CONQUEST = 7445; -- You've earned conquest points! -- Harvesting HARVESTING_IS_POSSIBLE_HERE = 7429; -- Harvesting is possible here if you have -- NPC Dialog PAORE_KUORE_DIALOG = 7379; -- Welcome to Windurst! Proceed through this gateway to entaru Port Windurst. KOLAPO_OILAPO_DIALOG = 7380; -- Hi-diddly-diddly! This is the gateway to Windurst! The grasslands you're on now are known as West Sarutabaruta. MAATA_ULAATA = 7381; -- Hello-wello! This is the central tower of the Horutoto Ruins. It's one of the several ancient-wancient magic towers which dot these grasslands. IPUPU_DIALOG = 7384; -- I decided to take a little strolly-wolly, but before I realized it, I found myself way out here! Now I am sorta stuck... Woe is me! -- Other Dialog NOTHING_HAPPENS = 7299; -- Nothing happens... NOTHING_OUT_OF_ORDINARY = 7394; -- There is nothing out of the ordinary here. -- Signs SIGN_1 = 7369; -- Northeast: Central Tower, Horutoto Ruins Northwest: Giddeus South: Port Windurst SIGN_3 = 7370; -- East: East Sarutabaruta West: Giddeus SIGN_5 = 7371; -- Northeast: Central Tower, Horutoto Ruins East: East Sarutabaruta West: Giddeus SIGN_7 = 7372; -- South: Windurst East: East Sarutabaruta SIGN_9 = 7373; -- West: Giddeus North: East Sarutabaruta South: Windurst SIGN_11 = 7374; -- North: East Sarutabaruta Southeast: Windurst SIGN_13 = 7375; -- East: Port Windurst West: West Tower, Horutoto Ruins SIGN_15 = 7376; -- East: East Sarutabaruta West: Giddeus Southeast: Windurst SIGN_17 = 7377; -- Northwest: Northwest Tower, Horutoto RuinsEast: Outpost Southwest: Giddeus -- conquest Base CONQUEST_BASE = 7140; -- Tallying conquest results... -- chocobo digging DIG_THROW_AWAY = 7058; -- You dig up ?Possible Special Code: 01??Possible Special Code: 01??Possible Special Code: 01? ?Possible Special Code: 01??Possible Special Code: 05?$?BAD CHAR: 8280??BAD CHAR: 80??BAD CHAR: 80?, but your inventory is full. FIND_NOTHING = 7060; -- You dig and you dig, but find nothing.
gpl-3.0
DarkstarProject/darkstar
scripts/zones/The_Sanctuary_of_ZiTah/IDs.lua
8
3727
----------------------------------- -- Area: The_Sanctuary_of_ZiTah ----------------------------------- require("scripts/globals/zone") ----------------------------------- zones = zones or {} zones[dsp.zone.THE_SANCTUARY_OF_ZITAH] = { text = { ITEM_CANNOT_BE_OBTAINED = 6382, -- You cannot obtain the <item>. Come back after sorting your inventory. FULL_INVENTORY_AFTER_TRADE = 6386, -- You cannot obtain the <item>. Try trading again after sorting your inventory. ITEM_OBTAINED = 6388, -- Obtained: <item>. GIL_OBTAINED = 6389, -- Obtained <number> gil. KEYITEM_OBTAINED = 6391, -- Obtained key item: <keyitem>. KEYITEM_LOST = 6392, -- Lost key item: <keyitem>. ITEMS_OBTAINED = 6397, -- You obtain <number> <item>! NOTHING_OUT_OF_ORDINARY = 6402, -- There is nothing out of the ordinary here. SENSE_OF_FOREBODING = 6403, -- You are suddenly overcome with a sense of foreboding... CONQUEST_BASE = 7049, -- Tallying conquest results... BEASTMEN_BANNER = 7130, -- There is a beastmen's banner. CONQUEST = 7217, -- You've earned conquest points! FISHING_MESSAGE_OFFSET = 7550, -- You can't fish here. DIG_THROW_AWAY = 7563, -- You dig up <item>, but your inventory is full. You regretfully throw the <item> away. FIND_NOTHING = 7565, -- You dig and you dig, but find nothing. SOMETHING_BETTER = 7733, -- Don't you have something better to do right now? CANNOT_REMOVE_FRAG = 7736, -- It is an oddly shaped stone monument. A shining stone is embedded in it, but cannot be removed... ALREADY_OBTAINED_FRAG = 7737, -- You have already obtained this monument's <keyitem>. Try searching for another. FOUND_ALL_FRAGS = 7739, -- You have obtained <keyitem>! You now have all 8 fragments of light! ZILART_MONUMENT = 7740, -- It is an ancient Zilart monument. STURDY_BRANCH = 7763, -- It is a beautiful, sturdy branch. SENSE_OMINOUS_PRESENCE = 7848, -- You sense an ominous presence... PLAYER_OBTAINS_ITEM = 8082, -- <name> obtains <item>! UNABLE_TO_OBTAIN_ITEM = 8083, -- You were unable to obtain the item. PLAYER_OBTAINS_TEMP_ITEM = 8084, -- <name> obtains the temporary item: <item>! ALREADY_POSSESS_TEMP = 8085, -- You already possess that temporary item. NO_COMBINATION = 8090, -- You were unable to enter a combination. REGIME_REGISTERED = 10268, -- New training regime registered! COMMON_SENSE_SURVIVAL = 12257, -- It appears that you have arrived at a new survival guide provided by the Adventurers' Mutual Aid Network. Common sense dictates that you should now be able to teleport here from similar tomes throughout the world. }, mob = { KEEPER_OF_HALIDOM_PH = { [17272977] = 17272978, -- 319.939 -0.037 187.231 }, NOBLE_MOLD_PH = { [17273276] = 17273278, -- -391.184 -0.269 -159.086 [17273277] = 17273278, -- -378.456 0.425 -162.489 }, GUARDIAN_TREANT = 17272838, DOOMED_PILGRIMS = 17272839, NOBLE_MOLD = 17273278, ISONADE = 17273285, GREENMAN = 17273295, }, npc = { CASKET_BASE = 17273338, OVERSEER_BASE = 17273365, CERMET_HEADSTONE = 17273390, }, } return zones[dsp.zone.THE_SANCTUARY_OF_ZITAH]
gpl-3.0
Fenix-XI/Fenix
scripts/zones/The_Sanctuary_of_ZiTah/TextIDs.lua
15
1760
-- Variable TextID Description text -- General Texts ITEM_CANNOT_BE_OBTAINED = 6379; -- You cannot obtain the item <item>. Come back after sorting your inventory. FULL_INVENTORY_AFTER_TRADE = 6383; -- You cannot obtain the <item>. Try trading again after sorting your inventory. ITEM_OBTAINED = 6384; -- Obtained: <item>. GIL_OBTAINED = 6385; -- Obtained <number> gil. KEYITEM_OBTAINED = 6387; -- Obtained key item: <keyitem>. ITEMS_OBTAINED = 6390; -- You obtain <param2 number> <param1 item>! BEASTMEN_BANNER = 7126; -- There is a beastmen's banner. FISHING_MESSAGE_OFFSET = 7546; -- You can't fish here. -- Conquest CONQUEST = 7213; -- You've earned conquest points! -- Quest Dialogs SENSE_OF_FOREBODING = 6399; -- You are suddenly overcome with a sense of foreboding... STURDY_BRANCH = 7754; -- It is a beautiful, sturdy branch. NOTHING_OUT_OF_ORDINARY = 6398; -- There is nothing out of the ordinary here. -- ZM4 Dialog CANNOT_REMOVE_FRAG = 7727; -- It is an oddly shaped stone monument. A shining stone is embedded in it, but cannot be removed... ALREADY_OBTAINED_FRAG = 7728; -- You have already obtained this monument's FOUND_ALL_FRAGS = 7730; -- You now have all 8 fragments of light! ZILART_MONUMENT = 7731; -- It is an ancient Zilart monument. -- conquest Base CONQUEST_BASE = 7045; -- Tallying conquest results... -- chocobo digging DIG_THROW_AWAY = 7559; -- You dig up ?Possible Special Code: 01??Possible Special Code: 01??Possible Special Code: 01? ?Possible Special Code: 01??Possible Special Code: 05?$?BAD CHAR: 8280??BAD CHAR: 80??BAD CHAR: 80?, but your inventory is full. FIND_NOTHING = 7561; -- You dig and you dig, but find nothing.
gpl-3.0
Fenix-XI/Fenix
scripts/zones/Apollyon/bcnms/SE_Apollyon.lua
13
1438
----------------------------------- -- Area: Appolyon -- Name: SE_Apollyon ----------------------------------- require("scripts/globals/limbus"); require("scripts/globals/keyitems"); -- After registering the BCNM via bcnmRegister(bcnmid) function onBcnmRegister(player,instance) SetServerVariable("[SE_Apollyon]UniqueID",GenerateLimbusKey()); HideArmouryCrates(GetInstanceRegion(1293),APPOLLYON_SE_NE); end; -- Physically entering the BCNM via bcnmEnter(bcnmid) function onBcnmEnter(player,instance) player:setVar("limbusbitmap",0); player:setVar("characterLimbusKey",GetServerVariable("[SE_Apollyon]UniqueID")); player:setVar("LimbusID",1293); player:delKeyItem(COSMOCLEANSE); player:delKeyItem(BLACK_CARD); end; -- 3=Disconnected or warped out (if dyna is empty: launch 4 after 3) -- 4=Finish function onBcnmLeave(player,instance,leavecode) -- print("leave code "..leavecode); if (leavecode == 4) then player:setPos(643,0.1,-600); ResetPlayerLimbusVariable(player) 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
Fenix-XI/Fenix
scripts/globals/mobskills/Sand_Blast.lua
24
1154
--------------------------------------------------- -- Sand Blast -- Deals Earth damage to targets in a fan-shaped area of effect. Additional effect: Blind -- Range: 8' cone --------------------------------------------------- require("scripts/globals/settings"); require("scripts/globals/status"); require("scripts/globals/monstertpmoves"); --------------------------------------------------- function onMobSkillCheck(target,mob,skill) return 0; end; function onMobWeaponSkill(target, mob, skill) local typeEffect = EFFECT_BLINDNESS; skill:setMsg(MobStatusEffectMove(mob, target, typeEffect, 20, 0, 120)); if (mob:getPool() == 1318 and mob:getLocalVar("SAND_BLAST") == 1) then -- Feeler Anltion if (GetMobAction(mob:getID()+6) == 0) then -- Alastor Antlion mob:setLocalVar("SAND_BLAST",0); -- Don't spawn more NMs local alastorAntlion = GetMobByID(mob:getID() + 6); alastorAntlion:setSpawn(mob:getXPos() + 1, mob:getYPos() + 1, mob:getZPos() + 1); -- Set its spawn location. SpawnMob((mob:getID() + 6), 120):updateClaim(target); end end return typeEffect; end;
gpl-3.0
DarkstarProject/darkstar
scripts/globals/equipment.lua
14
3248
require("scripts/globals/status"); BaseNyzulWeapons = { 18492, -- (WAR) Sturdy Axe 18753, -- (MNK) Burning Fists 18851, -- (WHM) Werebuster 18589, -- (BLM) Mage's Staff 17742, -- (RDM) Vorpal Sword 18003, -- (THF) Swordbreaker 17744, -- (PLD) Brave Blade 18944, -- (DRK) Death Sickle 17956, -- (BST) Double Axe 18034, -- (BRD) Dancing Dagger 18719, -- (RNG) Killer Bow 18443, -- (SAM) Windslicer 18426, -- (NIN) Sasuke Katana 18120, -- (DRG) Radiant Lance 18590, -- (SMN) Scepter Staff 17743, -- (BLU) Wightslayer 18720, -- (COR) Quicksilver 18754, -- (PUP) Inferno Claws 19102, -- (DNC) Main Gauche 18592 -- (SCH) Elder Staff }; ----------------------------------- -- Place convenience functions -- related to equipment here ----------------------------------- function isArtifactArmor(itemid) retval = false; if ((itemid >= 12511 and itemid <= 12520) or (itemid >= 13855 and itemid <= 13857) or (itemid >= 13868 and itemid <= 13869)) then retval = true; -- normal head sets elseif ((itemid >= 12638 and itemid <= 12650) or (itemid >= 13781 and itemid <= 13782)) then retval = true; -- normal body sets elseif (itemid >= 13961 and itemid <= 13975) then retval = true; -- normal hand sets elseif (itemid >= 14089 and itemid <= 14103) then retval = true; -- normal feet sets elseif (itemid >= 14214 and itemid <= 14228) then retval = true; -- normal legs sets elseif (itemid >= 15265 and itemid <= 15267) then retval = true; -- ToAU head sets elseif (itemid >= 14521 and itemid <= 14523) then retval = true; -- ToAU body sets elseif (itemid >= 14928 and itemid <= 14930) then retval = true; -- ToAU hand sets elseif (itemid >= 15684 and itemid <= 15686) then retval = true; -- ToAU feet sets elseif (itemid >= 15600 and itemid <= 15602) then retval = true; -- ToAU legs sets elseif (itemid >= 16138 and itemid <= 16140) then retval = true; -- WotG head sets elseif (itemid >= 14578 and itemid <= 14580) then retval = true; -- WotG body sets elseif (itemid >= 15002 and itemid <= 15004) then retval = true; -- WotG hand sets elseif (itemid >= 15746 and itemid <= 15748) then retval = true; -- WotG feet sets elseif (itemid >= 15659 and itemid <= 15661) then retval = true; -- WotG legs sets end return retval; end; function isBaseNyzulWeapon(itemId) for i, wepId in pairs(BaseNyzulWeapons) do if (itemId == wepId) then return true; end end return false; end; -- Provides a power for using a chocobo shirt with bunch of gysahl greens function ChocoboShirt(player) local body = player:getEquipID(dsp.slot.BODY); local power = 0; if (body == 10293) then -- Chocobo Shirt power = power + 1; end return power; end;
gpl-3.0
Fenix-XI/Fenix
scripts/globals/items/himesama_rice_ball.lua
51
1477
----------------------------------------- -- ID: 5928 -- Item: Himesama Rice Ball -- Food Effect: 30 Mins, All Races ----------------------------------------- -- HP +25 -- Dexterity +4 -- Vitality +4 -- Character +4 -- Effect with enhancing equipment (Note: these are latents on gear with the effect) -- Attack +60 -- Defense +40 -- Triple 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,5928); end; ----------------------------------- -- onEffectGain Action ----------------------------------- function onEffectGain(target,effect) target:addMod(MOD_HP, 25); target:addMod(MOD_DEX, 4); target:addMod(MOD_VIT, 4); target:addMod(MOD_CHR, 4); end; ----------------------------------------- -- onEffectLose Action ----------------------------------------- function onEffectLose(target,effect) target:delMod(MOD_HP, 25); target:delMod(MOD_DEX, 4); target:delMod(MOD_VIT, 4); target:delMod(MOD_CHR, 4); end;
gpl-3.0
DarkstarProject/darkstar
scripts/zones/Southern_San_dOria_[S]/IDs.lua
9
1534
----------------------------------- -- Area: Southern_San_dOria_[S] ----------------------------------- require("scripts/globals/zone") ----------------------------------- zones = zones or {} zones[dsp.zone.SOUTHERN_SAN_DORIA_S] = { text = { ITEM_CANNOT_BE_OBTAINED = 6382, -- You cannot obtain the <item>. Come back after sorting your inventory. ITEM_OBTAINED = 6388, -- Obtained: <item>. GIL_OBTAINED = 6389, -- Obtained <number> gil. KEYITEM_OBTAINED = 6391, -- Obtained key item: <keyitem>. MOG_LOCKER_OFFSET = 7360, -- Your Mog Locker lease is valid until <timestamp>, kupo. WYATT_DIALOG = 11079, -- Ahhh, sorry, sorry. The name's Wyatt, an' I be an armor merchant from Jeuno. Ended up 'ere in San d'Oria some way or another, though. HOMEPOINT_SET = 11109, -- Home point set! ITEM_DELIVERY_DIALOG = 11210, -- If'n ye have goods tae deliver, then Nembet be yer man! ALLIED_SIGIL = 12911, -- You have received the Allied Sigil! RETRIEVE_DIALOG_ID = 15574, -- You retrieve <item> from the porter moogle's care. COMMON_SENSE_SURVIVAL = 15648, -- It appears that you have arrived at a new survival guide provided by the Servicemen's Mutual Aid Network. Common sense dictates that you should now be able to teleport here from similar tomes throughout the world. }, mob = { }, npc = { }, } return zones[dsp.zone.SOUTHERN_SAN_DORIA_S]
gpl-3.0
DarkstarProject/darkstar
scripts/zones/Ordelles_Caves/npcs/qm3.lua
9
1097
----------------------------------- -- Area: Ordelle's Caves -- NPC: ??? (qm3) -- Involved in Quest: A Squire's Test II -- !pos -139 0.1 264 193 ------------------------------------- local ID = require("scripts/zones/Ordelles_Caves/IDs") require("scripts/globals/keyitems") ----------------------------------- function onTrade(player, npc, trade) end function onTrigger(player, npc) if os.time() - player:getCharVar("SquiresTestII") <= 60 and not player:hasKeyItem(dsp.ki.STALACTITE_DEW) then player:messageSpecial(ID.text.A_SQUIRE_S_TEST_II_DIALOG_II) player:addKeyItem(dsp.ki.STALACTITE_DEW) player:messageSpecial(ID.text.KEYITEM_OBTAINED, dsp.ki.STALACTITE_DEW) player:setCharVar("SquiresTestII", 0) elseif player:hasKeyItem(dsp.ki.STALACTITE_DEW) then player:messageSpecial(ID.text.A_SQUIRE_S_TEST_II_DIALOG_III) else player:messageSpecial(ID.text.NOTHING_OUT_OF_ORDINARY) player:setCharVar("SquiresTestII", 0) end end function onEventUpdate(player, csid, option) end function onEventFinish(player, csid, option) end
gpl-3.0
maikerumine/extreme_survival_mini
mods/hud/hunger.lua
1
10918
-- Keep these for backwards compatibility function hud.save_hunger(player) hud.set_hunger(player) end function hud.load_hunger(player) hud.get_hunger(player) end -- Poison player local function poisenp(tick, time, time_left, player) time_left = time_left + tick if time_left < time then minetest.after(tick, poisenp, tick, time, time_left, player) else --reset hud image end if player:get_hp()-1 > 0 then player:set_hp(player:get_hp()-1) end end function hud.item_eat(hunger_change, replace_with_item, poisen, heal) return function(itemstack, user, pointed_thing) if itemstack:take_item() ~= nil and user ~= nil then local name = user:get_player_name() local h = tonumber(hud.hunger[name]) local hp = user:get_hp() -- Saturation if h < 30 and hunger_change then h = h + hunger_change if h > 30 then h = 30 end hud.hunger[name] = h hud.set_hunger(user) end -- Healing if hp < 20 and heal then hp = hp + heal if hp > 20 then hp = 20 end user:set_hp(hp) end -- Poison if poisen then --set hud-img poisenp(1.0, poisen, 0, user) end --sound:eat itemstack:add_item(replace_with_item) end return itemstack end end local function overwrite(name, hunger_change, replace_with_item, poisen, heal) local tab = minetest.registered_items[name] if tab == nil then return end tab.on_use = hud.item_eat(hunger_change, replace_with_item, poisen, heal) minetest.registered_items[name] = tab end overwrite("default:apple", 2) if minetest.get_modpath("farming") ~= nil then overwrite("farming:bread", 4) end if minetest.get_modpath("es") ~= nil then overwrite("es:purpellium_container", 50,"vessels:glass_bottle",nil,50) end if minetest.get_modpath("esmobs") ~= nil then overwrite("esmobs:meat", 8) overwrite("esmobs:meat_raw", 2) overwrite("esmobs:chicken", 6) overwrite("esmobs:chicken_raw", 2) overwrite("esmobs:chicken_egg_fried", 2) overwrite("esmobs:rotten_flesh", -6) overwrite("esmobs:chicken_egg_fried", 3) overwrite("esmobs:mutton_cooked", 6) overwrite("esmobs:mutton_raw", 3) overwrite("esmobs:pork_raw", 6) overwrite("esmobs:pork_cooked", 3) overwrite("esmobs:beef_raw", 6) overwrite("esmobs:beef_cooked", 3) overwrite("esmobs:cheese", 4) overwrite("esmobs:rat_cooked", 3) overwrite("esmobs:rat", 1) overwrite("esmobs:bucket_milk", 8,"bucket:bucket_empty") end if minetest.get_modpath("moretrees") ~= nil then overwrite("moretrees:coconut_milk", 1) overwrite("moretrees:raw_coconut", 2) overwrite("moretrees:acorn_muffin", 3) overwrite("moretrees:spruce_nuts", 1) overwrite("moretrees:pine_nuts", 1) overwrite("moretrees:fir_nuts", 1) end if minetest.get_modpath("dwarves") ~= nil then overwrite("dwarves:beer", 2) overwrite("dwarves:apple_cider", 1) overwrite("dwarves:midus", 2) overwrite("dwarves:tequila", 2) overwrite("dwarves:tequila_with_lime", 2) overwrite("dwarves:sake", 2) end if minetest.get_modpath("animalmaterials") ~= nil then overwrite("animalmaterials:milk", 2) overwrite("animalmaterials:meat_raw", 3) overwrite("animalmaterials:meat_pork", 3) overwrite("animalmaterials:meat_beef", 3) overwrite("animalmaterials:meat_chicken", 3) overwrite("animalmaterials:meat_lamb", 3) overwrite("animalmaterials:meat_venison", 3) overwrite("animalmaterials:meat_undead", 3, "", 3) overwrite("animalmaterials:meat_toxic", 3, "", 5) overwrite("animalmaterials:meat_ostrich", 3) overwrite("animalmaterials:fish_bluewhite", 2) overwrite("animalmaterials:fish_clownfish", 2) end if minetest.get_modpath("fishing") ~= nil then overwrite("fishing:fish_raw", 2) overwrite("fishing:fish_cooked", 5) overwrite("fishing:sushi", 6) overwrite("fishing:shark", 4) overwrite("fishing:shark_cooked", 8) overwrite("fishing:pike", 4) overwrite("fishing:pike_cooked", 8) end if minetest.get_modpath("glooptest") ~= nil then overwrite("glooptest:kalite_lump", 1) end if minetest.get_modpath("bushes") ~= nil then overwrite("bushes:sugar", 1) overwrite("bushes:strawberry", 2) overwrite("bushes:berry_pie_raw", 3) overwrite("bushes:berry_pie_cooked", 4) overwrite("bushes:basket_pies", 15) end if minetest.get_modpath("bushes_classic") then -- bushes_classic mod, as found in the plantlife modpack local berries = { "strawberry", "blackberry", "blueberry", "raspberry", "gooseberry", "mixed_berry"} for _, berry in ipairs(berries) do if berry ~= "mixed_berry" then overwrite("bushes:"..berry, 1) end overwrite("bushes:"..berry.."_pie_raw", 2) overwrite("bushes:"..berry.."_pie_cooked", 5) overwrite("bushes:basket_"..berry, 15) end end if minetest.get_modpath("mushroom") ~= nil then overwrite("mushroom:brown", 1) overwrite("mushroom:red", 1, "", 3) end if minetest.get_modpath("docfarming") ~= nil then overwrite("docfarming:carrot", 3) overwrite("docfarming:cucumber", 2) overwrite("docfarming:corn", 3) overwrite("docfarming:potato", 4) overwrite("docfarming:bakedpotato", 5) overwrite("docfarming:raspberry", 3) end if minetest.get_modpath("farming_plus") ~= nil then overwrite("farming_plus:carrot_item", 3) overwrite("farming_plus:banana", 2) overwrite("farming_plus:orange_item", 2) overwrite("farming:pumpkin_bread", 4) overwrite("farming_plus:strawberry_item", 2) overwrite("farming_plus:tomato_item", 2) overwrite("farming_plus:potato_item", 4) overwrite("farming_plus:rhubarb_item", 2) end if minetest.get_modpath("mtfoods") ~= nil then overwrite("mtfoods:dandelion_milk", 1) overwrite("mtfoods:sugar", 1) overwrite("mtfoods:short_bread", 4) overwrite("mtfoods:cream", 1) overwrite("mtfoods:chocolate", 2) overwrite("mtfoods:cupcake", 2) overwrite("mtfoods:strawberry_shortcake", 2) overwrite("mtfoods:cake", 3) overwrite("mtfoods:chocolate_cake", 3) overwrite("mtfoods:carrot_cake", 3) overwrite("mtfoods:pie_crust", 3) overwrite("mtfoods:apple_pie", 3) overwrite("mtfoods:rhubarb_pie", 2) overwrite("mtfoods:banana_pie", 3) overwrite("mtfoods:pumpkin_pie", 3) overwrite("mtfoods:cookies", 2) overwrite("mtfoods:mlt_burger", 5) overwrite("mtfoods:potato_slices", 2) overwrite("mtfoods:potato_chips", 3) --mtfoods:medicine overwrite("mtfoods:casserole", 3) overwrite("mtfoods:glass_flute", 2) overwrite("mtfoods:orange_juice", 2) overwrite("mtfoods:apple_juice", 2) overwrite("mtfoods:apple_cider", 2) overwrite("mtfoods:cider_rack", 2) end if minetest.get_modpath("fruit") ~= nil then overwrite("fruit:apple", 2) overwrite("fruit:pear", 2) overwrite("fruit:bananna", 3) overwrite("fruit:orange", 2) end if minetest.get_modpath("mush45") ~= nil then overwrite("mush45:meal", 4) end if minetest.get_modpath("seaplants") ~= nil then overwrite("seaplants:kelpgreen", 1) overwrite("seaplants:kelpbrown", 1) overwrite("seaplants:seagrassgreen", 1) overwrite("seaplants:seagrassred", 1) overwrite("seaplants:seasaladmix", 6) overwrite("seaplants:kelpgreensalad", 1) overwrite("seaplants:kelpbrownsalad", 1) overwrite("seaplants:seagrassgreensalad", 1) overwrite("seaplants:seagrassgreensalad", 1) end if minetest.get_modpath("mobfcooking") ~= nil then overwrite("mobfcooking:cooked_pork", 6) overwrite("mobfcooking:cooked_ostrich", 6) overwrite("mobfcooking:cooked_beef", 6) overwrite("mobfcooking:cooked_chicken", 6) overwrite("mobfcooking:cooked_lamb", 6) overwrite("mobfcooking:cooked_venison", 6) overwrite("mobfcooking:cooked_fish", 6) end if minetest.get_modpath("creatures") ~= nil then overwrite("creatures:meat", 6) overwrite("creatures:flesh", 3) overwrite("creatures:rotten_flesh", 3, "", 3) end if minetest.get_modpath("ethereal") then overwrite("ethereal:strawberry", 1) overwrite("ethereal:banana", 4) overwrite("ethereal:pine_nuts", 1) overwrite("ethereal:bamboo_sprout", 0, "", 3) overwrite("ethereal:fern_tubers", 1) overwrite("ethereal:banana_bread", 7) overwrite("ethereal:mushroom_plant", 2) overwrite("ethereal:coconut_slice", 2) overwrite("ethereal:golden_apple", 4, "", nil, 10) overwrite("ethereal:wild_onion_plant", 2) overwrite("ethereal:mushroom_soup", 4, "ethereal:bowl") overwrite("ethereal:mushroom_soup_cooked", 6, "ethereal:bowl") overwrite("ethereal:hearty_stew", 6, "ethereal:bowl", 3) overwrite("ethereal:hearty_stew_cooked", 10, "ethereal:bowl") if minetest.get_modpath("bucket") then overwrite("ethereal:bucket_cactus", 2, "bucket:bucket_empty") end overwrite("ethereal:fish_raw", 2) overwrite("ethereal:fish_cooked", 5) overwrite("ethereal:seaweed", 1) overwrite("ethereal:yellowleaves", 1, "", nil, 1) overwrite("ethereal:sashimi", 4) end if minetest.get_modpath("farming") and farming.mod == "redo" then overwrite("farming:bread", 6) overwrite("farming:potato", 1) overwrite("farming:baked_potato", 6) overwrite("farming:cucumber", 4) overwrite("farming:tomato", 4) overwrite("farming:carrot", 3) overwrite("farming:carrot_gold", 6, "", nil, 8) overwrite("farming:corn", 3) overwrite("farming:corn_cob", 5) overwrite("farming:melon_slice", 2) overwrite("farming:pumpkin_slice", 1) overwrite("farming:pumpkin_bread", 9) overwrite("farming:coffee_cup", 2, "farming:drinking_cup") overwrite("farming:coffee_cup_hot", 3, "farming:drinking_cup", nil, 2) overwrite("farming:cookie", 2) overwrite("farming:chocolate_dark", 3) overwrite("farming:donut", 4) overwrite("farming:donut_chocolate", 6) overwrite("farming:donut_apple", 6) overwrite("farming:raspberries", 1) if minetest.get_modpath("vessels") then overwrite("farming:smoothie_raspberry", 2, "vessels:drinking_glass") end overwrite("farming:rhubarb", 1) overwrite("farming:rhubarb_pie", 6) end if minetest.get_modpath("kpgmobs") ~= nil then overwrite("kpgmobs:uley", 3) overwrite("kpgmobs:meat", 6) overwrite("kpgmobs:rat_cooked", 5) overwrite("kpgmobs:med_cooked", 4) if minetest.get_modpath("bucket") then overwrite("kpgmobs:bucket_milk", 4, "bucket:bucket_empty") end end if minetest.get_modpath("jkfarming") ~= nil then overwrite("jkfarming:carrot", 3) overwrite("jkfarming:corn", 3) overwrite("jkfarming:melon_part", 2) overwrite("jkfarming:cake", 3) end if minetest.get_modpath("jkanimals") ~= nil then overwrite("jkanimals:meat", 6) end if minetest.get_modpath("jkwine") ~= nil then overwrite("jkwine:grapes", 2) overwrite("jkwine:winebottle", 1) end -- player-action based hunger changes function hud.handle_node_actions(pos, oldnode, player, ext) if not player or not player:is_player() then return end local name = player:get_player_name() local exhaus = hud.exhaustion[name] local new = HUD_HUNGER_EXHAUST_PLACE -- placenode event if not ext then new = 0.9*HUD_HUNGER_EXHAUST_DIG if pos then -- rnd: make hunger depth dependent when digging local mul = 1.; if pos.y>-100 then mul = 1. else mul = 0.75-pos.y/300; end new = new*mul; end end -- assume its send by main timer when movement detected if not pos and not oldnode then new = HUD_HUNGER_EXHAUST_MOVE end exhaus = exhaus + new if exhaus > HUD_HUNGER_EXHAUST_LVL then exhaus = 0 local h = tonumber(hud.hunger[name]) h = h - 1 if h < 0 then h = 0 end hud.hunger[name] = h hud.set_hunger(player) end hud.exhaustion[name] = exhaus end minetest.register_on_placenode(hud.handle_node_actions) minetest.register_on_dignode(hud.handle_node_actions)
lgpl-2.1
Fenix-XI/Fenix
scripts/zones/Temenos/mobs/Ice_Elemental.lua
7
1799
----------------------------------- -- Area: Temenos E T -- NPC: Ice_Elemental ----------------------------------- package.loaded["scripts/zones/Temenos/TextIDs"] = nil; ----------------------------------- require("scripts/globals/limbus"); require("scripts/zones/Temenos/TextIDs"); ----------------------------------- -- onMobSpawn Action ----------------------------------- function onMobSpawn(mob) end; ----------------------------------- -- onMobEngaged ----------------------------------- function onMobEngaged(mob,target) end; ----------------------------------- -- onMobDeath ----------------------------------- function onMobDeath(mob,killer,ally) local mobID = mob:getID(); local mobX = mob:getXPos(); local mobY = mob:getYPos(); local mobZ = mob:getZPos(); switch (mobID): caseof { -- 100 a 106 inclut (Temenos -Northern Tower ) [16928849] = function (x) GetNPCByID(16928768+174):setPos(mobX,mobY,mobZ); GetNPCByID(16928768+174):setStatus(STATUS_NORMAL); end , [16928850] = function (x) GetNPCByID(16928768+216):setPos(mobX,mobY,mobZ); GetNPCByID(16928768+216):setStatus(STATUS_NORMAL); end , [16928851] = function (x) GetNPCByID(16928768+321):setPos(mobX,mobY,mobZ); GetNPCByID(16928768+321):setStatus(STATUS_NORMAL); end , [16928852] = function (x) GetNPCByID(16928768+45):setPos(mobX,mobY,mobZ); GetNPCByID(16928768+45):setStatus(STATUS_NORMAL); end , [16929034] = function (x) if (IsMobDead(16929035)==false) then -- wind DespawnMob(16929035); SpawnMob(16929041); end end , } end;
gpl-3.0
tcatm/luci
applications/luci-app-asterisk/luasrc/model/cbi/asterisk/dialplan_out.lua
68
3021
-- Copyright 2008 Jo-Philipp Wich <jow@openwrt.org> -- Licensed to the public under the Apache License 2.0. local ast = require("luci.asterisk") local function find_outgoing_contexts(uci) local c = { } local h = { } -- uci:foreach("asterisk", "dialplan", -- function(s) -- if not h[s['.name']] then -- c[#c+1] = { s['.name'], "Dialplan: %s" % s['.name'] } -- h[s['.name']] = true -- end -- end) uci:foreach("asterisk", "dialzone", function(s) if not h[s['.name']] then c[#c+1] = { s['.name'], "Dialzone: %s" % s['.name'] } h[s['.name']] = true end end) return c end local function find_incoming_contexts(uci) local c = { } local h = { } uci:foreach("asterisk", "sip", function(s) if s.context and not h[s.context] and uci:get_bool("asterisk", s['.name'], "provider") then c[#c+1] = { s.context, "Incoming: %s" % s['.name'] or s.context } h[s.context] = true end end) return c end local function find_trunks(uci) local t = { } uci:foreach("asterisk", "sip", function(s) if uci:get_bool("asterisk", s['.name'], "provider") then t[#t+1] = { "SIP/%s" % s['.name'], "SIP: %s" % s['.name'] } end end) uci:foreach("asterisk", "iax", function(s) t[#t+1] = { "IAX/%s" % s['.name'], "IAX: %s" % s.extension or s['.name'] } end) return t end --[[ dialzone {name} - Outgoing zone. uses - Outgoing line to use: TYPE/Name match (list) - Number to match countrycode - The effective country code of this dialzone international (list) - International prefix to match localzone - dialzone for local numbers addprefix - Prexix required to dial out. localprefix - Prefix for a local call ]] -- -- SIP dialzone configuration -- if arg[1] then cbimap = Map("asterisk", "Edit Dialplan Entry") entry = cbimap:section(NamedSection, arg[1]) back = entry:option(DummyValue, "_overview", "Back to dialplan overview") back.value = "" back.titleref = luci.dispatcher.build_url("admin", "asterisk", "dialplans") desc = entry:option(Value, "description", "Description") function desc.cfgvalue(self, s, ...) return Value.cfgvalue(self, s, ...) or s end match = entry:option(DynamicList, "match", "Number matches") intl = entry:option(DynamicList, "international", "Intl. prefix matches (optional)") trunk = entry:option(MultiValue, "uses", "Used trunk") for _, v in ipairs(find_trunks(cbimap.uci)) do trunk:value(unpack(v)) end aprefix = entry:option(Value, "addprefix", "Add prefix to dial out (optional)") --ast.idd.cbifill(aprefix) ccode = entry:option(Value, "countrycode", "Effective countrycode (optional)") ast.cc.cbifill(ccode) lzone = entry:option(ListValue, "localzone", "Dialzone for local numbers") lzone:value("", "no special treatment of local numbers") for _, v in ipairs(find_outgoing_contexts(cbimap.uci)) do lzone:value(unpack(v)) end lprefix = entry:option(Value, "localprefix", "Prefix for local calls (optional)") return cbimap end
apache-2.0
emender/emender
src/common/logger.lua
1
2315
-- -- This file is part of Emender. -- Copyright (C) 2014 Pavel Tisnovsky, Jaromir Hradilek -- -- Emender is free software: you can redistribute it and/or modify -- it under the terms of the GNU General Public License as published by -- the Free Software Foundation; version 3 of the License. -- -- Emender 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 Emender. If not, see <http://www.gnu.org/licenses/>. -- -- -- Module containing standard logger. -- local logger = { codes = { bold = "", reset = "", color_red = "", color_green = "", color_yellow = "", color_blue = "", color_magenta = "", color_cyan = "", } } -- -- Read the proper terminal control sequences by using the 'tput' command. -- We need to be on the safe side because different terminals could have -- different control codes. -- function readTputControlSequence(code) local handle = io.popen("tput " .. code) local result = handle:read("*a") handle:close() return result end -- -- If the function is called it turns on the color output -- function logger.setColorOutput(colorOutput) if colorOutput then logger.codes.bold = readTputControlSequence("bold") logger.codes.reset = readTputControlSequence("sgr0") logger.codes.color_red = readTputControlSequence("setaf 1") logger.codes.color_green = readTputControlSequence("setaf 2") logger.codes.color_yellow = readTputControlSequence("setaf 3") logger.codes.color_blue = readTputControlSequence("setaf 4") logger.codes.color_magenta = readTputControlSequence("setaf 5") logger.codes.color_cyan = readTputControlSequence("setaf 6") end end -- -- Standard logger message -- function logger.log(message) print(message) end -- -- Standard warning message -- function logger.warning(message) print(message) end -- -- Standard error message -- function logger.error(message) print(message) end return logger
gpl-3.0
8devices/carambola2-luci
applications/luci-asterisk/luasrc/model/cbi/asterisk-mod-res.lua
80
3097
--[[ LuCI - Lua Configuration Interface Copyright 2008 Steven Barth <steven@midlink.org> Copyright 2008 Jo-Philipp Wich <xm@leipzig.freifunk.net> Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 $Id$ ]]-- cbimap = Map("asterisk", "asterisk", "") module = cbimap:section(TypedSection, "module", "Modules", "") module.anonymous = true res_config_mysql = module:option(ListValue, "res_config_mysql", "MySQL Config Resource", "") res_config_mysql:value("yes", "Load") res_config_mysql:value("no", "Do Not Load") res_config_mysql:value("auto", "Load as Required") res_config_mysql.rmempty = true res_config_odbc = module:option(ListValue, "res_config_odbc", "ODBC Config Resource", "") res_config_odbc:value("yes", "Load") res_config_odbc:value("no", "Do Not Load") res_config_odbc:value("auto", "Load as Required") res_config_odbc.rmempty = true res_config_pgsql = module:option(ListValue, "res_config_pgsql", "PGSQL Module", "") res_config_pgsql:value("yes", "Load") res_config_pgsql:value("no", "Do Not Load") res_config_pgsql:value("auto", "Load as Required") res_config_pgsql.rmempty = true res_crypto = module:option(ListValue, "res_crypto", "Cryptographic Digital Signatures", "") res_crypto:value("yes", "Load") res_crypto:value("no", "Do Not Load") res_crypto:value("auto", "Load as Required") res_crypto.rmempty = true res_features = module:option(ListValue, "res_features", "Call Parking Resource", "") res_features:value("yes", "Load") res_features:value("no", "Do Not Load") res_features:value("auto", "Load as Required") res_features.rmempty = true res_indications = module:option(ListValue, "res_indications", "Indications Configuration", "") res_indications:value("yes", "Load") res_indications:value("no", "Do Not Load") res_indications:value("auto", "Load as Required") res_indications.rmempty = true res_monitor = module:option(ListValue, "res_monitor", "Call Monitoring Resource", "") res_monitor:value("yes", "Load") res_monitor:value("no", "Do Not Load") res_monitor:value("auto", "Load as Required") res_monitor.rmempty = true res_musiconhold = module:option(ListValue, "res_musiconhold", "Music On Hold Resource", "") res_musiconhold:value("yes", "Load") res_musiconhold:value("no", "Do Not Load") res_musiconhold:value("auto", "Load as Required") res_musiconhold.rmempty = true res_odbc = module:option(ListValue, "res_odbc", "ODBC Resource", "") res_odbc:value("yes", "Load") res_odbc:value("no", "Do Not Load") res_odbc:value("auto", "Load as Required") res_odbc.rmempty = true res_smdi = module:option(ListValue, "res_smdi", "SMDI Module", "") res_smdi:value("yes", "Load") res_smdi:value("no", "Do Not Load") res_smdi:value("auto", "Load as Required") res_smdi.rmempty = true res_snmp = module:option(ListValue, "res_snmp", "SNMP Module", "") res_snmp:value("yes", "Load") res_snmp:value("no", "Do Not Load") res_snmp:value("auto", "Load as Required") res_snmp.rmempty = true return cbimap
apache-2.0
Fenix-XI/Fenix
scripts/globals/spells/bluemagic/frost_breath.lua
25
2023
----------------------------------------- -- Spell: Frost Breath -- Deals ice damage to enemies within a fan-shaped area originating from the caster. Additional effect: Paralysis -- Spell cost: 136 MP -- Monster Type: Lizards -- Spell Type: Magical (Ice) -- Blue Magic Points: 3 -- Stat Bonus: INT-2 -- Level: 66 -- Casting Time: 6.5 seconds -- Recast Time: 42.75 seconds -- Magic Bursts on: Induration, Distortion, and Darkness -- Combos: Conserve MP ----------------------------------------- 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 multi = 2.08; local resist = applyResistance(caster,spell,target,caster:getStat(MOD_INT) - target:getStat(MOD_INT),BLUE_SKILL,1.0); local params = {}; -- This data should match information on http://wiki.ffxiclopedia.org/wiki/Calculating_Blue_Magic_Damage 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); if (caster:hasStatusEffect(EFFECT_AZURE_LORE)) then multi = multi + 0.50; end 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 return damage; end;
gpl-3.0
8devices/carambola2-luci
applications/luci-polipo/luasrc/model/cbi/polipo.lua
79
5961
--[[ LuCI - Lua Configuration Interface Copyright 2008 Aleksandar Krsteski <alekrsteski@gmail.com> 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$ ]]-- m = Map("polipo", translate("Polipo"), translate("Polipo is a small and fast caching web proxy.")) -- General section s = m:section(NamedSection, "general", "polipo", translate("Proxy")) s:tab("general", translate("General Settings")) s:tab("dns", translate("DNS and Query Settings")) s:tab("proxy", translate("Parent Proxy")) s:tab("logging", translate("Logging and RAM")) -- General settings s:taboption("general", Flag, "enabled", translate("enable")) o = s:taboption("general", Value, "proxyAddress", translate("Listen address"), translate("The interface on which Polipo will listen. To listen on all " .. "interfaces use 0.0.0.0 or :: (IPv6).")) o.placeholder = "0.0.0.0" o.datatype = "ipaddr" o = s:taboption("general", Value, "proxyPort", translate("Listen port"), translate("Port on which Polipo will listen")) o.optional = true o.placeholder = "8123" o.datatype = "port" o = s:taboption("general", DynamicList, "allowedClients", translate("Allowed clients"), translate("When listen address is set to 0.0.0.0 or :: (IPv6), you must " .. "list clients that are allowed to connect. The format is IP address " .. "or network address (192.168.1.123, 192.168.1.0/24, " .. "2001:660:116::/48 (IPv6))")) o.datatype = "ipaddr" o.placeholder = "0.0.0.0/0" -- DNS settings dns = s:taboption("dns", Value, "dnsNameServer", translate("DNS server address"), translate("Set the DNS server address to use, if you want Polipo to use " .. "different DNS server than the host system.")) dns.optional = true dns.datatype = "ipaddr" l = s:taboption("dns", ListValue, "dnsQueryIPv6", translate("Query DNS for IPv6")) l.default = "happily" l:value("true", translate("Query only IPv6")) l:value("happily", translate("Query IPv4 and IPv6, prefer IPv6")) l:value("reluctantly", translate("Query IPv4 and IPv6, prefer IPv4")) l:value("false", translate("Do not query IPv6")) l = s:taboption("dns", ListValue, "dnsUseGethostbyname", translate("Query DNS by hostname")) l.default = "reluctantly" l:value("true", translate("Always use system DNS resolver")) l:value("happily", translate("Query DNS directly, for unknown hosts fall back " .. "to system resolver")) l:value("reluctantly", translate("Query DNS directly, fallback to system resolver")) l:value("false", translate("Never use system DNS resolver")) -- Proxy settings o = s:taboption("proxy", Value, "parentProxy", translate("Parent proxy address"), translate("Parent proxy address (in host:port format), to which Polipo " .. "will forward the requests.")) o.optional = true o.datatype = "ipaddr" o = s:taboption("proxy", Value, "parentAuthCredentials", translate("Parent proxy authentication"), translate("Basic HTTP authentication supported. Provide username and " .. "password in username:password format.")) o.optional = true o.placeholder = "username:password" -- Logging s:taboption("logging", Flag, "logSyslog", translate("Log to syslog")) s:taboption("logging", Value, "logFacility", translate("Syslog facility")):depends("logSyslog", "1") v = s:taboption("logging", Value, "logFile", translate("Log file location"), translate("Use of external storage device is recommended, because the " .. "log file is written frequently and can grow considerably.")) v:depends("logSyslog", "") v.rmempty = true o = s:taboption("logging", Value, "chunkHighMark", translate("In RAM cache size (in bytes)"), translate("How much RAM should Polipo use for its cache.")) o.datatype = "uinteger" -- Disk cache section s = m:section(NamedSection, "cache", "polipo", translate("On-Disk Cache")) s:tab("general", translate("General Settings")) s:tab("advanced", translate("Advanced Settings")) -- Disk cache settings s:taboption("general", Value, "diskCacheRoot", translate("Disk cache location"), translate("Location where polipo will cache files permanently. Use of " .. "external storage devices is recommended, because the cache can " .. "grow considerably. Leave it empty to disable on-disk " .. "cache.")).rmempty = true s:taboption("general", Flag, "cacheIsShared", translate("Shared cache"), translate("Enable if cache (proxy) is shared by multiple users.")) o = s:taboption("advanced", Value, "diskCacheTruncateSize", translate("Truncate cache files size (in bytes)"), translate("Size to which cached files should be truncated")) o.optional = true o.placeholder = "1048576" o.datatype = "uinteger" o = s:taboption("advanced", Value, "diskCacheTruncateTime", translate("Truncate cache files time"), translate("Time after which cached files will be truncated")) o.optional = true o.placeholder = "4d12h" o = s:taboption("advanced", Value, "diskCacheUnlinkTime", translate("Delete cache files time"), translate("Time after which cached files will be deleted")) o.optional = true o.placeholder = "32d" -- Poor man's multiplexing section s = m:section(NamedSection, "pmm", "polipo", translate("Poor Man's Multiplexing"), translate("Poor Man's Multiplexing (PMM) is a technique that simulates " .. "multiplexing by requesting an instance in multiple segments. It " .. "tries to lower the latency caused by the weakness of HTTP " .. "protocol. NOTE: some sites may not work with PMM enabled.")) s:option(Value, "pmmSize", translate("PMM segments size (in bytes)"), translate("To enable PMM, PMM segment size must be set to some " .. "positive value.")).rmempty = true s:option(Value, "pmmFirstSize", translate("First PMM segment size (in bytes)"), translate("Size of the first PMM segment. If not defined, it defaults " .. "to twice the PMM segment size.")).rmempty = true return m
apache-2.0
Fenix-XI/Fenix
scripts/zones/Kazham/npcs/Kakapp.lua
13
3339
----------------------------------- -- Area: Kazham -- NPC: Kakapp -- Standard Info NPC ----------------------------------- package.loaded["scripts/zones/Kazham/TextIDs"] = nil; require("scripts/zones/Kazham/TextIDs"); ----------------------------------- -- onTrade Action ----------------------------------- -- item IDs -- 483 Broken Mithran Fishing Rod -- 22 Workbench -- 1008 Ten of Coins -- 1157 Sands of Silence -- 1158 Wandering Bulb -- 904 Giant Fish Bones -- 4599 Blackened Toad -- 905 Wyvern Skull -- 1147 Ancient Salt -- 4600 Lucky Egg function onTrade(player,npc,trade) local OpoOpoAndIStatus = player:getQuestStatus(OUTLANDS, THE_OPO_OPO_AND_I); local progress = player:getVar("OPO_OPO_PROGRESS"); local failed = player:getVar("OPO_OPO_FAILED"); local goodtrade = trade:hasItemQty(905,1); local badtrade = (trade:hasItemQty(483,1) or trade:hasItemQty(22,1) or trade:hasItemQty(1008,1) or trade:hasItemQty(1157,1) or trade:hasItemQty(1158,1) or trade:hasItemQty(4599,1) or trade:hasItemQty(904,1) or trade:hasItemQty(1147,1) or trade:hasItemQty(4600,1)); if (OpoOpoAndIStatus == QUEST_ACCEPTED) then if progress == 7 or failed == 8 then if goodtrade then player:startEvent(0x00E2); elseif badtrade then player:startEvent(0x00EC); end end end end; ----------------------------------- -- onTrigger Action ----------------------------------- function onTrigger(player,npc) local OpoOpoAndIStatus = player:getQuestStatus(OUTLANDS, THE_OPO_OPO_AND_I); local progress = player:getVar("OPO_OPO_PROGRESS"); local failed = player:getVar("OPO_OPO_FAILED"); local retry = player:getVar("OPO_OPO_RETRY"); if (OpoOpoAndIStatus == QUEST_ACCEPTED) then if retry >= 1 then -- has failed on future npc so disregard previous successful trade player:startEvent(0x00CC); elseif (progress == 7 or failed == 8) then player:startEvent(0x00D5); -- asking for wyvern skull elseif (progress >= 8 or failed >= 9) then player:startEvent(0x00F9); -- happy with wyvern skull end else player:startEvent(0x00CC); 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 == 0x00E2) then -- correct trade, onto next opo if player:getVar("OPO_OPO_PROGRESS") == 7 then player:tradeComplete(); player:setVar("OPO_OPO_PROGRESS",8); player:setVar("OPO_OPO_FAILED",0); else player:setVar("OPO_OPO_FAILED",9); end elseif (csid == 0x00EC) then -- wrong trade, restart at first opo player:setVar("OPO_OPO_FAILED",1); player:setVar("OPO_OPO_RETRY",8); end end;
gpl-3.0
DarkstarProject/darkstar
scripts/commands/setskill.lua
14
1982
--------------------------------------------------------------------------------------------------- -- func: setskill <skill name or ID> <skill level> <target> -- desc: sets target's level of specified skill --------------------------------------------------------------------------------------------------- require("scripts/globals/status") cmdprops = { permission = 1, parameters = "sis" } function error(player, msg) player:PrintToPlayer(msg) player:PrintToPlayer("!setskill <skill name or ID> <skill level> {player}") end function onTrigger(player, skillName, skillLV, target) if (skillName == nil) then error(player, "You must specify a skill to set!") return end if skillLV == nil then error(player, "You must specify the new skill level to set.") return end local skillID = tonumber(skillName) or dsp.skill[string.upper(skillName)] local targ; if skillID == nil or skillID == 0 or (skillID > 12 and skillID < 25) or skillID == 46 or skillID == 47 or skillID > 57 then error(player, "You must specify a valid skill.") return end if target == nil then if player:getCursorTarget() == nil then targ = player else if player:getCursorTarget():isPC() then targ = player:getCursorTarget() else error(player, "You must target a player or specify a name.") return end end else targ = GetPlayerByName(target) if targ == nil then player:PrintToPlayer(string.format("Player named '%s' not found!", target)) return end end targ:setSkillLevel(skillID, skillLV*10) targ:messageBasic(53, skillID, skillLV) if targ ~= player then player:PrintToPlayer(string.format("%s's new skillID '%s' Skill: %s", targ:getName(), skillName, (targ:getCharSkillLevel(skillID)/10)..".0")) end end
gpl-3.0
L3E8S0S6E5N1OA5N6D3T8W5O/4568584657657
plugins/invite.lua
299
1025
-- Invite other user to the chat group. -- Use !invite name User_name or !invite id id_number -- The User_name is the print_name (there are no spaces but _) do local function callback(extra, success, result) vardump(success) vardump(result) end local function run(msg, matches) local user = matches[2] -- User submitted a user name if matches[1] == "name" then user = string.gsub(user," ","_") end -- User submitted an id if matches[1] == "id" then user = 'user#id'..user end -- The message must come from a chat group if msg.to.type == 'chat' then local chat = 'chat#id'..msg.to.id chat_add_user(chat, user, callback, false) return "Add: "..user.." to "..chat else return 'This isnt a chat group!' end end return { description = "Invite other user to the chat group", usage = { "!invite name [user_name]", "!invite id [user_id]" }, patterns = { "^!invite (name) (.*)$", "^!invite (id) (%d+)$" }, run = run, moderation = true } end
gpl-2.0
Fenix-XI/Fenix
scripts/globals/items/coin_cookie.lua
17
1324
----------------------------------------- -- ID: 4520 -- Item: coin_cookie -- Food Effect: 5Min, All Races ----------------------------------------- -- Magic Regen While Healing 6 -- Vermin Killer 5 -- Poison Resist 5 ----------------------------------------- require("scripts/globals/status"); ----------------------------------------- -- OnItemCheck ----------------------------------------- function onItemCheck(target) local result = 0; if (target:hasStatusEffect(EFFECT_FOOD) == true or target:hasStatusEffect(EFFECT_FIELD_SUPPORT_FOOD) == true) then result = 246; end return result; end; ----------------------------------------- -- OnItemUse ----------------------------------------- function onItemUse(target) target:addStatusEffect(EFFECT_FOOD,0,0,300,4520); end; ----------------------------------------- -- onEffectGain Action ----------------------------------------- function onEffectGain(target,effect) target:addMod(MOD_MPHEAL, 6); target:addMod(MOD_VERMIN_KILLER, 5); target:addMod(MOD_POISONRES, 5); end; ----------------------------------------- -- onEffectLose Action ----------------------------------------- function onEffectLose(target,effect) target:delMod(MOD_MPHEAL, 6); target:delMod(MOD_VERMIN_KILLER, 5); target:delMod(MOD_POISONRES, 5); end;
gpl-3.0
ungarscool1/HL2RP
hl2rp/gamemode/modules/hitmenu/sv_init.lua
2
8192
local plyMeta = FindMetaTable("Player") local hits = {} local questionCallback /*--------------------------------------------------------------------------- Net messages ---------------------------------------------------------------------------*/ util.AddNetworkString("onHitAccepted") util.AddNetworkString("onHitCompleted") util.AddNetworkString("onHitFailed") /*--------------------------------------------------------------------------- Interface functions ---------------------------------------------------------------------------*/ DarkRP.getHits = fp{fn.Id, hits} function plyMeta:requestHit(customer, target, price) local canRequest, msg, cost = hook.Call("canRequestHit", DarkRP.hooks, self, customer, target, price) price = cost or price if canRequest == false then DarkRP.notify(customer, 1, 4, msg) return false end DarkRP.createQuestion(DarkRP.getPhrase("accept_hit_request", customer:Nick(), target:Nick(), DarkRP.formatMoney(price)), "hit" .. self:UserID() .. "|" .. customer:UserID() .. "|" .. target:UserID(), self, 20, questionCallback, customer, target, price ) DarkRP.notify(customer, 1, 4, DarkRP.getPhrase("hit_requested")) return true end function plyMeta:placeHit(customer, target, price) if hits[self] then DarkRP.error("This person has an active hit!", 2) end if not customer:canAfford(price) then DarkRP.notify(customer, 1, 4, DarkRP.getPhrase("cant_afford", DarkRP.getPhrase("hit"))) return end hits[self] = {} hits[self].price = price -- the agreed upon price (as opposed to the price set by the hitman) self:setHitCustomer(customer) self:setHitTarget(target) DarkRP.payPlayer(customer, self, price) hook.Call("onHitAccepted", DarkRP.hooks, self, target, customer) end function plyMeta:setHitTarget(target) if not hits[self] then DarkRP.error("This person has no active hit!", 2) end self:setSelfDarkRPVar("hitTarget", target) self:setDarkRPVar("hasHit", target and true or nil) end function plyMeta:setHitPrice(price) self:setDarkRPVar("hitPrice", math.Min(GAMEMODE.Config.maxHitPrice or 50000, math.Max(GAMEMODE.Config.minHitPrice or 200, price))) end function plyMeta:setHitCustomer(customer) if not hits[self] then DarkRP.error("This person has no active hit!", 2) end hits[self].customer = customer end function plyMeta:getHitCustomer() return hits[self] and hits[self].customer or nil end function plyMeta:abortHit(message) if not hits[self] then DarkRP.error("This person has no active hit!", 2) end message = message or "" hook.Call("onHitFailed", DarkRP.hooks, self, self:getHitTarget(), message) DarkRP.notifyAll(0, 4, DarkRP.getPhrase("hit_aborted", message)) self:finishHit() end function plyMeta:finishHit() self:setHitCustomer(nil) self:setHitTarget(nil) hits[self] = nil end function questionCallback(answer, hitman, customer, target, price) if not IsValid(customer) then return end if not IsValid(hitman) or not hitman:isHitman() then return end if not IsValid(customer) then DarkRP.notify(hitman, 1, 4, DarkRP.getPhrase("customer_left_server")) return end if not IsValid(target) then DarkRP.notify(hitman, 1, 4, DarkRP.getPhrase("target_left_server")) return end if not tobool(answer) then DarkRP.notify(customer, 1, 4, DarkRP.getPhrase("hit_declined")) return end if hits[hitman] then return end DarkRP.notify(hitman, 1, 4, DarkRP.getPhrase("hit_accepted")) hitman:placeHit(customer, target, price) end /*--------------------------------------------------------------------------- Chat commands ---------------------------------------------------------------------------*/ DarkRP.defineChatCommand("hitprice", function(ply, args) if not ply:isHitman() then return "" end local price = tonumber(args) or 0 ply:setHitPrice(price) price = ply:getHitPrice() DarkRP.notify(ply, 2, 4, DarkRP.getPhrase("hit_price_set", DarkRP.formatMoney(price))) return "" end) DarkRP.defineChatCommand("requesthit", function(ply, args) args = string.Explode(' ', args) local target = DarkRP.findPlayer(args[1]) local traceEnt = ply:GetEyeTrace().Entity local hitman = IsValid(traceEnt) and traceEnt:IsPlayer() and traceEnt or Player(tonumber(args[2] or -1) or -1) if not IsValid(hitman) or not IsValid(target) or not hitman:IsPlayer() then DarkRP.notify(ply, 1, 4, DarkRP.getPhrase("invalid_x", DarkRP.getPhrase("arguments"), "")) return "" end hitman:requestHit(ply, target, hitman:getHitPrice()) return "" end) /*--------------------------------------------------------------------------- Hooks ---------------------------------------------------------------------------*/ function DarkRP.hooks:onHitAccepted(hitman, target, customer) net.Start("onHitAccepted") net.WriteEntity(hitman) net.WriteEntity(target) net.WriteEntity(customer) net.Broadcast() DarkRP.notify(customer, 0, 8, DarkRP.getPhrase("hit_accepted")) customer.lastHitAccepted = CurTime() DarkRP.log("Hitman " .. hitman:Nick() .. " accepted a hit on " .. target:Nick() .. ", ordered by " .. customer:Nick() .. " for " .. DarkRP.formatMoney(hits[hitman].price), Color(255, 0, 255)) end function DarkRP.hooks:onHitCompleted(hitman, target, customer) net.Start("onHitCompleted") net.WriteEntity(hitman) net.WriteEntity(target) net.WriteEntity(customer) net.Broadcast() DarkRP.notifyAll(0, 6, DarkRP.getPhrase("hit_complete", hitman:Nick())) local targetname = IsValid(target) and target:Nick() or "disconnected player" DarkRP.log("Hitman " .. hitman:Nick() .. " finished a hit on " .. targetname .. ", ordered by " .. hits[hitman].customer:Nick() .. " for " .. DarkRP.formatMoney(hits[hitman].price), Color(255, 0, 255)) target:setDarkRPVar("lastHitTime", CurTime()) hitman:finishHit() end function DarkRP.hooks:onHitFailed(hitman, target, reason) net.Start("onHitFailed") net.WriteEntity(hitman) net.WriteEntity(target) net.WriteString(reason) net.Broadcast() local targetname = IsValid(target) and target:Nick() or "disconnected player" DarkRP.log("Hit on " .. targetname .. " failed. Reason: " .. reason, Color(255, 0, 255)) end hook.Add("PlayerDeath", "DarkRP Hitman System", function(ply, inflictor, attacker) if hits[ply] then -- player was hitman ply:abortHit(DarkRP.getPhrase("hitman_died")) end if IsValid(attacker) and attacker:IsPlayer() and hits[attacker] and attacker:getHitTarget() == ply then hook.Call("onHitCompleted", DarkRP.hooks, attacker, ply, hits[attacker].customer) end for hitman, hit in pairs(hits) do if not hitman or not IsValid(hitman) then hits[hitman] = nil continue end if hitman:getHitTarget() == ply then hitman:abortHit(DarkRP.getPhrase("target_died")) end end end) hook.Add("PlayerDisconnected", "Hitman system", function(ply) if hits[ply] then ply:abortHit(DarkRP.getPhrase("hitman_left_server")) end for hitman, hit in pairs(hits) do if hitman:getHitTarget() == ply then hitman:abortHit(DarkRP.getPhrase("target_left_server")) end if hit.customer == ply then hitman:abortHit(DarkRP.getPhrase("customer_left_server")) end end end) hook.Add("playerArrested", "Hitman system", function(ply) if not hits[ply] or not IsValid(hits[ply].customer) then return end for k, v in pairs(player.GetAll()) do if not GAMEMODE.CivilProtection[v:Team()] then continue end DarkRP.notify(v, 0, 8, DarkRP.getPhrase("x_had_hit_ordered_by_y", ply:Nick(), hits[ply].customer:Nick())) end ply:abortHit(DarkRP.getPhrase("hitman_arrested")) end) hook.Add("OnPlayerChangedTeam", "Hitman system", function(ply, prev, new) if hits[ply] then ply:abortHit(DarkRP.getPhrase("hitman_changed_team")) end end)
agpl-3.0
ungarscool1/HL2RP
hl2rp/gamemode/modules/fadmin/fadmin/playeractions/slap/sv_init.lua
4
2160
local function ExecuteSlap(target, Amount, ply) if not IsValid(target) or not IsValid(ply) then return end local Force = Vector(math.Rand(-500, 500), math.Rand(-500, 500), math.Rand(-100, 700)) local DmgInfo = DamageInfo() DmgInfo:SetDamage(Amount) DmgInfo:SetDamageType(DMG_DROWN) DmgInfo:SetAttacker(ply) DmgInfo:SetDamageForce(Force) target:TakeDamageInfo(DmgInfo) target:SetVelocity(Force) end local function Slap(ply, cmd, args) if not args[1] then return false end local targets = FAdmin.FindPlayer(args[1]) if not targets or #targets == 1 and not IsValid(targets[1]) then FAdmin.Messages.SendMessage(ply, 1, "Player not found") return false end local Amount = tonumber(args[2]) or 10 local Repetitions = tonumber(args[3]) for _, target in pairs(targets) do if not FAdmin.Access.PlayerHasPrivilege(ply, "Slap", target) then FAdmin.Messages.SendMessage(ply, 5, "No access!") return false end if IsValid(target) then if not Repetitions or Repetitions == 1 then ExecuteSlap(target, Amount, ply) else for i = 1, Repetitions, 1 do timer.Simple(i * 0.7, function() ExecuteSlap(target, Amount, ply) end) end end end end if not Repetitions or Repetitions == 1 then FAdmin.Messages.ActionMessage(ply, targets, "Slapped %s once with " .. Amount .. " damage", "You are being slapped once with " .. Amount .. " damage by %s", "Slapped %s once with " .. Amount .. " damage") else FAdmin.Messages.ActionMessage(ply, targets, "Slapping %s " .. Repetitions .. " times with " .. Amount .. " damage", "You are being slapped " .. Repetitions .. " times with " .. Amount .. " damage by %s", "Slapped %s " .. Repetitions .. " times with " .. Amount .. " damage") end return true, targets, Amount, Repetitions end FAdmin.StartHooks["Slap"] = function() FAdmin.Commands.AddCommand("Slap", Slap) FAdmin.Access.AddPrivilege("Slap", 2) end
agpl-3.0
DarkstarProject/darkstar
scripts/zones/Port_Windurst/npcs/Hakkuru-Rinkuru.lua
9
9010
----------------------------------- -- Area: Port Windurst -- NPC: Hakkuru-Rinkuru -- Involved In Quest: Making Amends -- Starts and Ends Quest: Wonder Wands -- !pos -111 -4 101 240 ----------------------------------- local ID = require("scripts/zones/Port_Windurst/IDs"); require("scripts/globals/settings"); require("scripts/globals/titles"); require("scripts/globals/keyitems"); require("scripts/globals/missions"); require("scripts/globals/quests"); ----------------------------------- function onTrade(player,npc,trade) if (player:getQuestStatus(WINDURST,dsp.quest.id.windurst.MAKING_AMENDS) == QUEST_ACCEPTED) then if (trade:hasItemQty(937,1) and trade:getItemCount() == 1) then player:startEvent(277,1500); else player:startEvent(275,0,937); end elseif (player:getQuestStatus(WINDURST,dsp.quest.id.windurst.WONDER_WANDS) == QUEST_ACCEPTED) then SecondReward = player:getCharVar("SecondRewardVar"); if (trade:hasItemQty(17091,1) and trade:hasItemQty(17061,1) and trade:hasItemQty(17053,1) and trade:getItemCount() == 3) then --Check that all 3 items have been traded, one each SecondReward = player:setCharVar("SecondRewardVar",1); player:startEvent(265,0,17091,17061,17053); --Completion of quest cutscene for Wondering Wands else player:startEvent(260,0,17091,17061,17053); --Remind player which items are needed ifquest is accepted and items are not traded end else player:startEvent(224); end end; function onTrigger(player,npc) MakingAmends = player:getQuestStatus(WINDURST,dsp.quest.id.windurst.MAKING_AMENDS); MakingAmens = player:getQuestStatus(WINDURST,dsp.quest.id.windurst.MAKING_AMENS); --Second quest in series WonderWands = player:getQuestStatus(WINDURST,dsp.quest.id.windurst.WONDER_WANDS); --Third and final quest in series needToZone = player:needToZone(); pFame = player:getFameLevel(WINDURST); -- ~[ Windurst Mission 6-1 Full Moon Fountain ]~ -- if (player:getCurrentMission(WINDURST) == dsp.mission.id.windurst.FULL_MOON_FOUNTAIN and player:getCharVar("MissionStatus") == 0) then player:startEvent(456,0,248); elseif (player:getCurrentMission(WINDURST) == dsp.mission.id.windurst.FULL_MOON_FOUNTAIN and player:getCharVar("MissionStatus") == 3) then player:startEvent(457); -- Check if we are on Windurst Mission 1-1 elseif (player:getCurrentMission(WINDURST) == dsp.mission.id.windurst.THE_HORUTOTO_RUINS_EXPERIMENT) then MissionStatus = player:getCharVar("MissionStatus"); if (MissionStatus == 0) then player:startEvent(90); elseif (MissionStatus == 1) then player:startEvent(91); elseif (MissionStatus == 3) then player:startEvent(94,0,dsp.ki.CRACKED_MANA_ORBS); -- Finish Mission 1-1 end elseif (player:getCurrentMission(WINDURST) == dsp.mission.id.windurst.TO_EACH_HIS_OWN_RIGHT and player:getCharVar("MissionStatus") == 2) then player:startEvent(147); -- Begin Making Amends Section elseif (MakingAmends == QUEST_AVAILABLE and pFame >= 2) then player:startEvent(274,0,937); -- MAKING AMENDS + ANIMAL GLUE: Quest Start elseif (MakingAmends == QUEST_ACCEPTED) then player:startEvent(275,0,937); -- MAKING AMENDS + ANIMAL GLUE: Quest Objective Reminder elseif (MakingAmends == QUEST_COMPLETED and needToZone == true) then player:startEvent(278); -- MAKING AMENDS: After Quest --End Making Amends Section; Begin Wonder Wands Section elseif (MakingAmends == QUEST_COMPLETED and MakingAmens == QUEST_COMPLETED and WonderWands == QUEST_AVAILABLE and pFame >= 5 and needToZone == false) then player:startEvent(259); --Starts Wonder Wands elseif (WonderWands == QUEST_ACCEPTED) then player:startEvent(260); --Reminder for Wonder Wands elseif (WonderWands == QUEST_COMPLETED) then if (player:getCharVar("SecondRewardVar") == 1) then player:startEvent(267); --Initiates second reward ifWonder Wands has been completed. else player:startEvent(224); --Plays default conversation once all quests in the series have been completed. end else player:startEvent(224); --Standard Conversation end -- End Wonder Wands Section end; function onEventUpdate(player,csid,option) end; function onEventFinish(player,csid,option) if (csid == 90) then player:setCharVar("MissionStatus",1); elseif (csid == 147) then player:setCharVar("MissionStatus",3); elseif (csid == 94) then -- Delete the variable(s) that was created for this mission player:setCharVar("Mission_started_from",0); player:setCharVar("MissionStatus_op1",0); player:setCharVar("MissionStatus_op2",0); player:setCharVar("MissionStatus_op3",0); player:setCharVar("MissionStatus_op4",0); player:setCharVar("MissionStatus_op5",0); player:setCharVar("MissionStatus_op6",0); finishMissionTimeline(player,1,csid,option); elseif (csid == 274 and option == 1) then player:addQuest(WINDURST,dsp.quest.id.windurst.MAKING_AMENDS); elseif (csid == 277) then player:addGil(GIL_RATE*1500); player:completeQuest(WINDURST,dsp.quest.id.windurst.MAKING_AMENDS); player:addFame(WINDURST,75); player:addTitle(dsp.title.QUICK_FIXER); player:needToZone(true); player:tradeComplete(); elseif (csid == 259 and option == 1) then player:addQuest(WINDURST,dsp.quest.id.windurst.WONDER_WANDS); elseif (csid == 267) then rand = math.random(3); --Setup random variable to determine which 2 items are returned upon quest completion if (rand == 1) then if (player:getFreeSlotsCount() == 1) then player:messageSpecial(ID.text.ITEM_CANNOT_BE_OBTAINED,17061); elseif (player:getFreeSlotsCount() == 0) then player:messageSpecial(ID.text.ITEM_CANNOT_BE_OBTAINED,17091); player:messageSpecial(ID.text.ITEM_CANNOT_BE_OBTAINED,17061); else player:addItem(17091,1); player:addItem(17061,1); --Returns the Oak Staff and the Mythril Rod player:messageSpecial(ID.text.ITEM_OBTAINED,17091); player:messageSpecial(ID.text.ITEM_OBTAINED,17061); player:setCharVar("SecondRewardVar",0); end elseif (rand == 2) then if (player:getFreeSlotsCount() == 1) then player:messageSpecial(ID.text.ITEM_CANNOT_BE_OBTAINED,17053); elseif (player:getFreeSlotsCount() == 0) then player:messageSpecial(ID.text.ITEM_CANNOT_BE_OBTAINED,17091); player:messageSpecial(ID.text.ITEM_CANNOT_BE_OBTAINED,17053); else player:addItem(17091,1); player:addItem(17053,1); --Returns the Oak Staff and the Rose Wand player:messageSpecial(ID.text.ITEM_OBTAINED,17091); player:messageSpecial(ID.text.ITEM_OBTAINED,17053); player:setCharVar("SecondRewardVar",0); end elseif (rand == 3) then if (player:getFreeSlotsCount() == 1) then player:messageSpecial(ID.text.ITEM_CANNOT_BE_OBTAINED,17053); elseif (player:getFreeSlotsCount() == 0) then player:messageSpecial(ID.text.ITEM_CANNOT_BE_OBTAINED,17061); player:messageSpecial(ID.text.ITEM_CANNOT_BE_OBTAINED,17053); else player:addItem(17061,1); player:addItem(17053,1); --Returns the Rose Wand and the Mythril Rod player:messageSpecial(ID.text.ITEM_OBTAINED,17061); player:messageSpecial(ID.text.ITEM_OBTAINED,17053); player:setCharVar("SecondRewardVar",0); end end elseif (csid == 265) then if (player:getFreeSlotsCount() == 0) then player:messageSpecial(ID.text.ITEM_CANNOT_BE_OBTAINED,12750); -- New Moon Armlets else player:tradeComplete(); player:addGil(GIL_RATE*4800); player:messageSpecial(ID.text.GIL_OBTAINED, 4800); player:addItem(12750); -- New Moon Armlets player:messageSpecial(ID.text.ITEM_OBTAINED, 12750); -- New Moon Armlets player:addFame(WINDURST,150); player:addTitle(dsp.title.DOCTOR_SHANTOTTOS_GUINEA_PIG); player:completeQuest(WINDURST,dsp.quest.id.windurst.WONDER_WANDS); end -- ~[ Windurst Mission 6-1 Full Moon Fountain ]~ -- elseif (csid == 456) then player:setCharVar("MissionStatus",1); player:addKeyItem(dsp.ki.SOUTHWESTERN_STAR_CHARM); player:messageSpecial(ID.text.KEYITEM_OBTAINED,dsp.ki.SOUTHWESTERN_STAR_CHARM); end end;
gpl-3.0
DarkstarProject/darkstar
scripts/globals/weaponskills/tachi_fudo.lua
10
1827
----------------------------------- -- Tachi: Fudo -- Great Katana weapon skill -- Skill Level: N/A -- Deals double damage. Damage varies with TP. Masamune: Aftermath. -- Available only when equipped with Masamune (85), Masamune (90), Masamune (95), Hiradennotachi +1 or Hiradennotachi +2. -- Aligned with Light Gorget, Snow Gorget & Aqua Gorget. -- Aligned with Light Belt, Snow Belt & Aqua Belt. -- Element: None -- Modifiers: STR:80% -- 100%TP 200%TP 300%TP -- 3.75 5.75 8 ----------------------------------- require("scripts/globals/aftermath") require("scripts/globals/settings") require("scripts/globals/status") require("scripts/globals/weaponskills") ----------------------------------- function onUseWeaponSkill(player, target, wsID, tp, primary, action, taChar) local params = {} params.numHits = 1 params.ftp100 = 3.75 params.ftp200 = 4.75 params.ftp300 = 5.75 params.str_wsc = 0.60 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 params.crit100 = 0.0 params.crit200 = 0.0 params.crit300 = 0.0 params.canCrit = false params.acc100 = 0.0 params.acc200 = 0.0 params.acc300 = 0.0 params.atk100 = 2; params.atk200 = 2; params.atk300 = 2; if USE_ADOULIN_WEAPON_SKILL_CHANGES then params.ftp100 = 3.75 params.ftp200 = 5.75 params.ftp300 = 8 params.str_wsc = 0.8 params.atk100 = 1; params.atk200 = 1; params.atk300 = 1; end local damage, criticalHit, tpHits, extraHits = doPhysicalWeaponskill(player, target, wsID, params, tp, action, primary, taChar) -- Apply aftermath if damage > 0 then dsp.aftermath.addStatusEffect(player, tp, dsp.slot.MAIN, dsp.aftermath.type.EMPYREAN) end return tpHits, extraHits, criticalHit, damage end
gpl-3.0
Fenix-XI/Fenix
scripts/zones/West_Sarutabaruta/npcs/Cavernous_Maw.lua
29
1467
----------------------------------- -- Area: West Sarutabaruta -- NPC: Cavernous Maw -- Teleports Players to West Sarutabaruta [S] -- @pos -2.229 0.001 -162.715 115 ----------------------------------- package.loaded["scripts/zones/West_Sarutabaruta/TextIDs"] = nil; ----------------------------------- require("scripts/globals/settings"); require("scripts/globals/keyitems"); require("scripts/globals/teleports"); require("scripts/globals/campaign"); require("scripts/zones/West_Sarutabaruta/TextIDs"); ----------------------------------- -- onTrade Action ----------------------------------- function onTrade(player,npc,trade) end; ----------------------------------- -- onTrigger Action ----------------------------------- function onTrigger(player,npc) if (ENABLE_WOTG == 1 and player:hasKeyItem(PURE_WHITE_FEATHER) and hasMawActivated(player,8)) then player:startEvent(0x0388); else player:messageSpecial(NOTHING_HAPPENS); end end; ----------------------------------- -- onEventUpdate ----------------------------------- function onEventUpdate(player,csid,option) -- printf("CSID: %u",csid); -- printf("RESULT: %u",option); end; ----------------------------------- -- onEventFinish Action ----------------------------------- function onEventFinish(player,csid,option) -- printf("CSID: %u",csid); -- printf("RESULT: %u",option); if (csid == 0x0388 and option == 1) then toMaw(player,7); end end;
gpl-3.0
h3r2tic/rendertoy
tools/tundra/scripts/tundra/tools/msvc-vscommon.lua
8
10970
-- msvc-vscommon.lua - utility code for all versions of Visual Studio module(..., package.seeall) local native = require "tundra.native" local os = require "os" -- Visual Studio tooling layout local vc_bin_map = { ["x86"] = { ["x86"] = "", ["x64"] = "x86_amd64", ["arm"] = "x86_arm", }, ["x64"] = { ["x86"] = "", ["x64"] = "amd64", ["arm"] = "x86_arm", -- is this really legal? }, } local vc_lib_map = { ["x86"] = { ["x86"] = "", ["x64"] = "amd64", ["arm"] = "arm", }, ["x64"] = { ["x86"] = "", ["x64"] = "amd64", ["arm"] = "arm", }, } -- Windows SDK layout local pre_win8_sdk_dir = { ["bin"] = "bin", ["include"] = "include", ["lib"] = "lib", } local win8_sdk_dir = { ["bin"] = "bin", ["include"] = "include", ["lib"] = "lib\\win8\\um", } local win81_sdk_dir = { ["bin"] = "bin", ["include"] = "include", ["lib"] = "lib\\winv6.3\\um", } local pre_win8_sdk = { ["x86"] = { ["bin"] = "", ["include"] = "", ["lib"] = "", }, ["x64"] = { ["bin"] = "x64", ["include"] = "", ["lib"] = "x64", }, } local post_win8_sdk = { ["x86"] = { ["bin"] = "x86", ["include"] = { "shared", "um" }, ["lib"] = "x86", }, ["x64"] = { ["bin"] = "x64", ["include"] = { "shared", "um" }, ["lib"] = "x64", }, ["arm"] = { ["bin"] = "arm", ["include"] = { "shared", "um" }, ["lib"] = "arm", }, } -- Maps from VS version to default SDK version. Also used to imitate behaviour -- before this patch, where SDK version was identified by VS version. local vs_sdk_map = { ["9.0"] = "v6.0A", ["10.0"] = "v7.0A", ["10.1"] = "v7.1A", ["11.0"] = "v8.0", ["12.0"] = "v8.1", -- The current visual studio 2015 download does not include the full windows -- 10 SDK, and new Win32 apps created in VS2015 default to using the 8.1 SDK ["14.0"] = "v8.1" } -- Each quadruplet specifies a registry key value that gets us the SDK location, -- followed by a folder structure (for each supported target architecture) -- and finally the corresponding bin, include and lib folder's relative location local pre_win10_sdk_map = { ["v6.0A"] = { "SOFTWARE\\Microsoft\\Microsoft SDKs\\Windows\\v6.0A", "InstallationFolder", pre_win8_sdk_dir, pre_win8_sdk }, ["v7.0A"] = { "SOFTWARE\\Microsoft\\Microsoft SDKs\\Windows\\v7.0A", "InstallationFolder", pre_win8_sdk_dir, pre_win8_sdk }, ["V7.1A"] = { "SOFTWARE\\Microsoft\\Microsoft SDKs\\Windows\\v7.1A", "InstallationFolder", pre_win8_sdk_dir, pre_win8_sdk }, ["v8.0"] = { "SOFTWARE\\Microsoft\\Windows Kits\\Installed Roots", "KitsRoot", win8_sdk_dir, post_win8_sdk }, ["v8.1"] = { "SOFTWARE\\Microsoft\\Windows Kits\\Installed Roots", "KitsRoot81", win81_sdk_dir, post_win8_sdk } } local win10_sdk = { "SOFTWARE\\Microsoft\\Windows Kits\\Installed Roots", "KitsRoot10" } local function get_host_arch() local snative = native.getenv("PROCESSOR_ARCHITECTURE") local swow = native.getenv("PROCESSOR_ARCHITEW6432", "") if snative == "AMD64" or swow == "AMD64" then return "x64" elseif snative == "IA64" or swow == "IA64" then return "itanium"; else return "x86" end end function path_combine(path, path_to_append) if path == nil then return path_to_append end if path:find("\\$") then return path .. path_to_append end return path .. "\\" .. path_to_append end function path_it(maybe_list) if type(maybe_list) == "table" then return ipairs(maybe_list) end return ipairs({maybe_list}) end function get_pre_win10_sdk(sdk_version, vs_version, target_arch) local result = { ["include"] = {}, } local sdk = pre_win10_sdk_map[sdk_version] assert(sdk, "The requested version of Visual Studio isn't supported") local sdk_root = native.reg_query("HKLM", sdk[1], sdk[2]) assert(sdk_root, "The requested version of the SDK isn't installed") sdk_root = string.gsub(sdk_root, "\\+$", "\\") local sdk_dir_base = sdk[3] local sdk_dir = sdk[4][target_arch] assert(sdk_dir, "The target platform architecture isn't supported by the SDK") result.bin = sdk_root .. sdk_dir_base["bin"] .. "\\" .. sdk_dir["bin"] local sdk_dir_base_include = sdk_dir_base["include"] for _, v in path_it(sdk_dir["include"]) do result.include[#result.include + 1] = sdk_root .. sdk_dir_base_include .. "\\" .. v end result.lib_str = sdk_root .. sdk_dir_base["lib"] .. "\\" .. sdk_dir["lib"] result.root = sdk_root -- Windows 10 changed CRT to be split between Windows SDK and VC. It -- appears that when targeting pre-win10 with VS2015 you should always use -- use 10.0.10150.0, according to Microsoft.Cpp.Common.props in MSBuild. if vs_version == "14.0" then local win10_sdk_root = native.reg_query("HKLM", win10_sdk[1], win10_sdk[2]) assert(win10_sdk_root, "The windows 10 UCRT is required when building using Visual studio 2015") result.include[#result.include + 1] = win10_sdk_root .. "Include\\10.0.10150.0\\ucrt" result.lib_str = result.lib_str .. ";" .. win10_sdk_root .. "Lib\\10.0.10150.0\\ucrt\\" .. post_win8_sdk[target_arch].lib end return result end function get_win10_sdk(sdk_version, vs_version, target_arch) -- Remove v prefix sdk_version = string.sub(sdk_version, 2, -1) -- This only checks if the windows 10 SDK specifically is installed. A -- 'dir exists' method would be needed here to check if a specific SDK -- target folder exists. local sdk_root = native.reg_query("HKLM", win10_sdk[1], win10_sdk[2]) assert(sdk_root, "The requested version of the SDK isn't installed") local result = { ["include"] = {} } result.bin = sdk_root .. "bin\\" .. post_win8_sdk[target_arch].bin local sdk_dir_base_include = sdk_root .. "include\\" .. sdk_version .. "\\" result.include[#result.include + 1] = sdk_dir_base_include .. "shared" result.include[#result.include + 1] = sdk_dir_base_include .. "ucrt" result.include[#result.include + 1] = sdk_dir_base_include .. "um" local sdk_dir_base_lib = sdk_root .. "Lib\\" .. sdk_version .. "\\" result.lib_str = sdk_dir_base_lib .. "ucrt\\" .. post_win8_sdk[target_arch].lib result.lib_str = result.lib_str .. ";" .. sdk_dir_base_lib .. "um\\" .. post_win8_sdk[target_arch].lib result.root = sdk_root return result end function get_sdk(sdk_version, vs_version, target_arch) -- All versions using v10.0.xxxxx.x use specific releases of the -- Win10 SDK. Other versions are assumed to be pre-win10 if string.sub(sdk_version, 1, 6) == "v10.0." then return get_win10_sdk(sdk_version, vs_version, target_arch) else return get_pre_win10_sdk(sdk_version, vs_version, target_arch) end end function apply_msvc_visual_studio(version, env, options) -- NOTE: don't make changes to `env` until you've asserted -- that the requested version is in fact installed, -- the `vs-wild` toolset will call this function -- repeatedly with a the next version but the same `env`, -- if a version fails (assert/error) if native.host_platform ~= "windows" then error("the msvc toolset only works on windows hosts") end -- Load basic MSVC environment setup first. -- We're going to replace the paths to some tools. tundra.unitgen.load_toolset('msvc', env) options = options or {} local target_arch = options.TargetArch or "x86" local host_arch = options.HostArch or get_host_arch() -- SDKs are identified by SdkVersion or vs version -- each VS version defines a default SDK to use. local sdk_version = options.SdkVersion or version sdk_version = vs_sdk_map[sdk_version] or sdk_version -- We'll find any edition of VS (including Express) here local vs_root = native.reg_query("HKLM", "SOFTWARE\\Microsoft\\VisualStudio\\SxS\\VS7", version) if vs_root == nil then -- This is necessary for supporting the "Visual C++ Build Tools", which includes only the Compiler & SDK (not Visual Studio) local vc_root = native.reg_query("HKLM", "SOFTWARE\\Microsoft\\VisualStudio\\SxS\\VC7", version) if vc_root ~= nil then vs_root = string.gsub(vc_root, "\\VC\\$", "\\") end end assert(vs_root, "Visual Studio [Version " .. version .. "] isn't installed. To use a different Visual Studio version, edit tundra.lua accordingly") vs_root = string.gsub(vs_root, "\\+$", "\\") local vc_lib local vc_bin vc_bin = vc_bin_map[host_arch][target_arch] if not vc_bin then errorf("can't build target arch %s on host arch %s", target_arch, host_arch) end vc_bin = vs_root .. "vc\\bin\\" .. vc_bin vc_lib = vs_root .. "vc\\lib\\" .. vc_lib_map[host_arch][target_arch] -- -- Now fix up the SDK -- local sdk = get_sdk(sdk_version, version, target_arch) -- -- Tools -- local cl_exe = '"' .. path_combine(vc_bin, "cl.exe") .. '"' local lib_exe = '"' .. path_combine(vc_bin, "lib.exe") .. '"' local link_exe = '"' .. path_combine(vc_bin, "link.exe") .. '"' local rc_exe = '"' .. path_combine(sdk.bin, "rc.exe") .. '"' -- pickup the Resource Compiler from the SDK env:set('CC', cl_exe) env:set('CXX', cl_exe) env:set('LIB', lib_exe) env:set('LD', link_exe) env:set('RC', rc_exe) if sdk_version == "9.0" then env:set("RCOPTS", "") -- clear the "/nologo" option (it was first added in VS2010) end if version == "12.0" or version == "14.0" then -- Force MSPDBSRV.EXE env:set("CCOPTS", "/FS") env:set("CXXOPTS", "/FS") end -- Wire-up the external environment env:set_external_env_var('VSINSTALLDIR', vs_root) env:set_external_env_var('VCINSTALLDIR', vs_root .. "\\vc") env:set_external_env_var('DevEnvDir', vs_root .. "Common7\\IDE") local include = {} for _, v in ipairs(sdk.include) do include[#include + 1] = v end include[#include + 1] = vs_root .. "VC\\ATLMFC\\INCLUDE" include[#include + 1] = vs_root .. "VC\\INCLUDE" -- if MFC isn't installed with VS -- the linker will throw an error when looking for libs -- Lua does not have a "does directory exist function" -- we could use one here local lib_str = sdk.lib_str .. ";" .. vs_root .. "\\VC\\ATLMFC\\lib\\" .. vc_lib_map[host_arch][target_arch] .. ";" .. vc_lib env:set_external_env_var("WindowsSdkDir", sdk.root) env:set_external_env_var("INCLUDE", table.concat(include, ';')) env:set_external_env_var("LIB", lib_str) env:set_external_env_var("LIBPATH", lib_str) -- Modify %PATH% local path = {} path[#path + 1] = sdk.root path[#path + 1] = vs_root .. "Common7\\IDE" if "x86" == host_arch then path[#path + 1] = vs_root .. "\\VC\\Bin" elseif "x64" == host_arch then path[#path + 1] = vs_root .. "\\VC\\Bin\\amd64" elseif "arm" == host_arch then path[#path + 1] = vs_root .. "\\VC\\Bin\\arm" end path[#path + 1] = vs_root .. "\\Common7\\IDE" path[#path + 1] = env:get_external_env_var('PATH') env:set_external_env_var("PATH", table.concat(path, ';')) end
mit
Fenix-XI/Fenix
scripts/zones/Giddeus/npcs/Harvesting_Point.lua
13
1059
----------------------------------- -- Area: Giddeus -- NPC: Harvesting Point ----------------------------------- package.loaded["scripts/zones/Giddeus/TextIDs"] = nil; ------------------------------------- require("scripts/globals/harvesting"); require("scripts/zones/Giddeus/TextIDs"); ----------------------------------- -- onTrade ----------------------------------- function onTrade(player,npc,trade) startHarvesting(player,player:getZoneID(),npc,trade,0x0046); end; ----------------------------------- -- onTrigger ----------------------------------- function onTrigger(player,npc) player:messageSpecial(HARVESTING_IS_POSSIBLE_HERE,1020); end; ----------------------------------- -- onEventUpdate ----------------------------------- function onEventUpdate(player,csid,option) --printf("CSID: %u",csid); --printf("RESULT: %u",option); end; ----------------------------------- -- onEventFinish ----------------------------------- function onEventFinish(player,csid,option) --printf("CSID: %u",csid); --printf("RESULT: %u",option); end;
gpl-3.0
Fenix-XI/Fenix
scripts/zones/Port_Windurst/npcs/Boronene.lua
13
1051
----------------------------------- -- Area: Port Windurst -- NPC: Boronene -- Type: Moghouse Renter -- @zone: 240 -- @pos 201.651 -13 229.584 -- -- Auto-Script: Requires Verification (Verfied by Brawndo) ----------------------------------- package.loaded["scripts/zones/Port_Windurst/TextIDs"] = nil; ----------------------------------- ----------------------------------- -- onTrade Action ----------------------------------- function onTrade(player,npc,trade) end; ----------------------------------- -- onTrigger Action ----------------------------------- function onTrigger(player,npc) player:startEvent(0x027e); 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
ungarscool1/HL2RP
hl2rp/entities/entities/spawned_weapon/init.lua
4
2306
AddCSLuaFile("cl_init.lua") AddCSLuaFile("shared.lua") include("shared.lua") function ENT:Initialize() self:PhysicsInit(SOLID_VPHYSICS) self:SetMoveType(MOVETYPE_VPHYSICS) self:SetSolid(SOLID_VPHYSICS) self:SetUseType(SIMPLE_USE) local phys = self:GetPhysicsObject() if not phys:IsValid() then self:SetModel("models/weapons/w_rif_ak47.mdl") self:PhysicsInit(SOLID_VPHYSICS) phys = self:GetPhysicsObject() end phys:Wake() self:SetCollisionGroup(COLLISION_GROUP_INTERACTIVE_DEBRIS) if self:Getamount() == 0 then self:Setamount(1) end end function ENT:DecreaseAmount() local amount = self.dt.amount self.dt.amount = amount - 1 if self.dt.amount <= 0 then self:Remove() self.PlayerUse = false self.Removed = true -- because it is not removed immediately end end function ENT:OnTakeDamage(dmg) self:TakePhysicsDamage(dmg) end function ENT:Use(activator, caller) if type(self.PlayerUse) == "function" then local val = self:PlayerUse(activator, caller) if val ~= nil then return val end elseif self.PlayerUse ~= nil then return self.PlayerUse end local class = self:GetWeaponClass() local weapon = ents.Create(class) if not weapon:IsValid() then return false end if not weapon:IsWeapon() then weapon:SetPos(self:GetPos()) weapon:SetAngles(self:GetAngles()) weapon:Spawn() weapon:Activate() self:DecreaseAmount() return end local ammoType = weapon:GetPrimaryAmmoType() local CanPickup = hook.Call("PlayerCanPickupWeapon", GAMEMODE, activator, weapon) local ShouldntContinue = hook.Call("PlayerPickupDarkRPWeapon", nil, activator, self, weapon) if not CanPickup or ShouldntContinue then return end local newAmmo = activator:GetAmmoCount(ammoType) -- Store ammo count before weapon pickup weapon:Remove() activator:Give(class) weapon = activator:GetWeapon(class) newAmmo = newAmmo + (self.ammoadd or 0) -- Gets rid of any ammo given during weapon pickup if self.clip1 then weapon:SetClip1(self.clip1) weapon:SetClip2(self.clip2 or -1) end activator:SetAmmo(newAmmo, ammoType) self:DecreaseAmount() end
agpl-3.0
Fenix-XI/Fenix
scripts/zones/Bastok_Mines/npcs/Wahid.lua
12
1988
----------------------------------- -- Area: Bastok Mines -- NPC: Wahid -- Start & Finishes Quest: The Siren's Tear -- @zone: 234 -- @pos 26.305 -1 -66.403 ----------------------------------- package.loaded["scripts/zones/Bastok_Mines/TextIDs"] = nil; ----------------------------------- require("scripts/globals/quests"); require("scripts/globals/titles"); require("scripts/globals/settings"); require("scripts/zones/Bastok_Mines/TextIDs"); ----------------------------------- -- onTrade Action ----------------------------------- function onTrade(player,npc,trade) local SirensTear = player:getQuestStatus(BASTOK,THE_SIREN_S_TEAR); if (SirensTear ~= QUEST_AVAILABLE) then if (trade:hasItemQty(576,1) and trade:getItemCount() == 1) then player:startEvent(0x0052); end end end; ----------------------------------- -- onTrigger Action ----------------------------------- function onTrigger(player,npc) local SirensTear = player:getQuestStatus(BASTOK,THE_SIREN_S_TEAR); if (SirensTear == QUEST_AVAILABLE) then player:startEvent(0x0051); else player:startEvent(0x001c); end end; ----------------------------------- -- onEventUpdate ----------------------------------- function onEventUpdate(player,csid,option) --printf("CSID2: %u",csid); --printf("RESULT2: %u",option); end; ----------------------------------- -- onEventFinish ----------------------------------- function onEventFinish(player,csid,option) -- printf("CSID: %u",csid); -- printf("RESULT: %u",option); if (csid == 0x0051) then player:addQuest(BASTOK,THE_SIREN_S_TEAR); elseif (csid == 0x0052) then player:tradeComplete(); player:completeQuest(BASTOK,THE_SIREN_S_TEAR); player:addFame(BASTOK,120); player:addGil(150*GIL_RATE); player:messageSpecial(GIL_OBTAINED,150*GIL_RATE); player:addTitle(TEARJERKER); player:setVar("SirensTear",0); end end;
gpl-3.0
Fenix-XI/Fenix
scripts/zones/Kazham/npcs/Thali_Mhobrum.lua
13
1641
----------------------------------- -- Area: Kazham -- NPC: Thali Mhobrum -- Standard Info NPC ----------------------------------- package.loaded["scripts/zones/Kazham/TextIDs"] = nil; require("scripts/zones/Kazham/TextIDs"); local path = { 55.816410, -11.000000, -43.992680, 54.761787, -11.000000, -44.046181, 51.805824, -11.000000, -44.200321, 52.922001, -11.000000, -44.186420, 51.890709, -11.000000, -44.224312, 47.689358, -11.000000, -44.374969, 52.826096, -11.000000, -44.191029, 47.709465, -11.000000, -44.374393, 52.782181, -11.000000, -44.192482, 47.469643, -11.000000, -44.383091 }; function onSpawn(npc) npc:initNpcAi(); npc:setPos(pathfind.first(path)); onPath(npc); end; function onPath(npc) pathfind.patrol(npc, path); end; ----------------------------------- -- onTrade Action ----------------------------------- function onTrade(player,npc,trade) end; ----------------------------------- -- onTrigger Action ----------------------------------- function onTrigger(player,npc) if (player:getVar("BathedInScent") == 1) then player:startEvent(0x00A3); -- scent from Blue Rafflesias npc:wait(-1); else player:startEvent(0x00BE); npc:wait(-1); end end; ----------------------------------- -- onEventUpdate ----------------------------------- function onEventUpdate(player,csid,option) --printf("CSID: %u",csid); --printf("RESULT: %u",option); end; ----------------------------------- -- onEventFinish ----------------------------------- function onEventFinish(player,csid,option,npc) --printf("CSID: %u",csid); --printf("RESULT: %u",option); npc:wait(0); end;
gpl-3.0
DarkstarProject/darkstar
scripts/mixins/families/colibri_mimic.lua
9
2775
--[[ Colibri that copy spells cast on it. localVar default description -------- ------- ----------- [colibri]reflect_blue_magic 0 set to 1 for this mob to also reflect blue magic cast on it https://ffxiclopedia.fandom.com/wiki/Colibri https://ffxiclopedia.fandom.com/wiki/Greater_Colibri https://ffxiclopedia.fandom.com/wiki/Chamrosh --]] require("scripts/globals/mixins") require("scripts/globals/magic") g_mixins = g_mixins or {} g_mixins.families = g_mixins.families or {} g_mixins.families.colibri_mimic = function(mob) mob:addListener("MAGIC_TAKE", "COLIBRI_MIMIC_MAGIC_TAKE", function(target, caster, spell) if target:AnimationSub() == 0 and spell:tookEffect() and (caster:isPC() or caster:isPet()) and (spell:getSpellGroup() ~= dsp.magic.spellGroup.BLUE or target:getLocalVar("[colibri]reflect_blue_magic") == 1) then target:setLocalVar("[colibri]spellToMimic", spell:getID()) -- which spell to mimic target:setLocalVar("[colibri]castWindow", os.time() + 30) -- after thirty seconds, will stop attempting to mimic target:setLocalVar("[colibri]castTime", os.time() + 6) -- enforce a delay between original spell, and mimic spell. target:AnimationSub(1) end end) mob:addListener("COMBAT_TICK", "COLIBRI_MIMIC_CTICK", function(mob) local spellToMimic = mob:getLocalVar("[colibri]spellToMimic") local castWindow = mob:getLocalVar("[colibri]castWindow") local castTime = mob:getLocalVar("[colibri]castTime") local osTime = os.time() if mob:AnimationSub() == 1 then if spellToMimic > 0 and osTime > castTime and castWindow > osTime and not mob:hasStatusEffect(dsp.effect.SILENCE) then mob:castSpell(spellToMimic) mob:setLocalVar("[colibri]spellToMimic", 0) mob:setLocalVar("[colibri]castWindow", 0) mob:setLocalVar("[colibri]castTime", 0) mob:AnimationSub(0) elseif spellToMimic == 0 or osTime > castWindow then mob:setLocalVar("[colibri]spellToMimic", 0) mob:setLocalVar("[colibri]castWindow", 0) mob:setLocalVar("[colibri]castTime", 0) mob:AnimationSub(0) end end end) mob:addListener("DISENGAGE", "COLIBRI_MIMIC_DISENGAGE", function(mob) mob:setLocalVar("[colibri]spellToMimic", 0) mob:setLocalVar("[colibri]castWindow", 0) mob:setLocalVar("[colibri]castTime", 0) if mob:AnimationSub() == 1 then mob:AnimationSub(0) end end) end return g_mixins.families.colibri_mimic
gpl-3.0
DarkstarProject/darkstar
scripts/zones/Behemoths_Dominion/mobs/King_Behemoth.lua
11
1784
----------------------------------- -- Area: Behemoth's Dominion -- HNM: King Behemoth ----------------------------------- local ID = require("scripts/zones/Behemoths_Dominion/IDs") mixins = {require("scripts/mixins/rage")} require("scripts/globals/settings") require("scripts/globals/status") require("scripts/globals/titles") require("scripts/globals/magic") ----------------------------------- function onMobInitialize(mob) mob:setMobMod(dsp.mobMod.MAGIC_COOL, 60) end function onMobSpawn(mob) if LandKingSystem_NQ > 0 or LandKingSystem_HQ > 0 then GetNPCByID(ID.npc.BEHEMOTH_QM):setStatus(dsp.status.DISAPPEAR) end mob:setLocalVar("[rage]timer", 3600) -- 60 minutes end function onSpellPrecast(mob, spell) if spell:getID() == 218 then spell:setAoE(dsp.magic.aoe.RADIAL) spell:setFlag(dsp.magic.spellFlag.HIT_ALL) spell:setRadius(30) spell:setAnimation(280) spell:setMPCost(1) end end function onMobDeath(mob, player, isKiller) player:addTitle(dsp.title.BEHEMOTH_DETHRONER) end function onMobDespawn(mob) -- Set King_Behemoth's Window Open Time if LandKingSystem_HQ ~= 1 then local wait = 72 * 3600 SetServerVariable("[POP]King_Behemoth", os.time() + wait) -- 3 days if LandKingSystem_HQ == 0 then -- Is time spawn only DisallowRespawn(mob:getID(), true) end end -- Set Behemoth's spawnpoint and respawn time (21-24 hours) if LandKingSystem_NQ ~= 1 then SetServerVariable("[PH]King_Behemoth", 0) DisallowRespawn(ID.mob.BEHEMOTH, false) UpdateNMSpawnPoint(ID.mob.BEHEMOTH) GetMobByID(ID.mob.BEHEMOTH):setRespawnTime(75600 + math.random(0, 6) * 1800) -- 21 - 24 hours with half hour windows end end
gpl-3.0
DarkstarProject/darkstar
scripts/globals/items/angler_stewpot.lua
11
1608
----------------------------------------- -- ID: 5611 -- Item: Angler's Stewpot -- Food Effect: 3 Hrs, All Races ----------------------------------------- -- TODO: Group Effect -- HP +10% (cap 200) -- MP +10 -- HP Recoverd while healing 5 -- MP Recovered while healing 1 -- Accuracy +15% Cap 15 -- Ranged Accuracy 15% Cap 15 ----------------------------------------- require("scripts/globals/status") require("scripts/globals/msg") ----------------------------------------- function onItemCheck(target) local result = 0 if target:hasStatusEffect(dsp.effect.FOOD) or target:hasStatusEffect(dsp.effect.FIELD_SUPPORT_FOOD) then result = dsp.msg.basic.IS_FULL end return result end function onItemUse(target) target:addStatusEffect(dsp.effect.FOOD,0,0,10800,5611) end function onEffectGain(target, effect) target:addMod(dsp.mod.FOOD_HPP, 10) target:addMod(dsp.mod.FOOD_HP_CAP, 200) target:addMod(dsp.mod.MP, 10) target:addMod(dsp.mod.HPHEAL, 5) target:addMod(dsp.mod.MPHEAL, 1) target:addMod(dsp.mod.FOOD_ACCP, 15) target:addMod(dsp.mod.FOOD_ACC_CAP, 15) target:addMod(dsp.mod.FOOD_RACCP, 15) target:addMod(dsp.mod.FOOD_RACC_CAP, 15) end function onEffectLose(target, effect) target:delMod(dsp.mod.FOOD_HPP, 10) target:delMod(dsp.mod.FOOD_HP_CAP, 200) target:delMod(dsp.mod.MP, 10) target:delMod(dsp.mod.HPHEAL, 5) target:delMod(dsp.mod.MPHEAL, 1) target:delMod(dsp.mod.FOOD_ACCP, 15) target:delMod(dsp.mod.FOOD_ACC_CAP, 15) target:delMod(dsp.mod.FOOD_RACCP, 15) target:delMod(dsp.mod.FOOD_RACC_CAP, 15) end
gpl-3.0
dualface/killpests
src/framework/cc/ui/UIImage.lua
9
3050
--[[ Copyright (c) 2011-2014 chukong-inc.com Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ]] -------------------------------- -- @module UIImage --[[-- quick UIImage控件 ]] local UIImage = class("UIImage", function(filename, options) if options and options.scale9 then return display.newScale9Sprite(filename, nil, nil, nil, options.capInsets) else return display.newSprite(filename) end end) -- start -- -------------------------------- -- UIImage构建函数 -- @function [parent=#UIImage] new -- @param string filename 图片文件名 -- @param table options 参数表 -- end -- function UIImage:ctor(filename, options) makeUIControl_(self) self:align(display.LEFT_BOTTOM) local contentSize = self:getContentSize() self:getComponent("components.ui.LayoutProtocol"):setLayoutSize(contentSize.width, contentSize.height) self.isScale9_ = options and options.scale9 if self.isScale9_ then self:setLayoutSizePolicy(display.AUTO_SIZE, display.AUTO_SIZE) end end -- start -- -------------------------------- -- UIImage设置控件大小 -- @function [parent=#UIImage] setLayoutSize -- @param number width 宽度 -- @param number height 高度 -- @return UIImage#UIImage 自身 -- end -- function UIImage:setLayoutSize(width, height) self:getComponent("components.ui.LayoutProtocol"):setLayoutSize(width, height) local width, height = self:getLayoutSize() local top, right, bottom, left = self:getLayoutPadding() width = width - left - right height = height - top - bottom if self.isScale9_ then self:setContentSize(cc.size(width, height)) else local boundingSize = self:getBoundingBox() local sx = width / (boundingSize.width / self:getScaleX()) local sy = height / (boundingSize.height / self:getScaleY()) if sx > 0 and sy > 0 then self:setScaleX(sx) self:setScaleY(sy) end end if self.layout_ then self:setLayout(self.layout_) end return self end return UIImage
mit
synthein/synthein
src/world/structureParser.lua
1
7496
local GridTable = require("gridTable") local PartRegistry = require("world/shipparts/partRegistry") local parse = require("parse") local blueprintDir = "res/ships/" --"blueprints/" local StructureParser = {} function StructureParser.loadShipFromFile(ship) local contents, size if ship then local file = string.format("res/ships/" .. ship .. ".txt") contents, size = love.filesystem.read(file) return contents, size end return nil, nil end function StructureParser.loadBlueprintFromFile(ship) local fileName = blueprintDir .. ship .. ".txt" if not love.filesystem.getInfo(fileName, "file") then return nil, string.format("File %s does not exist", fileName) end local contents, size if fileName then contents, size = love.filesystem.read(fileName) return contents, size end return nil, nil end local function parseLetterPair(string) if not string:match("%a[1234*]") then return end local c = string:sub(1, 1) local nc = string:sub(2, 2) local orientation = nc == '*' and 1 or tonumber(nc) return c, orientation end function StructureParser.blueprintUnpack(appendix) local shipString, stringLength if string.match(appendix, "[*\n]") then shipString = appendix stringLength = #appendix else shipString, stringLength = StructureParser.loadBlueprintFromFile(appendix) end if not (shipString and stringLength) then return end local baseX, baseY, corePart, player local lines = {} -- TODO make sure the line match can use end of file instead of new line for line in shipString:gmatch(".-\n") do table.insert(lines, line:sub(1, #line - 1)) local find = line:find("*") if find then baseY = #lines baseX = find - 1 end end if not (baseX and baseY) then return end local blueprint = GridTable() for i, line in ipairs(lines) do for j = 1,#line-1 do local lp = line:sub(j, j + 1) -- Location handling. local x = (j - baseX)/2 local y = baseY - i local c, orientation = parseLetterPair(lp) if c and orientation then -- Add to grid table blueprint:index(x, y, {c, orientation}) end end end return blueprint end function StructureParser.shipUnpack(appendix, shipData) local shipString, stringLength if string.match(appendix, "[*\n]") then shipString = appendix stringLength = #appendix else shipString, stringLength = StructureParser.loadShipFromFile(appendix) end if not (shipString and stringLength) then return end local baseX, baseY, corePart, player local lines = {} -- TODO make sure the line match can use end of file instead of new line for line in shipString:gmatch(".-\n") do table.insert(lines, line:sub(1, #line - 1)) local find = line:find("*") if find then baseY = #lines baseX = find - 1 local c = line:sub(baseX, baseX) corePart = PartRegistry.isCorePart[c] player = c == 'p' end end if not (baseX and baseY) then return end local loadDataTable = {} local location = {} local loadData = {} for i = 1, stringLength do local c = shipString:sub(i,i) if c == '(' then for a = 1,(stringLength-i) do c = shipString:sub(i + a, i + a) if c == ')' then local locationString = shipString:sub(i + 1, i + a - 1) location = parse.parseNumbers(locationString) end end elseif c == '[' then for a = 1,(stringLength-i) do c = shipString:sub(i + a, i + a) if c == ']' then local dataString = shipString:sub(i + 1, i + a - 1) loadData = parse.parseNumbers(dataString) end end table.insert(loadDataTable, {location, loadData}) end end local shipTable = {} shipTable.parts = GridTable() for i, line in ipairs(lines) do for j = 1,#line-1 do local lp = line:sub(j, j + 1) -- Location handling. local x = (j - baseX)/2 local y = baseY - i local c, orientation = parseLetterPair(lp) if c and orientation and (PartRegistry.partsList[c] ~= nil) then local part = PartRegistry.createPart(c, shipData) part:setLocation({x, y, orientation}) -- Add to grid table shipTable.parts:index(x, y, part) end end end if corePart then shipTable.corePart = shipTable.parts:index(0, 0) end for i, t in ipairs(loadDataTable) do local part = shipTable.parts:index(t[1][1], t[1][2]) if part then part:loadData(t[2]) end end return shipTable, player end function StructureParser.blueprintPack(blueprint) local string = "" local xLow, yLow, xHigh, yHigh = blueprint:getLimits() local stringTable = {} for y = yHigh, yLow, -1 do for x = xLow, xHigh, 1 do part = blueprint:index(x, y) if part then string = string .. part[1] if x == 0 and y == 0 then string = string .. "*" else string = string .. tostring(part[2]) end else string = string .. " " end end string = string .. "\n" end return string end function StructureParser.shipPack(structure, saveThePartData) PartRegistry.setPartChars() local string = "" local xLow, xHigh, yLow, yHigh = 0, 0, 0, 0 local parts = structure.gridTable:loop() local stringTable = {} for _, part in ipairs(parts) do local x = part.location[1] local y = part.location[2] if x < xLow then xLow = x elseif x > xHigh then xHigh = x end if y < yLow then yLow = y elseif y > yHigh then yHigh = y end end for i = 1, (yHigh - yLow + 1) do table.insert(stringTable, {}) for _ = 1, (xHigh - xLow + 1) do table.insert(stringTable[i], {" "}) end end for i, part in ipairs(parts) do local x = part.location[1] local y = part.location[2] local tempString, a, b -- local loadData = {} a = part.partChar --[[ --Find the string representation of the part. if getmetatable(part) == Block then a = "b" elseif getmetatable(part) == EngineBlock then a = "e" elseif getmetatable(part) == GunBlock then a = "g" elseif getmetatable(part) == AIBlock then a = "a" elseif getmetatable(part) == PlayerBlock then a = "p" elseif getmetatable(part) == Anchor then a = "n" end --]] if part == structure.corePart or (not structure.corePart and i==1) then b = "*" else b = tostring(part.location[3]) end tempString = a .. b --Add data to table if saveThePartData then stringTable[y - yLow + 1][x - xLow + 1] = {tempString, part:saveData()} else stringTable[y - yLow + 1][x - xLow + 1] = {tempString} end end --Put strings together local dataString = "" for i = 1,#stringTable do local ii = #stringTable - i + 1 for j = 1,#stringTable[ii] do string = string .. stringTable[ii][j][1] if stringTable[ii][j][2]then dataString = dataString .. parse.packLocation({j + xLow - 1, ii + yLow - 1}) .. parse.packData(stringTable[ii][j][2]) .. --Tserial.pack(stringTable[i][j][2], nil, true) .. "\n" end end string = string .. "\n" end string = string .. "\n" .. dataString return string end return StructureParser --Ideas to try. Do not delete --[[ -- Inside loop over each line y = y - 1 local length = #line local m = line:find("[.%[\n]") or length + 1 local types = line:sub(1, m - 1) local dataString = line:sub(m, length) local dataTable = {} for partData in dataString:gmatch("[.%[]([^.%[%]\n]*)%]?") do partDataTable = {} for number in partData:gmatch("[^,]") do table.insert(partDataTable, tonumber(number)) end table.insert(dataTable, partDataTable) end -- Data handling. partCounter = partCounter + 1 local partData = dataTable[partCounter] if partData then part:loadData(partData) end --]]
gpl-3.0
Fenix-XI/Fenix
scripts/zones/East_Ronfaure/npcs/Cheval_River.lua
13
1679
----------------------------------- -- Area: East Ronfaure -- NPC: Cheval_River -- @pos 223 -58 426 101 -- Involved in Quest: Waters of Cheval ----------------------------------- package.loaded["scripts/zones/East_Ronfaure/TextIDs"] = nil; ----------------------------------- require("scripts/globals/settings"); require("scripts/globals/quests"); require("scripts/zones/East_Ronfaure/TextIDs"); ----------------------------------- -- onTrade Action ----------------------------------- function onTrade(player,npc,trade) if (player:getQuestStatus(SANDORIA,WATER_OF_THE_CHEVAL) == QUEST_ACCEPTED and trade:hasItemQty(602, 1)) then if (trade:getItemCount() == 1 and player:getFreeSlotsCount() > 0) then player:tradeComplete(); player:addItem(603); player:messageSpecial(CHEVAL_RIVER_WATER, 603); else player:messageSpecial(ITEM_CANNOT_BE_OBTAINED, 603); end; end; end; ----------------------------------- -- onTrigger Action ----------------------------------- function onTrigger(player,npc) if (player:hasItem(602) == true) then player:messageSpecial(BLESSED_WATERSKIN); else player:messageSpecial(NOTHING_OUT_OF_ORDINARY); end; end; ----------------------------------- -- onEventUpdate ----------------------------------- function onEventUpdate(player,csid,option) --printf("CSID: %u",csid); --printf("RESULT: %u",option); end; ----------------------------------- -- onEventFinish ----------------------------------- function onEventFinish(player,csid,option) --printf("CSID: %u",csid); --printf("RESULT: %u",option); end;
gpl-3.0
DarkstarProject/darkstar
scripts/globals/items/nopales_salad.lua
11
1057
----------------------------------------- -- ID: 5701 -- Item: nopales_salad -- Food Effect: 3Hrs, All Races ----------------------------------------- -- Strength 1 -- Agility 6 -- Ranged Accuracy +20 -- Ranged Attack +10 ----------------------------------------- require("scripts/globals/status") require("scripts/globals/msg") ----------------------------------------- function onItemCheck(target) local result = 0 if target:hasStatusEffect(dsp.effect.FOOD) or target:hasStatusEffect(dsp.effect.FIELD_SUPPORT_FOOD) then result = dsp.msg.basic.IS_FULL end return result end function onItemUse(target) target:addStatusEffect(dsp.effect.FOOD,0,0,10800,5701) end function onEffectGain(target, effect) target:addMod(dsp.mod.STR, 1) target:addMod(dsp.mod.AGI, 6) target:addMod(dsp.mod.RACC, 20) target:addMod(dsp.mod.RATT, 10) end function onEffectLose(target, effect) target:delMod(dsp.mod.STR, 1) target:delMod(dsp.mod.AGI, 6) target:delMod(dsp.mod.RACC, 20) target:delMod(dsp.mod.RATT, 10) end
gpl-3.0
Fenix-XI/Fenix
scripts/globals/abilities/feral_howl.lua
58
3525
--------------------------------------------------- -- Ability: Feral Howl -- Terrorizes the target. -- Obtained: Beastmaster Level 75 -- Recast Time: 0:05:00 -- Duration: Apprx. 0:00:01 - 0:00:10 --------------------------------------------------- require("scripts/globals/settings"); require("scripts/globals/status"); ----------------------------------- -- onAbilityCheck ----------------------------------- function onAbilityCheck(player,target,ability) return 0,0; end; ----------------------------------- -- onUseAbility ----------------------------------- function onUseAbility(player,target,ability) local modAcc = player:getMerit(MERIT_FERAL_HOWL); --printf("modAcc : %u",modAcc); local feralHowlMod = player:getMod(MOD_FERAL_HOWL_DURATION); --printf("feralHowlMod : %u",feralHowlMod); local duration = 10; --printf("Duration : %u",duration); if target:hasStatusEffect(EFFECT_TERROR) == true or target:hasStatusEffect(EFFECT_STUN) == true then -- effect already on, or target stunned, do nothing -- reserved for miss based on target already having stun or terror effect active else -- Calculate duration. if feralHowlMod >= 1 then -- http://wiki.ffxiclopedia.org/wiki/Monster_Jackcoat_(Augmented)_%2B2 -- add 20% duration per merit level if wearing Augmented Monster Jackcoat +2 duration = (duration + (duration * modAcc * 0.04)); -- modAcc returns intervals of 5. (0.2 / 5 = 0.04) --printf("Duration post merit : %u",duration); end end -- Leaving potency at 1 since I am not sure it applies with this ability... no known way to increase resistance local potency = 1; --printf("Potency : %u",potency); -- Grabbing variables for terror accuracy. Unknown if ability is stat based. Using Beastmaster's level versus Target's level local pLvl = player:getMainLvl(); --printf("player level : %u",pLvl); local mLvl = target:getMainLvl(); --printf("mob level : %u",mLvl); -- Checking level difference between the target and the BST local dLvl = (mLvl - pLvl); --printf("level difference : %u",dLvl); -- Determining what level of resistance the target will have to the ability local resist = 0 dLvl = (10 * dLvl) - modAcc; -- merits increase accuracy by 5% per level if dLvl <= 0 then -- default level difference to 1 if mob is equal to the Beastmaster's level or less. resist = 1; --printf("resist : %u",resist); else resist = math.random(1,(dLvl + 100)); -- calculate chance of missing based on number of levels mob is higher than you. Target gets 10% resist per level over BST --printf("resist : %u",resist); end -- Adjusting duration based on resistance. Only fair way I could see to do it... if resist >= 20 then if (resist / 10) >= (duration) then duration = (duration - math.random(1,(duration - 2))); --printf("Duration post resist : %u",duration); else duration = (duration - math.random(1,(resist / 10))); --printf("Duration post resist : %u",duration); end end -- execute ability based off of resistance value; space reserved for resist message if resist <= 90 then -- still experimental. not exactly sure how to calculate hit % target:addStatusEffect(EFFECT_TERROR,potency,0,duration); else -- reserved for text related to resist end return EFFECT_TERROR; end;
gpl-3.0
ZACTELEGRAM1/-EMAM-ALI-1
plugins/gnuplot.lua
622
1813
--[[ * Gnuplot plugin by psykomantis * dependencies: * - gnuplot 5.00 * - libgd2-xpm-dev (on Debian distr) for more info visit: https://libgd.github.io/pages/faq.html * ]] -- Gnuplot needs absolute path for the plot, so i run some commands to find where we are local outputFile = io.popen("pwd","r") io.input(outputFile) local _pwd = io.read("*line") io.close(outputFile) local _absolutePlotPath = _pwd .. "/data/plot.png" local _scriptPath = "./data/gnuplotScript.gpl" do local function gnuplot(msg, fun) local receiver = get_receiver(msg) -- We generate the plot commands local formattedString = [[ set grid set terminal png set output "]] .. _absolutePlotPath .. [[" plot ]] .. fun local file = io.open(_scriptPath,"w"); file:write(formattedString) file:close() os.execute("gnuplot " .. _scriptPath) os.remove (_scriptPath) return _send_photo(receiver, _absolutePlotPath) end -- Check all dependencies before executing local function checkDependencies() local status = os.execute("gnuplot -h") if(status==true) then status = os.execute("gnuplot -e 'set terminal png'") if(status == true) then return 0 -- OK ready to go! else return 1 -- missing libgd2-xpm-dev end else return 2 -- missing gnuplot end end local function run(msg, matches) local status = checkDependencies() if(status == 0) then return gnuplot(msg,matches[1]) elseif(status == 1) then return "It seems that this bot miss a dependency :/" else return "It seems that this bot doesn't have gnuplot :/" end end return { description = "use gnuplot through telegram, only plot single variable function", usage = "!gnuplot [single variable function]", patterns = {"^!gnuplot (.+)$"}, run = run } end
gpl-2.0
Fenix-XI/Fenix
scripts/globals/homepoint.lua
13
17850
require("scripts/globals/settings"); local homepoints = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25, 26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50, 51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75, 76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100, 101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116}; --paramNum bit x y z rotation zone cost homepoints[0] = { 1, 1, -85.554, 1, -64.554, 45, 230, 500}; -- Southern San d'Oria #1 homepoints[1] = { 1, 2, 44.1, 2, -34.5, 170, 230, 500}; -- Southern San d'Oria #2 homepoints[2] = { 1, 3, 140.5, -2, 121, 0, 230, 500}; -- Southern San d'Oria #3 homepoints[3] = { 1, 4, -178, 4, 71, 0, 231, 500}; -- Northern San d'Oria #1 homepoints[4] = { 1, 5, 10, -0.2, 95, 0, 231, 500}; -- Northern San d'Oria #2 homepoints[5] = { 1, 6, 70, -0.2, 10, 0, 231, 500}; -- Northern San d'Oria #3 homepoints[6] = { 1, 7, -68, -4, -105, 0, 232, 500}; -- Port San d'Oria #1 homepoints[7] = { 1, 8, 48, -12, -105, 0, 232, 500}; -- Port San d'Oria #2 homepoints[8] = { 1, 9, -6, -13, -150, 0, 232, 500}; -- Port San d'Oria #3 homepoints[9] = { 1, 10, 39, 0, -43, 0, 234, 500}; -- Bastok Mines #1 homepoints[10] = { 1, 11, 118, 1, -58, 0, 234, 500}; -- Bastok Mines #2 homepoints[11] = { 1, 12, -293, -10, -102, 0, 235, 500}; -- Bastok Markets #1 homepoints[12] = { 1, 13, -328, -12, -33, 0, 235, 500}; -- Bastok Markets #2 homepoints[13] = { 1, 14, -189, -8, 26, 0, 235, 500}; -- Bastok Markets #3 homepoints[14] = { 1, 15, 58.85, 7.499, -27.790, 0, 236, 500}; -- Port Bastok #1 homepoints[15] = { 1, 16, 42, 8.5, -244, 0, 236, 500}; -- Port Bastok #2 homepoints[16] = { 1, 17, 46, -14, -19, 0, 237, 500}; -- Metalworks #1 homepoints[17] = { 1, 18, -32, -5, 132, 0, 238, 500}; -- Windurst Waters #1 homepoints[18] = { 1, 19, 138.5, 0, -14, 0, 238, 500}; -- Windurst Waters #2 homepoints[19] = { 1, 20, -72, -5, 125, 0, 239, 500}; -- Windurst Walls #1 homepoints[20] = { 1, 21, -212, 0, -99, 0, 239, 500}; -- Windurst Walls #2 homepoints[21] = { 1, 22, 31, -6.5, -40, 0, 239, 500}; -- Windurst Walls #3 homepoints[22] = { 1, 23, -68, -7, 112, 0, 240, 500}; -- Port Windurst #1 homepoints[23] = { 1, 24, -207, -8, 210, 0, 240, 500}; -- Port Windurst #2 homepoints[24] = { 1, 25, 180, -12, 226, 0, 240, 500}; -- Port Windurst #3 homepoints[25] = { 1, 26, 9, -2, 0, 0, 241, 500}; -- Windurst Woods #1 homepoints[26] = { 1, 27, 107, -5, -56, 0, 241, 500}; -- Windurst Woods #2 homepoints[27] = { 1, 28, -92, -5, 62, 0, 241, 500}; -- Windurst Woods #3 homepoints[28] = { 1, 29, 74, -7, -139, 0, 241, 500}; -- Windurst Woods #4 homepoints[29] = { 1, 30, -6, 3, 0, 0, 243, 500}; -- Ru'Lude Gardens #1 homepoints[30] = { 1, 31, 53, 9, -57, 0, 243, 500}; -- Ru'Lude Gardens #2 homepoints[31] = { 1, 32, -67, 6, -25, 1, 243, 500}; -- Ru'Lude Gardens #3 homepoints[32] = { 2, 1, -99, 0, 167, 0, 244, 500}; -- Upper Jeuno #1 homepoints[33] = { 2, 2, 32, -1, -44, 0, 244, 500}; -- Upper Jeuno #2 homepoints[34] = { 2, 3, -52, 1, 16, 0, 244, 500}; -- Upper Jeuno #3 homepoints[35] = { 2, 4, -99, 0, -183, 0, 245, 500}; -- Lower Jeuno #1 homepoints[36] = { 2, 5, 18, -1, 54, 0, 245, 500}; -- Lower Jeuno #2 homepoints[37] = { 2, 6, 37, 0, 9, 0, 246, 500}; -- Port Jeuno #1 homepoints[38] = { 2, 7, -155, -1, -4, 0, 246, 500}; -- Port Jeuno #2 homepoints[39] = { 2, 8, 78, -13, -94, 0, 250, 500}; -- Kazham #1 homepoints[40] = { 2, 9, -13, -15, 87, 0, 249, 500}; -- Mhaura #1 homepoints[41] = { 2, 10, -27, 0, -47, 0, 252, 500}; -- Norg #1 homepoints[42] = { 2, 11, -29, 0, -76, 0, 247, 500}; -- Rabao #1 homepoints[43] = { 2, 12, 36, -11, 35, 0, 248, 500}; -- Selbina #1 homepoints[44] = { 2, 13, -84, 4, -32, 128, 256, 500}; -- Western Adoulin #1 homepoints[45] = { 2, 14, -51, 0, 59, 128, 257, 500}; -- Eastern Adoulin #1 homepoints[46] = { 2, 15, -107, 3, 295, 128, 261, 1000}; -- Ceizak Battlegrounds #1 homepoints[47] = { 2, 16, -193, -0.5, -252, 128, 262, 1000}; -- Foret de Hennetiel #1 homepoints[48] = { 2, 17, -415, -63.2, 409, 106, 265, 1000}; -- Morimar Basalt Fields #1 homepoints[49] = { 2, 18, -420, 0, -62, 64, 263, 1000}; -- Yorcia Weald #1 homepoints[50] = { 2, 19, -23, 0, 174, 0, 266, 1000}; -- Marjami Ravine #1 homepoints[51] = { 2, 20, 210, 20.299, 315, 192, 267, 1000}; -- Kamihr Drifts #1 homepoints[52] = { 2, 21, 434, -40, 171, 0, 142, 1000}; -- Yughott Grotto #1 homepoints[53] = { 2, 22, 109, -38, -147, 0, 143, 1000}; -- Palborough Mines #1 homepoints[54] = { 2, 23, -132, -3, -303, 0, 145, 1000}; -- Giddeus #1 homepoints[55] = { 2, 24, 243, -24, 62, 0, 204, 1000}; -- Fei'Yin #1 homepoints[56] = { 2, 25, -984, 17, -289, 0, 208, 1000}; -- Quicksand Caves #1 homepoints[57] = { 2, 26, -80, 46, 62, 0, 160, 1000}; -- Den of Rancor #1 homepoints[58] = { 2, 27, -554, -70, 66, 0, 162, 1000}; -- Castle Zvahl Keep #1 homepoints[59] = { 2, 28, 5, -42, 526, 0, 130, 1000}; -- Ru'Aun Gardens #1 homepoints[60] = { 2, 29, -499, -42, 167, 0, 130, 1000}; -- Ru'Aun Gardens #2 homepoints[61] = { 2, 30, -312, -42, -422, 0, 130, 1000}; -- Ru'Aun Gardens #3 homepoints[62] = { 2, 31, 500, -42, 158, 0, 130, 1000}; -- Ru'Aun Gardens #4 homepoints[63] = { 2, 32, 305, -42, -427, 0, 130, 1000}; -- Ru'Aun Gardens #5 homepoints[64] = { 3, 1, -1, -27, 107, 0, 26, 500}; -- Tavnazian Safehold #1 homepoints[65] = { 3, 2, -21, 0, -21, 0, 50, 500}; -- Aht Urhgan Whitegate #1 homepoints[66] = { 3, 3, -20, 0, -25, 0, 53, 500}; -- Nashmau #1 -- homepoints[67] = { 3, 4, 0, 0, 0, 0, 48, 500}; -- Al Zahbi #1 // Doesn't exist related to BG Wiki homepoints[68] = { 3, 5, -85, 1, -66, 0, 80, 500}; -- Southern San d'Oria [S] #1 homepoints[69] = { 3, 6, -293, -10, -102, 0, 87, 500}; -- Bastok Markets [S] #1 homepoints[70] = { 3, 7, -32, -5, 131, 0, 94, 500}; -- Windurst Waters [S] #1 homepoints[71] = { 3, 8, -365, -176.5, -36, 0, 158, 1000}; -- Upper Delkfutt's Tower #1 homepoints[72] = { 3, 9, -13, 48, 61, 0, 178, 1000}; -- The Shrine of Ru'Avitau #1 homepoints[73] = { 3, 10, 0, 0, 0, 0, 29, 1000}; -- Riverne - Site #B01 #1 homepoints[74] = { 3, 11, -98, -10, -493, 192, 52, 1000}; -- Bhaflau Thickets #1 homepoints[75] = { 3, 12, -449, 13, -497, 0, 79, 1000}; -- Caedarva Mire #1 homepoints[76] = { 3, 13, 64, -196, 181, 0, 5, 1000}; -- Uleguerand Range #1 homepoints[77] = { 3, 14, 380, 23, -62, 0, 5, 1000}; -- Uleguerand Range #2 homepoints[78] = { 3, 15, 424, -32, 221, 0, 5, 1000}; -- Uleguerand Range #3 homepoints[79] = { 3, 16, 64, -96, 461, 0, 5, 1000}; -- Uleguerand Range #4 homepoints[80] = { 3, 17, -220, -1, -62, 0, 5, 1000}; -- Uleguerand Range #5 homepoints[81] = { 3, 18, -200, -10, 342, 0, 7, 1000}; -- Attohwa Chasm #1 homepoints[82] = { 3, 19, -58, 40, 14, 64, 9, 1000}; -- Pso'Xja #1 homepoints[83] = { 3, 20, 445, 27, -22, 0, 12, 1000}; -- Newton Movalpolos #1 homepoints[84] = { 3, 21, 189, 0, 362, 0, 30, 1000}; -- Riveren - Site #A01 #1 // Location not verified from retail homepoints[85] = { 3, 22, 7, 0, 709, 192, 33, 1000}; -- Al'Taieu #1 homepoints[86] = { 3, 23, -532, 0, 447, 128, 33, 1000}; -- Al'Taieu #2 homepoints[87] = { 3, 24, 569, 0, 410, 192, 33, 1000}; -- Al'Taieu #3 homepoints[88] = { 3, 25, -12, 0, -288, 192, 34, 1000}; -- Grand Palace of Hu'Xzoi #1 homepoints[89] = { 3, 26, -426, 0, 368, 224, 35, 1000}; -- The Garden of Ru'Hmet #1 homepoints[90] = { 3, 27, -540.844, -4.000, 70.809, 74, 61, 1000}; -- Mount Zhayolm #1 // No valid location homepoints[91] = { 3, 28, -303, -8, 526, 0, 113, 1000}; -- Cape Terrigan #1 homepoints[92] = { 3, 29, 88, -15, -217, 0, 153, 1000}; -- The Boyahda Tree #1 homepoints[93] = { 3, 30, 182, 34, -62, 223, 160, 1000}; -- Den of Rancor #2 homepoints[94] = { 3, 31, 102, 0, 269, 191, 204, 1000}; -- Fei'Yin #2 homepoints[95] = { 3, 32, -63, 50, 81, 192, 205, 1000}; -- Ifrit's Cauldron #1 homepoints[96] = { 4, 1, 573, 9, -500, 0, 208, 1000}; -- Quicksand Caves #2 homepoints[97] = { 4, 2, -165, -1, 12, 65, 230, 500}; -- Southern San d'Oria #4 homepoints[98] = { 4, 3, -132, 12, 194, 170, 231, 500}; -- Northern San d'Oria #4 homepoints[99] = { 4, 4, 87, 7, 1, 0, 234, 500}; -- Bastok Mines #3 homepoints[100] = { 4, 5, -192, -6, -69, 0, 235, 500}; -- Bastok Markets #4 homepoints[101] = { 4, 6, -127, -6, 8, 206, 236, 500}; -- Port Bastok #3 homepoints[102] = { 4, 7, -76, 2, 3, 124, 237, 500}; -- Metalworks #2 homepoints[103] = { 4, 8, 5, -4, -175, 130, 238, 500}; -- Windurst Waters #3 homepoints[104] = { 4, 9, -65, -5, 54, 127, 252, 500}; -- Norg #2 homepoints[105] = { 4, 10, -21, 8, 110, 64, 247, 500}; -- Rabao #2 homepoints[106] = { 4, 11, 130, 0, -16, 0, 50, 500}; -- Aht Urhgan Whitegate #2 homepoints[107] = { 4, 12, -108, -6, 108, 192, 50, 500}; -- Aht Urhgan Whitegate #3 homepoints[108] = { 4, 13, -99, 0, -68, 0, 50, 500}; -- Aht Urhgan Whitegate #4 homepoints[109] = { 4, 14, 32, 0, -164, 32, 256, 500}; -- Western Adoulin #2 homepoints[110] = { 4, 15, -51, 0, -96, 96, 257, 500}; -- Eastern Adoulin #2 homepoints[111] = { 4, 16, 223, -13, -254, 0, 137, 1000}; -- Xarcabard [S] #1 homepoints[112] = { 4, 17, 5.539, -0.434, 8.133, 73, 281, 1000}; -- Leafallia #1 // on your right when you enter. homepoints[113] = { 4, 18, 66, -70, -554, 128, 155, 1000}; -- *Castle Zvahl Keep [S] #1 // same location as in the present homepoints[114] = { 4, 19, -65, -17.5, 563, 224, 25, 1000}; -- Misareaux Coast #1 homepoints[115] = { 4, 20, -212, -21, 93, 64, 126, 500}; -- Qufim Island #1 -- homepoints[116] = { 4, 21, 0, 0, 0, 0, 276, 1000}; -- Inner Ra'Kaznar #1 // next to the Sinister Reign NPC and Ra'Kaznar Turris local freeHpTeleGroups = { 1, 2, 3, 4, 5, 6, 7, 8}; freeHpTeleGroups[1] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 97, 98}; --San d'Oria freeHpTeleGroups[2] = { 9, 10, 11, 12 ,13, 14, 15, 16, 99, 100, 101, 102}; -- Bastok freeHpTeleGroups[3] = { 17, 18, 19, 20, 21, 22, 23, 24, 25, 26 ,27 ,28, 103}; -- Windurst freeHpTeleGroups[4] = { 29, 30, 31, 32, 33, 34, 35, 36, 37, 38}; -- Jueno freeHpTeleGroups[5] = { 65, 106, 107, 108}; -- Aht Urghan freeHpTeleGroups[6] = { 44, 45, 109, 110}; -- Adoulin freeHpTeleGroups[7] = { 41, 104}; -- Norg freeHpTeleGroups[8] = { 42, 105}; -- Rabao function homepointMenu( player, csid, hpIndex) if ( HOMEPOINT_HEAL == 1) then player:addHP(player:getMaxHP()); player:addMP(player:getMaxMP()); end if ( HOMEPOINT_TELEPORT == 1) then if ( homepoints[hpIndex] == nil) then return; end -- Check for valid hpIndex player:setLocalVar("currentHpIndex", hpIndex + 1); local HpTeleportMask1 = bit.bor( bit.lshift( player:getVar("HpTeleportMask1a"), 16), player:getVar("HpTeleportMask1b")); local HpTeleportMask2 = bit.bor( bit.lshift( player:getVar("HpTeleportMask2a"), 16), player:getVar("HpTeleportMask2b")); local HpTeleportMask3 = bit.bor( bit.lshift( player:getVar("HpTeleportMask3a"), 16), player:getVar("HpTeleportMask3b")); local HpTeleportMask4 = bit.bor( bit.lshift( player:getVar("HpTeleportMask4a"), 16), player:getVar("HpTeleportMask4b")); -- Register new homepoint? local newHp = 0; if ( homepoints[hpIndex][1] == 1) then if ( bit.rshift( bit.lshift( HpTeleportMask1, 32 - homepoints[hpIndex][2]), 31) == 0) then newHp = 0x10000; -- This value causes the "You have registered a new home point!" dialog to display -- Update the homepoint teleport mask with the new location HpTeleportMask1 = bit.bor( HpTeleportMask1, bit.lshift( 1, homepoints[hpIndex][2] - 1)); -- Save new mask to database player:setVar("HpTeleportMask1a", bit.rshift( HpTeleportMask1, 16)); player:setVar("HpTeleportMask1b", bit.rshift( bit.lshift( HpTeleportMask1, 16), 16)); end elseif ( homepoints[hpIndex][1] == 2) then if ( bit.rshift( bit.lshift( HpTeleportMask2, 32 - homepoints[hpIndex][2]), 31) == 0) then newHp = 0x10000; HpTeleportMask2 = bit.bor( HpTeleportMask2, bit.lshift( 1, homepoints[hpIndex][2] - 1)); player:setVar("HpTeleportMask2a", bit.rshift( HpTeleportMask2, 16)); player:setVar("HpTeleportMask2b", bit.rshift( bit.lshift( HpTeleportMask2, 16), 16)); end elseif ( homepoints[hpIndex][1] == 3) then if ( bit.rshift( bit.lshift( HpTeleportMask3, 32 - homepoints[hpIndex][2]), 31) == 0) then newHp = 0x10000; HpTeleportMask3 = bit.bor( HpTeleportMask3, bit.lshift( 1, homepoints[hpIndex][2] - 1)); player:setVar("HpTeleportMask3a", bit.rshift( HpTeleportMask3, 16)); player:setVar("HpTeleportMask3b", bit.rshift( bit.lshift( HpTeleportMask3, 16), 16)); end elseif ( homepoints[hpIndex][1] == 4) then if ( bit.rshift( bit.lshift( HpTeleportMask4, 32 - homepoints[hpIndex][2]), 31) == 0) then newHp = 0x10000; HpTeleportMask4 = bit.bor( HpTeleportMask4, bit.lshift( 1, homepoints[hpIndex][2] - 1)); player:setVar("HpTeleportMask4a", bit.rshift( HpTeleportMask4, 16)); player:setVar("HpTeleportMask4b", bit.rshift( bit.lshift( HpTeleportMask4, 16), 16)); end end player:startEvent( csid, 0, HpTeleportMask1, HpTeleportMask2, HpTeleportMask3, HpTeleportMask4, player:getGil(), 4095, hpIndex + newHp); else player:PrintToPlayer( "Home point teleports are currently disabled on this server."); player:startEvent( csid, 0, 0, 0, 0, 0, player:getGil(), 4095, hpIndex); end end; function hpTeleport( player, option) if ( option == 2 or option > 0x10000 and option < 0x7F0003) then local hpIndex = bit.rshift( option, 16); -- Calculate hpIndex based on option selected local teleportCost = homepoints[hpIndex][8]; if ( freeHpTeleport( player, hpIndex)) then teleportCost = 0; end player:delGil(teleportCost); player:setLocalVar("currentHpIndex", 0); player:setPos( homepoints[hpIndex][3], homepoints[hpIndex][4], homepoints[hpIndex][5], homepoints[hpIndex][6], homepoints[hpIndex][7]); end end; function freeHpTeleport( player, hpIndex) local currentHpIndex = player:getLocalVar("currentHpIndex") - 1; for x = 1, 20 do if ( freeHpTeleGroups[x] ~= nil) then for y = 1, 20 do if ( freeHpTeleGroups[x][y] ~= nil) then if ( freeHpTeleGroups[x][y] == currentHpIndex) then for z = 1, 20 do if ( freeHpTeleGroups[x][z] ~= nil) then if ( freeHpTeleGroups[x][z] == hpIndex) then return true; end else break; end end end else break; end end else break; end end return false; end;
gpl-3.0
Fenix-XI/Fenix
scripts/zones/West_Ronfaure/npcs/qm1.lua
13
1477
----------------------------------- -- Area: West Ronfaure -- NPC: qm1 (???) -- Involved in Quest: The Dismayed Customer -- @pos -453 -20 -230 100 ----------------------------------- package.loaded["scripts/zones/West_Ronfaure/TextIDs"] = nil; ----------------------------------- require("scripts/globals/settings"); require("scripts/globals/quests"); require("scripts/globals/keyitems"); require("scripts/zones/West_Ronfaure/TextIDs"); ----------------------------------- -- onTrade Action ----------------------------------- function onTrade(player,npc,trade) end; ----------------------------------- -- onTrigger Action ----------------------------------- function onTrigger(player,npc) if (player:getQuestStatus(SANDORIA, THE_DISMAYED_CUSTOMER) == QUEST_ACCEPTED and player:getVar("theDismayedCustomer") == 1) then player:addKeyItem(GULEMONTS_DOCUMENT); player:messageSpecial(KEYITEM_OBTAINED, GULEMONTS_DOCUMENT); player:setVar("theDismayedCustomer", 0); else player:messageSpecial(DISMAYED_CUSTOMER); 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
soheildiscover/soheil
plugins/quotes.lua
651
1630
local quotes_file = './data/quotes.lua' local quotes_table function read_quotes_file() local f = io.open(quotes_file, "r+") if f == nil then print ('Created a new quotes file on '..quotes_file) serialize_to_file({}, quotes_file) else print ('Quotes loaded: '..quotes_file) f:close() end return loadfile (quotes_file)() end function save_quote(msg) local to_id = tostring(msg.to.id) if msg.text:sub(11):isempty() then return "Usage: !addquote quote" end if quotes_table == nil then quotes_table = {} end if quotes_table[to_id] == nil then print ('New quote key to_id: '..to_id) quotes_table[to_id] = {} end local quotes = quotes_table[to_id] quotes[#quotes+1] = msg.text:sub(11) serialize_to_file(quotes_table, quotes_file) return "done!" end function get_quote(msg) local to_id = tostring(msg.to.id) local quotes_phrases quotes_table = read_quotes_file() quotes_phrases = quotes_table[to_id] return quotes_phrases[math.random(1,#quotes_phrases)] end function run(msg, matches) if string.match(msg.text, "!quote$") then return get_quote(msg) elseif string.match(msg.text, "!addquote (.+)$") then quotes_table = read_quotes_file() return save_quote(msg) end end return { description = "Save quote", description = "Quote plugin, you can create and retrieve random quotes", usage = { "!addquote [msg]", "!quote", }, patterns = { "^!addquote (.+)$", "^!quote$", }, run = run }
gpl-2.0
DarkstarProject/darkstar
scripts/zones/Stellar_Fulcrum/npcs/_4z3.lua
27
1030
----------------------------------- -- Area: Stellar Fulcrum -- NPC: Qe'Lov Gate ------------------------------------- require("scripts/globals/status"); ----------------------------------- function onTrade(player,npc,trade) end; function onTrigger(player,npc) player:startEvent(32003); return 1; end; function onEventUpdate(player,csid,option) -- printf("onUpdate CSID: %u",csid); -- printf("onUpdate RESULT: %u",option); end; function onEventFinish(player,csid,option) -- printf("onFinish CSID: %u",csid); -- printf("onFinish RESULT: %u",option); local pZone = player:getZoneID(); if (csid == 32003 and option == 4) then if (player:getCharVar(tostring(pZone) .. "_Fight") == 100) then player:setCharVar("BCNM_Killed",0); player:setCharVar("BCNM_Timer",0); end player:setCharVar(tostring(pZone) .. "_Runaway",1); player:delStatusEffect(dsp.effect.BATTLEFIELD); player:setCharVar(tostring(pZone) .. "_Runaway",0) end end;
gpl-3.0
arfett/packages
utils/yunbridge/files/usr/bin/pretty-wifi-info.lua
106
2067
#!/usr/bin/lua local function get_basic_net_info(network, iface, accumulator) local net = network:get_network(iface) local device = net and net:get_interface() if device then accumulator["uptime"] = net:uptime() accumulator["iface"] = device:name() accumulator["mac"] = device:mac() accumulator["rx_bytes"] = device:rx_bytes() accumulator["tx_bytes"] = device:tx_bytes() accumulator["ipaddrs"] = {} for _, ipaddr in ipairs(device:ipaddrs()) do accumulator.ipaddrs[#accumulator.ipaddrs + 1] = { addr = ipaddr:host():string(), netmask = ipaddr:mask():string() } end end end local function get_wifi_info(network, iface, accumulator) local net = network:get_wifinet(iface) if net then local dev = net:get_device() if dev then accumulator["mode"] = net:active_mode() accumulator["ssid"] = net:active_ssid() accumulator["encryption"] = net:active_encryption() accumulator["quality"] = net:signal_percent() end end end local function collect_wifi_info() local network = require"luci.model.network".init() local accumulator = {} get_basic_net_info(network, "lan", accumulator) get_wifi_info(network, "wlan0", accumulator) return accumulator end local info = collect_wifi_info() print("Current WiFi configuration") if info.ssid then print("SSID: " .. info.ssid) end if info.mode then print("Mode: " .. info.mode) end if info.quality then print("Signal: " .. info.quality .. "%") end if info.encryption then print("Encryption method: " .. info.encryption) end if info.iface then print("Interface name: " .. info.iface) end if info.uptime then print("Active for: " .. math.floor(info.uptime / 60) .. " minutes") end if #info.ipaddrs > 0 then print("IP address: " .. info.ipaddrs[1].addr .. "/" .. info.ipaddrs[1].netmask) end if info.mac then print("MAC address: " .. info.mac) end if info.rx_bytes and info.tx_bytes then print("RX/TX: " .. math.floor(info.rx_bytes / 1024) .. "/" .. math.floor(info.tx_bytes / 1024) .. " KBs") end
gpl-2.0
Fenix-XI/Fenix
scripts/globals/spells/absorb-int.lua
17
1359
-------------------------------------- -- Spell: Absorb-INT -- Steals an enemy's intelligence. -------------------------------------- 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:hasStatusEffect(EFFECT_INT_DOWN) or caster:hasStatusEffect(EFFECT_INT_BOOST)) then spell:setMsg(75); -- no effect else local dINT = caster:getStat(MOD_INT) - target:getStat(MOD_INT); local resist = applyResistance(caster,spell,target,dINT,37,0); if (resist <= 0.125) then spell:setMsg(85); else spell:setMsg(333); caster:addStatusEffect(EFFECT_INT_BOOST,ABSORB_SPELL_AMOUNT*resist*((100+(caster:getMod(MOD_AUGMENTS_ABSORB)))/100), ABSORB_SPELL_TICK, ABSORB_SPELL_AMOUNT*ABSORB_SPELL_TICK,FLAG_DISPELABLE); -- caster gains INT target:addStatusEffect(EFFECT_INT_DOWN,ABSORB_SPELL_AMOUNT*resist*((100+(caster:getMod(MOD_AUGMENTS_ABSORB)))/100), ABSORB_SPELL_TICK, ABSORB_SPELL_AMOUNT*ABSORB_SPELL_TICK,FLAG_ERASBLE); -- target loses INT end end return EFFECT_INT_DOWN; end;
gpl-3.0
Fenix-XI/Fenix
scripts/zones/Tavnazian_Safehold/npcs/Nomad_Moogle.lua
13
1050
----------------------------------- -- -- Nomad Moogle -- ----------------------------------- require("scripts/globals/settings"); package.loaded["scripts/zones/Tavnazian_Safehold/TextIDs"] = nil; require("scripts/zones/Tavnazian_Safehold/TextIDs"); ----------------------------------- -- onTrade Action ----------------------------------- function onTrade(player,npc,trade) end; ----------------------------------- -- onTrigger Action ----------------------------------- function onTrigger(player,npc) player:showText(npc,NOMAD_MOOGLE_DIALOG); player:sendMenu(1); end; ----------------------------------- -- onEventUpdate Action ----------------------------------- function onEventUpdate(player,csid,option) --print("onEventUpdate"); --printf("CSID: %u",csid); --printf("RESULT: %u",option); end; ----------------------------------- -- onEventFinish Action ----------------------------------- function onEventFinish(player,csid,option) --print("onEventFinish"); --printf("CSID: %u",csid); --printf("RESULT: %u",option); end;
gpl-3.0
8devices/carambola2-luci
applications/luci-samba/luasrc/model/cbi/samba.lua
79
2602
--[[ LuCI - Lua Configuration Interface Copyright 2008 Steven Barth <steven@midlink.org> Copyright 2008 Jo-Philipp Wich <xm@leipzig.freifunk.net> Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 $Id$ ]]-- m = Map("samba", translate("Network Shares")) s = m:section(TypedSection, "samba", "Samba") s.anonymous = true s:tab("general", translate("General Settings")) s:tab("template", translate("Edit Template")) s:taboption("general", Value, "name", translate("Hostname")) s:taboption("general", Value, "description", translate("Description")) s:taboption("general", Value, "workgroup", translate("Workgroup")) s:taboption("general", Value, "homes", translate("Share home-directories"), translate("Allow system users to reach their home directories via " .. "network shares")) tmpl = s:taboption("template", Value, "_tmpl", translate("Edit the template that is used for generating the samba configuration."), translate("This is the content of the file '/etc/samba/smb.conf.template' from which your samba configuration will be generated. " .. "Values enclosed by pipe symbols ('|') should not be changed. They get their values from the 'General Settings' tab.")) tmpl.template = "cbi/tvalue" tmpl.rows = 20 function tmpl.cfgvalue(self, section) return nixio.fs.readfile("/etc/samba/smb.conf.template") end function tmpl.write(self, section, value) value = value:gsub("\r\n?", "\n") nixio.fs.writefile("//etc/samba/smb.conf.template", value) end s = m:section(TypedSection, "sambashare", translate("Shared Directories")) s.anonymous = true s.addremove = true s.template = "cbi/tblsection" s:option(Value, "name", translate("Name")) pth = s:option(Value, "path", translate("Path")) if nixio.fs.access("/etc/config/fstab") then pth.titleref = luci.dispatcher.build_url("admin", "system", "fstab") end s:option(Value, "users", translate("Allowed users")).rmempty = true ro = s:option(Flag, "read_only", translate("Read-only")) ro.rmempty = false ro.enabled = "yes" ro.disabled = "no" go = s:option(Flag, "guest_ok", translate("Allow guests")) go.rmempty = false go.enabled = "yes" go.disabled = "no" cm = s:option(Value, "create_mask", translate("Create mask"), translate("Mask for new files")) cm.rmempty = true cm.size = 4 dm = s:option(Value, "dir_mask", translate("Directory mask"), translate("Mask for new directories")) dm.rmempty = true dm.size = 4 return m
apache-2.0
soccermitchy/mitchbot
plugins/filters.lua
1
2497
function commandEngine(usr,chan,msg) if chan:sub(1,1)=="#" then target=chan else target=usr.nick end if not users[usr.host] then users[usr.host]={ identified=false, perms={} } users[usr.host].perms[""]=true end print(string.format("[MESSAGE]\t[%s][%s]<%s> %s",os.date(),chan,usr.nick,msg)) called=false if msg:sub(1,#config.cmdchar)==config.cmdchar and (users[usr.host].ignore==false or users[usr.host].ignore==nil) then pre,cmd,rest = msg:match("^("..config.cmdchar..")([^%s]+)%s?(.*)$") -- thanks to cracker64 if not cmd then return end args=split(rest," ") print(string.format("[COMMAND]\t[%s][%s][%s]",usr.nick,cmd,rest)) if commands[cmd] then if checkPerms(commands[cmd].level,usr.host) then status,target,send=pcall(commands[cmd].func,usr,chan,msg,args) if not status then print(string.format("[ERROR]\t\t%s",split(target,"\n")[1])) if chan:sub(1,1)=="#" then sendChat(chan,split(target,"\n")[1]) else sendChat(usr.nick,split(target,"\n")[1]) end else for k,v in pairs(activePatterns) do send=send:gsub(k,v) end if target=="usr" then sendChat(usr.nick,send) elseif target=="chan" then sendChat(chan,send) end end else sendChat(target,string.format("%s, you do not have the required permissions for the command %q. You need one of the following capabilities to use this: %s",usr.nick,cmd,table.concat(commands[cmd].level," "))) end --[[else sendChat(target,string.format("%s, the command %q does not exist.",usr.nick,cmd))]] end end end filtersLocked=false activePatterns={} function patterns(usr,chan,msg,args) if chan:sub(1,1)=="#" then target=chan else target=usr.nick end if args[1]=="clear" then if not filtersLocked then activePatterns={} return target,"Filters cleared." else return target,"Filters locked." end elseif args[1]=="add" then if not filtersLocked then activePatterns[args[2]]=args[3] return target,"Filter applied." else return target,"Filters locked." end elseif args[1]=="lock" then if checkPerms({"filters"},usr.host) then filtersLocked=true return target,"filters locked" else return target,"No perms to lock filters." end elseif args[1]=="unlock" then if checkPerms({"filters"},usr.host) then filtersLocked=false return target,"filters unlocked" else return target,"No perms to unlock filters." end else return target,"syntax: filter [clear|add|lock|unlock]" end end addcommand("filter",patterns)
gpl-2.0
Fenix-XI/Fenix
scripts/zones/Den_of_Rancor/npcs/Treasure_Coffer.lua
13
3854
----------------------------------- -- Area: Den of Rancor -- NPC: Treasure Coffer -- @zone 160 -- @pos ----------------------------------- package.loaded["scripts/zones/Den_of_Rancor/TextIDs"] = nil; ----------------------------------- require("scripts/globals/settings"); require("scripts/globals/keyitems"); require("scripts/globals/treasure"); require("scripts/globals/quests"); require("scripts/zones/Den_of_Rancor/TextIDs"); local TreasureType = "Coffer"; local TreasureLvL = 53; local TreasureMinLvL = 43; ----------------------------------- -- onTrade Action ----------------------------------- function onTrade(player,npc,trade) -- trade:hasItemQty(1050,1); -- Treasure Key -- trade:hasItemQty(1115,1); -- Skeleton Key -- trade:hasItemQty(1023,1); -- Living Key -- trade:hasItemQty(1022,1); -- Thief's Tools local questItemNeeded = 0; -- Player traded a key. if ((trade:hasItemQty(1050,1) or trade:hasItemQty(1115,1) or trade:hasItemQty(1023,1) or trade:hasItemQty(1022,1)) and trade:getItemCount() == 1) then -- IMPORTANT ITEM: AF Keyitems, AF Items, & Map ----------- local zone = player:getZoneID(); if (player:hasKeyItem(MAP_OF_THE_DEN_OF_RANCOR) == false) then questItemNeeded = 1; end -------------------------------------- local pack = openChance(player,npc,trade,TreasureType,TreasureLvL,TreasureMinLvL,questItemNeeded); local success = 0; if (pack[2] ~= nil) then player:messageSpecial(pack[2]); success = pack[1]; else success = pack[1]; end if (success ~= -2) then player:tradeComplete(); if (math.random() <= success) then -- Succeded to open the coffer player:messageSpecial(CHEST_UNLOCKED); if (questItemNeeded == 1) then player:addKeyItem(MAP_OF_THE_DEN_OF_RANCOR); player:messageSpecial(KEYITEM_OBTAINED,MAP_OF_THE_DEN_OF_RANCOR); -- Map of the Den of Rancor (KI) else player:setVar("["..zone.."]".."Treasure_"..TreasureType,os.time() + math.random(CHEST_MIN_ILLUSION_TIME,CHEST_MAX_ILLUSION_TIME)); local loot = cofferLoot(zone,npc); -- print("loot array: "); -- debug -- print("[1]", loot[1]); -- debug -- print("[2]", loot[2]); -- debug if (loot[1]=="gil") then player:addGil(loot[2]*GIL_RATE); player:messageSpecial(GIL_OBTAINED,loot[2]*GIL_RATE); else -- Item player:addItem(loot[2]); player:messageSpecial(ITEM_OBTAINED,loot[2]); end end UpdateTreasureSpawnPoint(npc:getID()); else player:messageSpecial(CHEST_MIMIC); spawnMimic(zone,npc,player); UpdateTreasureSpawnPoint(npc:getID(), true); end end end end; ----------------------------------- -- onTrigger Action ----------------------------------- function onTrigger(player,npc) player:messageSpecial(CHEST_LOCKED,1050); 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
DarkstarProject/darkstar
scripts/zones/Bastok_Mines/npcs/Neigepance.lua
12
1035
----------------------------------- -- Area: Bastok Mines -- NPC: Neigepance -- Standard Merchant NPC ----------------------------------- local ID = require("scripts/zones/Bastok_Mines/IDs") require("scripts/globals/shop") function onTrade(player,npc,trade) end function onTrigger(player,npc) local stock = { 17307, 9, 1, --Dart 845, 1150, 1, --Black Chocobo Feather 4545, 62, 3, --Gysahl Greens 840, 7, 3, --Chocobo Feather 17016, 11, 3, --Pet Food Alpha Biscuit 17017, 82, 3, --Pet Food Beta Biscuit 17860, 82, 3, --Carrot Broth 17862, 695, 3, --Bug Broth 17864, 126, 3, --Herbal Broth 17866, 695, 3, --Carrion Broth 5073, 50784, 3, --Scroll of Chocobo Mazurka } player:showText(npc, ID.text.NEIGEPANCE_SHOP_DIALOG) dsp.shop.nation(player, stock, dsp.nation.BASTOK) end function onEventUpdate(player,csid,option) end function onEventFinish(player,csid,option) end
gpl-3.0
Giorox/AngelionOT-Repo
data/npc/scripts/Atrad.lua
1
2270
local keywordHandler = KeywordHandler:new() local npcHandler = NpcHandler:new(keywordHandler) NpcSystem.parseParameters(npcHandler) function onCreatureAppear(cid) npcHandler:onCreatureAppear(cid) end function onCreatureDisappear(cid) npcHandler:onCreatureDisappear(cid) end function onCreatureSay(cid, type, msg) npcHandler:onCreatureSay(cid, type, msg) end function onThink() npcHandler:onThink() end -- Storage IDs -- oassassin = 22025 fassassin = 22026 sassassin = 22027 newaddon = 'Ah, right! The assassin katana! Here you go.' noitems = 'You do not have all the required items.' noitems2 = 'You do not have all the required items or you do not have the outfit, which by the way, is a requirement for this addon.' already = 'It seems you already have this addon, don\'t you try to mock me son!' function AssassinSecond(cid, message, keywords, parameters, node) if(not npcHandler:isFocused(cid)) then return false end if isPremium(cid) then if getPlayerStorageValue(cid,sassassin) == -1 then if getPlayerItemCount(cid,5804) >= 1 and getPlayerItemCount(cid,5930) >= 1 then if doPlayerRemoveItem(cid,5804,1) and doPlayerRemoveItem(cid,5930,1) then npcHandler:say('Ah, right! The assassin katana! Here you go.') doSendMagicEffect(getCreaturePosition(cid), 13) setPlayerStorageValue(cid,sassassin,1) if getPlayerSex(cid) == 1 then doPlayerAddOutfit(cid, 152, 2) elseif getPlayerSex(cid) == 0 then doPlayerAddOutfit(cid, 156, 2) end end else selfSay(noitems2) end else selfSay(already) end end end node1 = keywordHandler:addKeyword({'addon'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'To get assassin katana you need give me 1 behemoth claw and 1 nose ring. Do you have them with you?'}) node1:addChildKeyword({'yes'}, AssassinSecond, {}) node1:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Alright then. Come back when you got all neccessary items.', reset = true}) npcHandler:addModule(FocusModule:new())
gpl-3.0
DarkstarProject/darkstar
scripts/zones/Castle_Oztroja/npcs/_47b.lua
9
1646
----------------------------------- -- Area: Castle Oztroja -- NPC: _47b (Handle) -- Notes: Opens Trap Door (_47a) or Brass Door (_470) -- !pos 22.310 -1.087 -14.320 151 ----------------------------------- local ID = require("scripts/zones/Castle_Oztroja/IDs") require("scripts/globals/missions") require("scripts/globals/status") ----------------------------------- function onTrigger(player,npc) local X = player:getXPos() local Z = player:getZPos() local trapDoor = GetNPCByID(npc:getID() - 1) local brassDoor = GetNPCByID(npc:getID() - 2) if X < 21.6 and X > 18 and Z > -15.6 and Z < -12.4 then if VanadielDayOfTheYear() % 2 == 1 then if brassDoor:getAnimation() == dsp.anim.CLOSE_DOOR and npc:getAnimation() == dsp.anim.CLOSE_DOOR then npc:openDoor(8) -- wait 1 second delay goes here brassDoor:openDoor(6) end else if trapDoor:getAnimation() == dsp.anim.CLOSE_DOOR and npc:getAnimation() == dsp.anim.CLOSE_DOOR then npc:openDoor(8) -- wait 1 second delay goes here trapDoor:openDoor(6) end if player:getCurrentMission(WINDURST) == dsp.mission.id.windurst.TO_EACH_HIS_OWN_RIGHT and player:getCharVar("MissionStatus") == 3 then player:startEvent(43) end end else player:messageSpecial(ID.text.CANNOT_REACH_TARGET) end end function onEventUpdate(player,csid,option) end function onEventFinish(player,csid,option) if csid == 43 then player:setCharVar("MissionStatus", 4) end end
gpl-3.0
Fenix-XI/Fenix
scripts/globals/abilities/angon.lua
27
1282
----------------------------------- -- Ability: Angon -- Expends an Angon to lower an enemy's defense. -- Obtained: Dragoon Level 75 -- Recast Time: 0:03:00 -- Duration: 0:00:30 (+0:00:15 for each merit, cap is 0:01:30) -- Effect: Physical defense of target approximately -20% (51/256). -- Range: 10.0 yalms -- Notes: Only fails if it can't apply the def down status. ----------------------------------- require("scripts/globals/settings"); require("scripts/globals/status"); ----------------------------------- -- onAbilityCheck ----------------------------------- function onAbilityCheck(player,target,ability) local id = player:getEquipID(SLOT_AMMO); if (id == 18259) then return 0,0; else return MSGBASIC_UNABLE_TO_USE_JA,0; end end; ----------------------------------- -- onUseAbility ----------------------------------- function onUseAbility(player,target,ability) local typeEffect = EFFECT_DEFENSE_DOWN; local duration = 15 + player:getMerit(MERIT_ANGON); -- This will return 30 sec at one investment because merit power is 15. if (target:addStatusEffect(typeEffect,20,0,duration) == false) then ability:setMsg(75); end target:updateClaim(player); player:removeAmmo(); return typeEffect; end;
gpl-3.0
Fenix-XI/Fenix
scripts/globals/spells/invisible.lua
27
1280
----------------------------------------- -- Spell: Invisible -- Lessens chance of being detected by sight. -- Duration is random number between 30 seconds and 5 minutes ----------------------------------------- require("scripts/globals/settings"); require("scripts/globals/status"); ----------------------------------------- -- OnSpellCast ----------------------------------------- function onMagicCastingCheck(caster,target,spell) return 0; end; function onSpellCast(caster,target,spell) if (target:hasStatusEffect(EFFECT_INVISIBLE) == false) then -- last 7-9 minutes local duration = math.random(420, 540); if (target:getMainLvl() < 25) then duration = duration * target:getMainLvl() / 25; -- level adjustment end if (caster:hasStatusEffect(EFFECT_COMPOSURE) == true and caster:getID() == target:getID()) then duration = duration * 3; end if (target:getEquipID(15) == 13692) then -- skulker's cape duration = duration * 1.5; end spell:setMsg(230); target:addStatusEffect(EFFECT_INVISIBLE,0,10,(math.floor(duration) * SNEAK_INVIS_DURATION_MULTIPLIER)); else spell:setMsg(75); -- no effect. end return EFFECT_INVISIBLE; end;
gpl-3.0
Fenix-XI/Fenix
scripts/globals/spells/cure_ii.lua
26
4497
----------------------------------------- -- Spell: Cure II -- Restores target's HP. -- Shamelessly stolen from http://members.shaw.ca/pizza_steve/cure/Cure_Calculator.html ----------------------------------------- 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) local divisor = 0; local constant = 0; local basepower = 0; local power = 0; local basecure = 0; local final = 0; local minCure = 60; if (USE_OLD_CURE_FORMULA == true) then power = getCurePowerOld(caster); divisor = 1; constant = 20; if (power > 170) then divisor = 35.6666; constant = 87.62; elseif (power > 110) then divisor = 2; constant = 47.5; end else power = getCurePower(caster); if (power < 70) then divisor = 1; constant = 60; basepower = 40; elseif (power < 125) then divisor = 5.5; constant = 90; basepower = 70; elseif (power < 200) then divisor = 7.5; constant = 100; basepower = 125; elseif (power < 400) then divisor = 10; constant = 110; basepower = 200; elseif (power < 700) then divisor = 20; constant = 130; basepower = 400; else divisor = 999999; constant = 145; basepower = 0; end end if (target:getAllegiance() == caster:getAllegiance() and (target:getObjType() == TYPE_PC or target:getObjType() == TYPE_MOB)) then if (USE_OLD_CURE_FORMULA == true) then basecure = getBaseCure(power,divisor,constant); else basecure = getBaseCure(power,divisor,constant,basepower); end final = getCureFinal(caster,spell,basecure,minCure,false); if (caster:hasStatusEffect(EFFECT_AFFLATUS_SOLACE) and target:hasStatusEffect(EFFECT_STONESKIN) == false) then local solaceStoneskin = 0; local equippedBody = caster:getEquipID(SLOT_BODY); if (equippedBody == 11186) then solaceStoneskin = math.floor(final * 0.30); elseif (equippedBody == 11086) then solaceStoneskin = math.floor(final * 0.35); else solaceStoneskin = math.floor(final * 0.25); end target:addStatusEffect(EFFECT_STONESKIN,solaceStoneskin,0,25); end; final = final + (final * (target:getMod(MOD_CURE_POTENCY_RCVD)/100)); --Applying server mods.... final = final * CURE_POWER; local diff = (target:getMaxHP() - target:getHP()); if (final > diff) then final = diff; end target:addHP(final); target:wakeUp(); caster:updateEnmityFromCure(target,final); else if (target:isUndead()) then spell:setMsg(2); local dmg = calculateMagicDamage(minCure,1,caster,spell,target,HEALING_MAGIC_SKILL,MOD_MND,false)*0.5; local resist = applyResistance(caster,spell,target,caster:getStat(MOD_MND)-target:getStat(MOD_MND),HEALING_MAGIC_SKILL,1.0); dmg = dmg*resist; dmg = addBonuses(caster,spell,target,dmg); dmg = adjustForTarget(target,dmg,spell:getElement()); dmg = finalMagicAdjustments(caster,target,spell,dmg); final = dmg; target:delHP(final); target:updateEnmityFromDamage(caster,final); elseif (caster:getObjType() == TYPE_PC) then spell:setMsg(75); else -- e.g. monsters healing themselves. if (USE_OLD_CURE_FORMULA == true) then basecure = getBaseCureOld(power,divisor,constant); else basecure = getBaseCure(power,divisor,constant,basepower); end final = getCureFinal(caster,spell,basecure,minCure,false); local diff = (target:getMaxHP() - target:getHP()); if (final > diff) then final = diff; end target:addHP(final); end end return final; end;
gpl-3.0
franko/gsl-shell
benchmarks/lmfit/enso-model.lua
1
1509
use 'math' local function fdf_generate(dataset) local Y = dataset.F local n = #Y return function(x, f, J) local b0 = x[1] local b1 = x[2] local b2 = x[3] local b3 = x[4] local b4 = x[5] local b5 = x[6] local b6 = x[7] local b7 = x[8] local b8 = x[9] if f then for i = 1, n do local t = i local y = b0 y = y + b1 * cos(2*pi*t/12) y = y + b2 * sin(2*pi*t/12) y = y + b4 * cos(2*pi*t/b3) y = y + b5 * sin(2*pi*t/b3) y = y + b7 * cos(2*pi*t/b6) y = y + b8 * sin(2*pi*t/b6) f[i] = Y[i] - y end end if J then for i = 1, n do local t = i J:set(i, 1, -1) J:set(i, 2, -cos(2*pi*t/12)) J:set(i, 3, -sin(2*pi*t/12)) J:set(i, 4, -b4*(2*pi*t/(b3*b3))*sin(2*pi*t/b3) + b5*(2*pi*t/(b3*b3))*cos(2*pi*t/b3)) J:set(i, 5, -cos(2*pi*t/b3)) J:set(i, 6, -sin(2*pi*t/b3)) J:set(i, 7, -b7 * (2*pi*t/(b6*b6)) * sin(2*pi*t/b6) + b8 * (2*pi*t/(b6*b6)) * cos(2*pi*t/b6)) J:set(i, 8, -cos(2*pi*t/b6)) J:set(i, 9, -sin(2*pi*t/b6)) end end end end local function eval(x, t) local y = x[1] y = y + x[2] * cos(2*pi*t/12) y = y + x[3] * sin(2*pi*t/12) y = y + x[5] * cos(2*pi*t/x[4]) y = y + x[6] * sin(2*pi*t/x[4]) y = y + x[8] * cos(2*pi*t/x[7]) y = y + x[9] * sin(2*pi*t/x[7]) return y end return function(dataset) return {fdf= fdf_generate(dataset), eval= eval} end
gpl-3.0
Fenix-XI/Fenix
scripts/globals/weaponskills/tachi_yukikaze.lua
11
1731
----------------------------------- -- Tachi Yukikaze -- Great Katana weapon skill -- Skill Level: 200 (Samurai only.) -- Blinds target. Damage varies with TP. -- Blind effect duration is 60 seconds when unresisted. -- Will stack with Sneak Attack. -- Tachi: Yukikaze appears to have an attack bonus of 50%. http://www.bg-wiki.com/bg/Tachi:_Yukikaze -- Aligned with the Snow Gorget & Breeze Gorget. -- Aligned with the Snow Belt & Breeze Belt. -- Element: None -- Modifiers: STR:75% -- 100%TP 200%TP 300%TP -- 1.5625 2.6875 4.125 ----------------------------------- require("scripts/globals/status"); require("scripts/globals/settings"); require("scripts/globals/weaponskills"); ----------------------------------- function onUseWeaponSkill(player, target, wsID, tp, primary) local params = {}; params.numHits = 1; params.ftp100 = 1.5625; params.ftp200 = 1.88; params.ftp300 = 2.5; params.str_wsc = 0.75; 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; params.crit100 = 0.0; params.crit200 = 0.0; params.crit300 = 0.0; params.canCrit = false; params.acc100 = 0.0; params.acc200= 0.0; params.acc300= 0.0; params.atkmulti = 1.33; if (USE_ADOULIN_WEAPON_SKILL_CHANGES == true) then params.ftp200 = 2.6875; params.ftp300 = 4.125; params.atkmulti = 1.5; end local damage, criticalHit, tpHits, extraHits = doPhysicalWeaponskill(player, target, wsID, params, tp, primary); if (damage > 0 and target:hasStatusEffect(EFFECT_BLINDNESS) == false) then target:addStatusEffect(EFFECT_BLINDNESS, 25, 0, 60); end return tpHits, extraHits, criticalHit, damage; end
gpl-3.0
Fenix-XI/Fenix
scripts/globals/mobskills/Drop_Hammer.lua
33
1032
--------------------------------------------- -- Drop Hammer -- -- Description: Drops the hammer. Additional effect: Bind -- Type: Physical -- Utsusemi/Blink absorb: 2-3 shadows? -- Range: Melee -- Notes: Only used by "destroyers" (carrying massive warhammers). --------------------------------------------- require("scripts/globals/settings"); require("scripts/globals/status"); require("scripts/globals/monstertpmoves"); --------------------------------------------- function onMobSkillCheck(target,mob,skill) return 0; end; function onMobWeaponSkill(target, mob, skill) local numhits = 1; local accmod = 1; local dmgmod = 2.4; local info = MobPhysicalMove(mob,target,skill,numhits,accmod,dmgmod,TP_NO_EFFECT); local dmg = MobFinalAdjustments(info.dmg,mob,skill,target,MOBSKILL_PHYSICAL,MOBPARAM_BLUNT,info.hitslanded*math.random(2,3)); local typeEffect = EFFECT_BIND; MobPhysicalStatusEffectMove(mob, target, skill, typeEffect, 1, 0, 60); target:delHP(dmg); return dmg; end;
gpl-3.0
Fenix-XI/Fenix
scripts/zones/Rolanberry_Fields/npcs/Saarlan.lua
29
8425
----------------------------------- -- Area: Rolanberry Fields -- NPC: Saarlan -- Legion NPC -- @pos 242 24.395 468 ----------------------------------- package.loaded["scripts/zones/Rolanberry_Fields/TextIDs"] = nil; ----------------------------------- require("scripts/globals/settings"); require("scripts/globals/keyitems"); require("scripts/globals/titles"); require("scripts/zones/Rolanberry_Fields/TextIDs"); ----------------------------------- -- onTrade Action ----------------------------------- function onTrade(player,npc,trade) end; ----------------------------------- -- onTrigger Action ----------------------------------- function onTrigger(player,npc) local TITLE = 0; local MAXIMUS = 0; local LP = player:getCurrency("legion_point"); local MINIMUS = 0; if (player:hasKeyItem(LEGION_TOME_PAGE_MAXIMUS)) then MAXIMUS = 1; end if (player:hasKeyItem(LEGION_TOME_PAGE_MINIMUS)) then MINIMUS = 1; end if (player:hasTitle(SUBJUGATOR_OF_THE_LOFTY)) then TITLE = TITLE+1; end if (player:hasTitle(SUBJUGATOR_OF_THE_MIRED)) then TITLE = TITLE+2; end if (player:hasTitle(SUBJUGATOR_OF_THE_SOARING)) then TITLE = TITLE+4; end if (player:hasTitle(SUBJUGATOR_OF_THE_VEILED)) then TITLE = TITLE+8; end if (player:hasTitle(LEGENDARY_LEGIONNAIRE)) then TITLE = TITLE+16; end if (player:getVar("LegionStatus") == 0) then player:startEvent(8004); elseif (player:getVar("LegionStatus") == 1) then player:startEvent(8005, 0, TITLE, MAXIMUS, LP, MINIMUS); 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 GIL = player:getGil(); local LP = player:getCurrency("legion_point"); local LP_COST = 0; local ITEM = 0; if (csid == 8004) then player:setVar("LegionStatus",1) elseif (csid == 8005) then if (option == 0x0001000A) then if (GIL >= 360000) then player:addKeyItem(LEGION_TOME_PAGE_MAXIMUS); player:delGil(360000); player:messageSpecial(KEYITEM_OBTAINED, LEGION_TOME_PAGE_MAXIMUS) else player:messageSpecial(NOT_ENOUGH_GIL); end elseif (option == 0x0001000B) then if (GIL >= 180000) then player:addKeyItem(LEGION_TOME_PAGE_MINIMUS); player:delGil(180000); player:messageSpecial(KEYITEM_OBTAINED, LEGION_TOME_PAGE_MINIMUS) else player:messageSpecial(NOT_ENOUGH_GIL); end elseif (option == 0x00000002) then -- Gaiardas Ring LP_COST = 1000; ITEM = 10775 elseif (option == 0x00010002) then -- Gaubious Ring LP_COST = 1000; ITEM = 10776; elseif (option == 0x00020002) then -- Caloussu Ring LP_COST = 1000; ITEM = 10777; elseif (option == 0x00030002) then -- Nanger Ring LP_COST = 1000; ITEM = 10778; elseif (option == 0x00040002) then -- Sophia Ring LP_COST = 1000; ITEM = 10779; elseif (option == 0x00050002) then -- Quies Ring LP_COST = 1000; ITEM = 10780; elseif (option == 0x00060002) then -- Cynosure Ring LP_COST = 1000; ITEM = 10781; elseif (option == 0x00070002) then -- Ambuscade Ring LP_COST = 1000; ITEM = 10782; elseif (option == 0x00080002) then -- Veneficium Ring LP_COST = 1000; ITEM = 10783; elseif (option == 0x00090002) then -- Calma Armet ...Requires title: "Subjugator of the Lofty" LP_COST = 4500; ITEM = 10890; elseif (option == 0x000A0002) then -- Mustela Mask ...Requires title: "Subjugator of the Lofty" LP_COST = 4500; ITEM = 10891; elseif (option == 0x000B0002) then -- Magavan Beret ...Requires title: "Subjugator of the Lofty" LP_COST = 4500; ITEM = 10892; elseif (option == 0x000C0002) then -- Calma Gauntlets ...Requires title: "Subjugator of the Mired" LP_COST = 3000; ITEM = 10512; elseif (option == 0x000D0002) then -- Mustela Gloves ...Requires title: "Subjugator of the Mired" LP_COST = 3000; ITEM = 10513; elseif (option == 0x000E0002) then -- Magavan Mitts ...Requires title: "Subjugator of the Mired" LP_COST = 3000; ITEM = 10514; elseif (option == 0x000F0002) then -- Calma Hose ...Requires title: "Subjugator of the Soaring" LP_COST = 4500; ITEM = 11980; elseif (option == 0x00100002) then -- Mustela Brais ...Requires title: "Subjugator of the Soaring" LP_COST = 4500; ITEM = 11981; elseif (option == 0x00110002) then -- Magavan Slops ...Requires title: "Subjugator of the Soaring" LP_COST = 4500; ITEM = 11982; elseif (option == 0x00120002) then -- Calma Leggings ...Requires title: "Subjugator of the Veiled" LP_COST = 3000; ITEM = 10610; elseif (option == 0x00130002) then -- Mustela Boots ...Requires title: "Subjugator of the Veiled" LP_COST = 3000; ITEM = 10611; elseif (option == 0x00140002) then -- Magavan Clogs ...Requires title: "Subjugator of the Veiled" LP_COST = 3000; ITEM = 10612; elseif (option == 0x00150002) then -- Calma Breastplate ...Requires title: "Legendary Legionnaire" LP_COST = 10000; ITEM = 10462; elseif (option == 0x00160002) then -- Mustela Harness ...Requires title: "Legendary Legionnaire" LP_COST = 10000; ITEM = 10463; elseif (option == 0x00170002) then -- Magavan Frock ...Requires title: "Legendary Legionnaire" LP_COST = 10000; ITEM = 10464; elseif (option == 0x00180002) then -- Corybant Pearl ...Requires title: "Subjugator of the Lofty" LP_COST = 3000; ITEM = 11044; elseif (option == 0x00190002) then -- Saviesa Pearl ...Requires title: "Subjugator of the Mired" LP_COST = 3000; ITEM = 11045; elseif (option == 0x001A0002) then -- Ouesk Pearl ...Requires title: "Subjugator of the Soaring" LP_COST = 3000; ITEM = 11046; elseif (option == 0x001B0002) then -- Belatz Pearl ...Requires title: "Subjugator of the Soaring" LP_COST = 3000; ITEM = 11047; elseif (option == 0x001C0002) then -- Cytherea Pearl ...Requires title: "Subjugator of the Veiled" LP_COST = 3000; ITEM = 11048; elseif (option == 0x001D0002) then -- Myrddin Pearl ...Requires title: "Subjugator of the Veiled" LP_COST = 3000; ITEM = 11049; elseif (option == 0x001E0002) then -- Puissant Pearl ...Requires title: "Subjugator of the Veiled" LP_COST = 3000; ITEM = 11050; elseif (option == 0x001F0002) then -- Dhanurveda Ring ...Requires title: "Legendary Legionnaire" LP_COST = 6000; ITEM = 10784; elseif (option == 0000200002) then -- Provocare Ring ......Requires title: "Legendary Legionnaire" LP_COST = 6000; ITEM = 10785; elseif (option == 0000210002) then -- Mediator's Ring ...Requires title: "Legendary Legionnaire" LP_COST = 6000; ITEM = 10786; end end if (LP < LP_COST) then player:messageSpecial(LACK_LEGION_POINTS); elseif (ITEM > 0) then if (player:getFreeSlotsCount() >=1) then player:delCurrency("legion_point", LP_COST); player:addItem(ITEM, 1); player:messageSpecial(ITEM_OBTAINED, ITEM); else player:messageSpecial(ITEM_CANNOT_BE_OBTAINED, ITEM); end end end;
gpl-3.0
Fenix-XI/Fenix
scripts/globals/items/dish_of_spaghetti_melanzane.lua
18
1386
----------------------------------------- -- ID: 5213 -- Item: dish_of_spaghetti_melanzane -- Food Effect: 30Min, All Races ----------------------------------------- -- Health % 25 -- Health Cap 100 -- Vitality 2 -- Store TP 4 ----------------------------------------- require("scripts/globals/status"); ----------------------------------------- -- OnItemCheck ----------------------------------------- function onItemCheck(target) local result = 0; if (target:hasStatusEffect(EFFECT_FOOD) == true or target:hasStatusEffect(EFFECT_FIELD_SUPPORT_FOOD) == true) then result = 246; end return result; end; ----------------------------------------- -- OnItemUse ----------------------------------------- function onItemUse(target) target:addStatusEffect(EFFECT_FOOD,0,0,1800,5213); end; ----------------------------------- -- onEffectGain Action ----------------------------------- function onEffectGain(target,effect) target:addMod(MOD_FOOD_HPP, 25); target:addMod(MOD_FOOD_HP_CAP, 100); target:addMod(MOD_VIT, 2); target:addMod(MOD_STORETP, 4); end; ----------------------------------------- -- onEffectLose Action ----------------------------------------- function onEffectLose(target,effect) target:delMod(MOD_FOOD_HPP, 25); target:delMod(MOD_FOOD_HP_CAP, 100); target:delMod(MOD_VIT, 2); target:delMod(MOD_STORETP, 4); end;
gpl-3.0