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
rizaumami/merbot
plugins/xkcd.lua
1
1530
do function get_last_id(msg) local res, code = https.request('http://xkcd.com/info.0.json') if code ~= 200 then send_message(msg, '<b>HTTP ERROR</b>', 'html') end local data = json:decode(res) return data.num end function get_xkcd(msg, id) local res,code = http.request('http://xkcd.com/' .. id .. '/info.0.json') if code ~= 200 then send_message(msg, '<b>HTTP ERROR</b>', 'html') end local data = json:decode(res) local link_image = data.img if link_image:sub(0,2) == '//' then link_image = msg.text:sub(3,-1) end return link_image, data.num, data.title, data.alt end function get_xkcd_random(msg) local last = get_last_id(msg) local i = math.random(1, last) return get_xkcd(msg, i) end function run(msg, matches) if matches[1] == 'xkcd' then url, num, title, alt = get_xkcd_random(msg) else url, num, title, alt = get_xkcd(msg, matches[1]) end local relevantxkcd = '<a href="' .. url .. '">' .. title .. '</a>\n\n' .. alt .. '\n\n' bot_sendMessage(get_receiver_api(msg), relevantxkcd, false, msg.id, 'html') end return { description = 'Send comic images from xkcd', usage = { '<code>!xkcd</code>', 'Send random xkcd image and title.', '', '<code>!xkcd (id)</code>', 'Send an xkcd image and title.', '<b>Example</b>: <code>!xkcd 149</code>', }, patterns = { '^!(xkcd)$', '^!xkcd (%d+)', }, run = run } end
gpl-2.0
hooksta4/darkstar
scripts/globals/abilities/pets/burning_strike.lua
25
1274
--------------------------------------------------- -- Burning Strike M = 6? --------------------------------------------------- require("scripts/globals/settings"); require("scripts/globals/status"); require("scripts/globals/summon"); require("scripts/globals/magic"); require("scripts/globals/monstertpmoves"); --------------------------------------------------- function onAbilityCheck(player, target, ability) return 0,0; end; function onPetAbility(target, pet, skill) local numhits = 1; local accmod = 1; local dmgmod = 6; local totaldamage = 0; local damage = AvatarPhysicalMove(pet,target,skill,numhits,accmod,dmgmod,0,TP_NO_EFFECT,1,2,3); --get resist multiplier (1x if no resist) local resist = applyPlayerResistance(pet,-1,target,pet:getStat(MOD_INT)-target:getStat(MOD_INT),ELEMENTAL_MAGIC_SKILL, ELE_FIRE); --get the resisted damage damage.dmg = damage.dmg*resist; --add on bonuses (staff/day/weather/jas/mab/etc all go in this function) damage.dmg = mobAddBonuses(pet,spell,target,damage.dmg,1); totaldamage = AvatarFinalAdjustments(damage.dmg,pet,skill,target,MOBSKILL_PHYSICAL,MOBPARAM_SLASH,numhits); target:delHP(totaldamage); target:updateEnmityFromDamage(pet,totaldamage); return totaldamage; end
gpl-3.0
RockySeven3161/Tgcli
plugins/anti-flood.lua
281
2422
local NUM_MSG_MAX = 5 -- Max number of messages per TIME_CHECK seconds local TIME_CHECK = 5 local function kick_user(user_id, chat_id) local chat = 'chat#id'..chat_id local user = 'user#id'..user_id chat_del_user(chat, user, function (data, success, result) if success ~= 1 then local text = 'I can\'t kick '..data.user..' but should be kicked' send_msg(data.chat, '', ok_cb, nil) end end, {chat=chat, user=user}) end local function run (msg, matches) if msg.to.type ~= 'chat' then return 'Anti-flood works only on channels' else local chat = msg.to.id local hash = 'anti-flood:enabled:'..chat if matches[1] == 'enable' then redis:set(hash, true) return 'Anti-flood enabled on chat' end if matches[1] == 'disable' then redis:del(hash) return 'Anti-flood disabled on chat' end end end local function pre_process (msg) -- Ignore service msg if msg.service then print('Service message') return msg end local hash_enable = 'anti-flood:enabled:'..msg.to.id local enabled = redis:get(hash_enable) if enabled then print('anti-flood enabled') -- Check flood if msg.from.type == 'user' then -- Increase the number of messages from the user on the chat local hash = 'anti-flood:'..msg.from.id..':'..msg.to.id..':msg-num' local msgs = tonumber(redis:get(hash) or 0) if msgs > NUM_MSG_MAX then local receiver = get_receiver(msg) local user = msg.from.id local text = 'User '..user..' is flooding' local chat = msg.to.id send_msg(receiver, text, ok_cb, nil) if msg.to.type ~= 'chat' then print("Flood in not a chat group!") elseif user == tostring(our_id) then print('I won\'t kick myself') elseif is_sudo(msg) then print('I won\'t kick an admin!') else -- Ban user -- TODO: Check on this plugin bans local bhash = 'banned:'..msg.to.id..':'..msg.from.id redis:set(bhash, true) kick_user(user, chat) end msg = nil end redis:setex(hash, TIME_CHECK, msgs+1) end end return msg end return { description = 'Plugin to kick flooders from group.', usage = {}, patterns = { '^!antiflood (enable)$', '^!antiflood (disable)$' }, run = run, privileged = true, pre_process = pre_process }
gpl-2.0
gedadsbranch/Darkstar-Mission
scripts/zones/Quicksand_Caves/npcs/_5s0.lua
19
1270
----------------------------------- -- Area: Quicksand Caves -- NPC: Ornate Door -- Door blocked by Weight system -- @pos -21 0 -60 208 ----------------------------------- package.loaded["scripts/zones/Quicksand_Caves/TextIDs"] = nil; ----------------------------------- require("scripts/zones/Quicksand_Caves/TextIDs"); ----------------------------------- -- onTrade Action ----------------------------------- function onTrade(player,npc,trade) end; ----------------------------------- -- onTrigger Action ----------------------------------- function onTrigger(player,npc) local difX = player:getXPos()-(-30); local difZ = player:getZPos()-(-60); local Distance = math.sqrt( math.pow(difX,2) + math.pow(difZ,2) ); if(Distance < 3) then return -1; end player:messageSpecial(DOOR_FIRMLY_SHUT); return 1; end; ----------------------------------- -- onEventUpdate ----------------------------------- function onEventUpdate(player,csid,option) --printf("CSID: %u",csid); --printf("RESULT: %u",option); end; ----------------------------------- -- onEventFinish ----------------------------------- function onEventFinish(player,csid,option) --printf("CSID: %u",csid); --printf("RESULT: %u",option); end;
gpl-3.0
hooksta4/darkstar
scripts/zones/Cloister_of_Flames/npcs/Fire_Protocrystal.lua
19
1804
----------------------------------- -- Area: Cloister of Flames -- NPC: Fire Protocrystal -- Involved in Quests: Trial by Fire, Trial Size Trial by Fire -- @pos -721 0 -598 207 ----------------------------------- package.loaded["scripts/zones/Cloister_of_Flames/TextIDs"] = nil; ----------------------------------- require("scripts/globals/keyitems"); require("scripts/globals/bcnm"); require("scripts/zones/Cloister_of_Flames/TextIDs"); ----------------------------------- -- onTrade Action ----------------------------------- function onTrade(player,npc,trade) if (TradeBCNM(player,player:getZoneID(),trade,npc)) then return; end end; ----------------------------------- -- onTrigger Action ----------------------------------- function onTrigger(player,npc) if (player:getCurrentMission(ASA) == SUGAR_COATED_DIRECTIVE and player:getVar("ASA4_Scarlet") == 1) then player:startEvent(0x0002); elseif (EventTriggerBCNM(player,npc)) then return; else player:messageSpecial(PROTOCRYSTAL); end end; ----------------------------------- -- onEventUpdate ----------------------------------- function onEventUpdate(player,csid,option) --printf("onUpdate CSID: %u",csid); --printf("onUpdate RESULT: %u",option); if (EventUpdateBCNM(player,csid,option)) then return; end end; ----------------------------------- -- onEventFinish ----------------------------------- function onEventFinish(player,csid,option) --printf("onFinish CSID: %u",csid); --printf("onFinish RESULT: %u",option); if (csid==0x0002) then player:delKeyItem(DOMINAS_SCARLET_SEAL); player:addKeyItem(SCARLET_COUNTERSEAL); player:messageSpecial(KEYITEM_OBTAINED,SCARLET_COUNTERSEAL); player:setVar("ASA4_Scarlet","2"); elseif (EventFinishBCNM(player,csid,option)) then return; end end;
gpl-3.0
gedadsbranch/Darkstar-Mission
scripts/globals/spells/dark_carol.lua
13
1501
----------------------------------------- -- Spell: Dark Carol -- Increases dark resistance for party members within the area of effect. ----------------------------------------- require("scripts/globals/status"); require("scripts/globals/magic"); ----------------------------------------- -- OnSpellCast ----------------------------------------- function onMagicCastingCheck(caster,target,spell) return 0; end; function onSpellCast(caster,target,spell) local sLvl = caster:getSkillLevel(SKILL_SNG); -- Gets skill level of Singing local iLvl = caster:getWeaponSkillLevel(SLOT_RANGED); local power = 20; if (sLvl+iLvl > 200) then power = power + math.floor((sLvl+iLvl-200) / 10); end if(power >= 40) then power = 40; end local iBoost = caster:getMod(MOD_CAROL_EFFECT) + caster:getMod(MOD_ALL_SONGS_EFFECT); power = power + iBoost*5; if (caster:hasStatusEffect(EFFECT_SOUL_VOICE)) then power = power * 2; elseif (caster:hasStatusEffect(EFFECT_MARCATO)) then power = power * 1.5; end caster:delStatusEffect(EFFECT_MARCATO); local duration = 120; duration = duration * ((iBoost * 0.1) + (caster:getMod(MOD_SONG_DURATION_BONUS)/100) + 1); if (caster:hasStatusEffect(EFFECT_TROUBADOUR)) then duration = duration * 2; end if not (target:addBardSong(caster,EFFECT_CAROL,power,0,duration,caster:getID(), ELE_DARK, 1)) then spell:setMsg(75); end return EFFECT_CAROL; end;
gpl-3.0
gedadsbranch/Darkstar-Mission
scripts/zones/Cloister_of_Gales/mobs/Ogmios.lua
12
1272
----------------------------------- -- Area: Cloister of Gales -- NPC: Ogmios -- Involved in Quest: Carbuncle Debacle ----------------------------------- require("scripts/globals/settings"); require("scripts/globals/keyitems"); ----------------------------------- -- OnMobSpawn Action ----------------------------------- function onMobSpawn(mob) end; ----------------------------------- -- OnMobDeath Action ----------------------------------- function onMobDeath(mob,killer) killer:setVar("BCNM_Killed",1); record = 300; partyMembers = 6; pZone = killer:getZoneID(); killer:startEvent(0x7d01,0,record,0,(os.time() - killer:getVar("BCNM_Timer")),partyMembers,0,0); end; ----------------------------------- -- onEventUpdate ----------------------------------- function onEventUpdate(player,csid,option) --printf("onUpdate CSID: %u",csid); --printf("onUpdate RESULT: %u",option); if(csid == 0x7d01) then player:delStatusEffect(EFFECT_BATTLEFIELD); end end; ----------------------------------- -- onEventFinish ----------------------------------- function onEventFinish(player,csid,option) --printf("onFinish CSID: %u",csid); --printf("onFinish RESULT: %u",option); if(csid == 0x7d01) then player:delKeyItem(DAZEBREAKER_CHARM); end end;
gpl-3.0
hooksta4/darkstar
scripts/globals/abilities/maguss_roll.lua
9
2794
----------------------------------- -- Ability: Magus's Roll -- Enhances magic defense for party members within area of effect -- Optimal Job: Blue Mage -- Lucky Number: 2 -- Unlucky Number: 6 -- Level: 17 -- -- Die Roll |No BLU |With BLU ----------- ------- ----------- -- 1 |+5 |+13 -- 2 |+20 |+28 -- 3 |+6 |+14 -- 4 |+8 |+16 -- 5 |+9 |+17 -- 6 |+3 |+11 -- 7 |+10 |+18 -- 8 |+13 |+21 -- 9 |+14 |+22 -- 10 |+15 |+23 -- 11 |+25 |+33 -- Bust |-5 |-5 ----------------------------------- require("scripts/globals/settings"); require("scripts/globals/status"); ----------------------------------- -- onAbilityCheck ----------------------------------- function onAbilityCheck(player,target,ability) local effectID = getCorsairRollEffect(ability:getID()); ability:setRange(ability:getRange() + player:getMod(MOD_ROLL_RANGE)); if (player:hasStatusEffect(effectID) or player:hasBustEffect(effectID)) then return MSGBASIC_ROLL_ALREADY_ACTIVE,0; else player:setLocalVar("BLU_roll_bonus", 0); return 0,0; end end; ----------------------------------- -- onUseAbilityRoll ----------------------------------- function onUseAbilityRoll(caster,target,ability,total) local duration = 300 + caster:getMerit(MERIT_WINNING_STREAK) local effectpowers = {5, 20, 6, 8, 9, 3, 10, 13, 14, 15, 25, 5} local effectpower = effectpowers[total] local jobBonus = caster:getLocalVar("BLU_roll_bonus"); if (total < 12) then -- see chaos_roll.lua for comments if (jobBonus == 0) then if (caster:hasPartyJob(JOB_BLU) or math.random(0, 99) < caster:getMod(MOD_JOB_BONUS_CHANCE)) then jobBonus = 1; else jobBonus = 2; end end if (jobBonus == 1) then effectpower = effectpower + 8; end if (target:getID() == caster:getID()) then caster:setLocalVar("BLU_roll_bonus", jobBonus); end end if (caster:getMainJob() == JOB_COR and caster:getMainLvl() < target:getMainLvl()) then effectpower = effectpower * (caster:getMainLvl() / target:getMainLvl()); elseif (caster:getSubJob() == JOB_COR and caster:getSubLvl() < target:getMainLvl()) then effectpower = effectpower * (caster:getSubLvl() / target:getMainLvl()); end if (target:addCorsairRoll(caster:getMainJob(), caster:getMerit(MERIT_BUST_DURATION), EFFECT_MAGUSS_ROLL, effectpower, 0, duration, caster:getID(), total, MOD_MDEF) == false) then ability:setMsg(423); end end;
gpl-3.0
gedadsbranch/Darkstar-Mission
scripts/zones/Gustav_Tunnel/npcs/Grounds_Tome.lua
34
1136
----------------------------------- -- Area: Gustav Tunnel -- NPC: Grounds Tome ----------------------------------- require("scripts/globals/settings"); require("scripts/globals/groundsofvalor"); ----------------------------------- -- onTrade Action ----------------------------------- function onTrade(player,npc,trade) end; ----------------------------------- -- onTrigger Action ----------------------------------- function onTrigger(player,npc) startGov(GOV_EVENT_GUSTAV_TUNNEL,player); end; ----------------------------------- -- onEventSelection ----------------------------------- function onEventUpdate(player,csid,option) -- printf("CSID: %u",csid); -- printf("RESULT: %u",option); updateGov(player,csid,option,763,764,765,766,767,768,769,770,0,0); end; ----------------------------------- -- onEventFinish Action ----------------------------------- function onEventFinish(player,csid,option) -- printf("CSID: %u",csid); -- printf("RESULT: %u",option); finishGov(player,csid,option,763,764,765,766,767,768,769,770,0,0,GOV_MSG_GUSTAV_TUNNEL); end;
gpl-3.0
Erotix8210/FrozenCore
src/scripts/lua/LuaBridge/Stable Scripts/Azeroth/Karazhan/BOSS_Karazhan_Kilrek.lua
30
1152
function Kilrek_Broken_Pact(Unit, event, miscunit, misc) if Unit:GetHealthPct() < 2 and Didthat == 0 then Unit:FullCastSpellOnTarget(30065,Unit:GetUnitBySqlId(15688)) Unit:SendChatMessage(11, 0, "You let me down Terestian, you will pay for this...") Didthat = 1 else end end function Kilrek_FireBolt(Unit, event, miscunit, misc) print "Kilrek FireBolt" Unit:FullCastSpellOnTarget(15592,Unit:GetClosestPlayer()) Unit:SendChatMessage(11, 0, "Take that...") end function Kilrek_Summon_Imps(Unit, event, miscunit, misc) print "Kilrek Summon Imps" Unit:FullCastSpell(34237) Unit:SendChatMessage(11, 0, "Help me...") end function Kilrek_Amplify_Flames(Unit, event, miscunit, misc) print "Kilrek Amplify Flames" Unit:FullCastSpellOnTarget(30053,Unit:GetClosestPlayer()) Unit:SendChatMessage(11, 0, "Take fire will hurt you more...") end function Kilrek(unit, event, miscunit, misc) print "Kilrek" unit:RegisterEvent("Kilrek_Broken_Pact",1000,1) unit:RegisterEvent("Kilrek_FireBolt",8000,0) unit:RegisterEvent("Kilrek_Summon_Imps",30000,0) unit:RegisterEvent("Kilrek_Amplify_Flames",45000,0) end RegisterUnitEvent(17229,1,"Kilrek")
agpl-3.0
p5n/notion
contrib/statusbar/statusbar_external.lua
3
7016
-- Authors: Antti Vähäkotamäki -- License: LGPL, version 2.1 or later -- Last Changed: 2005 -- -- statusbar_external.lua -- if not statusbar_external then statusbar_external = { -- a simple example which shows utc time and date -- in %udate every second with 'date -u' { template_key = 'dateb', external_program = 'date', execute_delay = 1 * 1000, }, { template_key = 'udate', external_program = 'date -u', execute_delay = 5 * 1000, }, -- a more complicated example showing the usage -- percentage of hda1 every 30 seconds in %hda1u -- with df, grep and sed. { template_key = 'hda1u', external_program = 'df|grep hda1|sed "s/.*\\(..%\\).*/\\1/"', execute_delay = 30 * 1000, meter_length = 4, hint_regexp = { important = '9[456].', critical = { '9[789].', '1...', }, }, }, } end -- -- -- What is this? -- -- This is a simple "general" statusbar lua script which -- lets you show output of external programs in ion -- statusbar. This is convenient if you are not familiar -- with lua but can handle yourself with some other -- language enough to output what you would want the -- statusbar to show. -- -- -- -- How to use it? -- -- Short version: -- -- 1 ) modify settings variable -- 2 ) update template to include specified keys -- 3 ) dopath( "statusbar_external" ) in cfg_user.lua -- -- -- Longer version: -- -- There is an example settings-variable which can be -- modified to specify your own programs. The needed -- parameters are the following : -- -- * template_key -- An unique name for the meter. You must add this -- name with preceding % (for example %meter_name) -- into your statusbar template which is usually set -- in cfg_statusbar.lua. -- -- * external_program -- The program to execute. The last line of each -- flushed output this program writes to stdout is -- inserted as the content of the meter. -- -- * execute_delay -- The delay to wait before running the program again -- once it stops sending data. Some programs just -- send the data and exit while others continue -- sending data periodically. This value can be used -- to control the update rate for the first type of -- programs. -- -- * meter_length (optional) -- The space reserved for this meter in characters. -- If the value is not specified or is less than 1 -- then the space is determined by the length of the -- data being shown but some people do not want their -- statusbar width to change randomly. -- -- * hint_regexp (optional) -- These regular expressions (in Lua syntax) are -- matched with the data and in case of a match the -- named hint is set to the meter. The value can be -- either a string containing the regexp or a table -- containing several possible regexps (Lua regexp -- doesn't have an 'or'). By default the themes define -- a color for 'important' and 'critical' hints. -- -- After this script is loaded it starts executing all -- the provided programs and updates the statusbar every -- time one of them prints (and flushes) something. -- -- Also this is not a normal statusd script so it -- doesn't get loaded by template name automatically -- when ion starts. You must add -- -- dopath( "statusbar_external" ) -- -- to some script that is being loaded in Ion. For -- example ~/.ion3/cfg_user.lua is a good place. Note -- that cfg_statusbar.lua is not loaded inside the -- Ion process but in a separate process and thus this -- script can not be loaded from that file! -- -- --------------------------------------------------------- local timers = {} local callbacks = {} -- Just print out stderr for now. local function flush_stderr(partial_data) local result = "" while partial_data do result = result .. partial_data -- Yield until we get more input. popen_bgread will call resume on us. partial_data = coroutine.yield() end print(result, "\n") end -- Execute a program. This will continuously retrieve output from the program. function start_execute(key) -- Read output from the program and (if data) then update the statusbar local handle_output_changes = coroutine.create( function(input_data) local key = input_data local data = "" local partial_data = "" -- Keep reading data until we have it all while partial_data do data = data .. partial_data -- Yield until we get more input. -- popen_bgread will call resume on us. partial_data = coroutine.yield() end -- If no updates, then just schedule another run if not data or data == "" then return timers[key]:set(statusbar_external[key].execute_delay, callbacks[key]) end -- remove all but the last line data = string.gsub( data, "\n$", "" ) data = string.gsub( data, ".*\n", "" ); local sets = statusbar_external[key] local t_key = sets.template_key local t_length = sets.meter_length local h_regexp = sets.hint_regexp if not tlength or t_length < 1 then t_length = string.len( data ) end mod_statusbar.inform( t_key, data ) mod_statusbar.inform( t_key .. "_hint", '' ) mod_statusbar.inform(t_key .. "_template", string.rep( ' ', t_length)) if not h_regexp then h_regexp = {} end for hint, re in pairs( h_regexp ) do if ( type( re ) == 'string' ) then re = { re } end for _, r in ipairs( re ) do if ( string.find( data, r ) ) then mod_statusbar.inform(t_key .. "_hint", hint) end end end mod_statusbar.update() return timers[key]:set(statusbar_external[key].execute_delay, callbacks[key]) end ) -- We need to pass it the key before calling a background call. coroutine.resume(handle_output_changes, key) ioncore.popen_bgread(statusbar_external[key].external_program, function(cor) coroutine.resume(handle_output_changes, cor) end, coroutine.wrap(flush_stderr)) end -- Start all for key in pairs(statusbar_external) do timers[key] = ioncore.create_timer() callbacks[key] = loadstring("start_execute("..key..")") start_execute(key) end -- -- Copyright (c) Antti Vähäkotamäki 2005. -- -- Ion is free software; you can redistribute it and/or modify it under -- the terms of the GNU Lesser General Public License as published by -- the Free Software Foundation; either version 2.1 of the License, or -- (at your option) any later version. --
lgpl-2.1
hooksta4/darkstar
scripts/globals/items/dish_of_spag_nero_di_seppia_+1.lua
35
1798
----------------------------------------- -- ID: 5202 -- Item: dish_of_spag_nero_di_seppia_+1 -- Food Effect: 30Min, All Races ----------------------------------------- -- HP % 17 (cap 140) -- Dexterity 3 -- Vitality 2 -- Agility -1 -- Mind -2 -- Charisma -1 -- Double Attack 1 -- Store TP 6 ----------------------------------------- require("scripts/globals/status"); ----------------------------------------- -- OnItemCheck ----------------------------------------- function onItemCheck(target) local result = 0; if (target:hasStatusEffect(EFFECT_FOOD) == true or target:hasStatusEffect(EFFECT_FIELD_SUPPORT_FOOD) == true) then result = 246; end return result; end; ----------------------------------------- -- OnItemUse ----------------------------------------- function onItemUse(target) target:addStatusEffect(EFFECT_FOOD,0,0,3600,5202); end; ----------------------------------------- -- onEffectGain Action ----------------------------------------- function onEffectGain(target,effect) target:addMod(MOD_FOOD_HPP, 17); target:addMod(MOD_FOOD_HP_CAP, 140); target:addMod(MOD_DEX, 3); target:addMod(MOD_VIT, 2); target:addMod(MOD_AGI, -1); target:addMod(MOD_MND, -2); target:addMod(MOD_CHR, -1); target:addMod(MOD_DOUBLE_ATTACK, 1); target:addMod(MOD_STORETP, 6); end; ----------------------------------------- -- onEffectLose Action ----------------------------------------- function onEffectLose(target,effect) target:delMod(MOD_FOOD_HPP, 17); target:delMod(MOD_FOOD_HP_CAP, 140); target:delMod(MOD_DEX, 3); target:delMod(MOD_VIT, 2); target:delMod(MOD_AGI, -1); target:delMod(MOD_MND, -2); target:delMod(MOD_CHR, -1); target:delMod(MOD_DOUBLE_ATTACK, 1); target:delMod(MOD_STORETP, 6); end;
gpl-3.0
gedadsbranch/Darkstar-Mission
scripts/globals/items/strip_of_bison_jerky.lua
35
1398
----------------------------------------- -- ID: 5207 -- Item: strip_of_bison_jerky -- Food Effect: 60Min, All Races ----------------------------------------- -- Strength 5 -- Mind -2 -- Attack % 18 -- Attack Cap 70 ----------------------------------------- require("scripts/globals/status"); ----------------------------------------- -- OnItemCheck ----------------------------------------- function onItemCheck(target) local result = 0; if (target:hasStatusEffect(EFFECT_FOOD) == true or target:hasStatusEffect(EFFECT_FIELD_SUPPORT_FOOD) == true) then result = 246; end return result; end; ----------------------------------------- -- OnItemUse ----------------------------------------- function onItemUse(target) target:addStatusEffect(EFFECT_FOOD,0,0,3600,5207); end; ----------------------------------------- -- onEffectGain Action ----------------------------------------- function onEffectGain(target,effect) target:addMod(MOD_STR, 5); target:addMod(MOD_MND, -2); target:addMod(MOD_FOOD_ATTP, 18); target:addMod(MOD_FOOD_ATT_CAP, 70); end; ----------------------------------------- -- onEffectLose Action ----------------------------------------- function onEffectLose(target,effect) target:delMod(MOD_STR, 5); target:delMod(MOD_MND, -2); target:delMod(MOD_FOOD_ATTP, 18); target:delMod(MOD_FOOD_ATT_CAP, 70); end;
gpl-3.0
gedadsbranch/Darkstar-Mission
scripts/zones/Castle_Oztroja/npcs/_47j.lua
13
1569
----------------------------------- -- Area: Castle Oztroja -- NPC: _47j (Torch Stand) -- Notes: Opens door _472 near password #1 -- @pos -62.533 -1.859 -30.634 151 ----------------------------------- package.loaded["scripts/zones/Castle_Oztroja/TextIDs"] = nil; ----------------------------------- require("scripts/zones/Castle_Oztroja/TextIDs"); require("scripts/globals/settings"); ----------------------------------- -- onTrigger Action ----------------------------------- function onTrigger(player,npc) local DoorID = npc:getID() - 4; local DoorA = GetNPCByID(DoorID):getAnimation(); local TorchStandA = npc:getAnimation(); local Torch2 = npc:getID(); local Torch1 = npc:getID() - 1; if(DoorA == 9 and TorchStandA == 9) then player:startEvent(0x000a); end end; ----------------------------------- -- onEventUpdate ----------------------------------- function onEventUpdate(player,csid,option) --printf("CSID: %u",csid); --printf("RESULT: %u",option); end; ----------------------------------- -- onEventFinish Action ----------------------------------- function onEventFinish(player,csid,option) local Torch2 = GetNPCByID(17396169):getID(); local Torch1 = GetNPCByID(Torch2):getID() - 1; local DoorID = GetNPCByID(Torch2):getID() - 4; if (option == 1) then GetNPCByID(Torch1):openDoor(10); -- Torch Lighting GetNPCByID(Torch2):openDoor(10); -- Torch Lighting GetNPCByID(DoorID):openDoor(6); end end; --printf("CSID: %u",csid); --printf("RESULT: %u",option);
gpl-3.0
hooksta4/darkstar
scripts/globals/mobskills/Heavy_Stomp.lua
25
1078
--------------------------------------------- -- Heavy Stomp -- -- Description: Deals heavy damage to targets within an area of effect. Additional effect: Paralysis -- Type: Physical -- Utsusemi/Blink absorb: 2-3 shadows -- Range: Unknown radial -- Notes: Paralysis effect has a very long duration. --------------------------------------------- require("scripts/globals/settings"); require("scripts/globals/status"); require("scripts/globals/monstertpmoves"); --------------------------------------------- function onMobSkillCheck(target,mob,skill) return 0; end; function onMobWeaponSkill(target, mob, skill) local numhits = math.random(2,3); local accmod = 1; local dmgmod = .7; local info = MobPhysicalMove(mob,target,skill,numhits,accmod,dmgmod,TP_NO_EFFECT); local dmg = MobFinalAdjustments(info.dmg,mob,skill,target,MOBSKILL_PHYSICAL,MOBPARAM_BLUNT,info.hitslanded); local typeEffect = EFFECT_PARALYSIS; MobPhysicalStatusEffectMove(mob, target, skill, typeEffect, 15, 0, 360); target:delHP(dmg); return dmg; end;
gpl-3.0
hooksta4/darkstar
scripts/zones/The_Garden_of_RuHmet/npcs/HomePoint#1.lua
17
1203
----------------------------------- -- Area: The_Garden_of_RuHmet -- NPC: HomePoint#1 -- @pos ----------------------------------- package.loaded["scripts/zones/The_Garden_of_RuHmet/TextIDs"] = nil; require("scripts/globals/settings"); require("scripts/zones/The_Garden_of_RuHmet/TextIDs"); require("scripts/globals/homepoint"); ----------------------------------- -- onTrade Action ----------------------------------- function onTrade(player,npc,trade) end; ----------------------------------- -- onTrigger Action ----------------------------------- function onTrigger(player,npc) homepointMenu( player, 0x21fc, 89); 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
FishFilletsNG/fillets-data
script/pyramid/dialogs_it.lua
1
1421
dialogId("pyr-m-kam", "font_small", "Where are we now?") dialogStr("E ora dove siamo?") dialogId("pyr-v-vsim", "font_big", "The Pyramids... Notice how the classical motifs mix in this city.") dialogStr("Le Piramidi... Osserva come i motivi classici si mescolino in questa città.") dialogId("pyr-m-plaz", "font_small", "What is that crawling around over there?") dialogStr("Cos'è quel coso strisciante là?") dialogId("pyr-v-druha", "font_big", "You can’t see it from here. It’s on the other side of wall.") dialogStr("Ma se non puoi vederlo da qui! È dall'altra parte del muro.") dialogId("pyr-m-nudi", "font_small", "Look, the woman is bored!") dialogStr("Guarda, la signora è annoiata!") dialogId("pyr-v-sark", "font_big", "Do you think that this is taking us too long?") dialogStr("Pensi che ci stiamo mettendo troppo?") dialogId("pyr-m-comy", "font_small", "What should we say?") dialogStr("Cosa dovremmo dire?") dialogId("pyr-m-nic", "font_small", "You don’t have to carry anything.") dialogStr("Lei non deve portare niente.") dialogId("pyr-v-sfing", "font_big", "Don’t be afraid.") dialogStr("Non essere dispiaciuta.") dialogId("pyr-m-dest", "font_small", "What is it written on these tablets?") dialogStr("Che c'è scritto su queste tavolette?") dialogId("pyr-v-sbohem", "font_big", "So long and thanks for all the fish.") dialogStr("Così e così, e grazie per tutto il pesce.")
gpl-2.0
hooksta4/darkstar
scripts/globals/spells/dokumori_ichi.lua
18
1202
----------------------------------------- -- Spell: Dokumori: Ichi ----------------------------------------- require("scripts/globals/status"); require("scripts/globals/magic"); ----------------------------------------- -- OnSpellCast ----------------------------------------- function onMagicCastingCheck(caster,target,spell) return 0; end; function onSpellCast(caster,target,spell) local effect = EFFECT_POISON; -- Base Stats local dINT = (caster:getStat(MOD_INT) - target:getStat(MOD_INT)); --Duration Calculation local duration = 60 * applyResistance(caster,spell,target,dINT,NINJUTSU_SKILL,0); local power = 3; --Calculates resist chanve from Reist Blind if (target:hasStatusEffect(effect)) then spell:setMsg(75); -- no effect return effect; end if (math.random(0,100) >= target:getMod(MOD_POISONRES)) then if (duration >= 30) then if (target:addStatusEffect(effect,power,3,duration)) then spell:setMsg(236); else spell:setMsg(75); end else spell:setMsg(85); end else spell:setMsg(284); end return effect; end;
gpl-3.0
gedadsbranch/Darkstar-Mission
scripts/globals/mobskills/Cross_Reaver.lua
6
1033
--------------------------------------------- -- Cross Reaver -- -- Description: Deals high damage to players in a fan-shaped area. Additional effect: Stun -- Type: Physical -- ? ? ? (No data offered) -- Range: Melee -- Special weaponskill unique to Ark Angel HM. Deals ~500-900 damage. --------------------------------------------- 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) -- TODO: Can skillchain? Unknown property. local numhits = 2; local accmod = 1; local dmgmod = 4; local info = MobPhysicalMove(mob,target,skill,numhits,accmod,dmgmod,TP_NO_EFFECT); local dmg = MobFinalAdjustments(info.dmg,mob,skill,target,MOBSKILL_PHYSICAL,MOBPARAM_SLASH,MOBPARAM_2_SHADOW); MobPhysicalStatusEffectMove(mob, target, skill, EFFECT_STUN, 1, 0, 4); target:delHP(dmg); return dmg; end;
gpl-3.0
RAlexis/ArcEmu_MoP
src/scripts/lua/LuaBridge/0Misc/0LCF_Includes/LCF_Gameobject.lua
13
4327
--[[ * ArcEmu MMORPG Server * Copyright (C) 2005-2007 Ascent Team <http://www.ascentemu.com/> * Copyright (C) 2008-2010 <http://www.ArcEmu.org/> * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License as published by * the Free Software Foundation, either version 3 of the License, or * any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. *]] assert( include("LCF.lua") ) local GAMEOBJECT = LCF.GOMethods assert(GAMEOBJECT) local function alias(LHAname, LBname) GAMEOBJECT[LHAname] = function(self, ...) return self[LBname](self, ...); end end function GAMEOBJECT:SetUnclickable() self:SetUInt32Value(LCF.GAMEOBJECT_FLAGS,0x1) end function GAMEOBJECT:SetClickable() self:SetUInt32Value(LCF.GAMEOBJECT_FLAGS,0x0) end function GAMEOBJECT:IsUnclickable() local flags = self:SetUInt32Value(LCF.GAMEOBJECT_FLAGS,0x1) if(bit_and(flags,0x1) ) then return true end return false end function GAMEOBJECT:IsClickable() local flags = self:SetUInt32Value(LCF.GAMEOBJECT_FLAGS,0x1) if(bit_and(flags,0x1) == 0 or bit_and(flags, 0x2) ~= 0) then return true end return false end --[[function GAMEOBJECT:Respawn() self:SetPosition(self:GetX(),self:GetY(),self:GetZ(),self:GetO()) end]] function GAMEOBJECT:Close() self:SetByte(LCF.GAMEOBJECT_BYTES_1,0,1) end function GAMEOBJECT:IsOpen() return (self:GetByte(LCF.GAMEOBJECT_BYTES_1,0) == 0) end function GAMEOBJECT:IsClosed() return (self:GetByte(LCF.GAMEOBJECT_BYTES_1,0) == 1) end function GAMEOBJECT:Open() self:SetByte(LCF.GAMEOBJECT_BYTES_1,0,0) end function GAMEOBJECT:RegisterAIUpdateEvent( interval) self:GetScript():RegisterAIUpdateEvent(interval) end function GAMEOBJECT:ModifyAIUpdateEvent( nInterval) self:GetScript():ModifyAIUpdateEvent(nInterval) end function GAMEOBJECT:RemoveAIUpdateEvent() self:GetScript():RemoveAIUpdateEvent() end function GAMEOBJECT:GetName() return self:GetInfo().Name end function GAMEOBJECT:Type() return self:GetInfo().Type end function GAMEOBJECT:Activate() if (self:IsOpen()) then self:Close(); else self:Open(); end end function GAMEOBJECT:ChangeScale(scale, now) self:SetScale(scale) if (now) then self:Despawn(1, 1) end return true end function GAMEOBJECT:CreateLuaEvent(func, delay, repeats) --Not associated with the game object, but this is the most compatible method. CreateLuaEvent(func, delay, repeats) end function GAMEOBJECT:GetCreatureNearestCoords(x,y,z,e) return MapMgr:GetInterface():GetCreatureNearestCoords(x,y,z,e); end function GAMEOBJECT:GetGameObjectNearestCoords(x,y,z,e) return MapMgr:GetInterface():getGameObjectNearestCoords(x,y,z,e); end function GAMEOBJECT:GetObjectType() return "GameObject"; end alias("IsActive", "IsClosed") alias("IsInBack", "IsBehind") function GAMEOBJECT:PlaySoundToSet(sound_entry) local data = LuaPacket(722, 4); data:WriteUInt32(sound_entry); self:SendMessageToSet(data, true); end function GAMEOBJECT:SetZoneWeather(zoneid, _type, density) return SetWeather("zone", zoneid, _type, density); end function GAMEOBJECT:SpawnCreature(entry, x, y, z, o, fac, duration, e1, e2, e3, phase, save) return EasySpawn(1, entry, x, y, z, o, fac, duration, e1, e2, e3, save, phase) end function GAMEOBJECT:SpawnGameObject(entry, x, y, z, o, duration, scale, phase, save) return EasySpawn(2, entry, x, y, z, o, scale, duration, nil, nil, nil, save, phase) end function GAMEOBJECT:Update() self:Despawn(1, 1) end function GAMEOBJECT:CustomAnimate(aindex) if (aindex < 2) then local data = LuaPacket(179, 12); data:WriteGUID(self:GetGUID()); data:WriteUInt32(aindex); self:SendMessageToSet(data, false, false); return true end return false end function GAMEOBJECT:GetAreaId() return MapMgr:GetAreaID(self:GetX(), self:GetY()); end function GAMEOBJECT:GetLandHeight(x,y) return MapMgr:GetADTLandHeight(x,y) end
agpl-3.0
gebo-10/GLRender
bin/Lua/base/eventsystem.lua
3
4690
--利用ID分离对EventSystem的直接引用 _inner_event_system_list = _inner_event_system_list or {} _inner_event_system_id_count = _inner_event_system_id_count or 0 EventSystem = EventSystem or BaseClass() --事件系统(非单健) function EventSystem:__init() _inner_event_system_id_count = _inner_event_system_id_count + 1 self.system_id = _inner_event_system_id_count _inner_event_system_list[self.system_id] = self --需要激发的事件(延后调用方式) self.need_fire_events = List.New() --事件列表 self.event_list = {} self.delay_handle_list = {} self.delay_id_count = 0 self.is_deleted = false --self.timer_quest_manager = TimerQuest() self.obj_bind = {} end --调用已经处于派发队列中的Event function EventSystem:Update() --timer quest --self.timer_quest_manager:Update(Status.NowTime, Status.ElapseTime) local tempList = self.need_fire_events self.need_fire_events = List.New() --依次执行所有需要触发的事件 while not List.Empty(tempList) do local fire_info = List.PopFront(tempList) fire_info.event:Fire(fire_info.arg_list) end end function EventSystem:Bind(event_id, event_func, obj_key) if event_id == nil then error("Try to bind to a nil event_id") return end if obj_key == nil then print("event_id", event_id) error("obj_key cannot be nil. May use 'self' as third argument when calling EventSystem:Bind") return end if self.is_deleted then return end -- 检查是否重复绑定 by huanjiang local has = nil if self.obj_bind[obj_key] ~= nil then has = self.obj_bind[obj_key][event_id] else self.obj_bind[obj_key] = {} end if has then error("object has already registered to the event: "..event_id) else self.obj_bind[obj_key][event_id] = 1 end if self.event_list[event_id] == nil then self:CreateEvent(event_id) end local tmp_event = self.event_list[event_id] return tmp_event:Bind(event_func) end function EventSystem:UnBind(event_handle, obj_key) if event_handle == nil then return end if event_handle.event_id == nil then error("Try to unbind a nil event_id") return end if obj_key == nil then print("event_handle", event_handle) error("obj_key cannot be nil. May use 'self' as third argument when calling EventSystem:Unbind") return end if self.obj_bind[obj_key] ~= nil and self.obj_bind[obj_key][event_handle.event_id] then self.obj_bind[obj_key][event_handle.event_id] = nil local sub_count = 0 for index,v in pairs(self.obj_bind[obj_key]) do sub_count = sub_count + 1 end if sub_count <= 0 then self.obj_bind[obj_key] = nil end else --error("object has NOT been registerd to the event: "..event_id) return end if self.is_deleted then return end local tmp_event = self.event_list[event_handle.event_id] if tmp_event ~= nil then tmp_event:UnBind(event_handle) end end --立即触发 function EventSystem:Fire(event_id, ...) if event_id == nil then error("Try to call EventSystem:Fire() with a nil event_id") return end if self.is_deleted then return end local tmp_event = self.event_list[event_id] if tmp_event ~= nil then tmp_event:Fire({...}) end end --下一帧触发 function EventSystem:FireNextFrame(event_id, ...) if event_id == nil then error("Try to call EventSystem:FireNextFrame() with a nil event_id") return end if self.is_deleted then return end local tmp_event = self.event_list[event_id] if tmp_event ~= nil then local fire_info = {} fire_info.event = tmp_event fire_info.arg_list = {...} List.PushBack(self.need_fire_events, fire_info) end end function EventSystem:FireDelay(event_id, delay_time, ...) --[[ if event_id == nil then error("Try to call EventSystem:FireDelay() with a nil event_id") return end if self.is_deleted then return end self.delay_id_count = self.delay_id_count + 1 local delay_id = self.delay_id_count local system_id = self.system_id local arg_list = {...} local delay_call_func = function() --print("delay func") local obj = _inner_event_system_list[system_id] if obj~= nil then obj:Fire(event_id, unpack(arg_list)) --执行定时任务 obj.delay_handle_list[delay_id] = nil --删除该句柄 end end local quest_handle = self.timer_quest_manager:AddDelayQuest(delay_call_func, delay_time) self.delay_handle_list[delay_id] = quest_handle ]] end function EventSystem:CreateEvent(event_id) self.event_list[event_id] = Event.New(event_id) end function EventSystem:__delete() if not self.is_deleted then --self.timer_quest_manager:Stop() self.timer_quest_manager = nil _inner_event_system_list[self.system_id] = nil self.is_deleted = true end end
agpl-3.0
Erotix8210/FrozenCore
src/scripts/lua/LuaBridge/0Misc/0Defined Variables.lua
30
42701
--[[ OBJECT_FIELD_GUID 0x0000 // Size: 2, Type: LONG, Flags: PUBLIC OBJECT_FIELD_TYPE 0x0002 // Size: 1, Type: INT, Flags: PUBLIC OBJECT_FIELD_ENTRY 0x0003 // Size: 1, Type: INT, Flags: PUBLIC OBJECT_FIELD_SCALE_X 0x0004 // Size: 1, Type: FLOAT, Flags: PUBLIC OBJECT_FIELD_PADDING 0x0005 // Size: 1, Type: INT, Flags: NONE OBJECT_END 0x0006 LOWGUID OBJECT_FIELD_GUID HIGHGUID ( OBJECT_FIELD_GUID + 1 ) //ItemFields ITEM_FIELD_OWNER OBJECT_END + 0x0000 // Size: 2, Type: LONG, Flags: PUBLIC ITEM_FIELD_CONTAINED OBJECT_END + 0x0002 // Size: 2, Type: LONG, Flags: PUBLIC ITEM_FIELD_CREATOR OBJECT_END + 0x0004 // Size: 2, Type: LONG, Flags: PUBLIC ITEM_FIELD_GIFTCREATOR OBJECT_END + 0x0006 // Size: 2, Type: LONG, Flags: PUBLIC ITEM_FIELD_STACK_COUNT OBJECT_END + 0x0008 // Size: 1, Type: INT, Flags: OWNER, ITEM_OWNER ITEM_FIELD_DURATION OBJECT_END + 0x0009 // Size: 1, Type: INT, Flags: OWNER, ITEM_OWNER ITEM_FIELD_SPELL_CHARGES OBJECT_END + 0x000A // Size: 5, Type: INT, Flags: OWNER, ITEM_OWNER ITEM_FIELD_FLAGS OBJECT_END + 0x000F // Size: 1, Type: INT, Flags: PUBLIC ITEM_FIELD_ENCHANTMENT_1_1 OBJECT_END + 0x0010 // Size: 2, Type: INT, Flags: PUBLIC ITEM_FIELD_ENCHANTMENT_1_3 OBJECT_END + 0x0012 // Size: 1, Type: TWO_SHORT, Flags: PUBLIC ITEM_FIELD_ENCHANTMENT_2_1 OBJECT_END + 0x0013 // Size: 2, Type: INT, Flags: PUBLIC ITEM_FIELD_ENCHANTMENT_2_3 OBJECT_END + 0x0015 // Size: 1, Type: TWO_SHORT, Flags: PUBLIC ITEM_FIELD_ENCHANTMENT_3_1 OBJECT_END + 0x0016 // Size: 2, Type: INT, Flags: PUBLIC ITEM_FIELD_ENCHANTMENT_3_3 OBJECT_END + 0x0018 // Size: 1, Type: TWO_SHORT, Flags: PUBLIC ITEM_FIELD_ENCHANTMENT_4_1 OBJECT_END + 0x0019 // Size: 2, Type: INT, Flags: PUBLIC ITEM_FIELD_ENCHANTMENT_4_3 OBJECT_END + 0x001B // Size: 1, Type: TWO_SHORT, Flags: PUBLIC ITEM_FIELD_ENCHANTMENT_5_1 OBJECT_END + 0x001C // Size: 2, Type: INT, Flags: PUBLIC ITEM_FIELD_ENCHANTMENT_5_3 OBJECT_END + 0x001E // Size: 1, Type: TWO_SHORT, Flags: PUBLIC ITEM_FIELD_ENCHANTMENT_6_1 OBJECT_END + 0x001F // Size: 2, Type: INT, Flags: PUBLIC ITEM_FIELD_ENCHANTMENT_6_3 OBJECT_END + 0x0021 // Size: 1, Type: TWO_SHORT, Flags: PUBLIC ITEM_FIELD_ENCHANTMENT_7_1 OBJECT_END + 0x0022 // Size: 2, Type: INT, Flags: PUBLIC ITEM_FIELD_ENCHANTMENT_7_3 OBJECT_END + 0x0024 // Size: 1, Type: TWO_SHORT, Flags: PUBLIC ITEM_FIELD_ENCHANTMENT_8_1 OBJECT_END + 0x0025 // Size: 2, Type: INT, Flags: PUBLIC ITEM_FIELD_ENCHANTMENT_8_3 OBJECT_END + 0x0027 // Size: 1, Type: TWO_SHORT, Flags: PUBLIC ITEM_FIELD_ENCHANTMENT_9_1 OBJECT_END + 0x0028 // Size: 2, Type: INT, Flags: PUBLIC ITEM_FIELD_ENCHANTMENT_9_3 OBJECT_END + 0x002A // Size: 1, Type: TWO_SHORT, Flags: PUBLIC ITEM_FIELD_ENCHANTMENT_10_1 OBJECT_END + 0x002B // Size: 2, Type: INT, Flags: PUBLIC ITEM_FIELD_ENCHANTMENT_10_3 OBJECT_END + 0x002D // Size: 1, Type: TWO_SHORT, Flags: PUBLIC ITEM_FIELD_ENCHANTMENT_11_1 OBJECT_END + 0x002E // Size: 2, Type: INT, Flags: PUBLIC ITEM_FIELD_ENCHANTMENT_11_3 OBJECT_END + 0x0030 // Size: 1, Type: TWO_SHORT, Flags: PUBLIC ITEM_FIELD_ENCHANTMENT_12_1 OBJECT_END + 0x0031 // Size: 2, Type: INT, Flags: PUBLIC ITEM_FIELD_ENCHANTMENT_12_3 OBJECT_END + 0x0033 // Size: 1, Type: TWO_SHORT, Flags: PUBLIC ITEM_FIELD_PROPERTY_SEED OBJECT_END + 0x0034 // Size: 1, Type: INT, Flags: PUBLIC ITEM_FIELD_RANDOM_PROPERTIES_ID OBJECT_END + 0x0035 // Size: 1, Type: INT, Flags: PUBLIC ITEM_FIELD_ITEM_TEXT_ID OBJECT_END + 0x0036 // Size: 1, Type: INT, Flags: OWNER ITEM_FIELD_DURABILITY OBJECT_END + 0x0037 // Size: 1, Type: INT, Flags: OWNER, ITEM_OWNER ITEM_FIELD_MAXDURABILITY OBJECT_END + 0x0038 // Size: 1, Type: INT, Flags: OWNER, ITEM_OWNER ITEM_FIELD_CREATE_PLAYED_TIME OBJECT_END + 0x0039 // Size: 1, Type: INT, Flags: PUBLIC ITEM_END OBJECT_END + 0x003A //ContainerFields CONTAINER_FIELD_NUM_SLOTS ITEM_END + 0x0000 // Size: 1, Type: INT, Flags: PUBLIC CONTAINER_ALIGN_PAD ITEM_END + 0x0001 // Size: 1, Type: BYTES, Flags: NONE CONTAINER_FIELD_SLOT_1 ITEM_END + 0x0002 // Size: 72, Type: LONG, Flags: PUBLIC CONTAINER_END ITEM_END + 0x004A //UnitFields UNIT_FIELD_CHARM OBJECT_END + 0x0000 // Size: 2, Type: LONG, Flags: PUBLIC UNIT_FIELD_SUMMON OBJECT_END + 0x0002 // Size: 2, Type: LONG, Flags: PUBLIC UNIT_FIELD_CRITTER OBJECT_END + 0x0004 // Size: 2, Type: LONG, Flags: PRIVATE UNIT_FIELD_CHARMEDBY OBJECT_END + 0x0006 // Size: 2, Type: LONG, Flags: PUBLIC UNIT_FIELD_SUMMONEDBY OBJECT_END + 0x0008 // Size: 2, Type: LONG, Flags: PUBLIC UNIT_FIELD_CREATEDBY OBJECT_END + 0x000A // Size: 2, Type: LONG, Flags: PUBLIC UNIT_FIELD_TARGET OBJECT_END + 0x000C // Size: 2, Type: LONG, Flags: PUBLIC UNIT_FIELD_CHANNEL_OBJECT OBJECT_END + 0x000E // Size: 2, Type: LONG, Flags: PUBLIC UNIT_FIELD_BYTES_0 OBJECT_END + 0x0010 // Size: 1, Type: BYTES, Flags: PUBLIC UNIT_FIELD_HEALTH OBJECT_END + 0x0011 // Size: 1, Type: INT, Flags: PUBLIC UNIT_FIELD_POWER1 OBJECT_END + 0x0012 // Size: 1, Type: INT, Flags: PUBLIC UNIT_FIELD_POWER2 OBJECT_END + 0x0013 // Size: 1, Type: INT, Flags: PUBLIC UNIT_FIELD_POWER3 OBJECT_END + 0x0014 // Size: 1, Type: INT, Flags: PUBLIC UNIT_FIELD_POWER4 OBJECT_END + 0x0015 // Size: 1, Type: INT, Flags: PUBLIC UNIT_FIELD_POWER5 OBJECT_END + 0x0016 // Size: 1, Type: INT, Flags: PUBLIC UNIT_FIELD_POWER6 OBJECT_END + 0x0017 // Size: 1, Type: INT, Flags: PUBLIC UNIT_FIELD_POWER7 OBJECT_END + 0x0018 // Size: 1, Type: INT, Flags: PUBLIC UNIT_FIELD_MAXHEALTH OBJECT_END + 0x0019 // Size: 1, Type: INT, Flags: PUBLIC UNIT_FIELD_MAXPOWER1 OBJECT_END + 0x001A // Size: 1, Type: INT, Flags: PUBLIC UNIT_FIELD_MAXPOWER2 OBJECT_END + 0x001B // Size: 1, Type: INT, Flags: PUBLIC UNIT_FIELD_MAXPOWER3 OBJECT_END + 0x001C // Size: 1, Type: INT, Flags: PUBLIC UNIT_FIELD_MAXPOWER4 OBJECT_END + 0x001D // Size: 1, Type: INT, Flags: PUBLIC UNIT_FIELD_MAXPOWER5 OBJECT_END + 0x001E // Size: 1, Type: INT, Flags: PUBLIC UNIT_FIELD_MAXPOWER6 OBJECT_END + 0x001F // Size: 1, Type: INT, Flags: PUBLIC UNIT_FIELD_MAXPOWER7 OBJECT_END + 0x0020 // Size: 1, Type: INT, Flags: PUBLIC UNIT_FIELD_POWER_REGEN_FLAT_MODIFIER OBJECT_END + 0x0021 // Size: 7, Type: FLOAT, Flags: PRIVATE, OWNER UNIT_FIELD_POWER_REGEN_INTERRUPTED_FLAT_MODIFIER OBJECT_END + 0x0028 // Size: 7, Type: FLOAT, Flags: PRIVATE, OWNER UNIT_FIELD_LEVEL OBJECT_END + 0x002F // Size: 1, Type: INT, Flags: PUBLIC UNIT_FIELD_FACTIONTEMPLATE OBJECT_END + 0x0030 // Size: 1, Type: INT, Flags: PUBLIC UNIT_VIRTUAL_ITEM_SLOT_ID OBJECT_END + 0x0031 // Size: 3, Type: INT, Flags: PUBLIC UNIT_FIELD_FLAGS OBJECT_END + 0x0034 // Size: 1, Type: INT, Flags: PUBLIC UNIT_FIELD_FLAGS_2 OBJECT_END + 0x0035 // Size: 1, Type: INT, Flags: PUBLIC UNIT_FIELD_AURASTATE OBJECT_END + 0x0036 // Size: 1, Type: INT, Flags: PUBLIC UNIT_FIELD_BASEATTACKTIME OBJECT_END + 0x0037 // Size: 2, Type: INT, Flags: PUBLIC UNIT_FIELD_RANGEDATTACKTIME OBJECT_END + 0x0039 // Size: 1, Type: INT, Flags: PRIVATE UNIT_FIELD_BOUNDINGRADIUS OBJECT_END + 0x003A // Size: 1, Type: FLOAT, Flags: PUBLIC UNIT_FIELD_COMBATREACH OBJECT_END + 0x003B // Size: 1, Type: FLOAT, Flags: PUBLIC UNIT_FIELD_DISPLAYID OBJECT_END + 0x003C // Size: 1, Type: INT, Flags: PUBLIC UNIT_FIELD_NATIVEDISPLAYID OBJECT_END + 0x003D // Size: 1, Type: INT, Flags: PUBLIC UNIT_FIELD_MOUNTDISPLAYID OBJECT_END + 0x003E // Size: 1, Type: INT, Flags: PUBLIC UNIT_FIELD_MINDAMAGE OBJECT_END + 0x003F // Size: 1, Type: FLOAT, Flags: PRIVATE, OWNER, PARTY_LEADER UNIT_FIELD_MAXDAMAGE OBJECT_END + 0x0040 // Size: 1, Type: FLOAT, Flags: PRIVATE, OWNER, PARTY_LEADER UNIT_FIELD_MINOFFHANDDAMAGE OBJECT_END + 0x0041 // Size: 1, Type: FLOAT, Flags: PRIVATE, OWNER, PARTY_LEADER UNIT_FIELD_MAXOFFHANDDAMAGE OBJECT_END + 0x0042 // Size: 1, Type: FLOAT, Flags: PRIVATE, OWNER, PARTY_LEADER UNIT_FIELD_BYTES_1 OBJECT_END + 0x0043 // Size: 1, Type: BYTES, Flags: PUBLIC UNIT_FIELD_PETNUMBER OBJECT_END + 0x0044 // Size: 1, Type: INT, Flags: PUBLIC UNIT_FIELD_PET_NAME_TIMESTAMP OBJECT_END + 0x0045 // Size: 1, Type: INT, Flags: PUBLIC UNIT_FIELD_PETEXPERIENCE OBJECT_END + 0x0046 // Size: 1, Type: INT, Flags: OWNER UNIT_FIELD_PETNEXTLEVELEXP OBJECT_END + 0x0047 // Size: 1, Type: INT, Flags: OWNER UNIT_DYNAMIC_FLAGS OBJECT_END + 0x0048 // Size: 1, Type: INT, Flags: DYNAMIC UNIT_CHANNEL_SPELL OBJECT_END + 0x0049 // Size: 1, Type: INT, Flags: PUBLIC UNIT_MOD_CAST_SPEED OBJECT_END + 0x004A // Size: 1, Type: FLOAT, Flags: PUBLIC UNIT_CREATED_BY_SPELL OBJECT_END + 0x004B // Size: 1, Type: INT, Flags: PUBLIC UNIT_NPC_FLAGS OBJECT_END + 0x004C // Size: 1, Type: INT, Flags: DYNAMIC UNIT_NPC_EMOTESTATE OBJECT_END + 0x004D // Size: 1, Type: INT, Flags: PUBLIC UNIT_FIELD_STAT0 OBJECT_END + 0x004E // Size: 1, Type: INT, Flags: PRIVATE, OWNER UNIT_FIELD_STAT1 OBJECT_END + 0x004F // Size: 1, Type: INT, Flags: PRIVATE, OWNER UNIT_FIELD_STAT2 OBJECT_END + 0x0050 // Size: 1, Type: INT, Flags: PRIVATE, OWNER UNIT_FIELD_STAT3 OBJECT_END + 0x0051 // Size: 1, Type: INT, Flags: PRIVATE, OWNER UNIT_FIELD_STAT4 OBJECT_END + 0x0052 // Size: 1, Type: INT, Flags: PRIVATE, OWNER UNIT_FIELD_POSSTAT0 OBJECT_END + 0x0053 // Size: 1, Type: INT, Flags: PRIVATE, OWNER UNIT_FIELD_POSSTAT1 OBJECT_END + 0x0054 // Size: 1, Type: INT, Flags: PRIVATE, OWNER UNIT_FIELD_POSSTAT2 OBJECT_END + 0x0055 // Size: 1, Type: INT, Flags: PRIVATE, OWNER UNIT_FIELD_POSSTAT3 OBJECT_END + 0x0056 // Size: 1, Type: INT, Flags: PRIVATE, OWNER UNIT_FIELD_POSSTAT4 OBJECT_END + 0x0057 // Size: 1, Type: INT, Flags: PRIVATE, OWNER UNIT_FIELD_NEGSTAT0 OBJECT_END + 0x0058 // Size: 1, Type: INT, Flags: PRIVATE, OWNER UNIT_FIELD_NEGSTAT1 OBJECT_END + 0x0059 // Size: 1, Type: INT, Flags: PRIVATE, OWNER UNIT_FIELD_NEGSTAT2 OBJECT_END + 0x005A // Size: 1, Type: INT, Flags: PRIVATE, OWNER UNIT_FIELD_NEGSTAT3 OBJECT_END + 0x005B // Size: 1, Type: INT, Flags: PRIVATE, OWNER UNIT_FIELD_NEGSTAT4 OBJECT_END + 0x005C // Size: 1, Type: INT, Flags: PRIVATE, OWNER UNIT_FIELD_RESISTANCES OBJECT_END + 0x005D // Size: 7, Type: INT, Flags: PRIVATE, OWNER, PARTY_LEADER UNIT_FIELD_RESISTANCEBUFFMODSPOSITIVE OBJECT_END + 0x0064 // Size: 7, Type: INT, Flags: PRIVATE, OWNER UNIT_FIELD_RESISTANCEBUFFMODSNEGATIVE OBJECT_END + 0x006B // Size: 7, Type: INT, Flags: PRIVATE, OWNER UNIT_FIELD_BASE_MANA OBJECT_END + 0x0072 // Size: 1, Type: INT, Flags: PUBLIC UNIT_FIELD_BASE_HEALTH OBJECT_END + 0x0073 // Size: 1, Type: INT, Flags: PRIVATE, OWNER UNIT_FIELD_BYTES_2 OBJECT_END + 0x0074 // Size: 1, Type: BYTES, Flags: PUBLIC UNIT_FIELD_ATTACK_POWER OBJECT_END + 0x0075 // Size: 1, Type: INT, Flags: PRIVATE, OWNER UNIT_FIELD_ATTACK_POWER_MODS OBJECT_END + 0x0076 // Size: 1, Type: TWO_SHORT, Flags: PRIVATE, OWNER UNIT_FIELD_ATTACK_POWER_MULTIPLIER OBJECT_END + 0x0077 // Size: 1, Type: FLOAT, Flags: PRIVATE, OWNER UNIT_FIELD_RANGED_ATTACK_POWER OBJECT_END + 0x0078 // Size: 1, Type: INT, Flags: PRIVATE, OWNER UNIT_FIELD_RANGED_ATTACK_POWER_MODS OBJECT_END + 0x0079 // Size: 1, Type: TWO_SHORT, Flags: PRIVATE, OWNER UNIT_FIELD_RANGED_ATTACK_POWER_MULTIPLIER OBJECT_END + 0x007A // Size: 1, Type: FLOAT, Flags: PRIVATE, OWNER UNIT_FIELD_MINRANGEDDAMAGE OBJECT_END + 0x007B // Size: 1, Type: FLOAT, Flags: PRIVATE, OWNER UNIT_FIELD_MAXRANGEDDAMAGE OBJECT_END + 0x007C // Size: 1, Type: FLOAT, Flags: PRIVATE, OWNER UNIT_FIELD_POWER_COST_MODIFIER OBJECT_END + 0x007D // Size: 7, Type: INT, Flags: PRIVATE, OWNER UNIT_FIELD_POWER_COST_MULTIPLIER OBJECT_END + 0x0084 // Size: 7, Type: FLOAT, Flags: PRIVATE, OWNER UNIT_FIELD_MAXHEALTHMODIFIER OBJECT_END + 0x008B // Size: 1, Type: FLOAT, Flags: PRIVATE, OWNER UNIT_FIELD_HOVERHEIGHT OBJECT_END + 0x008C // Size: 1, Type: FLOAT, Flags: PUBLIC UNIT_FIELD_PADDING OBJECT_END + 0x008D // Size: 1, Type: INT, Flags: NONE UNIT_END OBJECT_END + 0x008E PLAYER_DUEL_ARBITER UNIT_END + 0x0000 // Size: 2, Type: LONG, Flags: PUBLIC PLAYER_FLAGS UNIT_END + 0x0002 // Size: 1, Type: INT, Flags: PUBLIC PLAYER_GUILDID UNIT_END + 0x0003 // Size: 1, Type: INT, Flags: PUBLIC PLAYER_GUILDRANK UNIT_END + 0x0004 // Size: 1, Type: INT, Flags: PUBLIC PLAYER_BYTES UNIT_END + 0x0005 // Size: 1, Type: BYTES, Flags: PUBLIC PLAYER_BYTES_2 UNIT_END + 0x0006 // Size: 1, Type: BYTES, Flags: PUBLIC PLAYER_BYTES_3 UNIT_END + 0x0007 // Size: 1, Type: BYTES, Flags: PUBLIC PLAYER_DUEL_TEAM UNIT_END + 0x0008 // Size: 1, Type: INT, Flags: PUBLIC PLAYER_GUILD_TIMESTAMP UNIT_END + 0x0009 // Size: 1, Type: INT, Flags: PUBLIC PLAYER_QUEST_LOG_1_1 UNIT_END + 0x000A // Size: 1, Type: INT, Flags: PARTY_MEMBER PLAYER_QUEST_LOG_1_2 UNIT_END + 0x000B // Size: 1, Type: INT, Flags: PRIVATE PLAYER_QUEST_LOG_1_3 UNIT_END + 0x000C // Size: 1, Type: BYTES, Flags: PRIVATE PLAYER_QUEST_LOG_1_4 UNIT_END + 0x000D // Size: 1, Type: INT, Flags: PRIVATE PLAYER_QUEST_LOG_2_1 UNIT_END + 0x000E // Size: 1, Type: INT, Flags: PARTY_MEMBER PLAYER_QUEST_LOG_2_2 UNIT_END + 0x000F // Size: 1, Type: INT, Flags: PRIVATE PLAYER_QUEST_LOG_2_3 UNIT_END + 0x0010 // Size: 1, Type: BYTES, Flags: PRIVATE PLAYER_QUEST_LOG_2_4 UNIT_END + 0x0011 // Size: 1, Type: INT, Flags: PRIVATE PLAYER_QUEST_LOG_3_1 UNIT_END + 0x0012 // Size: 1, Type: INT, Flags: PARTY_MEMBER PLAYER_QUEST_LOG_3_2 UNIT_END + 0x0013 // Size: 1, Type: INT, Flags: PRIVATE PLAYER_QUEST_LOG_3_3 UNIT_END + 0x0014 // Size: 1, Type: BYTES, Flags: PRIVATE PLAYER_QUEST_LOG_3_4 UNIT_END + 0x0015 // Size: 1, Type: INT, Flags: PRIVATE PLAYER_QUEST_LOG_4_1 UNIT_END + 0x0016 // Size: 1, Type: INT, Flags: PARTY_MEMBER PLAYER_QUEST_LOG_4_2 UNIT_END + 0x0017 // Size: 1, Type: INT, Flags: PRIVATE PLAYER_QUEST_LOG_4_3 UNIT_END + 0x0018 // Size: 1, Type: BYTES, Flags: PRIVATE PLAYER_QUEST_LOG_4_4 UNIT_END + 0x0019 // Size: 1, Type: INT, Flags: PRIVATE PLAYER_QUEST_LOG_5_1 UNIT_END + 0x001A // Size: 1, Type: INT, Flags: PARTY_MEMBER PLAYER_QUEST_LOG_5_2 UNIT_END + 0x001B // Size: 1, Type: INT, Flags: PRIVATE PLAYER_QUEST_LOG_5_3 UNIT_END + 0x001C // Size: 1, Type: BYTES, Flags: PRIVATE PLAYER_QUEST_LOG_5_4 UNIT_END + 0x001D // Size: 1, Type: INT, Flags: PRIVATE PLAYER_QUEST_LOG_6_1 UNIT_END + 0x001E // Size: 1, Type: INT, Flags: PARTY_MEMBER PLAYER_QUEST_LOG_6_2 UNIT_END + 0x001F // Size: 1, Type: INT, Flags: PRIVATE PLAYER_QUEST_LOG_6_3 UNIT_END + 0x0020 // Size: 1, Type: BYTES, Flags: PRIVATE PLAYER_QUEST_LOG_6_4 UNIT_END + 0x0021 // Size: 1, Type: INT, Flags: PRIVATE PLAYER_QUEST_LOG_7_1 UNIT_END + 0x0022 // Size: 1, Type: INT, Flags: PARTY_MEMBER PLAYER_QUEST_LOG_7_2 UNIT_END + 0x0023 // Size: 1, Type: INT, Flags: PRIVATE PLAYER_QUEST_LOG_7_3 UNIT_END + 0x0024 // Size: 1, Type: BYTES, Flags: PRIVATE PLAYER_QUEST_LOG_7_4 UNIT_END + 0x0025 // Size: 1, Type: INT, Flags: PRIVATE PLAYER_QUEST_LOG_8_1 UNIT_END + 0x0026 // Size: 1, Type: INT, Flags: PARTY_MEMBER PLAYER_QUEST_LOG_8_2 UNIT_END + 0x0027 // Size: 1, Type: INT, Flags: PRIVATE PLAYER_QUEST_LOG_8_3 UNIT_END + 0x0028 // Size: 1, Type: BYTES, Flags: PRIVATE PLAYER_QUEST_LOG_8_4 UNIT_END + 0x0029 // Size: 1, Type: INT, Flags: PRIVATE PLAYER_QUEST_LOG_9_1 UNIT_END + 0x002A // Size: 1, Type: INT, Flags: PARTY_MEMBER PLAYER_QUEST_LOG_9_2 UNIT_END + 0x002B // Size: 1, Type: INT, Flags: PRIVATE PLAYER_QUEST_LOG_9_3 UNIT_END + 0x002C // Size: 1, Type: BYTES, Flags: PRIVATE PLAYER_QUEST_LOG_9_4 UNIT_END + 0x002D // Size: 1, Type: INT, Flags: PRIVATE PLAYER_QUEST_LOG_10_1 UNIT_END + 0x002E // Size: 1, Type: INT, Flags: PARTY_MEMBER PLAYER_QUEST_LOG_10_2 UNIT_END + 0x002F // Size: 1, Type: INT, Flags: PRIVATE PLAYER_QUEST_LOG_10_3 UNIT_END + 0x0030 // Size: 1, Type: BYTES, Flags: PRIVATE PLAYER_QUEST_LOG_10_4 UNIT_END + 0x0031 // Size: 1, Type: INT, Flags: PRIVATE PLAYER_QUEST_LOG_11_1 UNIT_END + 0x0032 // Size: 1, Type: INT, Flags: PARTY_MEMBER PLAYER_QUEST_LOG_11_2 UNIT_END + 0x0033 // Size: 1, Type: INT, Flags: PRIVATE PLAYER_QUEST_LOG_11_3 UNIT_END + 0x0034 // Size: 1, Type: BYTES, Flags: PRIVATE PLAYER_QUEST_LOG_11_4 UNIT_END + 0x0035 // Size: 1, Type: INT, Flags: PRIVATE PLAYER_QUEST_LOG_12_1 UNIT_END + 0x0036 // Size: 1, Type: INT, Flags: PARTY_MEMBER PLAYER_QUEST_LOG_12_2 UNIT_END + 0x0037 // Size: 1, Type: INT, Flags: PRIVATE PLAYER_QUEST_LOG_12_3 UNIT_END + 0x0038 // Size: 1, Type: BYTES, Flags: PRIVATE PLAYER_QUEST_LOG_12_4 UNIT_END + 0x0039 // Size: 1, Type: INT, Flags: PRIVATE PLAYER_QUEST_LOG_13_1 UNIT_END + 0x003A // Size: 1, Type: INT, Flags: PARTY_MEMBER PLAYER_QUEST_LOG_13_2 UNIT_END + 0x003B // Size: 1, Type: INT, Flags: PRIVATE PLAYER_QUEST_LOG_13_3 UNIT_END + 0x003C // Size: 1, Type: BYTES, Flags: PRIVATE PLAYER_QUEST_LOG_13_4 UNIT_END + 0x003D // Size: 1, Type: INT, Flags: PRIVATE PLAYER_QUEST_LOG_14_1 UNIT_END + 0x003E // Size: 1, Type: INT, Flags: PARTY_MEMBER PLAYER_QUEST_LOG_14_2 UNIT_END + 0x003F // Size: 1, Type: INT, Flags: PRIVATE PLAYER_QUEST_LOG_14_3 UNIT_END + 0x0040 // Size: 1, Type: BYTES, Flags: PRIVATE PLAYER_QUEST_LOG_14_4 UNIT_END + 0x0041 // Size: 1, Type: INT, Flags: PRIVATE PLAYER_QUEST_LOG_15_1 UNIT_END + 0x0042 // Size: 1, Type: INT, Flags: PARTY_MEMBER PLAYER_QUEST_LOG_15_2 UNIT_END + 0x0043 // Size: 1, Type: INT, Flags: PRIVATE PLAYER_QUEST_LOG_15_3 UNIT_END + 0x0044 // Size: 1, Type: BYTES, Flags: PRIVATE PLAYER_QUEST_LOG_15_4 UNIT_END + 0x0045 // Size: 1, Type: INT, Flags: PRIVATE PLAYER_QUEST_LOG_16_1 UNIT_END + 0x0046 // Size: 1, Type: INT, Flags: PARTY_MEMBER PLAYER_QUEST_LOG_16_2 UNIT_END + 0x0047 // Size: 1, Type: INT, Flags: PRIVATE PLAYER_QUEST_LOG_16_3 UNIT_END + 0x0048 // Size: 1, Type: BYTES, Flags: PRIVATE PLAYER_QUEST_LOG_16_4 UNIT_END + 0x0049 // Size: 1, Type: INT, Flags: PRIVATE PLAYER_QUEST_LOG_17_1 UNIT_END + 0x004A // Size: 1, Type: INT, Flags: PARTY_MEMBER PLAYER_QUEST_LOG_17_2 UNIT_END + 0x004B // Size: 1, Type: INT, Flags: PRIVATE PLAYER_QUEST_LOG_17_3 UNIT_END + 0x004C // Size: 1, Type: BYTES, Flags: PRIVATE PLAYER_QUEST_LOG_17_4 UNIT_END + 0x004D // Size: 1, Type: INT, Flags: PRIVATE PLAYER_QUEST_LOG_18_1 UNIT_END + 0x004E // Size: 1, Type: INT, Flags: PARTY_MEMBER PLAYER_QUEST_LOG_18_2 UNIT_END + 0x004F // Size: 1, Type: INT, Flags: PRIVATE PLAYER_QUEST_LOG_18_3 UNIT_END + 0x0050 // Size: 1, Type: BYTES, Flags: PRIVATE PLAYER_QUEST_LOG_18_4 UNIT_END + 0x0051 // Size: 1, Type: INT, Flags: PRIVATE PLAYER_QUEST_LOG_19_1 UNIT_END + 0x0052 // Size: 1, Type: INT, Flags: PARTY_MEMBER PLAYER_QUEST_LOG_19_2 UNIT_END + 0x0053 // Size: 1, Type: INT, Flags: PRIVATE PLAYER_QUEST_LOG_19_3 UNIT_END + 0x0054 // Size: 1, Type: BYTES, Flags: PRIVATE PLAYER_QUEST_LOG_19_4 UNIT_END + 0x0055 // Size: 1, Type: INT, Flags: PRIVATE PLAYER_QUEST_LOG_20_1 UNIT_END + 0x0056 // Size: 1, Type: INT, Flags: PARTY_MEMBER PLAYER_QUEST_LOG_20_2 UNIT_END + 0x0057 // Size: 1, Type: INT, Flags: PRIVATE PLAYER_QUEST_LOG_20_3 UNIT_END + 0x0058 // Size: 1, Type: BYTES, Flags: PRIVATE PLAYER_QUEST_LOG_20_4 UNIT_END + 0x0059 // Size: 1, Type: INT, Flags: PRIVATE PLAYER_QUEST_LOG_21_1 UNIT_END + 0x005A // Size: 1, Type: INT, Flags: PARTY_MEMBER PLAYER_QUEST_LOG_21_2 UNIT_END + 0x005B // Size: 1, Type: INT, Flags: PRIVATE PLAYER_QUEST_LOG_21_3 UNIT_END + 0x005C // Size: 1, Type: BYTES, Flags: PRIVATE PLAYER_QUEST_LOG_21_4 UNIT_END + 0x005D // Size: 1, Type: INT, Flags: PRIVATE PLAYER_QUEST_LOG_22_1 UNIT_END + 0x005E // Size: 1, Type: INT, Flags: PARTY_MEMBER PLAYER_QUEST_LOG_22_2 UNIT_END + 0x005F // Size: 1, Type: INT, Flags: PRIVATE PLAYER_QUEST_LOG_22_3 UNIT_END + 0x0060 // Size: 1, Type: BYTES, Flags: PRIVATE PLAYER_QUEST_LOG_22_4 UNIT_END + 0x0061 // Size: 1, Type: INT, Flags: PRIVATE PLAYER_QUEST_LOG_23_1 UNIT_END + 0x0062 // Size: 1, Type: INT, Flags: PARTY_MEMBER PLAYER_QUEST_LOG_23_2 UNIT_END + 0x0063 // Size: 1, Type: INT, Flags: PRIVATE PLAYER_QUEST_LOG_23_3 UNIT_END + 0x0064 // Size: 1, Type: BYTES, Flags: PRIVATE PLAYER_QUEST_LOG_23_4 UNIT_END + 0x0065 // Size: 1, Type: INT, Flags: PRIVATE PLAYER_QUEST_LOG_24_1 UNIT_END + 0x0066 // Size: 1, Type: INT, Flags: PARTY_MEMBER PLAYER_QUEST_LOG_24_2 UNIT_END + 0x0067 // Size: 1, Type: INT, Flags: PRIVATE PLAYER_QUEST_LOG_24_3 UNIT_END + 0x0068 // Size: 1, Type: BYTES, Flags: PRIVATE PLAYER_QUEST_LOG_24_4 UNIT_END + 0x0069 // Size: 1, Type: INT, Flags: PRIVATE PLAYER_QUEST_LOG_25_1 UNIT_END + 0x006A // Size: 1, Type: INT, Flags: PARTY_MEMBER PLAYER_QUEST_LOG_25_2 UNIT_END + 0x006B // Size: 1, Type: INT, Flags: PRIVATE PLAYER_QUEST_LOG_25_3 UNIT_END + 0x006C // Size: 1, Type: BYTES, Flags: PRIVATE PLAYER_QUEST_LOG_25_4 UNIT_END + 0x006D // Size: 1, Type: INT, Flags: PRIVATE PLAYER_VISIBLE_ITEM_1_ENTRYID UNIT_END + 0x006E // Size: 1, Type: INT, Flags: PUBLIC PLAYER_VISIBLE_ITEM_1_ENCHANTMENT UNIT_END + 0x006F // Size: 1, Type: TWO_SHORT, Flags: PUBLIC PLAYER_VISIBLE_ITEM_2_ENTRYID UNIT_END + 0x0070 // Size: 1, Type: INT, Flags: PUBLIC PLAYER_VISIBLE_ITEM_2_ENCHANTMENT UNIT_END + 0x0071 // Size: 1, Type: TWO_SHORT, Flags: PUBLIC PLAYER_VISIBLE_ITEM_3_ENTRYID UNIT_END + 0x0072 // Size: 1, Type: INT, Flags: PUBLIC PLAYER_VISIBLE_ITEM_3_ENCHANTMENT UNIT_END + 0x0073 // Size: 1, Type: TWO_SHORT, Flags: PUBLIC PLAYER_VISIBLE_ITEM_4_ENTRYID UNIT_END + 0x0074 // Size: 1, Type: INT, Flags: PUBLIC PLAYER_VISIBLE_ITEM_4_ENCHANTMENT UNIT_END + 0x0075 // Size: 1, Type: TWO_SHORT, Flags: PUBLIC PLAYER_VISIBLE_ITEM_5_ENTRYID UNIT_END + 0x0076 // Size: 1, Type: INT, Flags: PUBLIC PLAYER_VISIBLE_ITEM_5_ENCHANTMENT UNIT_END + 0x0077 // Size: 1, Type: TWO_SHORT, Flags: PUBLIC PLAYER_VISIBLE_ITEM_6_ENTRYID UNIT_END + 0x0078 // Size: 1, Type: INT, Flags: PUBLIC PLAYER_VISIBLE_ITEM_6_ENCHANTMENT UNIT_END + 0x0079 // Size: 1, Type: TWO_SHORT, Flags: PUBLIC PLAYER_VISIBLE_ITEM_7_ENTRYID UNIT_END + 0x007A // Size: 1, Type: INT, Flags: PUBLIC PLAYER_VISIBLE_ITEM_7_ENCHANTMENT UNIT_END + 0x007B // Size: 1, Type: TWO_SHORT, Flags: PUBLIC PLAYER_VISIBLE_ITEM_8_ENTRYID UNIT_END + 0x007C // Size: 1, Type: INT, Flags: PUBLIC PLAYER_VISIBLE_ITEM_8_ENCHANTMENT UNIT_END + 0x007D // Size: 1, Type: TWO_SHORT, Flags: PUBLIC PLAYER_VISIBLE_ITEM_9_ENTRYID UNIT_END + 0x007E // Size: 1, Type: INT, Flags: PUBLIC PLAYER_VISIBLE_ITEM_9_ENCHANTMENT UNIT_END + 0x007F // Size: 1, Type: TWO_SHORT, Flags: PUBLIC PLAYER_VISIBLE_ITEM_10_ENTRYID UNIT_END + 0x0080 // Size: 1, Type: INT, Flags: PUBLIC PLAYER_VISIBLE_ITEM_10_ENCHANTMENT UNIT_END + 0x0081 // Size: 1, Type: TWO_SHORT, Flags: PUBLIC PLAYER_VISIBLE_ITEM_11_ENTRYID UNIT_END + 0x0082 // Size: 1, Type: INT, Flags: PUBLIC PLAYER_VISIBLE_ITEM_11_ENCHANTMENT UNIT_END + 0x0083 // Size: 1, Type: TWO_SHORT, Flags: PUBLIC PLAYER_VISIBLE_ITEM_12_ENTRYID UNIT_END + 0x0084 // Size: 1, Type: INT, Flags: PUBLIC PLAYER_VISIBLE_ITEM_12_ENCHANTMENT UNIT_END + 0x0085 // Size: 1, Type: TWO_SHORT, Flags: PUBLIC PLAYER_VISIBLE_ITEM_13_ENTRYID UNIT_END + 0x0086 // Size: 1, Type: INT, Flags: PUBLIC PLAYER_VISIBLE_ITEM_13_ENCHANTMENT UNIT_END + 0x0087 // Size: 1, Type: TWO_SHORT, Flags: PUBLIC PLAYER_VISIBLE_ITEM_14_ENTRYID UNIT_END + 0x0088 // Size: 1, Type: INT, Flags: PUBLIC PLAYER_VISIBLE_ITEM_14_ENCHANTMENT UNIT_END + 0x0089 // Size: 1, Type: TWO_SHORT, Flags: PUBLIC PLAYER_VISIBLE_ITEM_15_ENTRYID UNIT_END + 0x008A // Size: 1, Type: INT, Flags: PUBLIC PLAYER_VISIBLE_ITEM_15_ENCHANTMENT UNIT_END + 0x008B // Size: 1, Type: TWO_SHORT, Flags: PUBLIC PLAYER_VISIBLE_ITEM_16_ENTRYID UNIT_END + 0x008C // Size: 1, Type: INT, Flags: PUBLIC PLAYER_VISIBLE_ITEM_16_ENCHANTMENT UNIT_END + 0x008D // Size: 1, Type: TWO_SHORT, Flags: PUBLIC PLAYER_VISIBLE_ITEM_17_ENTRYID UNIT_END + 0x008E // Size: 1, Type: INT, Flags: PUBLIC PLAYER_VISIBLE_ITEM_17_ENCHANTMENT UNIT_END + 0x008F // Size: 1, Type: TWO_SHORT, Flags: PUBLIC PLAYER_VISIBLE_ITEM_18_ENTRYID UNIT_END + 0x0090 // Size: 1, Type: INT, Flags: PUBLIC PLAYER_VISIBLE_ITEM_18_ENCHANTMENT UNIT_END + 0x0091 // Size: 1, Type: TWO_SHORT, Flags: PUBLIC PLAYER_VISIBLE_ITEM_19_ENTRYID UNIT_END + 0x0092 // Size: 1, Type: INT, Flags: PUBLIC PLAYER_VISIBLE_ITEM_19_ENCHANTMENT UNIT_END + 0x0093 // Size: 1, Type: TWO_SHORT, Flags: PUBLIC PLAYER_CHOSEN_TITLE UNIT_END + 0x0094 // Size: 1, Type: INT, Flags: PUBLIC PLAYER_FAKE_INEBRIATION UNIT_END + 0x0095 // Size: 1, Type: INT, Flags: PUBLIC PLAYER_FIELD_INV_SLOT_HEAD UNIT_END + 0x0096 // Size: 46, Type: LONG, Flags: PRIVATE PLAYER_FIELD_PACK_SLOT_1 UNIT_END + 0x00C4 // Size: 32, Type: LONG, Flags: PRIVATE PLAYER_FIELD_BANK_SLOT_1 UNIT_END + 0x00E4 // Size: 56, Type: LONG, Flags: PRIVATE PLAYER_FIELD_BANKBAG_SLOT_1 UNIT_END + 0x011C // Size: 14, Type: LONG, Flags: PRIVATE PLAYER_FIELD_VENDORBUYBACK_SLOT_1 UNIT_END + 0x012A // Size: 24, Type: LONG, Flags: PRIVATE PLAYER_FIELD_KEYRING_SLOT_1 UNIT_END + 0x0142 // Size: 64, Type: LONG, Flags: PRIVATE PLAYER_FIELD_CURRENCYTOKEN_SLOT_1 UNIT_END + 0x0182 // Size: 64, Type: LONG, Flags: PRIVATE PLAYER_FARSIGHT UNIT_END + 0x01C2 // Size: 2, Type: LONG, Flags: PRIVATE PLAYER__FIELD_KNOWN_TITLES UNIT_END + 0x01C4 // Size: 2, Type: LONG, Flags: PRIVATE PLAYER__FIELD_KNOWN_TITLES1 UNIT_END + 0x01C6 // Size: 2, Type: LONG, Flags: PRIVATE PLAYER__FIELD_KNOWN_TITLES2 UNIT_END + 0x01C8 // Size: 2, Type: LONG, Flags: PRIVATE PLAYER_FIELD_KNOWN_CURRENCIES UNIT_END + 0x01CA // Size: 2, Type: LONG, Flags: PRIVATE PLAYER_XP UNIT_END + 0x01CC // Size: 1, Type: INT, Flags: PRIVATE PLAYER_NEXT_LEVEL_XP UNIT_END + 0x01CD // Size: 1, Type: INT, Flags: PRIVATE PLAYER_SKILL_INFO_1_1 UNIT_END + 0x01CE // Size: 384, Type: TWO_SHORT, Flags: PRIVATE PLAYER_CHARACTER_POINTS1 UNIT_END + 0x034E // Size: 1, Type: INT, Flags: PRIVATE PLAYER_CHARACTER_POINTS2 UNIT_END + 0x034F // Size: 1, Type: INT, Flags: PRIVATE PLAYER_TRACK_CREATURES UNIT_END + 0x0350 // Size: 1, Type: INT, Flags: PRIVATE PLAYER_TRACK_RESOURCES UNIT_END + 0x0351 // Size: 1, Type: INT, Flags: PRIVATE PLAYER_BLOCK_PERCENTAGE UNIT_END + 0x0352 // Size: 1, Type: FLOAT, Flags: PRIVATE PLAYER_DODGE_PERCENTAGE UNIT_END + 0x0353 // Size: 1, Type: FLOAT, Flags: PRIVATE PLAYER_PARRY_PERCENTAGE UNIT_END + 0x0354 // Size: 1, Type: FLOAT, Flags: PRIVATE PLAYER_EXPERTISE UNIT_END + 0x0355 // Size: 1, Type: INT, Flags: PRIVATE PLAYER_OFFHAND_EXPERTISE UNIT_END + 0x0356 // Size: 1, Type: INT, Flags: PRIVATE PLAYER_CRIT_PERCENTAGE UNIT_END + 0x0357 // Size: 1, Type: FLOAT, Flags: PRIVATE PLAYER_RANGED_CRIT_PERCENTAGE UNIT_END + 0x0358 // Size: 1, Type: FLOAT, Flags: PRIVATE PLAYER_OFFHAND_CRIT_PERCENTAGE UNIT_END + 0x0359 // Size: 1, Type: FLOAT, Flags: PRIVATE PLAYER_SPELL_CRIT_PERCENTAGE1 UNIT_END + 0x035A // Size: 7, Type: FLOAT, Flags: PRIVATE PLAYER_SHIELD_BLOCK UNIT_END + 0x0361 // Size: 1, Type: INT, Flags: PRIVATE PLAYER_SHIELD_BLOCK_CRIT_PERCENTAGE UNIT_END + 0x0362 // Size: 1, Type: FLOAT, Flags: PRIVATE PLAYER_EXPLORED_ZONES_1 UNIT_END + 0x0363 // Size: 128, Type: BYTES, Flags: PRIVATE PLAYER_REST_STATE_EXPERIENCE UNIT_END + 0x03E3 // Size: 1, Type: INT, Flags: PRIVATE PLAYER_FIELD_COINAGE UNIT_END + 0x03E4 // Size: 1, Type: INT, Flags: PRIVATE PLAYER_FIELD_MOD_DAMAGE_DONE_POS UNIT_END + 0x03E5 // Size: 7, Type: INT, Flags: PRIVATE PLAYER_FIELD_MOD_DAMAGE_DONE_NEG UNIT_END + 0x03EC // Size: 7, Type: INT, Flags: PRIVATE PLAYER_FIELD_MOD_DAMAGE_DONE_PCT UNIT_END + 0x03F3 // Size: 7, Type: INT, Flags: PRIVATE PLAYER_FIELD_MOD_HEALING_DONE_POS UNIT_END + 0x03FA // Size: 1, Type: INT, Flags: PRIVATE PLAYER_FIELD_MOD_HEALING_PCT UNIT_END + 0x03FB // Size: 1, Type: FLOAT, Flags: PRIVATE PLAYER_FIELD_MOD_HEALING_DONE_PCT UNIT_END + 0x03FC // Size: 1, Type: FLOAT, Flags: PRIVATE PLAYER_FIELD_MOD_TARGET_RESISTANCE UNIT_END + 0x03FD // Size: 1, Type: INT, Flags: PRIVATE PLAYER_FIELD_MOD_TARGET_PHYSICAL_RESISTANCE UNIT_END + 0x03FE // Size: 1, Type: INT, Flags: PRIVATE PLAYER_FIELD_BYTES UNIT_END + 0x03FF // Size: 1, Type: BYTES, Flags: PRIVATE PLAYER_AMMO_ID UNIT_END + 0x0400 // Size: 1, Type: INT, Flags: PRIVATE PLAYER_SELF_RES_SPELL UNIT_END + 0x0401 // Size: 1, Type: INT, Flags: PRIVATE PLAYER_FIELD_PVP_MEDALS UNIT_END + 0x0402 // Size: 1, Type: INT, Flags: PRIVATE PLAYER_FIELD_BUYBACK_PRICE_1 UNIT_END + 0x0403 // Size: 12, Type: INT, Flags: PRIVATE PLAYER_FIELD_BUYBACK_TIMESTAMP_1 UNIT_END + 0x040F // Size: 12, Type: INT, Flags: PRIVATE PLAYER_FIELD_KILLS UNIT_END + 0x041B // Size: 1, Type: TWO_SHORT, Flags: PRIVATE PLAYER_FIELD_TODAY_CONTRIBUTION UNIT_END + 0x041C // Size: 1, Type: INT, Flags: PRIVATE PLAYER_FIELD_YESTERDAY_CONTRIBUTION UNIT_END + 0x041D // Size: 1, Type: INT, Flags: PRIVATE PLAYER_FIELD_LIFETIME_HONORBALE_KILLS UNIT_END + 0x041E // Size: 1, Type: INT, Flags: PRIVATE PLAYER_FIELD_BYTES2 UNIT_END + 0x041F // Size: 1, Type: 6, Flags: PRIVATE PLAYER_FIELD_WATCHED_FACTION_INDEX UNIT_END + 0x0420 // Size: 1, Type: INT, Flags: PRIVATE PLAYER_FIELD_COMBAT_RATING_1 UNIT_END + 0x0421 // Size: 25, Type: INT, Flags: PRIVATE PLAYER_FIELD_ARENA_TEAM_INFO_1_1 UNIT_END + 0x043A // Size: 21, Type: INT, Flags: PRIVATE PLAYER_FIELD_HONOR_CURRENCY UNIT_END + 0x044F // Size: 1, Type: INT, Flags: PRIVATE PLAYER_FIELD_ARENA_CURRENCY UNIT_END + 0x0450 // Size: 1, Type: INT, Flags: PRIVATE PLAYER_FIELD_MAX_LEVEL UNIT_END + 0x0451 // Size: 1, Type: INT, Flags: PRIVATE PLAYER_FIELD_DAILY_QUESTS_1 UNIT_END + 0x0452 // Size: 25, Type: INT, Flags: PRIVATE PLAYER_RUNE_REGEN_1 UNIT_END + 0x046B // Size: 4, Type: FLOAT, Flags: PRIVATE PLAYER_NO_REAGENT_COST_1 UNIT_END + 0x046F // Size: 3, Type: INT, Flags: PRIVATE PLAYER_FIELD_GLYPH_SLOTS_1 UNIT_END + 0x0472 // Size: 6, Type: INT, Flags: PRIVATE PLAYER_FIELD_GLYPHS_1 UNIT_END + 0x0478 // Size: 6, Type: INT, Flags: PRIVATE PLAYER_GLYPHS_ENABLED UNIT_END + 0x047E // Size: 1, Type: INT, Flags: PRIVATE PLAYER_FIELD_PADDING UNIT_END + 0x047F // Size: 1, Type: INT, Flags: NONE PLAYER_END UNIT_END + 0x0480 //GameObjectFields OBJECT_FIELD_CREATED_BY OBJECT_END + 0x0000 // Size: 2, Type: LONG, Flags: PUBLIC GAMEOBJECT_DISPLAYID OBJECT_END + 0x0002 // Size: 1, Type: INT, Flags: PUBLIC GAMEOBJECT_FLAGS OBJECT_END + 0x0003 // Size: 1, Type: INT, Flags: PUBLIC GAMEOBJECT_PARENTROTATION OBJECT_END + 0x0004 // Size: 4, Type: FLOAT, Flags: PUBLIC GAMEOBJECT_DYNAMIC OBJECT_END + 0x0008 // Size: 1, Type: TWO_SHORT, Flags: DYNAMIC GAMEOBJECT_FACTION OBJECT_END + 0x0009 // Size: 1, Type: INT, Flags: PUBLIC GAMEOBJECT_LEVEL OBJECT_END + 0x000A // Size: 1, Type: INT, Flags: PUBLIC GAMEOBJECT_BYTES_1 OBJECT_END + 0x000B // Size: 1, Type: BYTES, Flags: PUBLIC GAMEOBJECT_END OBJECT_END + 0x000C //DynamicObjectFields DYNAMICOBJECT_CASTER OBJECT_END + 0x0000 // Size: 2, Type: LONG, Flags: PUBLIC DYNAMICOBJECT_BYTES OBJECT_END + 0x0002 // Size: 1, Type: BYTES, Flags: PUBLIC DYNAMICOBJECT_SPELLID OBJECT_END + 0x0003 // Size: 1, Type: INT, Flags: PUBLIC DYNAMICOBJECT_RADIUS OBJECT_END + 0x0004 // Size: 1, Type: FLOAT, Flags: PUBLIC DYNAMICOBJECT_CASTTIME OBJECT_END + 0x0005 // Size: 1, Type: INT, Flags: PUBLIC DYNAMICOBJECT_END OBJECT_END + 0x0006 //CorpseFields CORPSE_FIELD_OWNER OBJECT_END + 0x0000 // Size: 2, Type: LONG, Flags: PUBLIC CORPSE_FIELD_PARTY OBJECT_END + 0x0002 // Size: 2, Type: LONG, Flags: PUBLIC CORPSE_FIELD_DISPLAY_ID OBJECT_END + 0x0004 // Size: 1, Type: INT, Flags: PUBLIC CORPSE_FIELD_ITEM OBJECT_END + 0x0005 // Size: 19, Type: INT, Flags: PUBLIC CORPSE_FIELD_BYTES_1 OBJECT_END + 0x0018 // Size: 1, Type: BYTES, Flags: PUBLIC CORPSE_FIELD_BYTES_2 OBJECT_END + 0x0019 // Size: 1, Type: BYTES, Flags: PUBLIC CORPSE_FIELD_GUILD OBJECT_END + 0x001A // Size: 1, Type: INT, Flags: PUBLIC CORPSE_FIELD_FLAGS OBJECT_END + 0x001B // Size: 1, Type: INT, Flags: PUBLIC CORPSE_FIELD_DYNAMIC_FLAGS OBJECT_END + 0x001C // Size: 1, Type: INT, Flags: DYNAMIC CORPSE_FIELD_PAD OBJECT_END + 0x001D // Size: 1, Type: INT, Flags: NONE CORPSE_END OBJECT_END + 0x001E PLAYER_VISIBLE_ITEM_LENGTH 2 GAMEOBJECT_PARENTROTATION_01 OBJECT_END + 0x0005 // Size: 4, Type: FLOAT, Flags: PUBLIC GAMEOBJECT_PARENTROTATION_02 OBJECT_END + 0x0006 // Size: 4, Type: FLOAT, Flags: PUBLIC GAMEOBJECT_PARENTROTATION_03 OBJECT_END + 0x0007 // Size: 4, Type: FLOAT, Flags: PUBLIC CHAT_MSG_ADDON = -1, CHAT_MSG_SYSTEM = 0, //28, CHAT_MSG_SYSTEM = 0x00, 0 CHAT_MSG_SAY = 1, CHAT_MSG_PARTY = 2, CHAT_MSG_RAID = 3, CHAT_MSG_GUILD = 4, CHAT_MSG_OFFICER = 5, CHAT_MSG_YELL = 6, CHAT_MSG_WHISPER = 7, CHAT_MSG_WHISPER_MOB = 8,//CHAT_MSG_WHISPER_INFORM CHAT_MSG_WHISPER_INFORM = 9,//CHAT_MSG_REPLY CHAT_MSG_EMOTE = 10, CHAT_MSG_TEXT_EMOTE = 11, CHAT_MSG_MONSTER_SAY = 12, CHAT_MSG_MONSTER_PARTY = 13, CHAT_MSG_MONSTER_YELL = 14, CHAT_MSG_MONSTER_WHISPER = 15, CHAT_MSG_MONSTER_EMOTE = 16, CHAT_MSG_CHANNEL = 17, CHAT_MSG_CHANNEL_JOIN = 18, CHAT_MSG_CHANNEL_LEAVE = 19, CHAT_MSG_CHANNEL_LIST = 20, CHAT_MSG_CHANNEL_NOTICE = 21, CHAT_MSG_CHANNEL_NOTICE_USER = 22, CHAT_MSG_AFK = 23, CHAT_MSG_DND = 24, CHAT_MSG_IGNORED = 25, CHAT_MSG_SKILL = 26, CHAT_MSG_LOOT = 27, CHAT_MSG_MONEY = 28, CHAT_MSG_OPENING = 29, CHAT_MSG_TRADESKILLS = 30, CHAT_MSG_PET_INFO = 31, CHAT_MSG_COMBAT_MISC_INFO = 32, CHAT_MSG_COMBAT_XP_GAIN = 33, CHAT_MSG_COMBAT_HONOR_GAIN = 34, CHAT_MSG_COMBAT_FACTION_CHANGE = 35, CHAT_MSG_BG_EVENT_NEUTRAL = 36, CHAT_MSG_BG_EVENT_ALLIANCE = 37, CHAT_MSG_BG_EVENT_HORDE = 38, CHAT_MSG_RAID_LEADER = 39, CHAT_MSG_RAID_WARNING = 40, CHAT_MSG_RAID_WARNING_WIDESCREEN = 41, CHAT_MSG_RAID_BOSS_EMOTE = 42, CHAT_MSG_FILTERED = 43, CHAT_MSG_BATTLEGROUND = 44, CHAT_MSG_BATTLEGROUND_LEADER = 45, CHAT_MSG_RESTRICTED = 46, CHAT_MSG_ACHIEVEMENT = 48, CHAT_MSG_GUILD_ACHIEVEMENT = 49, LANG_UNIVERSAL = 0x00, LANG_ORCISH = 0x01, LANG_DARNASSIAN = 0x02, LANG_TAURAHE = 0x03, LANG_DWARVISH = 0x06, LANG_COMMON = 0x07, LANG_DEMONIC = 0x08, LANG_TITAN = 0x09, LANG_THELASSIAN = 0x0A, LANG_DRACONIC = 0x0B, LANG_KALIMAG = 0x0C, LANG_GNOMISH = 0x0D, LANG_TROLL = 0x0E, LANG_GUTTERSPEAK = 0x21, LANG_DRAENEI = 0x23, NUM_LANGUAGES = 0x24 MSG_COLOR_LIGHTRED "|cffff6060" MSG_COLOR_LIGHTBLUE "|cff00ccff" MSG_COLOR_TORQUISEBLUE "|cff00C78C" MSG_COLOR_SPRINGGREEN "|cff00FF7F" MSG_COLOR_GREENYELLOW "|cffADFF2F" MSG_COLOR_BLUE "|cff0000ff" MSG_COLOR_PURPLE "|cffDA70D6" MSG_COLOR_GREEN "|cff00ff00" MSG_COLOR_RED "|cffff0000" MSG_COLOR_GOLD "|cffffcc00" MSG_COLOR_GOLD2 "|cffFFC125" MSG_COLOR_GREY "|cff888888" MSG_COLOR_WHITE "|cffffffff" MSG_COLOR_SUBWHITE "|cffbbbbbb" MSG_COLOR_MAGENTA "|cffff00ff" MSG_COLOR_YELLOW "|cffffff00" MSG_COLOR_ORANGEY "|cffFF4500" MSG_COLOR_CHOCOLATE "|cffCD661D" MSG_COLOR_CYAN "|cff00ffff" MSG_COLOR_IVORY "|cff8B8B83" MSG_COLOR_LIGHTYELLOW "|cffFFFFE0" MSG_COLOR_SEXGREEN "|cff71C671" MSG_COLOR_SEXTEAL "|cff388E8E" MSG_COLOR_SEXPINK "|cffC67171" MSG_COLOR_SEXBLUE "|cff00E5EE" MSG_COLOR_SEXHOTPINK "|cffFF6EB4" ]]
agpl-3.0
hooksta4/darkstar
scripts/zones/zones/Garlaige_Citadel/npcs/Oaken_Box.lua
2
1666
----------------------------------- -- Area: Garlaige Citadel -- NPC: Oaken Box -- Involved In Quest: Peace for the Spirit -- @pos -164 0.1 225 200 ----------------------------------- package.loaded["scripts/zones/Garlaige_Citadel/TextIDs"] = nil; ----------------------------------- require("scripts/globals/settings"); require("scripts/globals/keyitems"); require("scripts/globals/quests"); require("scripts/zones/Garlaige_Citadel/TextIDs"); ----------------------------------- -- onTrade Action ----------------------------------- function onTrade(player,npc,trade) if (player:getQuestStatus(SANDORIA,PEACE_FOR_THE_SPIRIT) == QUEST_ACCEPTED) then if (trade:hasItemQty(1094,1) and trade:getItemCount() == 1) then -- Trade Nail Puller player:startEvent(0x000e); end end end; ----------------------------------- -- onTrigger Action ----------------------------------- function onTrigger(player,npc) if (player:getVar("peaceForTheSpiritCS") == 4 and player:hasItem(1094) == false) then -- Nail Puller player:messageSpecial(SENSE_OF_FOREBODING); SpawnMob(17596643,180):updateClaim(player); else player:messageSpecial(YOU_FIND_NOTHING); 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 == 0x000e) then player:tradeComplete(); player:setVar("peaceForTheSpiritCS",5); end end;
gpl-3.0
hooksta4/darkstar
scripts/globals/items/mushroom_salad.lua
39
1426
----------------------------------------- -- ID: 5678 -- Item: Mushroom Salad -- Food Effect: 3 Hrs, All Races ----------------------------------------- -- MP 14% Cap 85 -- Agility 6 -- Mind 6 -- Strength -5 -- Vitality -5 ----------------------------------------- require("scripts/globals/status"); ----------------------------------------- -- OnItemCheck ----------------------------------------- function onItemCheck(target) result = 0; if (target:hasStatusEffect(EFFECT_FOOD)) then result = 246; end return result; end; ----------------------------------------- -- OnItemUse ----------------------------------------- function onItemUse(target) target:addStatusEffect(EFFECT_FOOD,0,0,10800,5678); end; ----------------------------------------- -- onEffectGain Action ----------------------------------------- function onEffectGain(target,effect) target:addMod(MOD_FOOD_MPP, 14); target:addMod(MOD_FOOD_MP_CAP, 85); target:addMod(MOD_AGI, 6); target:addMod(MOD_MND, 6); target:addMod(MOD_STR, -5); target:addMod(MOD_VIT, -5); end; ----------------------------------------- -- onEffectLose Action ----------------------------------------- function onEffectLose(target,effect) target:delMod(MOD_FOOD_MPP, 14); target:delMod(MOD_FOOD_MP_CAP, 85); target:delMod(MOD_AGI, 6); target:delMod(MOD_MND, 6); target:delMod(MOD_STR, -5); target:delMod(MOD_VIT, -5); end;
gpl-3.0
adiyoss/DeepVOT
back_end_old_structure/main.lua
1
4490
-- for debuing purposes require('mobdebug').start() require('torch') require('nn') require('rnn') require('optim') ---------------------------------------------------------------------- -- parse command line arguments if not opt then print '\n==> processing options' cmd = torch.CmdLine() cmd:text() cmd:text('Bi-Directional LSTM') cmd:text() cmd:text('Options:') -- for the data cmd:option('-data_type', 'multi', 'the type of the data: lm | dummy | vot | neg_vot | multi') cmd:option('-train', 'train.t7', 'the path to the train data') cmd:option('-test', 'test.t7', 'the path to the test data') cmd:option('-batch_size', 1, 'the mini-batch size') cmd:option('-input_dim', 63, 'the input size') cmd:option('-val_percentage', 0.15, 'the percentage of exampels to be considered as validation set from the training set') -- for the model cmd:option('-model_type', 'lstm', 'the type of model: bi-lm | bi-lstm | lstm') cmd:option('-output_dim', 4, 'the output size') cmd:option('-hidden_size', 100, 'the hidden layer size') cmd:option('-dropout', 0.8, 'dropout rate') -- for the loss cmd:option('-loss', 'nll', 'the type of loss function: nll') -- for the train cmd:option('-save', 'results/', 'subdirectory to save/log experiments in') cmd:option('-plot', true, 'live plot') cmd:option('-optimization', 'ADAGRAD', 'optimization method: ADAGRAD | SGD') cmd:option('-learningRate', 0.1, 'learning rate at t=0') -- for the main cmd:option('-rho', 10, 'max sequence length') cmd:option('-patience', 5, 'the number of epochs to be patient before early stopping') cmd:option('-seed', 1245, 'the starter seed, for randomness') cmd:option('-threads', 4, 'the number of threads') -- check this cmd:text() opt = cmd:parse(arg or {}) end ---------------------------------------------------------------------- torch.setnumthreads(opt.threads) torch.manualSeed(opt.seed) -- Log results to files trainLogger = optim.Logger(paths.concat(opt.save, 'train.log')) testLogger = optim.Logger(paths.concat(opt.save, 'test.log')) validationLogger = optim.Logger(paths.concat(opt.save, 'validate.log')) gradLogger = optim.Logger(paths.concat(opt.save, 'grad.log')) paramsLogger = io.open(paths.concat(opt.save, 'params.log'), 'w') -- save cmd parameters for key, value in pairs(opt) do paramsLogger:write(key .. ': ' .. tostring(value) .. '\n') end paramsLogger:close() dofile('data.lua') dofile('model.lua') dofile('loss.lua') dofile('train.lua') dofile('test.lua') dofile('validate.lua') local iteration = 1 local best_loss = 100000 local loss = 0 --[[ local train_balance = torch.sum(train_y-1)/train_y:size(1) local val_balance = torch.sum(val_y-1)/val_y:size(1) local test_balance = torch.sum(test_y-1)/test_y:size(1) ]]-- -- data statistics print('\n==> data statistics: ') print('==> number of training examples: ' .. #train_data) print('==> number of validation examples: ' .. #val_data) print('==> number of test examples: ' .. #test_data) --[[ print('\n==> training set balance: first label: ' .. train_balance .. ', second label: ' .. (1-train_balance)) print('==> validation set balance: first label: ' .. val_balance .. ', second label: ' .. (1-val_balance)) print('==> test set balance: first label: ' .. test_balance .. ', second label: ' .. (1-test_balance)) ]]-- -- gets the first loss on the validation set loss = validate(val_data) print('==> validation loss: ' .. loss) -- training while loss < best_loss or iteration < opt.patience do -- train - forward and backprop train(train_data) -- validate loss = validate(val_data) print('\n==> validation loss: ' .. loss) -- for early stopping criteria if loss >= best_loss then -- increase iteration number iteration = iteration + 1 print('\n========================================') print('==> Loss did not improved, iteration: ' .. iteration) print('========================================\n') else -- update the best loss value best_loss = loss -- save/log current net local filename = paths.concat(opt.save, 'model.net') os.execute('mkdir -p ' .. sys.dirname(filename)) print('==> saving model to '..filename) torch.save(filename, rnn) iteration = 1 end end -- evaluate on the test set local test_loss = test(test_data) print('\n============ EVALUATING ON TEST SET ============') print('Loss = ' .. test_loss .. '\n')
mit
gedadsbranch/Darkstar-Mission
scripts/zones/Bastok_Mines/npcs/Sodragamm.lua
38
1086
----------------------------------- -- Area: Bastok Mines -- NPC: Sodragamm -- Type: Item Deliverer -- @zone: 234 -- @pos -24.741 -1 -64.944 -- -- Auto-Script: Requires Verification (Verified by Brawndo) ----------------------------------- package.loaded["scripts/zones/Bastok_Mines/TextIDs"] = nil; require("scripts/zones/Bastok_Mines/TextIDs"); ----------------------------------- -- onTrade Action ----------------------------------- function onTrade(player,npc,trade) end; ----------------------------------- -- onTrigger Action ----------------------------------- function onTrigger(player,npc) player:showText(npc, ITEM_DELIVERY_DIALOG); player:openSendBox(); end; ----------------------------------- -- onEventUpdate ----------------------------------- function onEventUpdate(player,csid,option) -- printf("CSID: %u",csid); -- printf("RESULT: %u",option); end; ----------------------------------- -- onEventFinish ----------------------------------- function onEventFinish(player,csid,option) -- printf("CSID: %u",csid); -- printf("RESULT: %u",option); end;
gpl-3.0
hooksta4/darkstar
scripts/zones/Mine_Shaft_2716/bcnms/century_of_hardship.lua
1
1845
----------------------------------- -- Area: Mine_Shaft_2716 -- Name: century_of_hardship -- bcnmID : 736 -- inst 2 -54 -1 -100 -- inst 3 425 -121 -99 ----------------------------------- package.loaded["scripts/zones/Mine_Shaft_2716/TextIDs"] = nil; ----------------------------------- require("scripts/globals/missions"); require("scripts/zones/Mine_Shaft_2716/TextIDs"); -- After registering the BCNM via bcnmRegister(bcnmid) function onBcnmRegister(player,instance) end; -- Physically entering the BCNM via bcnmEnter(bcnmid) function onBcnmEnter(player,instance) end; -- Leaving the BCNM by every mean possible, given by the LeaveCode -- 1=Select Exit on circle -- 2=Winning the BC -- 3=Disconnected or warped out -- 4=Losing the BC -- via bcnmLeave(1) or bcnmLeave(2). LeaveCodes 3 and 4 are called -- from the core when a player disconnects or the time limit is up, etc function onBcnmLeave(player,instance,leavecode) if (leavecode == 2) then -- play end CS. Need time and battle id for record keeping + storage player:addCurrency("mweya_plasm",300); player:PrintToPlayer( "You earned 300 Mweya Plasm!"); if (player:getCurrentMission(COP) == THREE_PATHS and player:getVar("COP_Louverance_s_Path") == 5) then player:startEvent(0x7d01,1,1,1,instance:getTimeInside(),1,0,0); player:setVar("COP_Louverance_s_Path",6); else player:startEvent(0x7d01,1,1,1,instance:getTimeInside(),1,0,1); end elseif (leavecode == 4) then player:startEvent(0x7d02); end end; function onEventUpdate(player,csid,option) -- print("bc update csid "..csid.." and option "..option); end; function onEventFinish(player,csid,option) -- print("bc finish csid "..csid.." and option "..option); if (csid == 0x7d01) then player:addExp(1000); end end;
gpl-3.0
p5n/notion
ioncore/ioncore_tabnum.lua
7
1322
-- -- ion/share/ioncore_tabnum.lua -- Ioncore tab numbering support -- -- Copyright (c) Tuomo Valkonen 2007-2009. -- -- See the included file LICENSE for details. -- ioncore.tabnum={} local framestate={} local function do_show(frame) if obj_exists(frame) then frame:set_grattr('numbered', 'set') framestate[frame]='set' else framestate[frame]=nil end end --DOC -- Show tab numbers on \var{frame}, clearing them when submap -- grab is released the next time. If \var{delay} is given, in -- milliseconds, the numbers are not actually displayed until this -- time has passed. function ioncore.tabnum.show(frame, delay) if delay and delay>0 then local tmr=ioncore.create_timer() framestate[frame]=tmr tmr:set(delay, function() do_show(frame) end) else do_show(frame) end end --DOC -- Clear all tab numbers set by \fnref{ioncore.tabnum.show}. function ioncore.tabnum.clear() local st=framestate framestate={} for f, s in pairs(st) do if s=='set' then if obj_exists(f) then f:set_grattr('numbered', 'unset') end elseif obj_is(s, "WTimer") then s:reset() end end end ioncore.get_hook("ioncore_submap_ungrab_hook") :add(ioncore.tabnum.clear)
lgpl-2.1
hooksta4/darkstar
scripts/zones/zones/Korroloka_Tunnel/npcs/qm1.lua
1
1102
----------------------------------- -- Area: Korroloka Tunnel -- NPC: ??? (qm1) - Morion Worm spawn -- @pos 254.652 -6.039 20.878 173 ----------------------------------- package.loaded["scripts/zones/Korroloka_Tunnel/TextIDs"] = nil; ----------------------------------- require("scripts/zones/Korroloka_Tunnel/TextIDs"); ----------------------------------- -- onSpawn Action ----------------------------------- function onSpawn(npc) end; ----------------------------------- -- onTrade Action ----------------------------------- function onTrade(player,npc,trade) local x = npc:getXPos(); local y = npc:getYPos(); local z = npc:getZPos(); local mob = GetMobByID(17486190); -- Trade Darksteel ore if (GetMobAction(17486190) == 0 and trade:hasItemQty(643,1) and trade:getItemCount() == 1) then player:tradeComplete(); SpawnMob(17486190,1800):updateClaim(player); -- Morion Worm mob:setPos(x+1,y,z); end end; ----------------------------------- -- onTrigger Action ----------------------------------- function onTrigger(player,npc) player:messageSpecial(MORION_WORM_1); end;
gpl-3.0
hooksta4/darkstar
scripts/zones/Davoi/npcs/_45g.lua
19
2043
----------------------------------- -- Area: Davoi -- NPC: Groaning Pond -- Used In Quest: Whence Blows the Wind -- @pos 101 0.1 60 149 ----------------------------------- package.loaded["scripts/zones/Davoi/TextIDs"] = nil; ----------------------------------- require("scripts/globals/settings"); require("scripts/globals/keyitems"); require("scripts/zones/Davoi/TextIDs"); ----------------------------------- -- onTrade Action ----------------------------------- function onTrade(player,npc,trade) end; ----------------------------------- -- onTrigger Action ----------------------------------- function onTrigger(player,npc) player:startEvent(0x0032); 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 == 0x0032 and player:getVar("miniQuestForORB_CS") == 1) then local c = player:getVar("countRedPoolForORB"); if (c == 0) then player:setVar("countRedPoolForORB", c + 8); player:delKeyItem(WHITE_ORB); player:addKeyItem(PINK_ORB); player:messageSpecial(KEYITEM_OBTAINED, PINK_ORB); elseif (c == 1 or c == 2 or c == 4) then player:setVar("countRedPoolForORB", c + 8); player:delKeyItem(PINK_ORB); player:addKeyItem(RED_ORB); player:messageSpecial(KEYITEM_OBTAINED, RED_ORB); elseif (c == 3 or c == 5 or c == 6) then player:setVar("countRedPoolForORB", c + 8); player:delKeyItem(RED_ORB); player:addKeyItem(BLOOD_ORB); player:messageSpecial(KEYITEM_OBTAINED, BLOOD_ORB); elseif (c == 7) then player:setVar("countRedPoolForORB", c + 8); player:delKeyItem(BLOOD_ORB); player:addKeyItem(CURSED_ORB); player:messageSpecial(KEYITEM_OBTAINED, CURSED_ORB); player:addStatusEffect(EFFECT_PLAGUE,0,0,900); end end end;
gpl-3.0
hooksta4/darkstar
scripts/zones/zones/Southern_San_dOria/npcs/Pourette.lua
2
2136
----------------------------------- -- Area: Southern San d'Oria -- NPC: Pourette -- Only sells when San d'Oria controlls Derfland Region ----------------------------------- package.loaded["scripts/zones/Southern_San_dOria/TextIDs"] = nil; ----------------------------------- require("scripts/globals/events/harvest_festivals"); require("scripts/globals/settings"); require("scripts/globals/shop"); require("scripts/globals/quests"); require("scripts/globals/conquest"); require("scripts/zones/Southern_San_dOria/TextIDs"); ----------------------------------- -- onTrade Action ----------------------------------- function onTrade(player,npc,trade) -- "Flyers for Regine" conditional script if (player:getQuestStatus(SANDORIA,FLYERS_FOR_REGINE) == 1) then if (trade:hasItemQty(532,1) == true and trade:getItemCount() == 1) then player:messageSpecial(FLYER_REFUSED); end else onHalloweenTrade(player,trade,npc); end end; ----------------------------------- -- onTrigger Action ----------------------------------- function onTrigger(player,npc) RegionOwner = GetRegionOwner(DERFLAND); if (RegionOwner ~= SANDORIA) then player:showText(npc,POURETTE_CLOSED_DIALOG); else player:showText(npc,POURETTE_OPEN_DIALOG); stock = {0x1100,128, --Derfland Pear 0x0269,142, --Ginger 0x11c1,62, --Gysahl Greens 0x0584,1656, --Olive Flower 0x0279,14, --Olive Oil 0x03b7,110} --Wijnruit showShop(player,SANDORIA,stock); end end; ----------------------------------- -- onEventUpdate ----------------------------------- function onEventUpdate(player,csid,option) --printf("CSID: %u",csid); --printf("RESULT: %u",option); end; ----------------------------------- -- onEventFinish ----------------------------------- function onEventFinish(player,csid,option) --printf("CSID: %u",csid); --printf("RESULT: %u",option); end;
gpl-3.0
gedadsbranch/Darkstar-Mission
scripts/globals/abilities/pets/sand_breath.lua
6
1257
--------------------------------------------------- -- Sand Breath --------------------------------------------------- require("/scripts/globals/settings"); require("/scripts/globals/status"); require("/scripts/globals/monstertpmoves"); --------------------------------------------------- function onAbilityCheck(player, target, ability) return 0,0; end; function onPetAbility(target, pet, skill, master) ---------- Deep Breathing ---------- -- 0 for none -- 1 for first merit -- 0.25 for each merit after the first -- TODO: 0.1 per merit for augmented AF2 (10663 *w/ augment*) local deep = 1; if (pet:hasStatusEffect(EFFECT_MAGIC_ATK_BOOST) == true) then deep = deep + 1 + (master:getMerit(MERIT_DEEP_BREATHING)-1)*0.25; pet:delStatusEffect(EFFECT_MAGIC_ATK_BOOST); end local gear = master:getMod(MOD_WYVERN_BREATH)/256; -- Master gear that enhances breath local dmgmod = MobBreathMove(pet, target, 0.185, pet:getMainLvl()*15, ELE_EARTH); -- Works out to (hp/6) + 15, as desired dmgmod = (dmgmod * (1+gear))*deep; local dmg = MobFinalAdjustments(dmgmod,pet,skill,target,MOBSKILL_MAGICAL,MOBPARAM_EARTH,MOBPARAM_IGNORE_SHADOWS); target:delHP(dmg); return dmg; end
gpl-3.0
hooksta4/darkstar
scripts/zones/Caedarva_Mire/npcs/Nasheefa.lua
19
1384
----------------------------------- -- Area: Caedarva Mire -- NPC: Nasheefa -- Type: Alzadaal Undersea Ruins -- @pos -440.998 0.107 -740.015 79 ----------------------------------- package.loaded["scripts/zones/Caedarva_Mire/TextIDs"] = nil; ----------------------------------- require("scripts/globals/keyitems"); require("scripts/zones/Caedarva_Mire/TextIDs"); ----------------------------------- -- onTrade Action ----------------------------------- function onTrade(player,npc,trade) if (trade:getItemCount() == 1 and trade:hasItemQty(2185,1)) then -- Silver player:tradeComplete(); player:startEvent(0x00b7); end end; ----------------------------------- -- onTrigger Action ----------------------------------- function onTrigger(player,npc) if (player:getXPos() < -440) then player:startEvent(0x00be); else player:startEvent(0x00b6); 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 == 0x00b7) then player:setPos(-219.977,-4,474.522,64,72); -- To Alzadaal Undersea Ruins {R} end end;
gpl-3.0
hooksta4/darkstar
scripts/zones/Windurst_Walls/npcs/Scavnix.lua
2
1180
----------------------------------- -- Area: Windurst Walls -- NPC: Scavnix -- Standard merchant, though he acts like a guild merchant -- @pos 17.731 0.106 239.626 239 ----------------------------------- package.loaded["scripts/zones/Windurst_Walls/TextIDs"] = nil; ----------------------------------- require("scripts/globals/settings"); require("scripts/globals/shop"); require("scripts/zones/Windurst_Walls/TextIDs"); ----------------------------------- -- onTrade Action ----------------------------------- function onTrade(player,npc,trade) end; ----------------------------------- -- onTrigger Action ----------------------------------- function onTrigger(player,npc) if (player:sendGuild(60418,11,22,6)) then player:showText(npc,SCAVNIX_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
moto-timo/vlc
share/lua/intf/dumpmeta.lua
98
2125
--[==========================================================================[ dumpmeta.lua: dump a file's meta data on stdout/stderr --[==========================================================================[ Copyright (C) 2010 the VideoLAN team $Id$ Authors: Antoine Cellerier <dionoea at videolan dot org> This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA. --]==========================================================================] --[[ to dump meta data information in the debug output, run: vlc -I luaintf --lua-intf dumpmeta coolmusic.mp3 Additional options can improve performance and output readability: -V dummy -A dummy --no-video-title --no-media-library -q --]] local item repeat item = vlc.input.item() until (item and item:is_preparsed()) -- preparsing doesn't always provide all the information we want (like duration) repeat until item:stats()["demux_read_bytes"] > 0 vlc.msg.info("name: "..item:name()) vlc.msg.info("uri: "..vlc.strings.decode_uri(item:uri())) vlc.msg.info("duration: "..tostring(item:duration())) vlc.msg.info("meta data:") local meta = item:metas() if meta then for key, value in pairs(meta) do vlc.msg.info(" "..key..": "..value) end else vlc.msg.info(" no meta data available") end vlc.msg.info("info:") for cat, data in pairs(item:info()) do vlc.msg.info(" "..cat) for key, value in pairs(data) do vlc.msg.info(" "..key..": "..value) end end vlc.misc.quit()
gpl-2.0
Erotix8210/FrozenCore
src/scripts/lua/LuaBridge/AUCHINDOUN/MANA_TOMBS/shaffar.lua
13
4734
--?!MAP=557 assert( include("manatombs.lua") , "Failed to load manatombs.lua") local mod = require("DUNGEON_AUCHINDOUN.INSTANCE_MANATOMBS") assert(mod) module(mod._NAME..".SHAFFAR",package.seeall) local self = getfenv(1) WorldDBQuery("DELETE FROM ai_agents WHERE entry = 18344;") function OnSpawn(unit) for i = 1,3 do unit:FullCastSpell(32371) end end function OnCombat(unit,_,mAggro) self[tostring(unit)] = { fireball = math.random(2,5), frostbolt = math.random(2,5), blink = math.random(20,30), beacon_spawn = 10, isHeroic = (mAggro:isPlayer() and TO_PLAYER(mAggro):IsHeroic() ) } local allies = unit:getFriendlyCreatures() for _,v in pairs(allies) do if(v:GetEntry() == 18431) then v:getAI():AttackReaction(mAggro,1,0) end end local say_text = math.random(3) if(say_text == 1) then unit:MonsterYell("We have not yet been properly introduced.") unit:PlaySoundToSet(10541) elseif(say_text == 2) then unit:MonsterYell("An epic battle. How exciting!") unit:PlaySoundToSet(10542) else unit:MonsterYell("I have longed for a good adventure!") unit:PlaySoundToSet(10543) end unit:RegisterAIUpdateEvent(1000) end function OnWipe(unit) unit:RemoveAIUpdateEvent() self[tostring(unit)] = nil end function OnTargetKill(unit) local say_text = math.random() if(say_text) then unit:MonsterYell("It has been... entertaining.") unit:PlaySoundToSet(10544) else unit:MonsterYell("And now we part company.") unit:PlaySoundToSet(10545) end end function OnDeath(unit) unit:MonsterYell("I must bid you... farewell.") unit:PlaySoundToSet(10546) end function AIUpdate(unit) if(unit:GetNextTarget() == nil) then unit:WipeThreatList() end local args = self[tostring(unit)] args.fireball = args.fireball -1 args.frostbolt = args.frostbolt -1 args.blink = args.blink -1 args.beacon_spawn = args.beacon_spawn - 1 if(unit:IsCasting() ) then return end if(args.beacon_spawn <= 0) then unit:FullCastSpell(32371) local say_chance = math.random() if(say_chance) then unit:MonsterYell("I have such fascinating things to show you.") unit:PlaySoundToSet(10540) end if(args.isHeroic) then args.beacon_spawn = math.random(5,8) else args.beacon_spawn = 10 end elseif(args.blink <=0) then unit:FullCastSpell(32365) unit:FullCastSpell(33546) args.blink = math.random(25,35) elseif(args.frostbolt <= 0) then local target = unit:GetRandomEnemy() unit:FullCastSpellOnTarget(target, 32370) args.frostbolt = math.random(7,15) elseif(args.fireball <= 0) then local target = unit:GetRandomEnemy() unit:FullCastSpellOnTarget(target, 20420) args.fireball = math.random(7,15) end end RegisterUnitEvent(18344,1,OnCombat) RegisterUnitEvent(18344,2,OnWipe) RegisterUnitEvent(18344,3,OnTargetKill) RegisterUnitEvent(18344,4,OnDeath) RegisterUnitEvent(18344,21,AIUpdate) --[[ BEACON AI ]] function BeaconOnSpawn(unit) local creator = unit:findLocalCreature(18344) unit:SetCreatedBy(creator) if(creator.CombatStatus:IsInCombat() == false) then return end local target = unit:GetRandomEnemy() unit:getAI():AttackReaction(target,1,0) end function BeaconOnCombat(unit) local creator = TO_CREATURE(unit:GetCreatedBy() ) unit:RegisterEvent(ArcaneBolt,2500,0) if(self[tostring(creator)].isHeroic) then unit:RegisterEvent(SummonApprentice,10000,1) else unit:RegisterEvent(SummonApprentice,20000,1) end end function BeaconOnWipe(unit) unit:RemoveEvents() end function ArcaneBolt(unit) local target = unit:GetRandomEnemy() unit:FullCastSpellOnTarget(target, 15254) end function SummonApprentice(unit) local prince = TO_CREATURE(unit:GetCreatedBy() ) prince:FullCastSpell(32372) unit:getAI():WipeThreatList() unit:Despawn(0,0) end RegisterUnitEvent(18431,18,BeaconOnSpawn) RegisterUnitEvent(18431,1,BeaconOnCombat) RegisterUnitEvent(18431,2,BeaconOnWipe) function ApprenticeOnSpawn(unit) local creator = unit:findLocalCreature(18344) local target = creator:getAI():getNextTarget() unit:AttackReaction(target,1,0) end function ApprenticeOnCombat(unit) unit:RegisterEvent(ApprenticeSpells,5000,0) end function ApprenticeOnWipe(unit) unit:RemoveEvents() local creator = unit:GetCreatedBy() if(creator) then unit:SetUnitToFollow(creator,5,(45/180)*math.pi) end end function ApprenticeSpells(unit) if(unit:GetNextTarget() == nil) then unit:getAI():WipeHateList() end if(unit:IsCasting() ) then return end local spelltocast = math.random() local target = unit:GetRandomEnemy() if(spelltocast) then unit:FullCastSpellOnTarget(target, 32369) else unit:FullCastSpellOnTarget(target, 32370) end end RegisterUnitEvent(18430,18,ApprenticeOnSpawn) RegisterUnitEvent(18430,1,ApprenticeOnCombat) RegisterUnitEvent(18430,2,ApprenticeOnWipe)
agpl-3.0
hooksta4/darkstar
scripts/globals/items/anthos_xiphos.lua
41
1078
----------------------------------------- -- ID: 17750 -- Item: Anthos Xiphos -- Additional Effect: Water Damage ----------------------------------------- require("scripts/globals/status"); require("scripts/globals/magic"); ----------------------------------- -- onAdditionalEffect Action ----------------------------------- function onAdditionalEffect(player,target,damage) local chance = 10; if (math.random(0,99) >= chance) then return 0,0,0; else local dmg = math.random(4,11); local params = {}; params.bonusmab = 0; params.includemab = false; dmg = addBonusesAbility(player, ELE_WATER, target, dmg, params); dmg = dmg * applyResistanceAddEffect(player,target,ELE_WATER,0); dmg = adjustForTarget(target,dmg,ELE_WATER); dmg = finalMagicNonSpellAdjustments(player,target,ELE_WATER,dmg); local message = MSGBASIC_ADD_EFFECT_DMG; if (dmg < 0) then message = MSGBASIC_ADD_EFFECT_HEAL; end return SUBEFFECT_WATER_DAMAGE,message,dmg; end end;
gpl-3.0
gedadsbranch/Darkstar-Mission
scripts/globals/items/serving_of_cilbir.lua
35
1562
----------------------------------------- -- ID: 5642 -- Item: serving_of_cilbir -- Food Effect: 3Hrs, All Races ----------------------------------------- -- HP % 5 -- MP % 5 -- HP recovered while healing 3 -- MP recovered while healing 3 ----------------------------------------- require("scripts/globals/status"); ----------------------------------------- -- OnItemCheck ----------------------------------------- function onItemCheck(target) local result = 0; if (target:hasStatusEffect(EFFECT_FOOD) == true or target:hasStatusEffect(EFFECT_FIELD_SUPPORT_FOOD) == true) then result = 246; end return result; end; ----------------------------------------- -- OnItemUse ----------------------------------------- function onItemUse(target) target:addStatusEffect(EFFECT_FOOD,0,0,10800,5642); end; ----------------------------------- -- onEffectGain Action ----------------------------------- function onEffectGain(target,effect) target:addMod(MOD_FOOD_HPP, 5); target:addMod(MOD_FOOD_HP_CAP, 999); target:addMod(MOD_FOOD_MPP, 5); target:addMod(MOD_FOOD_MP_CAP, 999); target:addMod(MOD_MPHEAL, 3); target:addMod(MOD_HPHEAL, 3); end; ----------------------------------------- -- onEffectLose Action ----------------------------------------- function onEffectLose(target,effect) target:delMod(MOD_FOOD_HPP, 5); target:delMod(MOD_FOOD_HP_CAP, 999); target:delMod(MOD_FOOD_MPP, 5); target:delMod(MOD_FOOD_MP_CAP, 999); target:delMod(MOD_MPHEAL, 3); target:delMod(MOD_HPHEAL, 3); end;
gpl-3.0
hooksta4/darkstar
scripts/globals/abilities/wild_flourish.lua
28
2168
----------------------------------- -- Ability: Wild Flourish -- Readies target for a skillchain. Requires at least two Finishing Moves. -- Obtained: Dancer Level 60 -- Finishing Moves Used: 2 -- Recast Time: 0:30 -- Duration: 0:05 ----------------------------------- 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_FINISHING_MOVE_1)) then return MSGBASIC_NO_FINISHINGMOVES,0; elseif (player:hasStatusEffect(EFFECT_FINISHING_MOVE_2)) then player:delStatusEffect(EFFECT_FINISHING_MOVE_2); return 0,0; elseif (player:hasStatusEffect(EFFECT_FINISHING_MOVE_3)) then player:delStatusEffectSilent(EFFECT_FINISHING_MOVE_3); player:addStatusEffect(EFFECT_FINISHING_MOVE_1,1,0,7200); return 0,0; elseif (player:hasStatusEffect(EFFECT_FINISHING_MOVE_4)) then player:delStatusEffectSilent(EFFECT_FINISHING_MOVE_4); player:addStatusEffect(EFFECT_FINISHING_MOVE_2,1,0,7200); return 0,0; elseif (player:hasStatusEffect(EFFECT_FINISHING_MOVE_5)) then player:delStatusEffectSilent(EFFECT_FINISHING_MOVE_5); player:addStatusEffect(EFFECT_FINISHING_MOVE_3,1,0,7200); return 0,0; else return MSGBASIC_NO_FINISHINGMOVES,0; end end end; ----------------------------------- -- onUseAbility ----------------------------------- function onUseAbility(player,target,ability) if (not target:hasStatusEffect(EFFECT_CHAINBOUND, 0) and not target:hasStatusEffect(EFFECT_SKILLCHAIN, 0)) then target:addStatusEffectEx(EFFECT_CHAINBOUND, 0, 1, 0, 5, 0, 1); else ability:setMsg(156); end return 0, getFlourishAnimation(player:getWeaponSkillType(SLOT_MAIN)), 1; end;
gpl-3.0
hooksta4/darkstar
scripts/zones/Kazham/npcs/Ghemi_Sinterilo.lua
6
1332
----------------------------------- -- Area: Kazham -- NPC: Ghemi Senterilo -- Standard Merchant NPC ----------------------------------- require("scripts/globals/shop"); package.loaded["scripts/zones/Kazham/TextIDs"] = nil; require("scripts/zones/Kazham/TextIDs"); ----------------------------------- -- onTrade Action ----------------------------------- function onTrade(player,npc,trade) end; ----------------------------------- -- onTrigger Action ----------------------------------- function onTrigger(player,npc) player:showText(npc,GHEMISENTERILO_SHOP_DIALOG); stock = {0x1174,72, -- Pamamas 0x1150,54, -- Kazham Pineapple 0x1126,36, -- Mithran Tomato 0x0264,54, -- Kazham Peppers 0x0274,236, -- Cinnamon 0x0278,109, -- Kukuru Bean 0x1443,156, -- Elshimo Coconut 0x15E4,154, -- Elshimo Pachira Fruit 0x0b35,9100, -- Kazham Waystone 0x02DB,2877} -- Aquilaria Log showShop(player, STATIC, stock); end; ----------------------------------- -- onEventUpdate ----------------------------------- function onEventUpdate(player,csid,option) --printf("CSID: %u",csid); --printf("RESULT: %u",option); end; ----------------------------------- -- onEventFinish ----------------------------------- function onEventFinish(player,csid,option) --printf("CSID: %u",csid); --printf("RESULT: %u",option); end;
gpl-3.0
gedadsbranch/Darkstar-Mission
scripts/zones/Dynamis-Xarcabard/bcnms/dynamis_xarcabard.lua
10
1179
----------------------------------- -- Area: Dynamis Xarcabard -- Name: Dynamis Xarcabard ----------------------------------- -- After registering the BCNM via bcnmRegister(bcnmid) function onBcnmRegister(player,instance) SetServerVariable("[DynaXarcabard]UniqueID",player:getDynamisUniqueID(1285)); SetServerVariable("[DynaXarcabard]TE150_Trigger",0); SetServerVariable("[DynaXarcabard]Boss_Trigger",0); end; -- Physically entering the BCNM via bcnmEnter(bcnmid) function onBcnmEnter(player,instance) player:setVar("DynamisID",GetServerVariable("[DynaXarcabard]UniqueID")); local realDay = os.time(); local dynaWaitxDay = player:getVar("dynaWaitxDay"); if ((dynaWaitxDay + (BETWEEN_2DYNA_WAIT_TIME * 24 * 60 * 60)) < realDay) then player:setVar("dynaWaitxDay",realDay); end end; -- Leaving the Dynamis by every mean possible, given by the LeaveCode -- 3=Disconnected or warped out (if dyna is empty: launch 4 after 3) -- 4=Finish he dynamis function onBcnmLeave(player,instance,leavecode) --print("leave code "..leavecode); if(leavecode == 4) then GetNPCByID(17330778):setStatus(2); SetServerVariable("[DynaXarcabard]UniqueID",0); end end;
gpl-3.0
hooksta4/darkstar
scripts/globals/items/rarab_tail.lua
35
1193
----------------------------------------- -- ID: 4444 -- Item: rarab_tail -- Food Effect: 5Min, All Races ----------------------------------------- -- Agility 1 -- Vitality -3 ----------------------------------------- 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,4444); end; ----------------------------------- -- onEffectGain Action ----------------------------------- function onEffectGain(target,effect) target:addMod(MOD_AGI, 1); target:addMod(MOD_VIT, -3); end; ----------------------------------------- -- onEffectLose Action ----------------------------------------- function onEffectLose(target,effect) target:delMod(MOD_AGI, 1); target:delMod(MOD_VIT, -3); end;
gpl-3.0
gflima/nclua
examples/www/http_get.lua
1
3439
--[[ Copyright (C) 2013-2018 PUC-Rio/Laboratorio TeleMidia This file is part of NCLua. NCLua is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 2 of the License, or (at your option) any later version. NCLua is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with NCLua. If not, see <https://www.gnu.org/licenses/>. ]]-- -- Written by Guilherme F. Lima. -- TODO: Add support to re-entrant http.get() calls. local http = {} local assert = assert local pairs = pairs local tonumber = tonumber local tcp = require ('tcp') _ENV = nil local function normalize (s) return s:gsub ('\r', '') end local function clamp (x, min, max) if x < min then return min end if x > max then return max end return x end local function http_get_request_string (server, path, headers, body) local s = ('GET %s HTTP/1.1\nHost: %s'):format (path, server) for k,v in pairs (headers or {}) do k = k:gsub ('[\r\n]', '') v = v:gsub ('[\r\n', '') s = s .. ('%s: %s\n'):format (k, v) end return s .. '\n\n' .. (body or '') end function http.get (uri, headers, body, callback) local schema, server, path = uri:match ('^(%w+://)(.-)(/.*)$') tcp.execute ( function () local status local errmsg assert (schema == 'http://', ("unsupported schema '%s'"):format (schema)) -- Connect to server. status, errmsg = tcp.connect (server, 80, 5) if status == false then return callback (status, errmsg) end -- Send request. local req = http_get_request_string (server, path) status, errmsg = tcp.send (req) if status == false then return callback (status, errmsg) end -- Collect response header. local buf = '' local init, i, j, tries = 1, nil, nil, 50 repeat local s, errmsg = tcp.receive () if status == false then return callback (s, errmsg) end buf = buf .. s i, j = buf:find ('\r\n\r\n', init, true) tries = tries - 1 init = init - 2 if init < 1 then init = 1 end until (i ~= nil and j ~= nil) or tries == 0 if tries == 0 then return callback (false, 'cannot find end of HTTP header') end local header = assert (normalize (buf:sub (1, i - 1))) local body = assert (normalize (buf:sub (j + 1))) -- Collect body local length = tonumber (buf:match ('Content%-Length:%s*(%d+)')) if length <= 0 then return callback (true, uri, header, '') end while #body < length do local s, errmsg = tcp.receive () if s == false then return callback (s, errmsg) end body = body .. normalize (s) end body = body:sub (1, length) -- trim tcp.disconnect () return callback (true, uri, header, body) end ) end return http
gpl-2.0
prosody-modules/import2
mod_couchdb/couchdb/couchapi.lib.lua
32
2213
local setmetatable = setmetatable; local pcall = pcall; local type = type; local t_concat = table.concat; local print = print; local socket_url = require "socket.url"; local http = require "socket.http"; local ltn12 = require "ltn12"; --local json = require "json"; local json = module:require("couchdb/json"); --module("couchdb") local _M = {}; local function urlcat(url, path) return url:gsub("/*$", "").."/"..path:gsub("^/*", ""); end local doc_mt = {}; doc_mt.__index = doc_mt; function doc_mt:get() return self.db:get(socket_url.escape(self.id)); end function doc_mt:put(val) return self.db:put(socket_url.escape(self.id), val); end function doc_mt:__tostring() return "couchdb.doc("..self.url..")"; end local db_mt = {}; db_mt.__index = db_mt; function db_mt:__tostring() return "couchdb.db("..self.url..")"; end function db_mt:doc(id) local url = urlcat(self.url, socket_url.escape(id)); return setmetatable({ url = url, db = self, id = id }, doc_mt); end function db_mt:get(id) local url = urlcat(self.url, id); local a,b = http.request(url); local r,x = pcall(json.decode, a); if r then a = x; end return a,b; end function db_mt:put(id, value) local url = urlcat(self.url, id); if type(value) == "table" then value = json.encode(value); elseif value ~= nil and type(value) ~= "string" then return nil, "Invalid type"; end local t = {}; local a,b = http.request { url = url, sink = ltn12.sink.table(t), source = ltn12.source.string(value), method = "PUT", headers = { ["Content-Length"] = #value, ["Content-Type"] = "application/json" } }; a = t_concat(t); local r,x = pcall(json.decode, a); if r then a = x; end return a,b; end local server_mt = {}; server_mt.__index = server_mt; function server_mt:db(name) local url = urlcat(self.url, socket_url.escape(name)); return setmetatable({ url = url }, db_mt); end function server_mt:__tostring() return "couchdb.server("..self.url..")"; end function _M.server(url) return setmetatable({ url = url }, server_mt); end function _M.db(url) return setmetatable({ url = url }, db_mt); end return _M;
mit
hooksta4/darkstar
scripts/zones/zones/Ifrits_Cauldron/npcs/Mining_Point.lua
2
1060
----------------------------------- -- Area: Ifrits Cauldron -- NPC: Mining Point ----------------------------------- package.loaded["scripts/zones/Ifrits_Cauldron/TextIDs"] = nil; ------------------------------------- require("scripts/globals/mining"); require("scripts/zones/Ifrits_Cauldron/TextIDs"); ----------------------------------- -- onTrade ----------------------------------- function onTrade(player,npc,trade) startMining(player,player:getZoneID(),npc,trade,0x0014); end; ----------------------------------- -- onTrigger ----------------------------------- function onTrigger(player,npc) player:messageSpecial(MINING_IS_POSSIBLE_HERE,605); end; ----------------------------------- -- onEventUpdate ----------------------------------- function onEventUpdate(player,csid,option) --printf("CSID: %u",csid); --printf("RESULT: %u",option); end; ----------------------------------- -- onEventFinish ----------------------------------- function onEventFinish(player,csid,option) --printf("CSID: %u",csid); --printf("RESULT: %u",option); end;
gpl-3.0
warrenseine/premake
tests/actions/vstudio/vc200x/test_external_compiler.lua
1
1684
-- -- tests/actions/vstudio/vc200x/test_external_compiler.lua -- Validate generation the VCCLCompiler element for external tools in VS 200x C/C++ projects. -- Copyright (c) 2011-2013 Jason Perkins and the Premake project -- local suite = test.declare("vs200x_external_compiler") local vc200x = premake.vstudio.vc200x -- -- Setup/teardown -- local sln, prj function suite.setup() _ACTION = "vs2008" sln, prj = test.createsolution() system "PS3" end local function prepare() local cfg = test.getconfig(prj, "Debug") vc200x.VCCLCompilerTool(cfg) end -- -- Verify the basic structure with no extra flags or settings. -- function suite.checkDefaults() prepare() test.capture [[ <Tool Name="VCCLCompilerTool" AdditionalOptions="-Xc+=exceptions -Xc+=rtti" UsePrecompiledHeader="0" ProgramDataBaseFileName="$(OutDir)\MyProject.pdb" DebugInformationFormat="0" CompileAs="0" /> ]] end -- -- Make sure that include directories are project relative. -- function suite.includeDirsAreProjectRelative() includedirs { "../include", "include" } prepare() test.capture [[ <Tool Name="VCCLCompilerTool" AdditionalOptions="-Xc+=exceptions -Xc+=rtti" AdditionalIncludeDirectories="..\include;include" UsePrecompiledHeader="0" ]] end -- -- Check handling of forced includes. -- function suite.forcedIncludeFiles() forceincludes { "stdafx.h", "include/sys.h" } prepare() test.capture [[ <Tool Name="VCCLCompilerTool" AdditionalOptions="-Xc+=exceptions -Xc+=rtti" UsePrecompiledHeader="0" ProgramDataBaseFileName="$(OutDir)\MyProject.pdb" DebugInformationFormat="0" CompileAs="0" ForcedIncludeFiles="stdafx.h;include\sys.h" ]] end
bsd-3-clause
hooksta4/darkstar
scripts/zones/zones/Aht_Urhgan_Whitegate/npcs/Ghatsad.lua
2
26081
----------------------------------- -- Area: Aht Urhgan Whitegate -- NPC: Ghatsad -- Standard Info NPC -- Involved in quest: No String Attached ----------------------------------- package.loaded["scripts/zones/Aht_Urhgan_Whitegate/TextIDs"] = nil; ----------------------------------- require("scripts/globals/common"); require("scripts/globals/settings"); require("scripts/globals/quests"); require("scripts/globals/status"); require("scripts/zones/Aht_Urhgan_Whitegate/TextIDs"); ----------------------------------- -- onTrade Action ----------------------------------- function onTrade(player,npc,trade) local attachmentStatus = player:getVar("PUP_AttachmentStatus"); local attachments = player:getVar("PUP_Attachments"); local unlockedAttachments = player:getVar("PUP_AttachmentUnlock"); local attachmentTime = player:getVar("PUP_AttachmentReady"); local attachmentReady = (attachmentTime ~= 0 and attachmentTime < os.time()); local attachmentWait = player:getVar("PUP_AttachmentWait"); if (attachmentStatus == 2) then if (trade:getSlotCount() == 4) then if (trade:getItemQty(661) == 1 and trade:getItemQty(2173) == 1 and trade:getItemQty(2290) == 1 and trade:getItemQty(16419) == 1) then player:tradeComplete(); if (attachments == 0) then player:startEvent(624, 0, 0, 0, 0, 0, 2185, 3); elseif (attachments == 1) then player:startEvent(624, 0, 0, 0, 0, 0, 2186, 3); elseif (attachments == 2) then player:startEvent(624, 0, 0, 0, 0, 0, 2187, 1); end player:setVar("PUP_AttachmentStatus", 5) end elseif (trade:getSlotCount() == 5) then if (trade:getItemQty(661) == 1 and trade:getItemQty(2173) == 1 and trade:getItemQty(2290) == 1 and trade:getItemQty(16419) == 1) then if (attachments == 0) then if (trade:getItemQty(2185) == 3) then player:tradeComplete(); player:startEvent(625); player:setVar("PUP_AttachmentStatus", 8) player:setVar("PUP_AttachmentReady",getMidnight()); end elseif (attachments == 1) then if (trade:getItemQty(2186) == 3) then player:tradeComplete(); player:startEvent(625); player:setVar("PUP_AttachmentStatus", 8) player:setVar("PUP_AttachmentReady",getMidnight()); end elseif (attachments == 2) then if (trade:getItemQty(2187) == 1) then player:tradeComplete(); player:startEvent(625); player:setVar("PUP_AttachmentStatus", 8) player:setVar("PUP_AttachmentReady",getMidnight()); end end end end elseif (attachmentStatus == 3) then if (trade:getSlotCount() == 4) then if (trade:getItemQty(718) == 1 and trade:getItemQty(2288) == 1 and trade:getItemQty(879) == 1 and trade:getItemQty(17220) == 1) then player:tradeComplete(); if (attachments == 0) then player:startEvent(624, 0, 0, 0, 0, 0, 2185, 3); elseif (attachments == 1) then player:startEvent(624, 0, 0, 0, 0, 0, 2186, 3); elseif (attachments == 2) then player:startEvent(624, 0, 0, 0, 0, 0, 2187, 1); end player:setVar("PUP_AttachmentStatus", 6) end elseif (trade:getSlotCount() == 5) then if (trade:getItemQty(718) == 1 and trade:getItemQty(2288) == 1 and trade:getItemQty(879) == 1 and trade:getItemQty(17220) == 1) then if (attachments == 0) then if (trade:getItemQty(2185) == 3) then player:tradeComplete(); player:startEvent(625); player:setVar("PUP_AttachmentStatus", 9) player:setVar("PUP_AttachmentReady",getMidnight()); end elseif (attachments == 1) then if (trade:getItemQty(2186) == 3) then player:tradeComplete(); player:startEvent(625); player:setVar("PUP_AttachmentStatus", 9) player:setVar("PUP_AttachmentReady",getMidnight()); end elseif (attachments == 2) then if (trade:getItemQty(2187) == 1) then player:tradeComplete(); player:startEvent(625); player:setVar("PUP_AttachmentStatus", 9) player:setVar("PUP_AttachmentReady",getMidnight()); end end end end elseif (attachmentStatus == 4) then if (trade:getSlotCount() == 4) then if (trade:getItemQty(823) == 1 and trade:getItemQty(828) == 1 and trade:getItemQty(2289) == 1 and trade:getItemQty(13465) == 1) then player:tradeComplete(); if (attachments == 0) then player:startEvent(624, 0, 0, 0, 0, 0, 2185, 3); elseif (attachments == 1) then player:startEvent(624, 0, 0, 0, 0, 0, 2186, 3); elseif (attachments == 2) then player:startEvent(624, 0, 0, 0, 0, 0, 2187, 1); end player:setVar("PUP_AttachmentStatus", 7) end elseif (trade:getSlotCount() == 5) then if (trade:getItemQty(823) == 1 and trade:getItemQty(828) == 1 and trade:getItemQty(2289) == 1 and trade:getItemQty(13465) == 1) then if (attachments == 0) then if (trade:getItemQty(2185) == 3) then player:tradeComplete(); player:startEvent(625); player:setVar("PUP_AttachmentStatus", 10) player:setVar("PUP_AttachmentReady",getMidnight()); end elseif (attachments == 1) then if (trade:getItemQty(2186) == 3) then player:tradeComplete(); player:startEvent(625); player:setVar("PUP_AttachmentStatus", 10) player:setVar("PUP_AttachmentReady",getMidnight()); end elseif (attachments == 2) then if (trade:getItemQty(2187) == 1) then player:tradeComplete(); player:startEvent(625); player:setVar("PUP_AttachmentStatus", 10) player:setVar("PUP_AttachmentReady",getMidnight()); end end end end elseif (attachmentStatus == 5) then if (attachments == 0) then if (trade:getSlotCount() == 1 and trade:getItemQty(2185) == 3) then player:tradeComplete(); player:startEvent(625); player:setVar("PUP_AttachmentStatus", 8) player:setVar("PUP_AttachmentReady",getMidnight()); end elseif (attachments == 1) then if (trade:getSlotCount() == 1 and trade:getItemQty(2186) == 3) then player:tradeComplete(); player:startEvent(625); player:setVar("PUP_AttachmentStatus", 8) player:setVar("PUP_AttachmentReady",getMidnight()); end elseif (attachments == 2) then if (trade:getSlotCount() == 1 and trade:getItemQty(2187) == 1) then player:tradeComplete(); player:startEvent(625); player:setVar("PUP_AttachmentStatus", 8) player:setVar("PUP_AttachmentReady",getMidnight()); end end elseif (attachmentStatus == 6) then if (attachments == 0) then if (trade:getSlotCount() == 1 and trade:getItemQty(2185) == 3) then player:tradeComplete(); player:startEvent(625); player:setVar("PUP_AttachmentStatus", 9) player:setVar("PUP_AttachmentReady",getMidnight()); end elseif (attachments == 1) then if (trade:getSlotCount() == 1 and trade:getItemQty(2186) == 3) then player:tradeComplete(); player:startEvent(625); player:setVar("PUP_AttachmentStatus", 9) player:setVar("PUP_AttachmentReady",getMidnight()); end elseif (attachments == 2) then if (trade:getSlotCount() == 1 and trade:getItemQty(2187) == 1) then player:tradeComplete(); player:startEvent(625); player:setVar("PUP_AttachmentStatus", 9) player:setVar("PUP_AttachmentReady",getMidnight()); end end elseif (attachmentStatus == 7) then if (attachments == 0) then if (trade:getSlotCount() == 1 and trade:getItemQty(2185) == 3) then player:tradeComplete(); player:startEvent(625); player:setVar("PUP_AttachmentStatus", 10) player:setVar("PUP_AttachmentReady",getMidnight()); end elseif (attachments == 1) then if (trade:getSlotCount() == 1 and trade:getItemQty(2186) == 3) then player:tradeComplete(); player:startEvent(625); player:setVar("PUP_AttachmentStatus", 10) player:setVar("PUP_AttachmentReady",getMidnight()); end elseif (attachments == 2) then if (trade:getSlotCount() == 1 and trade:getItemQty(2187) == 1) then player:tradeComplete(); player:startEvent(625); player:setVar("PUP_AttachmentStatus", 10) player:setVar("PUP_AttachmentReady",getMidnight()); end end elseif (attachments == 3 and attachmentStatus == 11) then if (trade:getSlotCount() == 3) then if (trade:getItemQty(2186) == 2) then if (trade:getItemQty(2502) == 1) then if (trade:getItemQty(4613) == 1) then player:tradeComplete(); player:setVar("PUP_AttachmentStatus", 12) player:setVar("PUP_AttachmentReady",getMidnight()); player:setVar("PUP_AttachmentWait",math.random(1,3)); player:startEvent(902); elseif (trade:getItemQty(4716) == 1) then player:tradeComplete(); player:setVar("PUP_AttachmentStatus", 12) player:setVar("PUP_AttachmentReady",getMidnight()); player:setVar("PUP_AttachmentWait",math.random(2,3)); player:startEvent(902); elseif (trade:getItemQty(4610) == 1) then player:tradeComplete(); player:setVar("PUP_AttachmentStatus", 12) player:setVar("PUP_AttachmentReady",getMidnight()); player:setVar("PUP_AttachmentWait",4); player:startEvent(902); end elseif (trade:getItemQty(2501) == 1) then if (trade:getItemQty(4770) == 1) then player:tradeComplete(); player:setVar("PUP_AttachmentStatus", 13) player:setVar("PUP_AttachmentReady",getMidnight()); player:setVar("PUP_AttachmentWait",math.random(1,3)); player:startEvent(902); elseif (trade:getItemQty(4878) == 1) then player:tradeComplete(); player:setVar("PUP_AttachmentStatus", 13) player:setVar("PUP_AttachmentReady",getMidnight()); player:setVar("PUP_AttachmentWait",math.random(2,3)); player:startEvent(902); elseif (trade:getItemQty(4752) == 1) then player:tradeComplete(); player:setVar("PUP_AttachmentStatus", 13) player:setVar("PUP_AttachmentReady",getMidnight()); player:setVar("PUP_AttachmentWait",4); player:startEvent(902); end end end end elseif (attachments == 4 and attachmentStatus == 14) then if (trade:getSlotCount() == 3) then if (trade:getItemQty(2186) == 4) then if (trade:getItemQty(2502) == 1 and unlockedAttachments == 46) then if (trade:getItemQty(4613) == 1) then player:tradeComplete(); player:setVar("PUP_AttachmentStatus", 12) player:setVar("PUP_AttachmentReady",getMidnight()); player:setVar("PUP_AttachmentWait",math.random(1,3)); player:startEvent(902); elseif (trade:getItemQty(4716) == 1) then player:tradeComplete(); player:setVar("PUP_AttachmentStatus", 12) player:setVar("PUP_AttachmentReady",getMidnight()); player:setVar("PUP_AttachmentWait",math.random(2,3)); player:startEvent(902); elseif (trade:getItemQty(4610) == 1) then player:tradeComplete(); player:setVar("PUP_AttachmentStatus", 12) player:setVar("PUP_AttachmentReady",getMidnight()); player:setVar("PUP_AttachmentWait",4); player:startEvent(902); end elseif (trade:getItemQty(2501) == 1 and unlockedAttachments == 30) then if (trade:getItemQty(4770) == 1) then player:tradeComplete(); player:setVar("PUP_AttachmentStatus", 13) player:setVar("PUP_AttachmentReady",getMidnight()); player:setVar("PUP_AttachmentWait",math.random(1,3)); player:startEvent(902); elseif (trade:getItemQty(4878) == 1) then player:tradeComplete(); player:setVar("PUP_AttachmentStatus", 13) player:setVar("PUP_AttachmentReady",getMidnight()); player:setVar("PUP_AttachmentWait",math.random(2,3)); player:startEvent(902); elseif (trade:getItemQty(4752) == 1) then player:tradeComplete(); player:setVar("PUP_AttachmentStatus", 13) player:setVar("PUP_AttachmentReady",getMidnight()); player:setVar("PUP_AttachmentWait",4); player:startEvent(902); end end end end elseif ((attachmentStatus == 12 or attachmentStatus == 13) and attachmentWait > 0 and attachmentReady == true) then if (trade:getSlotCount() == 1 and trade:getItemQty(5592) == 1) then player:tradeComplete(); player:setVar("PUP_AttachmentReady",getMidnight()); player:setVar("PUP_AttachmentWait",attachmentWait - 1); player:startEvent(904); end end end; ----------------------------------- -- onTrigger Action ----------------------------------- function onTrigger(player,npc) --cs 620 - new frame - param 6: itemid payment param 7: number of payment param 8: bitpack choices (bit 0 no thanks, bit 1 VE, bit 2 SS, bit 3 SW) --cs 621 - new frame (if canceled previous) --cs 622 - bring me mats --cs 624 - all mats, just need payment --cs 625 - thanks, have everything, come back later --cs 626 - come back later --cs 627 - automaton frame done (param 2: frame) --cs 628 - you can customise automaton by changing frame --cs 629 - you can alter automatons abilities and character by equipping attachments (what are these last 2 for?) --cs 900 - start soulsoother/spiritreaver --cs 901 - start second head --cs 902 - start work on chosen head --cs 903 - head almost done --cs 904 - give coffee --cs 905 - head complete local NoStringsAttached = player:getQuestStatus(AHT_URHGAN,NO_STRINGS_ATTACHED); local NoStringsAttachedProgress = player:getVar("NoStringsAttachedProgress"); local Automaton = player:hasKeyItem(798); local automatonName = player:getAutomatonName(); local CreationStarted_Day = player:getVar("CreationStarted_Day"); local currentDay = VanadielDayOfTheYear(); local CreationReady = ((CreationStarted_Day < currentDay) or (player:getVar("CreationStarted_Year") < VanadielYear())); local attachments = player:getVar("PUP_Attachments"); local attachmentStatus = player:getVar("PUP_AttachmentStatus"); local unlockedAttachments = player:getVar("PUP_AttachmentUnlock"); local attachmentTime = player:getVar("PUP_AttachmentReady"); local attachmentReady = (attachmentTime ~= 0 and attachmentTime < os.time()); local attachmentWait = player:getVar("PUP_AttachmentWait"); --[[ attachment status: 0 - none 1 - declined a new frame 2 - accepted valoredge 3 - accepted sharphot 4 - accepted stormwaker 5 - paid mats for valoredge 6 - paid mats for sharpshot 7 - paid mats for stormwaker 8 - paid mats+coins for valoredge 9 - paid mats+coins for sharpshot 10 - paid mats+coins for stormwaker 11 - asked about soulsoother/spiritreaver 12 - paid for soulsoother 13 - paid for spiritreaver 14 - asked about soulsoother/spiritreaver (after obtaining the first) ]] if (NoStringsAttached == QUEST_ACCEPTED and NoStringsAttachedProgress == 2) then player:startEvent(0x0106); -- he want you to go to Arrapago elseif (NoStringsAttached == QUEST_ACCEPTED and NoStringsAttachedProgress == 3) then player:startEvent(0x0107); -- reminder to go to Arrapago elseif (NoStringsAttached == QUEST_ACCEPTED and NoStringsAttachedProgress == 4 and Automaton == true) then player:startEvent(0x0108); -- you give the antique automaton to him and need to wait a gameday elseif (NoStringsAttached == QUEST_ACCEPTED and NoStringsAttachedProgress == 5 and CreationReady == true) then player:startEvent(0x0109); -- you go back for your automaton elseif (NoStringsAttached == QUEST_COMPLETED and attachments == 0 and attachmentStatus == 0 and player:getMainJob() == JOB_PUP and player:getMainLvl() >= 10) then player:startEventString(620, automatonName, automatonName, automatonName, automatonName, attachments, 0, 0, 0, 0, 2185, 3, unlockedAttachments); elseif (NoStringsAttached == QUEST_COMPLETED and attachments == 0 and attachmentStatus == 1) then player:startEvent(621, 0, 0, 0, 0, 0, 2185, 3, unlockedAttachments); elseif (NoStringsAttached == QUEST_COMPLETED and attachments == 1 and attachmentStatus == 0 and player:getMainJob() == JOB_PUP and player:getMainLvl() >= 20) then player:startEventString(620, automatonName, automatonName, automatonName, automatonName, attachments, 0, 0, 0, 0, 2186, 3, unlockedAttachments); elseif (NoStringsAttached == QUEST_COMPLETED and attachments == 1 and attachmentStatus == 1) then player:startEvent(621, 0, 0, 0, 0, 0, 2186, 3, unlockedAttachments); elseif (NoStringsAttached == QUEST_COMPLETED and attachments == 2 and attachmentStatus == 0 and player:getMainJob() == JOB_PUP and player:getMainLvl() >= 30) then player:startEventString(620, automatonName, automatonName, automatonName, automatonName, attachments, 0, 0, 0, 0, 2187, 1, unlockedAttachments); elseif (NoStringsAttached == QUEST_COMPLETED and attachments == 3 and attachmentStatus == 0 and player:getMainJob() == JOB_PUP and player:getMainLvl() >= 40) then player:startEventString(900, automatonName, automatonName, automatonName, automatonName, 0, 0, 0, 0, 0, 2186, 2); elseif (NoStringsAttached == QUEST_COMPLETED and attachments == 4 and attachmentStatus == 0 and player:getMainJob() == JOB_PUP and player:getMainLvl() >= 50) then if (unlockedAttachments == 30) then player:startEventString(901, automatonName, automatonName, automatonName, automatonName, 1, 0, 0, 0, 0, 2186, 4); elseif (unlockedAttachments == 46) then player:startEventString(901, automatonName, automatonName, automatonName, automatonName, 0, 0, 0, 0, 0, 2186, 4); end elseif (NoStringsAttached == QUEST_COMPLETED and attachments == 2 and attachmentStatus == 1) then player:startEvent(621, 0, 0, 0, 0, 0, 2187, 1, unlockedAttachments); elseif (NoStringsAttached == QUEST_COMPLETED and attachmentStatus >= 8 and attachmentStatus <= 10 and attachmentReady == false) then player:startEvent(626); elseif (NoStringsAttached == QUEST_COMPLETED and attachmentStatus == 8 and attachmentReady == true) then player:startEventString(627, automatonName, automatonName, automatonName, automatonName, 0, 1); elseif (NoStringsAttached == QUEST_COMPLETED and attachmentStatus == 9 and attachmentReady == true) then player:startEventString(627, automatonName, automatonName, automatonName, automatonName, 0, 2); elseif (NoStringsAttached == QUEST_COMPLETED and attachmentStatus == 10 and attachmentReady == true) then player:startEventString(627, automatonName, automatonName, automatonName, automatonName, 0, 3); elseif (NoStringsAttached == QUEST_COMPLETED and attachmentStatus == 2) then if (attachments == 0) then player:startEvent(622, 0, 1, 0, 0, 0, 2185, 3); elseif (attachments == 1) then player:startEvent(622, 0, 1, 0, 0, 0, 2186, 3); elseif (attachments == 2) then player:startEvent(622, 0, 1, 0, 0, 0, 2187, 1); end elseif (NoStringsAttached == QUEST_COMPLETED and attachmentStatus == 3) then if (attachments == 0) then player:startEvent(622, 0, 2, 0, 0, 0, 2185, 3); elseif (attachments == 1) then player:startEvent(622, 0, 2, 0, 0, 0, 2186, 3); elseif (attachments == 2) then player:startEvent(622, 0, 2, 0, 0, 0, 2187, 1); end elseif (NoStringsAttached == QUEST_COMPLETED and attachmentStatus == 4) then if (attachments == 0) then player:startEvent(622, 0, 3, 0, 0, 0, 2185, 3); elseif (attachments == 1) then player:startEvent(622, 0, 3, 0, 0, 0, 2186, 3); elseif (attachments == 2) then player:startEvent(622, 0, 3, 0, 0, 0, 2187, 1); end elseif (NoStringsAttached == QUEST_COMPLETED and attachmentStatus >= 5 and attachmentStatus <= 7) then if (attachments == 0) then player:startEvent(624, 0, 0, 0, 0, 0, 2185, 3); elseif (attachments == 1) then player:startEvent(624, 0, 0, 0, 0, 0, 2186, 3); elseif (attachments == 2) then player:startEvent(624, 0, 0, 0, 0, 0, 2187, 1); end elseif (NoStringsAttached == QUEST_COMPLETED and attachmentStatus == 11 and attachments == 3) then player:startEventString(900, automatonName, automatonName, automatonName, automatonName, 0, 0, 1, 0, 0, 2186, 7); elseif (NoStringsAttached == QUEST_COMPLETED and (attachmentStatus == 12 or attachmentStatus == 13) and attachmentReady == false) then player:startEvent(903, attachmentWait, 1); elseif (NoStringsAttached == QUEST_COMPLETED and (attachmentStatus == 12 or attachmentStatus == 13) and attachmentReady == true and attachmentWait > 0) then player:startEvent(903, attachmentWait, 0); elseif (NoStringsAttached == QUEST_COMPLETED and (attachmentStatus == 12 or attachmentStatus == 13) and attachmentReady == true and attachmentWait == 0) then player:startEvent(905, attachmentStatus-12); elseif (NoStringsAttached == QUEST_COMPLETED and attachmentStatus == 14) then if (unlockedAttachments == 30) then player:startEventString(901, automatonName, automatonName, automatonName, automatonName, 1, 0, 1, 0, 0, 2186, 4); elseif (unlockedAttachments == 46) then player:startEventString(901, automatonName, automatonName, automatonName, automatonName, 0, 0, 1, 0, 0, 2186, 4); end elseif (attachments > 0) then local rand = math.random(1,2); if (rand == 1) then player:startEvent(628); else player:startEventString(629, automatonName, automatonName, automatonName, automatonName); end else player:startEvent(0x0100); 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 == 0x0106) then player:setVar("NoStringsAttachedProgress",3); elseif (csid == 0x0108) then player:setVar("CreationStarted_Day",VanadielDayOfTheYear()); player:setVar("CreationStarted_Year",VanadielYear()); player:setVar("NoStringsAttachedProgress",5); player:delKeyItem(798); elseif (csid == 0x0109) then player:setVar("NoStringsAttachedProgress",6); player:setVar("CreationStarted_Day",0); player:setVar("CreationStarted_Year",0); elseif (csid == 620 or csid == 621) then player:setVar("PUP_AttachmentStatus", option+1); elseif (csid == 627) then local attachments = player:getVar("PUP_Attachments"); local attachmentStatus = player:getVar("PUP_AttachmentStatus"); local unlockedAttachments = player:getVar("PUP_AttachmentUnlock"); if (attachmentStatus == 8) then player:unlockAttachment(8225); player:unlockAttachment(8194); player:setVar("PUP_AttachmentStatus", 0); player:setVar("PUP_Attachments", attachments+1); player:setVar("PUP_AttachmentUnlock", unlockedAttachments+2); player:setVar("PUP_AttachmentReady", 0); player:messageSpecial(AUTOMATON_VALOREDGE_UNLOCK); elseif (attachmentStatus == 9) then player:unlockAttachment(8226); player:unlockAttachment(8195); player:setVar("PUP_AttachmentStatus", 0); player:setVar("PUP_Attachments", attachments+1); player:setVar("PUP_AttachmentUnlock", unlockedAttachments+4); player:setVar("PUP_AttachmentReady", 0); player:messageSpecial(AUTOMATON_SHARPSHOT_UNLOCK); elseif (attachmentStatus == 10) then player:unlockAttachment(8227); player:unlockAttachment(8196); player:setVar("PUP_AttachmentStatus", 0); player:setVar("PUP_Attachments", attachments+1); player:setVar("PUP_AttachmentUnlock", unlockedAttachments+8); player:setVar("PUP_AttachmentReady", 0); player:messageSpecial(AUTOMATON_STORMWAKER_UNLOCK); end elseif (csid == 900) then player:setVar("PUP_AttachmentStatus", 11); elseif (csid == 901) then player:setVar("PUP_AttachmentStatus", 14); elseif (csid == 905) then local attachments = player:getVar("PUP_Attachments"); local attachmentStatus = player:getVar("PUP_AttachmentStatus"); local unlockedAttachments = player:getVar("PUP_AttachmentUnlock"); if (attachmentStatus == 12) then player:unlockAttachment(8197); player:setVar("PUP_AttachmentStatus", 0); player:setVar("PUP_Attachments", attachments+1); player:setVar("PUP_AttachmentReady", 0); player:setVar("PUP_AttachmentUnlock", unlockedAttachments+16); player:messageSpecial(AUTOMATON_SOULSOOTHER_UNLOCK); elseif (attachmentStatus == 13) then player:unlockAttachment(8198); player:setVar("PUP_AttachmentStatus", 0); player:setVar("PUP_Attachments", attachments+1); player:setVar("PUP_AttachmentReady", 0); player:setVar("PUP_AttachmentUnlock", unlockedAttachments+32); player:messageSpecial(AUTOMATON_SPIRITREAVER_UNLOCK); end end end;
gpl-3.0
instead-hub/plainstead
build/games/cat/main-ru.lua
1
3005
game.codepage="UTF-8"; game.act = 'Не получается.'; game.inv = 'Гм.. Странная штука..'; game.use = 'Не сработает...'; game.dsc = [[Команды:^ look(или просто ввод), act <на что> (или просто на что), use <что> [на что], go <куда>,^ back, inv, way, obj, quit, save <fname>, load <fname>. Работает автодополнение по табуляции.^^ Олег Г., Владимир П., Илья.Р., и другие в фантастической и драматической text-adventure Петра К.^^ ВОЗВРАЩЕНИЕ КВАНТОВОГО КОТА^^ В прошлом хакер. Он ушел жить в лес. Но он вернулся. Вернулся чтобы забрать своего кота.^^ - Я ПРОСТО ПРИШЕЛ ЗАБРАТЬ СВОЕГО КОТА... ^^]]; me().nam = 'Олег'; main = room { nam = 'ВОЗВРАЩЕНИЕ КВАНТОВОГО КОТА', pic = 'gfx/thecat.png', dsc = [[ За окном моей хижины снова белеет снег, а в камине так же, как и тогда, потрескивают дрова... Третья зима. Прошло уже две зимы, но те события, о которых я хочу рассказать, встают перед моими глазами так, словно это было вчера...^^ Я работал лесником уже больше десяти лет. Больше десяти лет я жил в своей хижине, окруженной лесом, собирая капканы браконьеров и выезжая раз в одну или две недели в близлежащий поселок... После воскресной службы в местной церкви я заходил в магазинчик и покупал необходимые мне вещи: патроны к дробовику, крупу, хлеб, лекарства...^^ Когда-то я был неплохим компьютерным специалистом... Впрочем, это уже не важно... Десять лет я не видел экрана монитора, и не жалею об этом.^^ Теперь я понимаю, что корни того, что тогда произошло, лежат давно — во второй половине 30-х... Хотя лучше начать все по-порядку...^^ В тот холодный февральский день я, как всегда, собрался ехать в поселок...]], obj = { vobj(1,'Дальше','{Дальше}.') }, act = function() return walk('home'); end, exit = function() set_music("mus/ofd.xm"); end, }; set_music("mus/new.s3m"); dofile("ep1-ru.lua"); dofile("ep2-ru.lua"); dofile("ep3-ru.lua"); --me().where = 'eside'; --inv():add('mywear'); --inv():add('gun'); --inv():add('trap');
mit
gedadsbranch/Darkstar-Mission
scripts/globals/abilities/desperate_flourish.lua
2
2959
----------------------------------- -- Ability: Desperate Flourish -- Weighs down a target with a low rate of success. Requires one Finishing Move. -- Obtained: Dancer Level 30 -- Finishing Moves Used: 1 -- Recast Time: 00:20 -- Duration: ?? ----------------------------------- require("scripts/globals/settings"); require("scripts/globals/status"); require("scripts/globals/weaponskills"); require("scripts/globals/magic"); ----------------------------------- -- onAbilityCheck ----------------------------------- function onAbilityCheck(player,target,ability) if (player:getAnimation() ~= 1) then return MSGBASIC_REQUIRES_COMBAT,0; else if (player:hasStatusEffect(EFFECT_FINISHING_MOVE_1)) then player:delStatusEffect(EFFECT_FINISHING_MOVE_1); return 0,0; elseif (player:hasStatusEffect(EFFECT_FINISHING_MOVE_2)) then player:delStatusEffectSilent(EFFECT_FINISHING_MOVE_2); player:addStatusEffect(EFFECT_FINISHING_MOVE_1,1,0,7200); return 0,0; elseif (player:hasStatusEffect(EFFECT_FINISHING_MOVE_3)) then player:delStatusEffectSilent(EFFECT_FINISHING_MOVE_3); player:addStatusEffect(EFFECT_FINISHING_MOVE_2,1,0,7200); return 0,0; elseif (player:hasStatusEffect(EFFECT_FINISHING_MOVE_4)) then player:delStatusEffectSilent(EFFECT_FINISHING_MOVE_4); player:addStatusEffect(EFFECT_FINISHING_MOVE_3,1,0,7200); return 0,0; elseif (player:hasStatusEffect(EFFECT_FINISHING_MOVE_5)) then player:delStatusEffectSilent(EFFECT_FINISHING_MOVE_5); player:addStatusEffect(EFFECT_FINISHING_MOVE_4,1,0,7200); return 0,0; else return MSGBASIC_NO_FINISHINGMOVES,0; end end end; ----------------------------------- -- onUseAbility ----------------------------------- function onUseAbility(player,target,ability) local isSneakValid = player:hasStatusEffect(EFFECT_SNEAK_ATTACK); if(isSneakValid and not player:isBehind(target))then isSneakValid = false; end local hitrate = getHitRate(player,target,true); if (math.random() <= hitrate or isSneakValid) then local bonus = 50 - target:getMod(MOD_STUNRES); local spell = getSpell(216); local resist = applyResistance(player,spell,target,0,player:getSkillLevel(player:getWeaponSkillType(SLOT_MAIN)),bonus) if resist > 0.25 then target:delStatusEffectSilent(EFFECT_WEIGHT); target:addStatusEffect(EFFECT_WEIGHT, 50, 0, 60 * resist); else ability:setMsg(110); end ability:setMsg(127); return EFFECT_WEIGHT, getFlourishAnimation(player:getWeaponSkillType(SLOT_MAIN)), 2; else ability:setMsg(158); return 0; end end;
gpl-3.0
membphis/vanilla
spec/v/dispatcher_spec.lua
3
3889
require('spec.helper') describe("Dispatcher", function() before_each(function() Application = require 'vanilla.v.application' Dispatcher = require 'vanilla.v.dispatcher' Controller = require 'vanilla.v.controller' Request = require 'vanilla.v.request' Response = require 'vanilla.v.response' View = require 'vanilla.v.views.rtpl' Error = require 'vanilla.v.error' Plugin = require 'vanilla.v.plugin' application = Application:new(config) dispatcher = Dispatcher:new(application) request = Request:new() response = Response:new() plugin = Plugin:new() end) after_each(function() package.loaded['vanilla.v.application'] = nil package.loaded['vanilla.v.dispatcher'] = nil package.loaded['vanilla.v.controller'] = nil package.loaded['vanilla.v.request'] = nil package.loaded['vanilla.v.response'] = nil package.loaded['vanilla.v.views.rtpl'] = nil package.loaded['vanilla.v.error'] = nil package.loaded['vanilla.v.plugin'] = nil Application = nil Dispatcher = nil Controller = nil Request = nil Response = nil View = nil Error = nil Plugin = nil application = nil dispatcher = nil request = nil response = nil plugin = nil end) describe("#new", function() it("creates a new instance of a dispatcher with application", function() assert.are.same(application, dispatcher.application) end) end) describe("#_init", function() it("init a dispatcher instance", function() assert.are.same(request, dispatcher.request) end) end) describe("#getRequest", function() it("get a request instance", function() assert.are.same(request, dispatcher.request) end) end) describe("#setRequest", function() it("set a request instance", function() assert.are.same(request, dispatcher.request) end) end) describe("#getResponse", function() it("get a response instance", function() assert.are.same(response, dispatcher.response) end) end) describe("#setResponse", function() it("set a response instance", function() assert.are.same(response, dispatcher.response) end) end) describe("#registerPlugin", function() it("register a plugin to app", function() assert.are.same(plugin, dispatcher.plugins) end) end) -- describe("#_router", function() -- it("raises an error with a code", function() -- local ok, err = pcall(function() controller:raise_error(1000) end) -- assert.are.equal(false, ok) -- assert.are.equal(1000, err.code) -- end) -- it("raises an error with a code and custom attributes", function() -- local custom_attrs = { custom_attr_1 = "1", custom_attr_2 = "2" } -- local ok, err = pcall(function() controller:raise_error(1000, custom_attrs) end) -- assert.are.equal(false, ok) -- assert.are.equal(1000, err.code) -- assert.are.same(custom_attrs, err.custom_attrs) -- end) -- end) -- describe("#dispatch", function() -- before_each(function() -- local Response = require 'gin.core.response' -- response = Response.new({ -- status = 200, -- headers = { ['one'] = 'first', ['two'] = 'second' }, -- body = { name = 'gin'} -- }) -- end) -- it("sets the ngx status", function() -- Router.respond(ngx, response) -- assert.are.equal(200, ngx.status) -- end) -- end) end)
mit
amireh/grind
test/unit/lua_regex.lua
1
2491
require 'rex_pcre' local ptrn = [[(?<timestamp>[A-Z]{1}[a-z]{2} [0-9]+ [0-9]{2}:[0-9]{2}:[0-9]{2})\s{1}(?<app>\w+)\s{1}.*]] local ptrn = [[(?:<\d+>)(?<timestamp>[A-Z]{1}[a-z]{2}\s+[0-9]+\s+[0-9]{2}:[0-9]{2}:[0-9]{2}\s{1})|(?<moo>\d{4}-\d{2}-\d{2}\s+\d{2}:\d{2}:\d{2}\s{1})|(\d{2}:\d{2}:\d{2}):\s{1}|(\d{2}:\d{2}:\d{2})]] local ptrn = [[(?J)(?:<\d+>)(?<timestamp>[A-Z]{1}[a-z]{2}\s+[0-9]+\s+[0-9]{2}:[0-9]{2}:[0-9]{2}\s{1})?|(?<timestamp>\d{4}-\d{2}-\d{2}\s{1}\d{2}:\d{2}:\d{2}\s{1})?]] -- local ptrn = [[(?|(?<DN>Mon|Fri|Sun)(?:day)?|(?<DN>Tue)(?:sday)?|(?<DN>Wed)(?:nesday)?|(?<DN>Thu)(?:rsday)?|(?<DN>Sat)(?:urday)?)]] local ptrn = [[(?J)(?<DN>Mon|Fri|Sun)(?:day)?|(?<DN>Tue)(?:sday)?|(?<DN>Wed)(?:nesday)?|(?<DN>Thu)(?:rsday)?|(?<DN>Sat)(?:urday)?]] local ptrn = [[(?:(\d{4}-\d{2}-\d{2}\s\d{2}:\d{2}:\d{2}) (.*))+]] -- local ptrn = [[(foobar) went to the (?<place>\w+)]] -- local ptrn = [[(foobar) went to the (?<place>\w+)]] -- local text = [==[<15>Jun 27 20:45:19 cornholio dakapi: [I] {012345678} handler: looking up website with APIKey: -- 1234-12-12 12:12:12 -- ]==] local text = [[Sunday\GDN]] local text = [[2012-07-15 19:21:31 [I] GameMgr: loading Pendulum config 2012-07-15 19:21:31 [I] GameMgr: found existing configuration, parsing...]] -- local text = "foobar went to the zoo and foobared some more" local rex = rex_pcre.new(ptrn) if not rex then return print("Invalid PCRE rex '" .. ptrn .. "'") end local count = arg[1] or 10 print("Matching " .. ptrn .. " " .. count .. " times") for i=0,count do print(rex:find(text)) print(rex_pcre.match(text, rex)) -- print(rex_pcre.find(text, rex)) print(rex:exec(text)) local b,e,captures = rex:exec(text) -- local e = nil -- print("Matched @ " .. b .. " => " .. e) local capture_values = {} local capture_b, capture_e = nil,nil for k,v in pairs(captures or {}) do if type(k) == "number" and type(v) == "number" then if not capture_b then capture_b = v elseif not capture_e then capture_e = v table.insert(capture_values, text:sub(capture_b, capture_e)) capture_b, capture_e = nil, nil end else end if type(k) ~= "number" and v then print(k .. " => " .. v) end -- e = v -- end -- if type(k) == "number" and v and type(v) == "string" then print(k .. " => " .. v) end -- print(k .. " => " .. tostring(v)) end -- print("Captures:") -- for k,v in pairs(capture_values) do -- print(v) -- end -- rex:find(text) end
mit
gedadsbranch/Darkstar-Mission
scripts/zones/Windurst_Waters_[S]/npcs/Ezura-Romazura.lua
34
1541
----------------------------------- -- Area: Windurst Waters [S] -- NPC: Ezura-Romazura -- Standard Merchant NPC ----------------------------------- package.loaded["scripts/zones/Windurst_Waters_[S]/TextIDs"] = nil; ----------------------------------- require("scripts/globals/shop"); require("scripts/zones/Windurst_Waters_[S]/TextIDs"); ----------------------------------- -- onTrade Action ----------------------------------- function onTrade(player,npc,trade) end; ----------------------------------- -- onTrigger Action ----------------------------------- function onTrigger(player,npc) player:showText(npc,EZURAROMAZURA_SHOP_DIALOG); stock = {0x12a3,123750, -- Scroll of Stone V 0x12ad,133110, -- Scroll of Water V 0x129e,144875, -- Scroll of Aero V 0x1294,162500, -- Scroll of Fire V 0x1299,186375, -- Scroll of Blizzard V 0x131d,168150, -- Scroll of Stoneja 0x131f,176700, -- Scroll of Waterja 0x131a,193800, -- Scroll of Firaja 0x131c,185240, -- Scroll of Aeroja 0x12ff,126000} -- Scroll of Break showShop(player, STATIC, stock); end; ----------------------------------- -- onEventUpdate ----------------------------------- function onEventUpdate(player,csid,option) --printf("CSID: %u",csid); --printf("RESULT: %u",option); end; ----------------------------------- -- onEventFinish ----------------------------------- function onEventFinish(player,csid,option) --printf("CSID: %u",csid); --printf("RESULT: %u",option); end;
gpl-3.0
gedadsbranch/Darkstar-Mission
scripts/globals/items/homemade_steak.lua
35
1124
----------------------------------------- -- ID: 5226 -- Item: homemade_steak -- Food Effect: 30Min, All Races ----------------------------------------- -- Strength 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,5226); end; ----------------------------------- -- onEffectGain Action ----------------------------------- function onEffectGain(target,effect) target:addMod(MOD_STR, 1); end; ----------------------------------------- -- onEffectLose Action ----------------------------------------- function onEffectLose(target,effect) target:delMod(MOD_STR, 1); end;
gpl-3.0
drogers141/mac-hydra
winutil.lua
1
7154
-- window related functionality -- moving, data, etc --local util = require "util" local util = dofile(package.searchpath("util", package.path)) win = {} ---------------------------------------------------------------------- -- Rectangle operations - all take and return rectangles (no mutation) -- ie - same as hydra's frames {x, y, w, h} ---------------------------------------------------------------------- -- move a rect by adding an {x, y} vector to it -- r - rect to move -- m - {x, y} - movement vector - +x moves right, -x moves left -- +y moves down, -y moves up win.move_rect = function(r, m) return {x = r.x + m.x, y = r.y + m.y, w = r.w, h = r.h} end -- resize a rect by moving the right and/or bottom edge -- attempting to resize to a negative width or height is a no-op -- and r is returned -- r - rect to resize -- delta - {x, y} - vector to resize by - +x grows window to right, -- -x shrinks window on right, +y grows window downward -- -y shrinks window by raising bottom win.resize_rect = function(r, delta) local result = {x = r.x, y = r.y, w = r.w + delta.x, h = r.h + delta.y} if result.w <= 0 or result.h <= 0 then return r else return result end end -- throw a rect in one direction to the inside border of a bounding rect -- can throw a rect left, right, up, or down and it will stick to the edge -- of the surrounding rect where it hits - general case is to move a window -- all the way to the edge of a screen in one direction while maintaining -- its size and location on the axis in the other direction -- however, you can have a window that is somewhat past the edge of a screen -- and throw it in the same direction to quickly put it back fully on the screen -- r - rect to throw -- outside_r - "outside" or "enclosing" rect that the rect gets thrown to -- quotes are for case explained above - doesn't have to be actually enclosing -- direction - string - one of ["left", "right", "up", "down"] -- bad direction or outside_r cause assertion failure win.throw_rect = function(r, outside_r, direction) local outside_right = outside_r.x + outside_r.w local outside_bottom = outside_r.y + outside_r.h assert(outside_right > 0 and outside_bottom > 0) ret = nil if direction == "left" then ret = util.merge(r, {x = outside_r.x}) elseif direction == "right" then ret = util.merge(r, {x = outside_right-r.w}) elseif direction == "up" then ret = util.merge(r, {y = outside_r.y}) elseif direction == "down" then ret = util.merge(r, {y = outside_bottom-r.h}) else assert(false, "bad direction: " .. direction) end return ret end -- like throw_rect but for resizing -- expand a rect in one direction all the way to meet the inside border of the -- bounding rect -- unlike resize rect - since only expanding - can fill in all 4 directions -- r - rect to throw -- outside_r - bounding rect that the rect gets filled to -- note that as long as the resulting rect has positive width and height -- expand_fill can behave similarly to the cases mentioned in throw_win -- commentary -- direction - string - one of ["left", "right", "up", "down"] -- bad direction or outside_r cause assertion failure -- causing the resulting rect to have non-positive width or height -- causes an assertion failure function win.expand_fill_rect(r, outside_r, direction) local outside_right = outside_r.x + outside_r.w local outside_bottom = outside_r.y + outside_r.h local r_right = r.x + r.w local r_bottom = r.y + r.h assert(outside_right > 0 and outside_bottom > 0) ret = nil if direction == "left" then ret = util.merge(r, {x = outside_r.x, w = r_right - outside_r.x}) elseif direction == "right" then ret = util.merge(r, {w = outside_right - r.x}) elseif direction == "up" then ret = util.merge(r, {y = outside_r.y, h = r_bottom - outside_r.y}) elseif direction == "down" then ret = util.merge(r, {h = outside_bottom - r.y}) else assert(false, "bad direction: " .. direction) end assert(ret.w > 0 and ret.h > 0, "resized rect not cool by Euclid") return ret end ---------------------------------------------------------------------- -- Window operations - mutate window frame state ---------------------------------------------------------------------- local function screen_size(w) local s_rect = w:screen():frame() return {w = s_rect['w'], h = s_rect['h']} end -- move a window by adding an {x, y} vector to it -- by default x and y are percentage of screen width or height, respectively -- w - window to move -- m - {x, y} - movement vector - +x moves right, -x moves left -- +y moves down, -y moves up -- eg m = {x = 5, y = 0} -> moves window 5% of screen width to right -- use-pix - if this is set to a truthy value, x and y are interpreted -- as pixels - so above would move the window 5 pixels to the right win.move_win = function(w, m, use_pix) local x, y = m['x'], m['y'] if not use_pix then local sz = screen_size(w) x, y = x * sz['w']/100, y * sz['h']/100 end --print ('x:', x, 'y:', y) local frame = win.move_rect(w:frame(), {x=x, y=y}) w:setframe(frame) end -- resize a window by adding an {x, y} vector to it by moving the right and/or bottom edge -- attempting to resize to a negative width or height is a no-op -- by default x and y are percentage of screen width or height, respectively -- w - window to resize -- m - {x, y} - resize vector - +x grows right edge, -x shrinks right edge -- +y resizes down, -y resizes up -- eg m = {x = 5, y = 0} -> grows window 5% of screen width to right -- use-pix - if this is set to a truthy value, x and y are interpreted -- as pixels - so above would grow the window 5 pixels to the right win.resize_win = function(w, m, use_pix) local x, y = m['x'], m['y'] if not use_pix then local sz = screen_size(w) x, y = x * sz['w']/100, y * sz['h']/100 end --print ('x:', x, 'y:', y) local frame = win.resize_rect(w:frame(), {x=x, y=y}) w:setframe(frame) end -- throw a window to stick to the edge of its screen -- see throw_rect comments for more -- NOTE: Uses frame_without_dock_or_menu() as the outside rect to throw to -- direction - string - one of ["left", "right", "up", "down"] -- bad direction causes assertion failure win.throw_win = function(w, direction) local wr = w:frame() local sr = w:screen():frame_without_dock_or_menu() local frame = win.throw_rect(wr, sr, direction) w:setframe(frame) end -- expand a window in one direction to the edge of its screen -- see expand_fill_rect comments for more -- NOTE: Uses frame_without_dock_or_menu() as the outside rect to expand to -- direction - string - one of ["left", "right", "up", "down"] -- bad direction causes assertion failure -- causing a window with non-positive width or height to result -- also causes assertion failure win.expand_fill_win = function(w, direction) local wr = w:frame() local sr = w:screen():frame_without_dock_or_menu() local frame = win.expand_fill_rect(wr, sr, direction) w:setframe(frame) end return win
mit
hooksta4/darkstar
scripts/zones/The_Colosseum/npcs/Crystal.lua
3
1346
----------------------------------- -- Area: The Colosseum -- NPC: Cooking -- Guild Merchant NPC: Woodworking Guild -- @pos 0 0 0 0 zone 71 ----------------------------------- package.loaded["scripts/zones/The_Colosseum/TextIDs"] = nil; ----------------------------------- require("scripts/globals/settings"); require("scripts/globals/shop"); require("scripts/globals/quests"); require("scripts/zones/The_Colosseum/TextIDs"); function onTrade(player,npc,trade) end; ----------------------------------- -- onTrigger Action ----------------------------------- function onTrigger(player,npc) player:PrintToPlayer("All the crystals you need for your crafting adventures!"); stock = {0x1008,1, --Crystal clusters 0x1009,1, 0x100A,1, 0x100b,1, 0x100c,1, 0x100d,1, 0x100e,1, 0x100f,1, 0x1091,1, --HQ Crystals 0x108e,1, 0x108f,1, 0x1090,1, 0x1092,1, 0x1093,1, 0x1094,1, 0x1095,1,} showShop(player, STATIC, stock); end; ----------------------------------- -- onEventUpdate ----------------------------------- function onEventUpdate(player,csid,option) --printf("CSID: %u",csid); --printf("RESULT: %u",option); end; ----------------------------------- -- onEventFinish ----------------------------------- function onEventFinish(player,csid,option) --printf("CSID: %u",csid); --printf("RESULT: %u",option); end;
gpl-3.0
hooksta4/darkstar
scripts/globals/spells/raiton_ichi.lua
17
1257
----------------------------------------- -- Spell: Raiton: Ichi -- Deals lightning damage to an enemy and lowers its resistance against earth. ----------------------------------------- require("scripts/globals/status"); require("scripts/globals/magic"); ----------------------------------------- -- OnSpellCast ----------------------------------------- function onMagicCastingCheck(caster,target,spell) return 0; end; function onSpellCast(caster,target,spell) --doNinjutsuNuke(V,M,caster,spell,target,hasMultipleTargetReduction,resistBonus) local duration = 15 + caster:getMerit(MERIT_RAITON_EFFECT) -- T1 bonus debuff duration local bonusAcc = 0; local bonusMab = caster:getMerit(MERIT_RAITON_EFFECT) + caster:getMod(MOD_NIN_NUKE_BONUS); -- T1 mag atk + "enhances Ninjustu damage" mod if (caster:isBehind(target,15) and caster:hasStatusEffect(EFFECT_INNIN)) then -- Innin mag atk bonus from behind, guesstimating angle at 15 degrees bonusMab = bonusMab + caster:getStatusEffect(EFFECT_INNIN):getPower(); end local dmg = doNinjutsuNuke(28,1,caster,spell,target,false,bonusAcc,bonusMab); handleNinjutsuDebuff(caster,target,spell,30,duration,MOD_EARTHRES); return dmg; end;
gpl-3.0
gedadsbranch/Darkstar-Mission
scripts/globals/items/cup_of_healing_tea.lua
35
1373
----------------------------------------- -- ID: 4286 -- Item: cup_of_healing_tea -- Food Effect: 240Min, All Races ----------------------------------------- -- Magic 10 -- Vitality -1 -- Charisma 3 -- Magic Regen While Healing 2 ----------------------------------------- require("scripts/globals/status"); ----------------------------------------- -- OnItemCheck ----------------------------------------- function onItemCheck(target) local result = 0; if (target:hasStatusEffect(EFFECT_FOOD) == true or target:hasStatusEffect(EFFECT_FIELD_SUPPORT_FOOD) == true) then result = 246; end return result; end; ----------------------------------------- -- OnItemUse ----------------------------------------- function onItemUse(target) target:addStatusEffect(EFFECT_FOOD,0,0,14400,4286); end; ----------------------------------- -- onEffectGain Action ----------------------------------- function onEffectGain(target,effect) target:addMod(MOD_MP, 10); target:addMod(MOD_VIT, -1); target:addMod(MOD_CHR, 3); target:addMod(MOD_MPHEAL, 2); end; ----------------------------------------- -- onEffectLose Action ----------------------------------------- function onEffectLose(target,effect) target:delMod(MOD_MP, 10); target:delMod(MOD_VIT, -1); target:delMod(MOD_CHR, 3); target:delMod(MOD_MPHEAL, 2); end;
gpl-3.0
gedadsbranch/Darkstar-Mission
scripts/zones/Dynamis-Qufim/mobs/Adamantking_Effigy.lua
17
2130
----------------------------------- -- Area: Dynamis Qufim -- NPC: Adamantking_Effigy ----------------------------------- package.loaded["scripts/zones/Dynamis-Qufim/TextIDs"] = nil; ----------------------------------- require("scripts/globals/dynamis"); require("scripts/zones/Dynamis-Qufim/TextIDs"); ----------------------------------- -- onMobSpawn Action ----------------------------------- function onMobSpawn(mob) mob:setMobMod(MOBMOD_SUPERLINK, mob:getShortID()); end; ----------------------------------- -- onMobEngaged ----------------------------------- function onMobEngaged(mob,target) local X = mob:getXPos(); local Y = mob:getYPos(); local Z = mob:getZPos(); local spawnList = QufimQuadavList; if(mob:getStatPoppedMobs() == false) then mob:setStatPoppedMobs(true); for nb = 1, table.getn(spawnList), 2 do if(mob:getID() == spawnList[nb]) then -- si l'id du mob engager correpond a un ID de la list for nbi = 1, table.getn(spawnList[nb + 1]), 1 do if((nbi % 2) == 0) then X=X+2; Z=Z+2; else X=X-2; Z=Z-2; end local mobNBR = spawnList[nb + 1][nbi]; --printf("Serjeant_Tombstone => mob %u \n",mobNBR); if(mobNBR ~= nil) then -- Spawn Mob SpawnMob(mobNBR):setMobMod(MOBMOD_SUPERLINK, mob:getShortID()); GetMobByID(mobNBR):setPos(X,Y,Z); GetMobByID(mobNBR):setSpawn(X,Y,Z); -- Spawn Pet for BST, DRG, and SMN local MJob = GetMobByID(mobNBR):getMainJob(); -- printf("Serjeant_Tombstone => mob %u \n",mobNBR); -- printf("mobjob %u \n",MJob); if(MJob == 9 or MJob == 14 or MJob == 15) then -- Spawn Pet for BST , DRG , and SMN SpawnMob(mobNBR + 1):setMobMod(MOBMOD_SUPERLINK, mob:getShortID()); GetMobByID(mobNBR + 1):setPos(X,Y,Z); GetMobByID(mobNBR + 1):setSpawn(X,Y,Z); end end end end end end end; ----------------------------------- -- onMobDeath ----------------------------------- function onMobDeath(mob,killer) -- local mobID = mob:getID(); end;
gpl-3.0
gedadsbranch/Darkstar-Mission
scripts/zones/Port_Windurst/npcs/Pichichi.lua
36
2675
----------------------------------- -- Area: Port Windurst -- NPC: Pichichi ----------------------------------- package.loaded["scripts/zones/Port_Windurst/TextIDs"] = nil; ----------------------------------- require("scripts/globals/quests"); require("scripts/globals/settings"); require("scripts/zones/Port_Windurst/TextIDs"); ----------------------------------- -- onTrade Action ----------------------------------- function onTrade(player,npc,trade) end; ----------------------------------- -- onTrigger Action ----------------------------------- function onTrigger(player,npc) TruthJusticeOnionWay = player:getQuestStatus(WINDURST,TRUTH_JUSTICE_AND_THE_ONION_WAY); KnowOnesOnions = player:getQuestStatus(WINDURST,KNOW_ONE_S_ONIONS); InspectorsGadget = player:getQuestStatus(WINDURST,INSPECTOR_S_GADGET); OnionRings = player:getQuestStatus(WINDURST,ONION_RINGS); CryingOverOnions = player:getQuestStatus(WINDURST,CRYING_OVER_ONIONS); ThePromise = player:getQuestStatus(WINDURST,THE_PROMISE); if (ThePromise == QUEST_COMPLETED) then Message = math.random(0,1) if (Message == 1) then player:startEvent(0x0212); else player:startEvent(0x0218); end elseif (CryingOverOnions == QUEST_COMPLETED) then player:startEvent(0x01ff); elseif (CryingOverOnions == QUEST_ACCEPTED) then player:startEvent(0x01f7); elseif (OnionRings == QUEST_COMPLETED) then player:startEvent(0x01bd); elseif (OnionRings == QUEST_ACCEPTED ) then player:startEvent(0x01b6); elseif (InspectorsGadget == QUEST_COMPLETED) then player:startEvent(0x01a7); elseif (InspectorsGadget == QUEST_ACCEPTED) then player:startEvent(0x019f); elseif (KnowOnesOnions == QUEST_COMPLETED) then player:startEvent(0x019b); elseif (KnowOnesOnions == QUEST_ACCEPTED) then KnowOnesOnionsVar = player:getVar("KnowOnesOnions"); if (KnowOnesOnionsVar == 2) then player:startEvent(0x019a); else player:startEvent(0x018b); end elseif (TruthJusticeOnionWay == QUEST_COMPLETED) then player:startEvent(0x0181); elseif (TruthJusticeOnionWay == QUEST_ACCEPTED) then player:startEvent(0x0176); else player:startEvent(0x016c); 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
FishFilletsNG/fillets-data
script/snowman/dialogs_bg.lua
1
1469
dialogId("tr-m-chlad1", "font_small", "I’m kind of cold.") dialogStr("Нещо ми е хладно.") dialogId("tr-v-jid1", "font_big", "No wonder. This is the Winter Mess Hall.") dialogStr("Не се учудвам. Това е Зимна бъркотия.") dialogId("tr-m-chlad2", "font_small", "I’m cold.") dialogStr("Студено ми е.") dialogId("tr-v-jid2", "font_big", "Well that’s what you would expect in a Winter Mess Hall, right?") dialogStr("Ами това се очаква когато се намираш в Зимната Зала, нали?") dialogId("tr-v-prezil", "font_big", "At least the snowman has survived.") dialogStr("Поне снежният човек оцеля.") dialogId("tr-m-cvicit", "font_small", "Maybe you should start thinking about how to manipulate the tables.") dialogStr("Може би трябва да започнеш да мислиш как да използваш масите.") dialogId("tr-m-ztuhl", "font_small", "Everything is so frozen here...") dialogStr("Тук всичко е толкова замръзнало...") dialogId("tr-m-au1", "font_small", "Ow!") dialogStr("Ох!") dialogId("tr-m-au2", "font_small", "Ouch!") dialogStr("Боли!") dialogId("tr-v-agres", "font_big", "I’ve never seen such an aggressive snowman.") dialogStr("Никога не съм виждал толкова агресивен снежен човек.") dialogId("tr-x-koste", "", "") dialogStr("")
gpl-2.0
gedadsbranch/Darkstar-Mission
scripts/zones/Upper_Jeuno/npcs/Brutus.lua
11
9517
----------------------------------- -- Area: Upper Jeuno -- NPC: Brutus -- Starts Quest: Chocobo's Wounds, Save My Son, Path of the Beastmaster, Wings of gold, Scattered into Shadow, Chocobo on the Loose! -- @pos -55 8 95 244 ----------------------------------- package.loaded["scripts/zones/Upper_Jeuno/TextIDs"] = nil; package.loaded["scripts/globals/settings"] = nil; ----------------------------------- require("scripts/globals/settings"); require("scripts/globals/titles"); require("scripts/globals/keyitems"); require("scripts/globals/quests"); require("scripts/zones/Upper_Jeuno/TextIDs"); ----------------------------------- -- onTrade Action ----------------------------------- function onTrade(player,npc,trade) end; ----------------------------------- -- onTrigger Action ----------------------------------- function onTrigger(player,npc) local chocoboOnTheLoose = player:getQuestStatus(JEUNO,CHOCOBO_ON_THE_LOOSE); local chocoboOnTheLooseStatus = player:getVar("ChocoboOnTheLoose"); local ChocobosWounds = player:getQuestStatus(JEUNO,CHOCOBO_S_WOUNDS); local saveMySon = player:getQuestStatus(JEUNO,SAVE_MY_SON); local wingsOfGold = player:getQuestStatus(JEUNO,WINGS_OF_GOLD); local scatIntoShadow = player:getQuestStatus(JEUNO,SCATTERED_INTO_SHADOW); local mLvl = player:getMainLvl(); local mJob = player:getMainJob(); if(chocoboOnTheLoose == QUEST_AVAILABLE) then player:startEvent(0x276D); elseif(chocoboOnTheLoose == QUEST_ACCEPTED and chocoboOnTheLooseStatus == 0) then player:startEvent(0x276E); elseif(chocoboOnTheLoose == QUEST_ACCEPTED and chocoboOnTheLooseStatus == 2) then player:startEvent(0x276F); elseif(chocoboOnTheLoose == QUEST_ACCEPTED and chocoboOnTheLooseStatus == 3) then player:startEvent(0x2773); elseif(chocoboOnTheLoose == QUEST_ACCEPTED and (chocoboOnTheLooseStatus == 5 or chocoboOnTheLooseStatus == 6)) then player:startEvent(0x2774); elseif(chocoboOnTheLoose == QUEST_ACCEPTED and chocoboOnTheLooseStatus == 7 and player:needToZone() == false and (player:getVar("ChocoboOnTheLooseDay") < VanadielDayOfTheYear() or player:getVar("ChocoboOnTheLooseYear") < VanadielYear())) then player:startEvent(0x277D); elseif(player:getMainLvl() >= 20 and ChocobosWounds ~= QUEST_COMPLETED) then local chocoFeed = player:getVar("ChocobosWounds_Event"); if(ChocobosWounds == QUEST_AVAILABLE) then player:startEvent(0x0047); elseif(chocoFeed == 1) then player:startEvent(0x0041); elseif(chocoFeed == 2) then player:startEvent(0x0042); else player:startEvent(0x0066); end elseif(ChocobosWounds == QUEST_COMPLETED and saveMySon == QUEST_AVAILABLE) then player:startEvent(0x0016); elseif(saveMySon == QUEST_COMPLETED and player:getQuestStatus(JEUNO,PATH_OF_THE_BEASTMASTER) == QUEST_AVAILABLE) then player:startEvent(0x0046); elseif(mLvl >= AF1_QUEST_LEVEL and mJob == 9 and wingsOfGold == QUEST_AVAILABLE) then if(player:getVar("wingsOfGold_shortCS") == 1) then player:startEvent(0x0089); -- Start Quest "Wings of gold" (Short dialog) else player:setVar("wingsOfGold_shortCS",1); player:startEvent(0x008b); -- Start Quest "Wings of gold" (Long dialog) end elseif(wingsOfGold == QUEST_ACCEPTED) then if(player:hasKeyItem(GUIDING_BELL) == false) then player:startEvent(0x0088); else player:startEvent(0x008a); -- Finish Quest "Wings of gold" end elseif(wingsOfGold == QUEST_COMPLETED and mLvl < AF2_QUEST_LEVEL and mJob == 9) then player:startEvent(0x0086); -- Standard dialog after "Wings of gold" elseif(scatIntoShadow == QUEST_AVAILABLE and mLvl >= AF2_QUEST_LEVEL and mJob == 9) then if(player:getVar("scatIntoShadow_shortCS") == 1) then player:startEvent(0x008f); else player:setVar("scatIntoShadow_shortCS",1); player:startEvent(0x008d); end elseif(scatIntoShadow == QUEST_ACCEPTED) then local scatIntoShadowCS = player:getVar("scatIntoShadowCS"); if(player:hasKeyItem(AQUAFLORA1) or player:hasKeyItem(AQUAFLORA2) or player:hasKeyItem(AQUAFLORA3)) then player:startEvent(0x008e); elseif(scatIntoShadowCS == 0) then player:startEvent(0x0090); elseif(scatIntoShadowCS == 1) then player:startEvent(0x0095); elseif(scatIntoShadowCS == 2) then player:startEvent(0x0087); end elseif(scatIntoShadow == QUEST_COMPLETED) then player:startEvent(0x0097); elseif(player:getQuestStatus(JEUNO,PATH_OF_THE_BEASTMASTER) == QUEST_COMPLETED) then player:startEvent(0x0014); else player:startEvent(0x0042, player:getMainLvl()); 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 == 0x276D) then player:addQuest(JEUNO,CHOCOBO_ON_THE_LOOSE); elseif(csid == 0x276E) then player:setVar("ChocoboOnTheLoose", 1); elseif(csid == 0x276F) then player:setVar("ChocoboOnTheLoose", 3); elseif(csid == 0x2773) then player:setVar("ChocoboOnTheLoose", 4); elseif(csid == 0x2774) then player:setVar("ChocoboOnTheLoose", 7); player:setVar("ChocoboOnTheLooseDay", VanadielDayOfTheYear()); player:setVar("ChocoboOnTheLooseYear", VanadielYear()); player:needToZone(true); elseif(csid == 0x277D) then player:setVar("ChocoboOnTheLoose", 0); player:setVar("ChocoboOnTheLooseDay", 0); player:setVar("ChocoboOnTheLooseYear", 0); player:addFame(JEUNO, JEUNO_FAME*30); player:addItem(2317); player:messageSpecial(ITEM_OBTAINED,2317); -- Chocobo Egg (a bit warm) player:completeQuest(JEUNO,CHOCOBO_ON_THE_LOOSE); elseif(csid == 0x0047 and option == 1) then player:addQuest(JEUNO,CHOCOBO_S_WOUNDS); player:setVar("ChocobosWounds_Event",1); elseif(csid == 0x0046) then player:addQuest(JEUNO,PATH_OF_THE_BEASTMASTER); player:addTitle(ANIMAL_TRAINER); player:unlockJob(9); -- Beastmaster player:messageSpecial(YOU_CAN_NOW_BECOME_A_BEASTMASTER); player:addFame(JEUNO, JEUNO_FAME*30); player:completeQuest(JEUNO,PATH_OF_THE_BEASTMASTER); elseif((csid == 0x008b or csid == 0x0089) and option == 1) then player:addQuest(JEUNO,WINGS_OF_GOLD); player:setVar("wingsOfGold_shortCS",0); elseif(csid == 0x008a) then if(player:getFreeSlotsCount() < 1) then player:messageSpecial(ITEM_CANNOT_BE_OBTAINED,16680); else player:delKeyItem(GUIDING_BELL); player:addItem(16680); player:messageSpecial(ITEM_OBTAINED,16680); -- Barbaroi Axe player:addFame(JEUNO,AF1_FAME); player:completeQuest(JEUNO,WINGS_OF_GOLD); end elseif((csid == 0x008f or csid == 0x008d) and option == 1) then player:addQuest(JEUNO,SCATTERED_INTO_SHADOW); player:setVar("scatIntoShadow_shortCS",0); player:addKeyItem(AQUAFLORA1); player:addKeyItem(AQUAFLORA2); player:addKeyItem(AQUAFLORA3); player:messageSpecial(KEYITEM_OBTAINED,AQUAFLORA1); elseif(csid == 0x0090) then player:setVar("scatIntoShadowCS",1); elseif(csid == 0x0087) then if(player:getFreeSlotsCount() < 1) then player:messageSpecial(ITEM_CANNOT_BE_OBTAINED,14097); else player:setVar("scatIntoShadowCS",0); player:addItem(14097); player:messageSpecial(ITEM_OBTAINED,14097); -- Beast Gaiters player:addFame(JEUNO,JEUNO_FAME*AF2_FAME); player:completeQuest(JEUNO,SCATTERED_INTO_SHADOW); end end end;
gpl-3.0
hooksta4/darkstar
scripts/zones/Horlais_Peak/npcs/Hot_springs.lua
2
1887
----------------------------------- -- Area: Northern San d'Oria -- NPC: Hot Springs -- @Zone: 139 -- @pos 444 -37 -18 ----------------------------------- package.loaded["scripts/zones/Horlais_Peak/TextIDs"] = nil; ----------------------------------- require("scripts/globals/titles"); require("scripts/globals/keyitems"); require("scripts/globals/settings"); require("scripts/zones/Horlais_Peak/TextIDs"); ----------------------------------- -- onTrade Action ----------------------------------- function onTrade(player,npc,trade) if (player:getQuestStatus(OUTLANDS,SECRET_OF_THE_DAMP_SCROLL) == QUEST_ACCEPTED and trade:hasItemQty(1210,1) and trade:getItemCount() == 1) then player:startEvent(0x0002,1210); end end; ----------------------------------- -- onTrigger Action ----------------------------------- function onTrigger(player,npc) if (player:getQuestStatus(SANDORIA,THE_GENERAL_S_SECRET) == 1) and (player:hasKeyItem(CURILLAS_BOTTLE_EMPTY) == true) then player:addKeyItem(CURILLAS_BOTTLE_FULL) player:messageSpecial(KEYITEM_OBTAINED,CURILLAS_BOTTLE_FULL); player:delKeyItem(CURILLAS_BOTTLE_EMPTY); 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); if (csid == 0x0002) then player:tradeComplete(); player:addItem(4949); -- Scroll of Jubaku: Ichi player:messageSpecial(ITEM_OBTAINED, 4949); player:addFame(OUTLANDS,NORG_FAME*75); player:addTitle(CRACKER_OF_THE_SECRET_CODE); player:completeQuest(OUTLANDS,SECRET_OF_THE_DAMP_SCROLL); end end;
gpl-3.0
FishFilletsNG/fillets-data
script/imprisoned/dialogs_ru.lua
1
1938
dialogId("ncp-m-tesno0", "font_small", "Look, how I am supposed to get out of here?") dialogStr("Посмотри, как я смогу выйти отсюда?") dialogId("ncp-m-tesno1", "font_small", "It’s quite tight in here.") dialogStr("Здесь достаточно тесно.") dialogId("ncp-v-dostala", "font_big", "How did you manage to get there?") dialogStr("Как ты туда забралась?") dialogId("ncp-v-sasanka", "font_big", "Stop playing with anemones and help me to get us out of here.") dialogStr("Прекрати играть с анемонами и помоги мне выйти отсюда.") dialogId("ncp-m-nekoukej", "font_small", "Don’t be surprised.") dialogStr("Не удивляйся.") dialogId("ncp-m-komari", "font_small", "There are so many corals here...") dialogStr("Здесь так много кораллов...") dialogId("ncp-v-ceho", "font_big", "What?") dialogStr("Что?") dialogId("ncp-m-koraly", "font_small", "So many corals. Are you deaf or what?") dialogStr("Кораллов много. Глухой, что ли?") dialogId("ncp-m-tvrdy", "font_small", "Oh my, this is a hard coral.") dialogStr("О, это твердый коралл.") dialogId("ncp-v-mekky", "font_big", "Oh my, this is a soft coral.") dialogStr("Оу, а это мягкий коралл.") dialogId("ncp-v-tak", "font_big", "So!") dialogStr("И?") dialogId("ncp-m-muzes", "font_small", "Now you can get out, can’t you?") dialogStr("Теперь ты можешь выйти, не так ли?") dialogId("ncp-v-neprojedu", "font_big", "Hmm, I can’t get through here...") dialogStr("Хм, я не могу пройти здесь...") dialogId("ncp-m-barvy", "font_small", "I love colors...") dialogStr("Я люблю цветные...") dialogId("ncp-x-tik", "", "") dialogStr("") dialogId("ncp-x-tup", "", "") dialogStr("") dialogId("ncp-x-ihaha", "", "") dialogStr("")
gpl-2.0
hooksta4/darkstar
scripts/zones/zones/Selbina/npcs/Mathilde.lua
19
1810
----------------------------------- -- Area: Selbina -- NPC: Mathilde -- Involved in Quest: Riding on the Clouds -- @pos 12.578 -8.287 -7.576 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") == 1) 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) if (player:getCurrentMission(COP) ==MORE_QUESTIONS_THAN_ANSWERS and player:getVar("PromathiaStatus")==2) then player:startEvent(0x2715); else player:startEvent(0x00ab); 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 == 0x2715) then player:setVar("PromathiaStatus",0); player:completeMission(COP,MORE_QUESTIONS_THAN_ANSWERS); player:addMission(COP,ONE_TO_BE_FEARED); end end;
gpl-3.0
hooksta4/darkstar
scripts/zones/Quicksand_Caves/Zone.lua
2
5828
----------------------------------- -- -- Zone: Quicksand_Caves (208) -- ----------------------------------- package.loaded["scripts/zones/Quicksand_Caves/TextIDs"] = nil; ----------------------------------- require("scripts/globals/settings"); require("scripts/globals/keyitems"); require("scripts/globals/zone"); require("scripts/zones/Quicksand_Caves/TextIDs"); base_id = 17629685; ----------------------------------- -- onInitialize ----------------------------------- function onInitialize(zone) local tomes = {17629766,17629767,17629768,17629769,17629770,17629771}; SetGroundsTome(tomes); -- Weight Door System (RegionID, X, Radius, Z) zone:registerRegion(1, -15, 5, -60, 0,0,0); -- 0x010D01EF Door zone:registerRegion(3, 15, 5,-180, 0,0,0); -- 0x010D01F1 Door zone:registerRegion(5, -580, 5,-420, 0,0,0); -- 0x010D01F3 Door zone:registerRegion(7, -700, 5,-420, 0,0,0); -- 0x010D01F5 Door zone:registerRegion(9, -700, 5,-380, 0,0,0); -- 0x010D01F7 Door zone:registerRegion(11, -780, 5,-460, 0,0,0); -- 0x010D01F9 Door zone:registerRegion(13, -820, 5,-380, 0,0,0); -- 0x010D01FB Door zone:registerRegion(15, -260, 5, 740, 0,0,0); -- 0x010D01FD Door zone:registerRegion(17, -340, 5, 660, 0,0,0); -- 0x010D01FF Door zone:registerRegion(19, -420, 5, 740, 0,0,0); -- 0x010D0201 Door zone:registerRegion(21, -340, 5, 820, 0,0,0); -- 0x010D0203 Door zone:registerRegion(23, -409, 5, 800, 0,0,0); -- 0x010D0205 Door zone:registerRegion(25, -400, 5, 670, 0,0,0); -- 0x010D0207 Door --[[ -- (Old) zone:registerRegion(1,-18,-1, -62,-13,1, -57); zone:registerRegion(3, 13,-1, -183, 18,1, -177); zone:registerRegion(5,-583,-1,-422,-577,1,-418); zone:registerRegion(7,-703,-1,-423,-697,1,-417); zone:registerRegion(9,-703,-1,-383,-697,1,-377); zone:registerRegion(11,-782,-1,-462,-777,1,-457); zone:registerRegion(13,-823,-1,-383,-817,1,-377); zone:registerRegion(15,-262,-1, 737,-257,1, 742); zone:registerRegion(17,-343,-1, 657,-337,1, 662); zone:registerRegion(19,-343,-1, 818,-337,1, 822); zone:registerRegion(21,-411,-1, 797,-406,1, 803); zone:registerRegion(23,-422,-1, 737,-417,1, 742); zone:registerRegion(25,-403,-1, 669,-397,1, 674); ]]-- -- Hole in the Sand zone:registerRegion(30,495,-9,-817,497,-7,-815); -- E-11 (Map 2) zone:registerRegion(31,815,-9,-744,817,-7,-742); -- M-9 (Map 2) zone:registerRegion(32,215,6,-17,217,8,-15); -- K-6 (Map 3) zone:registerRegion(33,-297,6,415,-295,8,417); -- E-7 (Map 6) zone:registerRegion(34,-137,6,-177,-135,8,-175); -- G-7 (Map 8) SetServerVariable("BastokFight8_1" ,0); SetServerVariable("Bastok8-1LastClear", os.time()-QM_RESET_TIME); -- Set a delay on ??? mission NM pop. UpdateTreasureSpawnPoint(17629735); end; ----------------------------------- -- onConquestUpdate ----------------------------------- function onConquestUpdate(zone, updatetype) local players = zone:getPlayers(); for name, player in pairs(players) do conquestUpdate(zone, player, updatetype, CONQUEST_BASE); end end; ----------------------------------- -- onZoneIn ----------------------------------- function onZoneIn(player,prevZone) local cs = -1; if ((player:getXPos() == 0) and (player:getYPos() == 0) and (player:getZPos() == 0)) then player:setPos(-980.193,14.913,-282.863,60); end return cs; end; ----------------------------------- -- onRegionEnter ----------------------------------- function onRegionEnter(player,region) local RegionID = region:GetRegionID(); if (RegionID >= 30) then switch (RegionID): caseof { [30] = function (x) player:setPos(496,-6,-816); end, [31] = function (x) player:setPos(816,-6,-743); end, [32] = function (x) player:setPos(216,9,-16); end, [33] = function (x) player:setPos(-296,9,416); end, [34] = function (x) player:setPos(-136,9,-176); end, } else local race = player:getRace(); printf("entering region %u",RegionID); if (race == 8) then -- Galka weight = 3; elseif (race == 5 or race == 6) then -- Taru male or female weight = 1; else -- Hume/Elvaan/Mithra weight = 2; end local varname = "[DOOR]Weight_Sensor_"..RegionID; w = GetServerVariable(varname); w = w + weight; SetServerVariable(varname,w); if (player:hasKeyItem(2051) or w >= 3) then local door = GetNPCByID(base_id + RegionID - 1); door:openDoor(15); -- open door with a 15 second time delay. --platform = GetNPCByID(base_id + RegionID + 1); --platform:setAnimation(8); -- this is supposed to light up the platform but it's not working. Tried other values too. end end end; ----------------------------------- -- OnRegionLeave ----------------------------------- function onRegionLeave(player,region) local RegionID = region:GetRegionID(); if (RegionID < 30) then local race = player:getRace(); -- printf("exiting region %u",RegionID); if (race == 8) then -- Galka weight = 3; elseif (race == 5 or race == 6) then -- Taru male or female weight = 1; else -- Hume/Elvaan/Mithra weight = 2; end; local varname = "[DOOR]Weight_Sensor_"..RegionID; w = GetServerVariable(varname); lastWeight = w; w = w - weight; SetServerVariable(varname,w); if (lastWeight >= 3 and w < 3) then --platform = GetNPCByID(base_id + RegionID + 1); --platform:setAnimation(9); 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
hooksta4/darkstar
scripts/globals/weaponskills/swift_blade.lua
30
1389
----------------------------------- -- Swift Blade -- Sword weapon skill -- Skill Level: 225 -- Delivers a three-hit attack. params.accuracy varies with TP. -- Will stack with Sneak Attack. -- Aligned with the Shadow Gorget & Soil Gorget. -- Aligned with the Shadow Belt & Soil Belt. -- Element: None -- Modifiers: STR:50% ; MND:50% -- 100%TP 200%TP 300%TP -- 1.50 1.50 1.50 ----------------------------------- require("scripts/globals/status"); require("scripts/globals/settings"); require("scripts/globals/weaponskills"); ----------------------------------- function onUseWeaponSkill(player, target, wsID) local params = {}; params.numHits = 3; params.ftp100 = 1.5; params.ftp200 = 1.5; params.ftp300 = 1.5; params.str_wsc = 0.3; params.dex_wsc = 0.0; params.vit_wsc = 0.0; params.agi_wsc = 0.0; params.int_wsc = 0.0; params.mnd_wsc = 0.3; params.chr_wsc = 0.0; params.crit100 = 0.0; params.crit200 = 0.0; params.crit300 = 0.0; params.canCrit = false; params.acc100 = 0.8; params.acc200= 0.9; params.acc300= 1; params.atkmulti = 1; if (USE_ADOULIN_WEAPON_SKILL_CHANGES == true) then params.str_wsc = 0.5; params.mnd_wsc = 0.5; end local damage, criticalHit, tpHits, extraHits = doPhysicalWeaponskill(player, target, params); damage = damage * WEAPON_SKILL_POWER return tpHits, extraHits, criticalHit, damage; end
gpl-3.0
FishFilletsNG/fillets-data
script/viking1/dialogs_ru.lua
1
3170
dialogId("d1-z-b1", "", "") dialogStr("") dialogId("d1-z-b2", "", "") dialogStr("") dialogId("d1-z-b3", "", "") dialogStr("") dialogId("d1-z-p1", "", "") dialogStr("") dialogId("d1-z-p2", "", "") dialogStr("") dialogId("d1-z-v0", "", "") dialogStr("") dialogId("d1-z-v1", "", "") dialogStr("") dialogId("d1-z-v2", "", "") dialogStr("") dialogId("dr-m-tojesnad", "font_small", "This must be a Viking ship!") dialogStr("Это, должно быть, корабль викингов!") dialogId("dr-v-jiste", "font_big", "Sure, it’s a drakkar.") dialogStr("Да, это драккар.") dialogId("dr-m-musela", "font_small", "She must have sunk fast. The oarsmen are still in their places.") dialogStr("Он, наверно, быстро затонул. Гребцы до сих пор на своих местах.") dialogId("dr-v-mozna", "font_big", "Maybe they sank her on purpose. Warriors would always accompany their leader on his way to Valhalla.") dialogStr("Возможно, его специально потопили. Воины всегда сопровождают своего лидера на пути в Валхаллу.") dialogId("dr-m-hruza", "font_small", "That’s awful. They look like they’re still alive.") dialogStr("Это ужасно. Они выглядят как живые.") dialogId("d1-1-hudba0", "font_viking1", "The music is gone!") dialogStr("Музыка стихла!") dialogId("d1-1-hudba1", "font_viking1", "They stopped playing!") dialogStr("Они перестали играть!") dialogId("d1-1-hudba2", "font_viking1", "The music stopped again!") dialogStr("Музыка снова остановилась!") dialogId("d1-2-brb0", "font_viking2", "Oh, no!") dialogStr("О, нет!") dialogId("d1-2-brb1", "font_viking2", "Again?") dialogStr("Снова?") dialogId("d1-2-brb2", "font_viking2", "Oh, not again!") dialogStr("О, только не снова!") dialogId("d1-3-brb0", "font_viking3", "What happened?") dialogStr("Что случилось?") dialogId("d1-3-brb1", "font_viking3", "Again?") dialogStr("Снова?") dialogId("d1-3-brb2", "font_viking3", "Oh, no!") dialogStr("О, нет!") dialogId("d1-4-brb0", "font_viking4", "The bloody music stopped!") dialogStr("Чёртова музыка остановилась!") dialogId("d1-4-brb1", "font_viking4", "What are they doing up there?") dialogStr("Что они там делают?") dialogId("d1-4-brb2", "font_viking4", "How could it be?") dialogStr("Как это может быть?") dialogId("d1-5-nevadi0", "font_viking5", "Take it easy, boys. Solo for Olaf!") dialogStr("Успокойтесь, парни. Соло для Олафа!") dialogId("d1-5-nevadi1", "font_viking5", "Never mind that, boys. We can sing ourself!") dialogStr("Не обращайте внимания, ребята. Мы можем петь и без музыки!") dialogId("d1-5-nevadi2", "font_viking5", "Never mind, boys. We can sing ourself, like in the old times!") dialogStr("Не обращайте внимания, друзья. Мы можем петь и без музыки, как в былые времена!")
gpl-2.0
hooksta4/darkstar
scripts/zones/zones/Bastok_Mines/npcs/Griselda.lua
4
1819
----------------------------------- -- Area: Bastok Mines -- NPC: Griselda -- Standard Merchant NPC -- @pos -25.749 -0.044 52.360 234 ----------------------------------- package.loaded["scripts/zones/Bastok_Mines/TextIDs"] = nil; ----------------------------------- require("scripts/globals/shop"); require("scripts/globals/quests"); require("scripts/zones/Bastok_Mines/TextIDs"); ----------------------------------- -- onTrade Action ----------------------------------- function onTrade(player,npc,trade) end; ----------------------------------- -- onTrigger Action ----------------------------------- function onTrigger(player,npc) local WildcatBastok = player:getVar("WildcatBastok"); if (player:getQuestStatus(BASTOK,LURE_OF_THE_WILDCAT_BASTOK) == QUEST_ACCEPTED and player:getMaskBit(WildcatBastok,15) == false) then player:startEvent(0x01fb); else player:showText(npc,GRISELDA_SHOP_DIALOG); stock = { 0x115A, 360,1, --Bottle of pineapple juice 0x1127, 21,2, --Bretzel 0x118A, 432,2, --Pickled herring 0x1148, 990,2, --Bottle of melon juice 0x1193, 90,3, --Loaf of iron bread 0x1118, 108,3, --Strip of meat jerky 0x119D, 10,3 --Flask of distilled water } showNationShop(player, BASTOK, stock); end end; ----------------------------------- -- onEventUpdate ----------------------------------- function onEventUpdate(player,csid,option) --printf("CSID: %u",csid); --printf("RESULT: %u",option); end; ----------------------------------- -- onEventFinish ----------------------------------- function onEventFinish(player,csid,option) --printf("CSID: %u",csid); --printf("RESULT: %u",option); if (csid == 0x01fb) then player:setMaskBit(player:getVar("WildcatBastok"),"WildcatBastok",15,true); end end;
gpl-3.0
gedadsbranch/Darkstar-Mission
scripts/globals/items/skewer_of_m&p_chicken.lua
36
1336
----------------------------------------- -- ID: 5639 -- Item: Skewer of M&P Chicken -- Food Effect: 3Min, All Races ----------------------------------------- -- Strength 5 -- Intelligence -5 -- Attack % 25 -- Attack Cap 154 ----------------------------------------- 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,180,5639); end; ----------------------------------- -- onEffectGain Action ----------------------------------- function onEffectGain(target,effect) target:addMod(MOD_STR, 5); target:addMod(MOD_INT, -5); target:addMod(MOD_FOOD_ATTP, 25); target:addMod(MOD_FOOD_ATT_CAP, 154); end; ----------------------------------------- -- onEffectLose Action ----------------------------------------- function onEffectLose(target,effect) target:delMod(MOD_STR, 5); target:delMod(MOD_INT, -5); target:delMod(MOD_FOOD_ATTP, 25); target:delMod(MOD_FOOD_ATT_CAP, 154); end;
gpl-3.0
hooksta4/darkstar
scripts/zones/Abyssea-Uleguerand/Zone.lua
33
1487
----------------------------------- -- -- Zone: Abyssea - Uleguerand -- ----------------------------------- package.loaded["scripts/zones/Abyssea-Uleguerand/TextIDs"] = nil; ----------------------------------- require("scripts/globals/settings"); require("scripts/globals/quests"); require("scripts/zones/Abyssea-Uleguerand/TextIDs"); ----------------------------------- -- onInitialize ----------------------------------- function onInitialize(zone) end; ----------------------------------- -- onZoneIn ----------------------------------- function onZoneIn(player,prevZone) local cs = -1; if (player:getXPos() == 0 and player:getYPos() == 0 and player:getZPos() == 0) then player:setPos(-238, -40, -520.5, 0); end if (player:getQuestStatus(ABYSSEA, THE_TRUTH_BECKONS) == QUEST_ACCEPTED and player:getVar("1stTimeAyssea") == 0) then player:setVar("1stTimeAyssea",1); end return cs; end; ----------------------------------- -- onRegionEnter ----------------------------------- function onRegionEnter(player,region) end; ----------------------------------- -- onEventUpdate ----------------------------------- function onEventUpdate(player,csid,option) -- printf("CSID: %u",csid); -- printf("RESULT: %u",option); end; ----------------------------------- -- onEventFinish ----------------------------------- function onEventFinish(player,csid,option) -- printf("CSID: %u",csid); -- printf("RESULT: %u",option); end;
gpl-3.0
hooksta4/darkstar
scripts/zones/zones/Abyssea-Uleguerand/Zone.lua
33
1487
----------------------------------- -- -- Zone: Abyssea - Uleguerand -- ----------------------------------- package.loaded["scripts/zones/Abyssea-Uleguerand/TextIDs"] = nil; ----------------------------------- require("scripts/globals/settings"); require("scripts/globals/quests"); require("scripts/zones/Abyssea-Uleguerand/TextIDs"); ----------------------------------- -- onInitialize ----------------------------------- function onInitialize(zone) end; ----------------------------------- -- onZoneIn ----------------------------------- function onZoneIn(player,prevZone) local cs = -1; if (player:getXPos() == 0 and player:getYPos() == 0 and player:getZPos() == 0) then player:setPos(-238, -40, -520.5, 0); end if (player:getQuestStatus(ABYSSEA, THE_TRUTH_BECKONS) == QUEST_ACCEPTED and player:getVar("1stTimeAyssea") == 0) then player:setVar("1stTimeAyssea",1); end return cs; end; ----------------------------------- -- onRegionEnter ----------------------------------- function onRegionEnter(player,region) end; ----------------------------------- -- onEventUpdate ----------------------------------- function onEventUpdate(player,csid,option) -- printf("CSID: %u",csid); -- printf("RESULT: %u",option); end; ----------------------------------- -- onEventFinish ----------------------------------- function onEventFinish(player,csid,option) -- printf("CSID: %u",csid); -- printf("RESULT: %u",option); end;
gpl-3.0
gedadsbranch/Darkstar-Mission
scripts/zones/Lower_Jeuno/npcs/Domenic.lua
34
1998
----------------------------------- -- Area: Lower Jeuno -- NPC: Domenic -- BCNM/KSNM Teleporter ----------------------------------- package.loaded["scripts/zones/Lower_Jeuno/TextIDs"] = nil; ----------------------------------- require("scripts/zones/Lower_Jeuno/TextIDs"); require("scripts/globals/settings"); require("scripts/globals/teleports"); require("scripts/globals/quests"); ----------------------------------- -- onTrade Action ----------------------------------- function onTrade(player,npc,trade) end; ----------------------------------- -- onTrigger Action ----------------------------------- function onTrigger(player,npc) if (player:hasCompleteQuest(JEUNO,BEYOND_INFINITY) == true) then player:startEvent(0x2783,player:getGil()); else player:startEvent(0x2784); 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 == 0x2783) then if (option == 1 and player:getGil() >= 750) then player:delGil(750); toGhelsba(player); elseif (option == 2 and player:getGil() >= 750) then player:delGil(750); player:setPos(0, 0, 0, 0, 139); elseif (option == 3 and player:getGil() >= 750) then player:delGil(750); player:setPos(0, 0, 0, 0, 144); elseif (option == 4 and player:getGil() >= 750) then player:delGil(750); player:setPos(0, 0, 0, 0, 146); elseif (option == 5 and player:getGil() >= 1000) then player:delGil(1000); player:setPos(0, 0, 0, 0, 206); end end end;
gpl-3.0
hooksta4/darkstar
scripts/zones/zones/Northern_San_dOria/npcs/Cauzeriste.lua
2
1211
----------------------------------- -- Area: Northern San d'Oria -- NPC: Cauzeriste -- Guild Merchant NPC: Woodworking Guild -- @pos -175.946 3.999 280.301 231 ----------------------------------- package.loaded["scripts/zones/Northern_San_dOria/TextIDs"] = nil; ----------------------------------- require("scripts/globals/settings"); require("scripts/globals/shop"); require("scripts/globals/quests"); require("scripts/zones/Northern_San_dOria/TextIDs"); ----------------------------------- -- onTrade Action ----------------------------------- function onTrade(player,npc,trade) end; ----------------------------------- -- onTrigger Action ----------------------------------- function onTrigger(player,npc) if (player:sendGuild(513,6,21,0)) then player:showText(npc,CAUZERISTE_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
AnySDK/Sample_Lua
frameworks/cocos2d-x/external/lua/luajit/src/src/jit/bc.lua
78
5606
---------------------------------------------------------------------------- -- LuaJIT bytecode listing module. -- -- Copyright (C) 2005-2013 Mike Pall. All rights reserved. -- Released under the MIT license. See Copyright Notice in luajit.h ---------------------------------------------------------------------------- -- -- This module lists the bytecode of a Lua function. If it's loaded by -jbc -- it hooks into the parser and lists all functions of a chunk as they -- are parsed. -- -- Example usage: -- -- luajit -jbc -e 'local x=0; for i=1,1e6 do x=x+i end; print(x)' -- luajit -jbc=- foo.lua -- luajit -jbc=foo.list foo.lua -- -- Default output is to stderr. To redirect the output to a file, pass a -- filename as an argument (use '-' for stdout) or set the environment -- variable LUAJIT_LISTFILE. The file is overwritten every time the module -- is started. -- -- This module can also be used programmatically: -- -- local bc = require("jit.bc") -- -- local function foo() print("hello") end -- -- bc.dump(foo) --> -- BYTECODE -- [...] -- print(bc.line(foo, 2)) --> 0002 KSTR 1 1 ; "hello" -- -- local out = { -- -- Do something with each line: -- write = function(t, ...) io.write(...) end, -- close = function(t) end, -- flush = function(t) end, -- } -- bc.dump(foo, out) -- ------------------------------------------------------------------------------ -- Cache some library functions and objects. local jit = require("jit") assert(jit.version_num == 20001, "LuaJIT core/library version mismatch") local jutil = require("jit.util") local vmdef = require("jit.vmdef") local bit = require("bit") local sub, gsub, format = string.sub, string.gsub, string.format local byte, band, shr = string.byte, bit.band, bit.rshift local funcinfo, funcbc, funck = jutil.funcinfo, jutil.funcbc, jutil.funck local funcuvname = jutil.funcuvname local bcnames = vmdef.bcnames local stdout, stderr = io.stdout, io.stderr ------------------------------------------------------------------------------ local function ctlsub(c) if c == "\n" then return "\\n" elseif c == "\r" then return "\\r" elseif c == "\t" then return "\\t" else return format("\\%03d", byte(c)) end end -- Return one bytecode line. local function bcline(func, pc, prefix) local ins, m = funcbc(func, pc) if not ins then return end local ma, mb, mc = band(m, 7), band(m, 15*8), band(m, 15*128) local a = band(shr(ins, 8), 0xff) local oidx = 6*band(ins, 0xff) local op = sub(bcnames, oidx+1, oidx+6) local s = format("%04d %s %-6s %3s ", pc, prefix or " ", op, ma == 0 and "" or a) local d = shr(ins, 16) if mc == 13*128 then -- BCMjump return format("%s=> %04d\n", s, pc+d-0x7fff) end if mb ~= 0 then d = band(d, 0xff) elseif mc == 0 then return s.."\n" end local kc if mc == 10*128 then -- BCMstr kc = funck(func, -d-1) kc = format(#kc > 40 and '"%.40s"~' or '"%s"', gsub(kc, "%c", ctlsub)) elseif mc == 9*128 then -- BCMnum kc = funck(func, d) if op == "TSETM " then kc = kc - 2^52 end elseif mc == 12*128 then -- BCMfunc local fi = funcinfo(funck(func, -d-1)) if fi.ffid then kc = vmdef.ffnames[fi.ffid] else kc = fi.loc end elseif mc == 5*128 then -- BCMuv kc = funcuvname(func, d) end if ma == 5 then -- BCMuv local ka = funcuvname(func, a) if kc then kc = ka.." ; "..kc else kc = ka end end if mb ~= 0 then local b = shr(ins, 24) if kc then return format("%s%3d %3d ; %s\n", s, b, d, kc) end return format("%s%3d %3d\n", s, b, d) end if kc then return format("%s%3d ; %s\n", s, d, kc) end if mc == 7*128 and d > 32767 then d = d - 65536 end -- BCMlits return format("%s%3d\n", s, d) end -- Collect branch targets of a function. local function bctargets(func) local target = {} for pc=1,1000000000 do local ins, m = funcbc(func, pc) if not ins then break end if band(m, 15*128) == 13*128 then target[pc+shr(ins, 16)-0x7fff] = true end end return target end -- Dump bytecode instructions of a function. local function bcdump(func, out, all) if not out then out = stdout end local fi = funcinfo(func) if all and fi.children then for n=-1,-1000000000,-1 do local k = funck(func, n) if not k then break end if type(k) == "proto" then bcdump(k, out, true) end end end out:write(format("-- BYTECODE -- %s-%d\n", fi.loc, fi.lastlinedefined)) local target = bctargets(func) for pc=1,1000000000 do local s = bcline(func, pc, target[pc] and "=>") if not s then break end out:write(s) end out:write("\n") out:flush() end ------------------------------------------------------------------------------ -- Active flag and output file handle. local active, out -- List handler. local function h_list(func) return bcdump(func, out) end -- Detach list handler. local function bclistoff() if active then active = false jit.attach(h_list) if out and out ~= stdout and out ~= stderr then out:close() end out = nil end end -- Open the output file and attach list handler. local function bcliston(outfile) if active then bclistoff() end if not outfile then outfile = os.getenv("LUAJIT_LISTFILE") end if outfile then out = outfile == "-" and stdout or assert(io.open(outfile, "w")) else out = stderr end jit.attach(h_list, "bc") active = true end -- Public module functions. module(...) line = bcline dump = bcdump targets = bctargets on = bcliston off = bclistoff start = bcliston -- For -j command line option.
mit
modulexcite/Zero-K-Infrastructure
ZeroKLobby_NET4.0/Benchmarker/Benchmarks/games/path_test.sdd/Luaui/pathTests/Config/Crossing_4_final.lua
12
1412
local test = { { delayToNextTest = 300, unitList = {}, }, { delayToNextTest = 300, unitList = {}, }, { delayToNextTest = 300, unitList = {}, }, { delayToNextTest = 300, unitList = {}, }, } local MAX_DELAY_FACTOR = 1.75 local stepSize = 128 local units = { "corak", "corraid", "corsh", "correap", "corak", "corraid", "corsh", "correap", } local x1 = 128 local x2 = Game.mapSizeX - x1 for testNum = 1,#test do if units[testNum] and UnitDefNames[units[testNum]] then local unitDef = UnitDefNames[units[testNum]] local unitList = test[testNum].unitList local maxTravelTime = ((x1 - x2))/unitDef.speed * 30 * MAX_DELAY_FACTOR if maxTravelTime < 0 then maxTravelTime = -maxTravelTime end for z = stepSize, Game.mapSizeZ - stepSize, stepSize do local y1 = Spring.GetGroundHeight(x1, z) local y2 = Spring.GetGroundHeight(x2, z) unitList[#unitList+1] = { unitName = units[testNum], teamID = 0, startCoordinates = {x1, y1, z}, destinationCoordinates = {{x2, y2, z}}, maxTargetDist = 40, maxTravelTime = maxTravelTime, } end --Spring.Echo("Max travel time for " .. units[testNum] .. ": " .. maxTravelTime) --Spring.Log(widget:GetInfo().name, "info", "Max travel time for " .. units[testNum] .. ": " .. maxTravelTime) else Spring.Log(widget:GetInfo().name, "warning", "invalid unit name for path test") end end return test
gpl-3.0
p5n/notion
etc/look_brownsteel.lua
5
2149
-- look_brownsteel.lua drawing engine configuration file for Notion. if not gr.select_engine("de") then return end de.reset() de.defstyle("*", { shadow_colour = "#404040", highlight_colour = "#707070", background_colour = "#505050", foreground_colour = "#a0a0a0", padding_pixels = 1, highlight_pixels = 1, shadow_pixels = 1, border_style = "elevated", font = "-*-helvetica-medium-r-normal-*-14-*-*-*-*-*-*-*", text_align = "center", }) de.defstyle("tab", { font = "-*-helvetica-medium-r-normal-*-12-*-*-*-*-*-*-*", de.substyle("active-selected", { shadow_colour = "#304050", highlight_colour = "#708090", background_colour = "#506070", foreground_colour = "#ffffff", }), de.substyle("active-unselected", { shadow_colour = "#203040", highlight_colour = "#607080", background_colour = "#405060", foreground_colour = "#a0a0a0", }), de.substyle("inactive-selected", { shadow_colour = "#404040", highlight_colour = "#909090", background_colour = "#606060", foreground_colour = "#a0a0a0", }), de.substyle("inactive-unselected", { shadow_colour = "#404040", highlight_colour = "#707070", background_colour = "#505050", foreground_colour = "#a0a0a0", }), text_align = "center", }) de.defstyle("input", { shadow_colour = "#404040", highlight_colour = "#707070", background_colour = "#000000", foreground_colour = "#ffffff", padding_pixels = 1, highlight_pixels = 1, shadow_pixels = 1, border_style = "elevated", de.substyle("*-cursor", { background_colour = "#ffffff", foreground_colour = "#000000", }), de.substyle("*-selection", { background_colour = "#505050", foreground_colour = "#ffffff", }), }) de.defstyle("input-menu", { de.substyle("active", { shadow_colour = "#304050", highlight_colour = "#708090", background_colour = "#506070", foreground_colour = "#ffffff", }), }) dopath("lookcommon_emboss") gr.refresh()
lgpl-2.1
gedadsbranch/Darkstar-Mission
scripts/zones/Konschtat_Highlands/npcs/qm2.lua
11
1422
----------------------------------- -- Area: Konschtat Highlands -- NPC: qm2 (???) -- Involved in Quest: Forge Your Destiny -- @pos -709 2 102 108 ----------------------------------- package.loaded["scripts/zones/Konschtat_Highlands/TextIDs"] = nil; ----------------------------------- require("scripts/globals/quests"); require("scripts/zones/Konschtat_Highlands/TextIDs"); ----------------------------------- -- onTrade Action ----------------------------------- function onTrade(player,npc,trade) if(player:getQuestStatus(OUTLANDS,FORGE_YOUR_DESTINY) == QUEST_ACCEPTED) then if(trade:getItemCount() == 1 and trade:hasItemQty(1151,1) and GetMobAction(17219999) == 0) then -- Oriental Steel SpawnMob(17219999, 300):updateEnmity(player); -- Spawn Forger, Despawn after inactive for 5 minutes player:tradeComplete(); end end end; ----------------------------------- -- onTrigger Action ----------------------------------- function onTrigger(player,npc) player:messageSpecial(NOTHING_OUT_OF_ORDINARY); 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
gedadsbranch/Darkstar-Mission
scripts/zones/Castle_Oztroja/Zone.lua
28
1816
----------------------------------- -- -- Zone: Castle_Oztroja (151) -- ----------------------------------- package.loaded["scripts/zones/Castle_Oztroja/TextIDs"] = nil; ----------------------------------- require("scripts/globals/settings"); require("scripts/globals/zone"); require("scripts/zones/Castle_Oztroja/TextIDs"); ----------------------------------- -- onInitialize ----------------------------------- function onInitialize(zone) -- Yagudo Avatar SetRespawnTime(17396134, 900, 10800); UpdateTreasureSpawnPoint(17396206); UpdateTreasureSpawnPoint(17396207); end; ----------------------------------- -- onZoneIn ----------------------------------- function onZoneIn(player,prevZone) local cs = -1; if (player:getXPos() == 0 and player:getYPos() == 0 and player:getZPos() == 0) then player:setPos(-162.895,22.136,-139.923,2); end return cs; end; ----------------------------------- -- onConquestUpdate ----------------------------------- function onConquestUpdate(zone, updatetype) local players = zone:getPlayers(); for name, player in pairs(players) do conquestUpdate(zone, player, updatetype, CONQUEST_BASE); end end; ----------------------------------- -- onRegionEnter ----------------------------------- function onRegionEnter(player,region) end; ----------------------------------- -- onEventUpdate ----------------------------------- function onEventUpdate(player,csid,option) -- printf("CSID: %u",csid); -- printf("RESULT: %u",option); end; ----------------------------------- -- onEventFinish ----------------------------------- function onEventFinish(player,csid,option) -- printf("CSID: %u",csid); -- printf("RESULT: %u",option); end;
gpl-3.0
hooksta4/darkstar
scripts/zones/zones/Mount_Zhayolm/mobs/Wamoura_Prince.lua
2
1564
----------------------------------- -- Area: Mount Zhayolm -- MOB: Wamoura Prince ----------------------------------- require("scripts/globals/status"); -- TODO: Damage resistances in streched and curled stances. Halting movement during stance change. Morph into Wamoura. ----------------------------------- -- OnMobSpawn Action ----------------------------------- function onMobSpawn(mob) mob:setLocalVar("formTime", os.time() + math.random(43,47)); end; ----------------------------------- -- onMobRoam Action -- Autochange stance ----------------------------------- function onMobRoam(mob) local roamTime = mob:getLocalVar("formTime"); if (mob:AnimationSub() == 0 and os.time() > roamTime) then mob:AnimationSub(1); mob:setLocalVar("formTime", os.time() + math.random(43,47)); elseif (mob:AnimationSub() == 1 and os.time() > roamTime) then mob:AnimationSub(0); mob:setLocalVar("formTime", os.time() + math.random(43,47)); end end; ----------------------------------- -- OnMobFight Action -- Stance change in battle ----------------------------------- function onMobFight(mob,target) local fightTime = mob:getLocalVar("formTime"); if (mob:AnimationSub() == 0 and os.time() > fightTime) then mob:AnimationSub(1); mob:setLocalVar("formTime", os.time() + math.random(43,47)); elseif (mob:AnimationSub() == 1 and os.time() > fightTime) then mob:AnimationSub(0); mob:setLocalVar("formTime", os.time() + math.random(43,47)); end end; function onMobDeath(mob) end;
gpl-3.0
gedadsbranch/Darkstar-Mission
scripts/zones/Tavnazian_Safehold/npcs/Hieroglyphics.lua
17
2352
----------------------------------- -- Area: Tavnazian_Safehold -- NPC: Hieroglyphics -- Notes: Dynamis Tavnazia Enter -- @pos 3.674 -7.278 -27.856 26 ----------------------------------- package.loaded["scripts/zones/Tavnazian_Safehold/TextIDs"] = nil; ----------------------------------- require("scripts/globals/settings"); require("scripts/globals/keyitems"); require("scripts/globals/dynamis"); require("scripts/globals/missions"); require("scripts/zones/Tavnazian_Safehold/TextIDs"); ----------------------------------- -- onTrade Action ----------------------------------- function onTrade(player,npc,trade) end; ----------------------------------- -- onTrigger Action ----------------------------------- function onTrigger(player,npc) if( (player:hasCompletedMission(COP,DARKNESS_NAMED) or FREE_COP_DYNAMIS == 1) and player:hasKeyItem(DYNAMIS_BUBURIMU_SLIVER ) and player:hasKeyItem(DYNAMIS_QUFIM_SLIVER ) and player:hasKeyItem(DYNAMIS_VALKURM_SLIVER )) then local firstDyna = 0; local realDay = os.time(); local dynaWaitxDay = player:getVar("dynaWaitxDay"); if(player:getMainLvl() < DYNA_LEVEL_MIN) then player:messageSpecial(PLAYERS_HAVE_NOT_REACHED_LEVEL,DYNA_LEVEL_MIN); elseif((dynaWaitxDay + (BETWEEN_2DYNA_WAIT_TIME * 24 * 60 * 60)) < realDay or player:getVar("DynamisID") == GetServerVariable("[DynaTavnazia]UniqueID")) then player:startEvent(0x024C,10,0,0,BETWEEN_2DYNA_WAIT_TIME,32,VIAL_OF_SHROUDED_SAND,4236,4237); else dayRemaining = math.floor(((dynaWaitxDay + (BETWEEN_2DYNA_WAIT_TIME * 24 * 60 * 60)) - realDay)/3456); printf("dayRemaining : %u",dayRemaining ); player:messageSpecial(YOU_CANNOT_ENTER_DYNAMIS,dayRemaining,10); end else player:messageSpecial(MYSTERIOUS_VOICE); end end; ----------------------------------- -- onEventUpdate ----------------------------------- function onEventUpdate(player,csid,option) --printf("CSID: %u",csid); --printf("updateRESULT: %u",option); end; ----------------------------------- -- onEventFinish ----------------------------------- function onEventFinish(player,csid,option) --printf("CSID: %u",csid); --printf("finishRESULT: %u",option); if(csid == 0x024C and option == 0) then player:setPos(0.1,-7,-21,190,42); end end;
gpl-3.0
AnySDK/Sample_Lua
frameworks/cocos2d-x/tests/lua-tests/src/AssetsManagerTest/AssetsManagerTest.lua
10
4584
local targetPlatform = cc.Application:getInstance():getTargetPlatform() local lineSpace = 40 local itemTagBasic = 1000 local menuItemNames = { "enter", "reset", "update", } local winSize = cc.Director:getInstance():getWinSize() local function updateLayer() local layer = cc.Layer:create() local support = false if (cc.PLATFORM_OS_IPHONE == targetPlatform) or (cc.PLATFORM_OS_IPAD == targetPlatform) or (cc.PLATFORM_OS_WINDOWS == targetPlatform) or (cc.PLATFORM_OS_ANDROID == targetPlatform) or (cc.PLATFORM_OS_MAC == targetPlatform) then support = true end if not support then print("Platform is not supported!") return layer end local isUpdateItemClicked = false local assetsManager = nil local pathToSave = "" local menu = cc.Menu:create() menu:setPosition(cc.p(0, 0)) cc.MenuItemFont:setFontName("Arial") cc.MenuItemFont:setFontSize(24) local progressLable = cc.Label:createWithTTF("",s_arialPath,30) progressLable:setAnchorPoint(cc.p(0.5, 0.5)) progressLable:setPosition(cc.p(140,50)) layer:addChild(progressLable) pathToSave = createDownloadDir() local function onError(errorCode) if errorCode == cc.ASSETSMANAGER_NO_NEW_VERSION then progressLable:setString("no new version") elseif errorCode == cc.ASSETSMANAGER_NETWORK then progressLable:setString("network error") end end local function onProgress( percent ) local progress = string.format("downloading %d%%",percent) progressLable:setString(progress) end local function onSuccess() progressLable:setString("downloading ok") end local function getAssetsManager() if nil == assetsManager then assetsManager = cc.AssetsManager:new("https://raw.github.com/samuele3hu/AssetsManagerTest/master/package.zip", "https://raw.github.com/samuele3hu/AssetsManagerTest/master/version", pathToSave) assetsManager:retain() assetsManager:setDelegate(onError, cc.ASSETSMANAGER_PROTOCOL_ERROR ) assetsManager:setDelegate(onProgress, cc.ASSETSMANAGER_PROTOCOL_PROGRESS) assetsManager:setDelegate(onSuccess, cc.ASSETSMANAGER_PROTOCOL_SUCCESS ) assetsManager:setConnectionTimeout(3) end return assetsManager end local function update(sender) progressLable:setString("") getAssetsManager():update() end local function reset(sender) progressLable:setString("") deleteDownloadDir(pathToSave) getAssetsManager():deleteVersion() createDownloadDir() end local function reloadModule( moduleName ) package.loaded[moduleName] = nil return require(moduleName) end local function enter(sender) if not isUpdateItemClicked then local realPath = pathToSave .. "/package" addSearchPath(realPath,true) end assetsManagerModule = reloadModule("AssetsManagerTest/AssetsManagerModule") assetsManagerModule.newScene(AssetsManagerTestMain) end local callbackFuncs = { enter, reset, update, } local function menuCallback(tag, menuItem) local scene = nil local nIdx = menuItem:getLocalZOrder() - itemTagBasic local ExtensionsTestScene = CreateExtensionsTestScene(nIdx) if nil ~= ExtensionsTestScene then cc.Director:getInstance():replaceScene(ExtensionsTestScene) end end for i = 1, table.getn(menuItemNames) do local item = cc.MenuItemFont:create(menuItemNames[i]) item:registerScriptTapHandler(callbackFuncs[i]) item:setPosition(winSize.width / 2, winSize.height - i * lineSpace) if not support then item:setEnabled(false) end menu:addChild(item, itemTagBasic + i) end local function onNodeEvent(msgName) if nil ~= assetsManager then assetsManager:release() assetsManager = nil end end layer:registerScriptHandler(onNodeEvent) layer:addChild(menu) return layer end ------------------------------------- -- AssetsManager Test ------------------------------------- function AssetsManagerTestMain() local scene = cc.Scene:create() scene:addChild(updateLayer()) scene:addChild(CreateBackMenuItem()) return scene end
mit
hooksta4/darkstar
scripts/zones/Windurst_Waters_[S]/npcs/Tahl_Mhioguch.lua
38
1053
----------------------------------- -- Area: Windurst Waters (S) -- NPC: Tahl Mhioguch -- Type: Standard NPC -- @zone: 94 -- @pos -64.907 -5.947 81.391 -- -- Auto-Script: Requires Verification (Verified by Brawndo) ----------------------------------- package.loaded["scripts/zones/Windurst_Waters_[S]/TextIDs"] = nil; ----------------------------------- ----------------------------------- -- onTrade Action ----------------------------------- function onTrade(player,npc,trade) end; ----------------------------------- -- onTrigger Action ----------------------------------- function onTrigger(player,npc) player:startEvent(0x01b6); end; ----------------------------------- -- onEventUpdate ----------------------------------- function onEventUpdate(player,csid,option) -- printf("CSID: %u",csid); -- printf("RESULT: %u",option); end; ----------------------------------- -- onEventFinish ----------------------------------- function onEventFinish(player,csid,option) -- printf("CSID: %u",csid); -- printf("RESULT: %u",option); end;
gpl-3.0
hooksta4/darkstar
scripts/zones/zones/West_Sarutabaruta/npcs/Twinkle_Tree.lua
4
2136
----------------------------------- -- Area: West Sarutabaruta -- NPC: Twinkle Tree -- Involved in Quest: To Catch a Falling Star -- Note: EventID for Twinkle Tree is unknown. Quest funtions but the full event is not played. -- @pos 156.003 -40.753 333.742 115 ----------------------------------- package.loaded["scripts/zones/West_Sarutabaruta/TextIDs"] = nil; ----------------------------------- require("scripts/globals/quests"); require("scripts/globals/settings"); require("scripts/globals/titles"); require("scripts/globals/status"); require("scripts/zones/West_Sarutabaruta/TextIDs"); ----------------------------------- -- onTrade Action ----------------------------------- function onTrade(player,npc,trade) starstatus = player:getQuestStatus(WINDURST,TO_CATCH_A_FALLIHG_STAR); if (starstatus == 1 and VanadielHour() <= 3) then if (trade:getGil() == 0 and trade:hasItemQty(868,1) == true and trade:getItemCount() == 1 and player:getVar("QuestCatchAFallingStar_prog") == 0) then if (player:getFreeSlotsCount() == 0) then player:messageSpecial(7336); player:messageSpecial(7338); player:messageSpecial(ITEM_CANNOT_BE_OBTAINED,546); else player:tradeComplete(trade); player:messageSpecial(7336); player:messageSpecial(7338); player:addItem(546,1); player:messageSpecial(ITEM_OBTAINED,546); player:setVar("QuestCatchAFallingStar_prog",1); end end end end; ----------------------------------- -- onTrigger Action ----------------------------------- function onTrigger(player,npc) if (VanadielHour() <= 3 and player:getVar("QuestCatchAFallingStar_prog") == 0) then player:messageSpecial(7336); player:messageSpecial(7338); else player:messageSpecial(7339); end end; ----------------------------------- -- onEventUpdate ----------------------------------- function onEventUpdate(player,csid,option) --printf("CSID: %u",csid); --printf("RESULT: %u",option); end; ----------------------------------- -- onEventFinish ----------------------------------- function onEventFinish(player,csid,option) --printf("CSID: %u",csid); --printf("RESULT: %u",option); end;
gpl-3.0
hooksta4/darkstar
scripts/zones/West_Sarutabaruta/npcs/Twinkle_Tree.lua
4
2136
----------------------------------- -- Area: West Sarutabaruta -- NPC: Twinkle Tree -- Involved in Quest: To Catch a Falling Star -- Note: EventID for Twinkle Tree is unknown. Quest funtions but the full event is not played. -- @pos 156.003 -40.753 333.742 115 ----------------------------------- package.loaded["scripts/zones/West_Sarutabaruta/TextIDs"] = nil; ----------------------------------- require("scripts/globals/quests"); require("scripts/globals/settings"); require("scripts/globals/titles"); require("scripts/globals/status"); require("scripts/zones/West_Sarutabaruta/TextIDs"); ----------------------------------- -- onTrade Action ----------------------------------- function onTrade(player,npc,trade) starstatus = player:getQuestStatus(WINDURST,TO_CATCH_A_FALLIHG_STAR); if (starstatus == 1 and VanadielHour() <= 3) then if (trade:getGil() == 0 and trade:hasItemQty(868,1) == true and trade:getItemCount() == 1 and player:getVar("QuestCatchAFallingStar_prog") == 0) then if (player:getFreeSlotsCount() == 0) then player:messageSpecial(7336); player:messageSpecial(7338); player:messageSpecial(ITEM_CANNOT_BE_OBTAINED,546); else player:tradeComplete(trade); player:messageSpecial(7336); player:messageSpecial(7338); player:addItem(546,1); player:messageSpecial(ITEM_OBTAINED,546); player:setVar("QuestCatchAFallingStar_prog",1); end end end end; ----------------------------------- -- onTrigger Action ----------------------------------- function onTrigger(player,npc) if (VanadielHour() <= 3 and player:getVar("QuestCatchAFallingStar_prog") == 0) then player:messageSpecial(7336); player:messageSpecial(7338); else player:messageSpecial(7339); 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
BooM-amour/DJBOOM
data/utils.lua
23
23874
URL = require "socket.url" http = require "socket.http" https = require "ssl.https" ltn12 = require "ltn12" serpent = require "serpent" feedparser = require "feedparser" json = (loadfile "./libs/JSON.lua")() mimetype = (loadfile "./libs/mimetype.lua")() redis = (loadfile "./libs/redis.lua")() JSON = (loadfile "./libs/dkjson.lua")() http.TIMEOUT = 10 function get_receiver(msg) if msg.to.type == 'user' then return 'user#id'..msg.from.id end if msg.to.type == 'chat' then return 'chat#id'..msg.to.id end if msg.to.type == 'encr_chat' then return msg.to.print_name end end function is_chat_msg( msg ) if msg.to.type == 'chat' then return true end return false end function string.random(length) local str = ""; for i = 1, length do math.random(97, 122) str = str..string.char(math.random(97, 122)); end return str; end function string:split(sep) local sep, fields = sep or ":", {} local pattern = string.format("([^%s]+)", sep) self:gsub(pattern, function(c) fields[#fields+1] = c end) return fields end -- DEPRECATED function string.trim(s) print("string.trim(s) is DEPRECATED use string:trim() instead") return s:gsub("^%s*(.-)%s*$", "%1") end -- Removes spaces function string:trim() return self:gsub("^%s*(.-)%s*$", "%1") end function get_http_file_name(url, headers) -- Eg: foo.var local file_name = url:match("[^%w]+([%.%w]+)$") -- Any delimited alphanumeric on the url file_name = file_name or url:match("[^%w]+(%w+)[^%w]+$") -- Random name, hope content-type works file_name = file_name or str:random(5) local content_type = headers["content-type"] local extension = nil if content_type then extension = mimetype.get_mime_extension(content_type) end if extension then file_name = file_name.."."..extension end local disposition = headers["content-disposition"] if disposition then -- attachment; filename=CodeCogsEqn.png file_name = disposition:match('filename=([^;]+)') or file_name end return file_name end -- Saves file to /tmp/. If file_name isn't provided, -- will get the text after the last "/" for filename -- and content-type for extension function download_to_file(url, file_name) print("url to download: "..url) local respbody = {} local options = { url = url, sink = ltn12.sink.table(respbody), redirect = true } -- nil, code, headers, status local response = nil if url:starts('https') then options.redirect = false response = {https.request(options)} else response = {http.request(options)} end local code = response[2] local headers = response[3] local status = response[4] if code ~= 200 then return nil end file_name = file_name or get_http_file_name(url, headers) local file_path = "/tmp/"..file_name print("Saved to: "..file_path) file = io.open(file_path, "w+") file:write(table.concat(respbody)) file:close() return file_path end function vardump(value) print(serpent.block(value, {comment=false})) end -- taken from http://stackoverflow.com/a/11130774/3163199 function scandir(directory) local i, t, popen = 0, {}, io.popen for filename in popen('ls -a "'..directory..'"'):lines() do i = i + 1 t[i] = filename end return t end -- http://www.lua.org/manual/5.2/manual.html#pdf-io.popen function run_command(str) local cmd = io.popen(str) local result = cmd:read('*all') cmd:close() return result end -- User has privileges function is_sudo(msg) local var = false -- Check users id in config for v,user in pairs(_config.sudo_users) do if user == msg.from.id then var = true end end return var end -- Returns the name of the sender function get_name(msg) local name = msg.from.first_name if name == nil then name = msg.from.id end return name end -- Returns at table of lua files inside plugins function plugins_names( ) local files = {} for k, v in pairs(scandir("plugins")) do -- Ends with .lua if (v:match(".lua$")) then table.insert(files, v) end end return files end -- Function name explains what it does. function file_exists(name) local f = io.open(name,"r") if f ~= nil then io.close(f) return true else return false end end -- Save into file the data serialized for lua. -- Set uglify true to minify the file. function serialize_to_file(data, file, uglify) file = io.open(file, 'w+') local serialized if not uglify then serialized = serpent.block(data, { comment = false, name = '_' }) else serialized = serpent.dump(data) end file:write(serialized) file:close() end -- Returns true if the string is empty function string:isempty() return self == nil or self == '' end -- Returns true if the string is blank function string:isblank() self = self:trim() return self:isempty() end -- DEPRECATED!!!!! function string.starts(String, Start) print("string.starts(String, Start) is DEPRECATED use string:starts(text) instead") return Start == string.sub(String,1,string.len(Start)) end -- Returns true if String starts with Start function string:starts(text) return text == string.sub(self,1,string.len(text)) end -- Send image to user and delete it when finished. -- cb_function and cb_extra are optionals callback function _send_photo(receiver, file_path, cb_function, cb_extra) local cb_extra = { file_path = file_path, cb_function = cb_function, cb_extra = cb_extra } -- Call to remove with optional callback send_photo(receiver, file_path, cb_function, cb_extra) end -- Download the image and send to receiver, it will be deleted. -- cb_function and cb_extra are optionals callback function send_photo_from_url(receiver, url, cb_function, cb_extra) -- If callback not provided cb_function = cb_function or ok_cb cb_extra = cb_extra or false local file_path = download_to_file(url, false) if not file_path then -- Error local text = 'Error downloading the image' send_msg(receiver, text, cb_function, cb_extra) else print("File path: "..file_path) _send_photo(receiver, file_path, cb_function, cb_extra) end end -- Same as send_photo_from_url but as callback function function send_photo_from_url_callback(cb_extra, success, result) local receiver = cb_extra.receiver local url = cb_extra.url local file_path = download_to_file(url, false) if not file_path then -- Error local text = 'Error downloading the image' send_msg(receiver, text, ok_cb, false) else print("File path: "..file_path) _send_photo(receiver, file_path, ok_cb, false) end end -- Send multiple images asynchronous. -- param urls must be a table. function send_photos_from_url(receiver, urls) local cb_extra = { receiver = receiver, urls = urls, remove_path = nil } send_photos_from_url_callback(cb_extra) end -- Use send_photos_from_url. -- This function might be difficult to understand. function send_photos_from_url_callback(cb_extra, success, result) -- cb_extra is a table containing receiver, urls and remove_path local receiver = cb_extra.receiver local urls = cb_extra.urls local remove_path = cb_extra.remove_path -- The previously image to remove if remove_path ~= nil then os.remove(remove_path) print("Deleted: "..remove_path) end -- Nil or empty, exit case (no more urls) if urls == nil or #urls == 0 then return false end -- Take the head and remove from urls table local head = table.remove(urls, 1) local file_path = download_to_file(head, false) local cb_extra = { receiver = receiver, urls = urls, remove_path = file_path } -- Send first and postpone the others as callback send_photo(receiver, file_path, send_photos_from_url_callback, cb_extra) end -- Callback to remove a file function rmtmp_cb(cb_extra, success, result) local file_path = cb_extra.file_path local cb_function = cb_extra.cb_function or ok_cb local cb_extra = cb_extra.cb_extra if file_path ~= nil then os.remove(file_path) print("Deleted: "..file_path) end -- Finally call the callback cb_function(cb_extra, success, result) end -- Send document to user and delete it when finished. -- cb_function and cb_extra are optionals callback function _send_document(receiver, file_path, cb_function, cb_extra) local cb_extra = { file_path = file_path, cb_function = cb_function or ok_cb, cb_extra = cb_extra or false } -- Call to remove with optional callback send_document(receiver, file_path, rmtmp_cb, cb_extra) end -- Download the image and send to receiver, it will be deleted. -- cb_function and cb_extra are optionals callback function send_document_from_url(receiver, url, cb_function, cb_extra) local file_path = download_to_file(url, false) print("File path: "..file_path) _send_document(receiver, file_path, cb_function, cb_extra) end -- Parameters in ?a=1&b=2 style function format_http_params(params, is_get) local str = '' -- If is get add ? to the beginning if is_get then str = '?' end local first = true -- Frist param for k,v in pairs (params) do if v then -- nil value if first then first = false str = str..k.. "="..v else str = str.."&"..k.. "="..v end end end return str end -- Check if user can use the plugin and warns user -- Returns true if user was warned and false if not warned (is allowed) function warns_user_not_allowed(plugin, msg) if not user_allowed(plugin, msg) then local text = 'This plugin requires privileged user' local receiver = get_receiver(msg) send_msg(receiver, text, ok_cb, false) return true else return false end end -- Check if user can use the plugin function user_allowed(plugin, msg) if plugin.privileged and not is_sudo(msg) then return false end return true end function send_order_msg(destination, msgs) local cb_extra = { destination = destination, msgs = msgs } send_order_msg_callback(cb_extra, true) end function send_order_msg_callback(cb_extra, success, result) local destination = cb_extra.destination local msgs = cb_extra.msgs local file_path = cb_extra.file_path if file_path ~= nil then os.remove(file_path) print("Deleted: " .. file_path) end if type(msgs) == 'string' then send_large_msg(destination, msgs) elseif type(msgs) ~= 'table' then return end if #msgs < 1 then return end local msg = table.remove(msgs, 1) local new_cb_extra = { destination = destination, msgs = msgs } if type(msg) == 'string' then send_msg(destination, msg, send_order_msg_callback, new_cb_extra) elseif type(msg) == 'table' then local typ = msg[1] local nmsg = msg[2] new_cb_extra.file_path = nmsg if typ == 'document' then send_document(destination, nmsg, send_order_msg_callback, new_cb_extra) elseif typ == 'image' or typ == 'photo' then send_photo(destination, nmsg, send_order_msg_callback, new_cb_extra) elseif typ == 'audio' then send_audio(destination, nmsg, send_order_msg_callback, new_cb_extra) elseif typ == 'video' then send_video(destination, nmsg, send_order_msg_callback, new_cb_extra) else send_file(destination, nmsg, send_order_msg_callback, new_cb_extra) end end end -- Same as send_large_msg_callback but friendly params function send_large_msg(destination, text) local cb_extra = { destination = destination, text = text } send_large_msg_callback(cb_extra, true) end -- If text is longer than 4096 chars, send multiple msg. -- https://core.telegram.org/method/messages.sendMessage function send_large_msg_callback(cb_extra, success, result) local text_max = 4096 local destination = cb_extra.destination local text = cb_extra.text local text_len = string.len(text) local num_msg = math.ceil(text_len / text_max) if num_msg <= 1 then send_msg(destination, text, ok_cb, false) else local my_text = string.sub(text, 1, 4096) local rest = string.sub(text, 4096, text_len) local cb_extra = { destination = destination, text = rest } send_msg(destination, my_text, send_large_msg_callback, cb_extra) end end -- Returns a table with matches or nil function match_pattern(pattern, text, lower_case) if text then local matches = {} if lower_case then matches = { string.match(text:lower(), pattern) } else matches = { string.match(text, pattern) } end if next(matches) then return matches end end -- nil end -- Function to read data from files function load_from_file(file, default_data) local f = io.open(file, "r+") -- If file doesn't exists if f == nil then -- Create a new empty table default_data = default_data or {} serialize_to_file(default_data, file) print ('Created file', file) else print ('Data loaded from file', file) f:close() end return loadfile (file)() end -- See http://stackoverflow.com/a/14899740 function unescape_html(str) local map = { ["lt"] = "<", ["gt"] = ">", ["amp"] = "&", ["quot"] = '"', ["apos"] = "'" } new = string.gsub(str, '(&(#?x?)([%d%a]+);)', function(orig, n, s) var = map[s] or n == "#" and string.char(s) var = var or n == "#x" and string.char(tonumber(s,16)) var = var or orig return var end) return new end --Check if this chat is realm or not function is_realm(msg) local var = false local realms = 'realms' local data = load_data(_config.moderation.data) local chat = msg.to.id if data[tostring(realms)] then if data[tostring(realms)][tostring(msg.to.id)] then var = true end return var end end --Check if this chat is a group or not function is_group(msg) local var = false local groups = 'groups' local data = load_data(_config.moderation.data) local chat = msg.to.id if data[tostring(groups)] then if data[tostring(groups)][tostring(msg.to.id)] then var = true end return var end end function savelog(group, logtxt) local text = (os.date("[ %c ]=> "..logtxt.."\n \n")) local file = io.open("./groups/logs/"..group.."log.txt", "a") file:write(text) file:close() end function user_print_name(user) if user.print_name then return user.print_name end local text = '' if user.first_name then text = user.last_name..' ' end if user.lastname then text = text..user.last_name end return text end --Check if user is the owner of that group or not function is_owner(msg) local var = false local data = load_data(_config.moderation.data) local user = msg.from.id if data[tostring(msg.to.id)] then if data[tostring(msg.to.id)]['set_owner'] then if data[tostring(msg.to.id)]['set_owner'] == tostring(user) then var = true end end end if data['admins'] then if data['admins'][tostring(user)] then var = true end end for v,user in pairs(_config.sudo_users) do if user == msg.from.id then var = true end end return var end function is_owner2(user_id, group_id) local var = false local data = load_data(_config.moderation.data) if data[tostring(group_id)] then if data[tostring(group_id)]['set_owner'] then if data[tostring(group_id)]['set_owner'] == tostring(user_id) then var = true end end end if data['admins'] then if data['admins'][tostring(user_id)] then var = true end end for v,user in pairs(_config.sudo_users) do if user == user_id then var = true end end return var end --Check if user is admin or not function is_admin(msg) local var = false local data = load_data(_config.moderation.data) local user = msg.from.id local admins = 'admins' if data[tostring(admins)] then if data[tostring(admins)][tostring(user)] then var = true end end for v,user in pairs(_config.sudo_users) do if user == msg.from.id then var = true end end return var end function is_admin2(user_id) local var = false local data = load_data(_config.moderation.data) local user = user_id local admins = 'admins' if data[tostring(admins)] then if data[tostring(admins)][tostring(user)] then var = true end end for v,user in pairs(_config.sudo_users) do if user == user_id then var = true end end return var end --Check if user is the mod of that group or not function is_momod(msg) local var = false local data = load_data(_config.moderation.data) local user = msg.from.id if data[tostring(msg.to.id)] then if data[tostring(msg.to.id)]['moderators'] then if data[tostring(msg.to.id)]['moderators'][tostring(user)] then var = true end end end if data[tostring(msg.to.id)] then if data[tostring(msg.to.id)]['set_owner'] then if data[tostring(msg.to.id)]['set_owner'] == tostring(user) then var = true end end end if data['admins'] then if data['admins'][tostring(user)] then var = true end end for v,user in pairs(_config.sudo_users) do if user == msg.from.id then var = true end end return var end function is_momod2(user_id, group_id) local var = false local data = load_data(_config.moderation.data) local usert = user_id if data[tostring(group_id)] then if data[tostring(group_id)]['moderators'] then if data[tostring(group_id)]['moderators'][tostring(usert)] then var = true end end end if data[tostring(group_id)] then if data[tostring(group_id)]['set_owner'] then if data[tostring(group_id)]['set_owner'] == tostring(user_id) then var = true end end end if data['admins'] then if data['admins'][tostring(user_id)] then var = true end end for v,user in pairs(_config.sudo_users) do if user == usert then var = true end end return var end -- Returns the name of the sender function kick_user(user_id, chat_id) if tonumber(user_id) == tonumber(our_id) then -- Ignore bot return end if is_owner2(user_id, chat_id) then -- Ignore admins return end local chat = 'chat#id'..chat_id local user = 'user#id'..user_id chat_del_user(chat, user, ok_cb, true) end -- Ban function ban_user(user_id, chat_id) if tonumber(user_id) == tonumber(our_id) then -- Ignore bot return end if is_admin2(user_id) then -- Ignore admins return end -- Save to redis local hash = 'banned:'..chat_id redis:sadd(hash, user_id) -- Kick from chat kick_user(user_id, chat_id) end -- Global ban function banall_user(user_id) if tonumber(user_id) == tonumber(our_id) then -- Ignore bot return end if is_admin2(user_id) then -- Ignore admins return end -- Save to redis local hash = 'gbanned' redis:sadd(hash, user_id) end -- Global unban function unbanall_user(user_id) --Save on redis local hash = 'gbanned' redis:srem(hash, user_id) end -- Check if user_id is banned in chat_id or not function is_banned(user_id, chat_id) --Save on redis local hash = 'banned:'..chat_id local banned = redis:sismember(hash, user_id) return banned or false end -- Check if user_id is globally banned or not function is_gbanned(user_id) --Save on redis local hash = 'gbanned' local banned = redis:sismember(hash, user_id) return banned or false end -- Returns chat_id ban list function ban_list(chat_id) local hash = 'banned:'..chat_id local list = redis:smembers(hash) local text = "Ban list !\n\n" for k,v in pairs(list) do local user_info = redis:hgetall('user:'..v) if user_info and user_info.print_name then text = text..k.." - "..string.gsub(user_info.print_name, "_", " ").." ["..v.."]\n" else text = text..k.." - "..v.."\n" end end return text end -- Returns globally ban list function banall_list() local hash = 'gbanned' local list = redis:smembers(hash) local text = "global bans !\n\n" for k,v in pairs(list) do local user_info = redis:hgetall('user:'..v) if user_info and user_info.print_name then text = text..k.." - "..string.gsub(user_info.print_name, "_", " ").." ["..v.."]\n" else text = text..k.." - "..v.."\n" end end return text end -- /id by reply function get_message_callback_id(extra, success, result) if result.to.type == 'chat' then local chat = 'chat#id'..result.to.id send_large_msg(chat, result.from.id) else return 'Use This in Your Groups' end end -- kick by reply for mods and owner function Kick_by_reply(extra, success, result) if result.to.type == 'chat' then local chat = 'chat#id'..result.to.id if tonumber(result.from.id) == tonumber(our_id) then -- Ignore bot return "I won't kick myself" end if is_momod2(result.from.id, result.to.id) then -- Ignore mods,owner,admin return "you can't kick mods,owner and admins" end chat_del_user(chat, 'user#id'..result.from.id, ok_cb, false) else return 'Use This in Your Groups' end end -- Kick by reply for admins function Kick_by_reply_admins(extra, success, result) if result.to.type == 'chat' then local chat = 'chat#id'..result.to.id if tonumber(result.from.id) == tonumber(our_id) then -- Ignore bot return "I won't kick myself" end if is_admin2(result.from.id) then -- Ignore admins return end chat_del_user(chat, 'user#id'..result.from.id, ok_cb, false) else return 'Use This in Your Groups' end end --Ban by reply for admins function ban_by_reply(extra, success, result) if result.to.type == 'chat' then local chat = 'chat#id'..result.to.id if tonumber(result.from.id) == tonumber(our_id) then -- Ignore bot return "I won't ban myself" end if is_momod2(result.from.id, result.to.id) then -- Ignore mods,owner,admin return "you can't kick mods,owner and admins" end ban_user(result.from.id, result.to.id) send_large_msg(chat, "User "..result.from.id.." Banned") else return 'Use This in Your Groups' end end -- Ban by reply for admins function ban_by_reply_admins(extra, success, result) if result.to.type == 'chat' then local chat = 'chat#id'..result.to.id if tonumber(result.from.id) == tonumber(our_id) then -- Ignore bot return "I won't ban myself" end if is_admin2(result.from.id) then -- Ignore admins return end ban_user(result.from.id, result.to.id) send_large_msg(chat, "User "..result.from.id.." Banned") else return 'Use This in Your Groups' end end -- Unban by reply function unban_by_reply(extra, success, result) if result.to.type == 'chat' then local chat = 'chat#id'..result.to.id if tonumber(result.from.id) == tonumber(our_id) then -- Ignore bot return "I won't unban myself" end send_large_msg(chat, "User "..result.from.id.." Unbanned") -- Save on redis local hash = 'banned:'..result.to.id redis:srem(hash, result.from.id) else return 'Use This in Your Groups' end end function banall_by_reply(extra, success, result) if result.to.type == 'chat' then local chat = 'chat#id'..result.to.id if tonumber(result.from.id) == tonumber(our_id) then -- Ignore bot return "I won't banall myself" end if is_admin2(result.from.id) then -- Ignore admins return end local name = user_print_name(result.from) banall_user(result.from.id) chat_del_user(chat, 'user#id'..result.from.id, ok_cb, false) send_large_msg(chat, "User "..name.."["..result.from.id.."] hammered") else return 'Use This in Your Groups' end end
gpl-2.0
snabbco/snabb
src/lib/yang/path.lua
6
7158
-- Use of this source code is governed by the Apache 2.0 license; see COPYING. -- This module can be used to parse a path based on a yang schema (or its -- derivative grammar) and produce a lua table which is a native lua way -- of representing a path. The path provided is a subset of XPath supporting -- named keys such as [addr=1.2.3.4] and also basic positional querying -- for arrays e.g [position()=1] for the first element. -- -- The structure of the path is dependent on the type the node is. The -- conversions are as follows: -- -- Scalar fields: -- A lua string of the member name -- Struct fields: -- A lua string of the member name -- Array fields: -- This is a table which has a "name" property specifying member -- name and a "key" field which is a 1 based integer to specify the -- position in the array. -- Table fields: -- This is a table which has a "name" property specifying member -- name and has a "keys" (not key) property which is either: -- - A string representing the key if the table is string keyed. -- - A lua table with corrisponding leaf names as the key and the -- value as the value. module(..., package.seeall) local equal = require("core.lib").equal local datalib = require("lib.yang.data") local normalize_id = datalib.normalize_id local function table_keys(t) local ret = {} for k, v in pairs(t) do table.insert(ret, k) end return ret end local syntax_error = function (str, pos) local header = "Syntax error in " io.stderr:write(header..str.."\n") io.stderr:write(string.rep(" ", #header + pos-1)) io.stderr:write("^\n") os.exit(1) end local function extract_parts (fragment) local rtn = {query={}} local pos function consume (char) if fragment:sub(pos, pos) ~= char then syntax_error(fragment, pos) end pos = pos + 1 end function eol () return pos > #fragment end function token () local ret, new_pos = fragment:match("([^=%]]+)()", pos) if not ret then syntax_error(fragment, pos) end pos = new_pos return ret end rtn.name, pos = string.match(fragment, "([^%[]+)()") while not eol() do consume('[', pos) local k = token() consume('=') local v = token() consume(']') rtn.query[k] = v end return rtn end -- Finds the grammar node for a fragment in a given grammar. local function extract_grammar_node(grammar, name) local handlers = {} function handlers.struct () return grammar.members[name] end function handlers.table () if grammar.keys[name] == nil then return grammar.values[name] else return grammar.keys[name] end end function handlers.choice () for case_name, case in pairs(grammar.choices) do if case[name] ~= nil then return case[name] end end end return assert(assert(handlers[grammar.type], grammar.type)(), name) end -- Converts an XPath path to a lua array consisting of path componants. -- A path component can then be resolved on a yang data tree: function convert_path(grammar, path) local path = normalize_path(path) local handlers = {} function handlers.scalar(grammar, fragment) return {name=fragment.name, grammar=grammar} end function handlers.struct(grammar, fragment) return {name=fragment.name, grammar=grammar} end function handlers.table(grammar, fragment) return {name=fragment.name, keys=fragment.query, grammar=grammar} end function handlers.array(grammar, fragment) local position = fragment.query["position()"] return {name=fragment.name, key=tonumber(position), grammar=grammar} end local function handle(grammar, fragment) return assert(handlers[grammar.type], grammar.type)(grammar, fragment) end if path == "/" then return {} end local ret = {} local node = grammar if path:sub(1, 1) == "/" then path = path:sub(2) end -- remove leading / if path:sub(-1) == "/" then path = path:sub(1, -2) end -- remove trailing / for element in path:split("/") do local parts = extract_parts(element) node = extract_grammar_node(node, parts.name) local luapath = handle(node, parts) table.insert(ret, luapath) end return ret end function parse_path (path) local depth = 0 local t, token = {}, '' local function insert_token () table.insert(t, token) token = '' end for i=1,#path do local c = path:sub(i, i) if depth == 0 and c == '/' then if #token > 0 then insert_token() end else token = token..c if c == '[' then depth = depth + 1 end if c == ']' then depth = depth - 1 if depth == 0 and path:sub(i+1, i+1) ~= '[' then insert_token() end end end end insert_token() local ret = {} for _, element in ipairs(t) do if element ~= '' then table.insert(ret, extract_parts(element)) end end return ret end function normalize_path(path) local ret = {} for _,part in ipairs(parse_path(path)) do local str = part.name local keys = table_keys(part.query) table.sort(keys) for _,k in ipairs(keys) do str = str..'['..k..'='..part.query[k]..']' end table.insert(ret, str) end return '/'..table.concat(ret, '/') end function selftest() print("selftest: lib.yang.path") local schemalib = require("lib.yang.schema") local schema_src = [[module snabb-simple-router { namespace snabb:simple-router; prefix simple-router; import ietf-inet-types {prefix inet;} leaf active { type boolean; default true; } leaf-list blocked-ips { type inet:ipv4-address; } container routes { list route { key addr; leaf addr { type inet:ipv4-address; mandatory true; } leaf port { type uint8 { range 0..11; } mandatory true; } } }}]] local scm = schemalib.load_schema(schema_src, "xpath-test") local grammar = datalib.config_grammar_from_schema(scm) -- Test path to lua path. local path = convert_path(grammar,"/routes/route[addr=1.2.3.4]/port") assert(path[1].name == "routes") assert(path[2].name == "route") assert(path[2].keys) assert(path[2].keys["addr"] == "1.2.3.4") assert(path[3].name == "port") local path = convert_path(grammar, "/blocked-ips[position()=4]/") assert(path[1].name == "blocked-ips") assert(path[1].key == 4) assert(normalize_path('') == '/') assert(normalize_path('//') == '/') assert(normalize_path('/') == '/') assert(normalize_path('//foo//bar//') == '/foo/bar') assert(normalize_path('//foo[b=1][c=2]//bar//') == '/foo[b=1][c=2]/bar') assert(normalize_path('//foo[c=1][b=2]//bar//') == '/foo[b=2][c=1]/bar') assert(extract_parts('//foo[b=1]')) parse_path('/alarms/alarm-list/alarm'.. '[resource=alarms/alarm-list/alarm/related-alarm/resource]'.. '[alarm-type-id=/alarms/alarm-list/alarm/related-alarm/alarm-type-id]') print("selftest: ok") end
apache-2.0
bigcrush/cqueues
src/cqueues.lua
3
4105
local loader = function(loader, ...) local core = require"_cqueues" local errno = require"_cqueues.errno" local monotime = core.monotime local running = core.running local strerror = errno.strerror local unpack = assert(table.unpack or unpack) -- 5.1 compat -- lazily load auxlib to prevent circular or unused dependencies local auxlib = setmetatable({}, { __index = function (t, k) local v = require"cqueues.auxlib"[k] rawset(t, k, v) return v end }) -- load deprecated APIs into shadow table to keep hidden unless used local notsupp = {} setmetatable(core, { __index = notsupp }) -- -- core.poll -- -- Wrap the cqueues yield protocol to support polling across -- multilevel resume/yield. Requires explicit or implicit use -- (through monkey patching of coroutine.resume and coroutine.wrap) -- of auxlib.resume or auxlib.wrap. -- -- Also supports polling from outside of a running event loop using -- a cheap hack. NOT RECOMMENDED. -- local _POLL = core._POLL local yield = coroutine.yield local poller function core.poll(...) if running() then return yield(_POLL, ...) else local tuple poller = poller or auxlib.assert3(core.new()) poller:wrap(function (...) tuple = { core.poll(...) } end, ...) -- NOTE: must step twice, once to call poll and -- again to wake up auxlib.assert3(poller:step()) auxlib.assert3(poller:step()) return unpack(tuple or {}) end end -- core.poll -- -- core.sleep -- -- Sleep primitive. -- function core.sleep(timeout) core.poll(timeout) end -- core.sleep -- -- core:step -- -- Wrap the low-level :step interface to make managing event loops -- slightly easier. -- local step; step = core.interpose("step", function (self, timeout) if core.running() then core.poll(self, timeout) return step(self, 0.0) else return step(self, timeout) end end) -- -- Lua 5.1 doesn't allow continuations in C -- so we have to emulate them in lua. -- if _VERSION == "Lua 5.1" then local function checkstep(self, ok, ...) if ok == "yielded" then return checkstep(self, self:step_resume(coroutine.yield(...))) else return ok, ... end end local step_; step_ = core.interpose("step", function (self, timeout) return checkstep(self, step_(self, timeout)) end) end -- core:step -- -- core:loop -- -- Step until an error is encountered. -- local function todeadline(timeout) -- special case 0 timeout to avoid monotime call in totimeout return timeout and (timeout > 0 and monotime() + timeout or 0) or nil end -- todeadline local function totimeout(deadline) if not deadline then return nil, false elseif deadline == 0 then return 0, true else local curtime = monotime() if curtime < deadline then return deadline - curtime, false else return 0, true end end end -- totimeout core.interpose("loop", function (self, timeout) local function checkstep(self, deadline, ok, ...) local timeout, expired = totimeout(deadline) if not ok then return false, ... elseif expired or self:empty() then return true else return checkstep(self, deadline, self:step(timeout)) end end local deadline = todeadline(timeout) return checkstep(self, deadline, self:step(timeout)) end) -- core:loop -- -- core:errors -- -- Return iterator over core:loop. -- core.interpose("errors", function (self, timeout) local deadline = todeadline(timeout) return function () local timeout = totimeout(deadline) return select(2, self:loop(timeout)) end end) -- core:errors -- -- core.assert -- -- DEPRECATED. See auxlib.assert. -- function notsupp.assert(...) return auxlib.assert(...) end -- notsupp.assert -- -- core.resume -- -- DEPRECATED. See auxlib.resume. -- function notsupp.resume(...) return auxlib.resume(...) end -- notsupp.resume -- -- core.wrap -- -- DEPRECATED. See auxlib.wrap. -- function notsupp.wrap(...) return auxlib.wrap(...) end -- notsupp.wrap core.loader = loader return core end -- loader return loader(loader, ...)
mit
hooksta4/darkstar
scripts/zones/Gustav_Tunnel/mobs/Macroplasm.lua
18
1100
---------------------------------- -- Area: Gustav Tunnel -- MOB: macroplasm ----------------------------------- package.loaded["scripts/zones/Gustav_Tunnel/TextIDs"] = nil; require("scripts/globals/settings"); require("scripts/globals/status"); require("scripts/zones/Gustav_Tunnel/TextIDs"); ----------------------------------- -- onMobDeath ----------------------------------- function onMobDeath(mob,killer) local X = GetMobByID(17645795):getXPos(); local Y = GetMobByID(17645795):getYPos(); local Z = GetMobByID(17645795):getZPos(); local A = GetMobByID(17645796):getXPos(); local B = GetMobByID(17645796):getYPos(); local C = GetMobByID(17645796):getZPos(); if (mob:getID() == 17645795) then SpawnMob(17645797):setPos(X,Y,Z); SpawnMob(17645798):setPos(X,Y,Z); GetMobByID(17645797):updateEnmity(killer); GetMobByID(17645798):updateEnmity(killer); elseif (mob:getID() == 17645796) then SpawnMob(17645799):setPos(A,B,C); SpawnMob(17645800):setPos(A,B,C); GetMobByID(17645799):updateEnmity(killer); GetMobByID(17645800):updateEnmity(killer); end end;
gpl-3.0
hooksta4/darkstar
scripts/zones/Valkurm_Dunes/Zone.lua
2
4846
----------------------------------- -- -- Zone: Valkurm_Dunes (103) -- ----------------------------------- package.loaded["scripts/zones/Valkurm_Dunes/TextIDs"] = nil; package.loaded["scripts/globals/chocobo_digging"] = nil; ----------------------------------- require("scripts/zones/Valkurm_Dunes/TextIDs"); require("scripts/globals/zone"); require("scripts/globals/icanheararainbow"); require("scripts/globals/status"); require("scripts/globals/weather"); require("scripts/globals/conquest"); require("scripts/globals/chocobo_digging"); ----------------------------------- -- Chocobo Digging vars ----------------------------------- local itemMap = { -- itemid, abundance, requirement { 880, 224, DIGREQ_NONE }, { 887, 39, DIGREQ_NONE }, { 645, 14, DIGREQ_NONE }, { 893, 105, DIGREQ_NONE }, { 737, 17, DIGREQ_NONE }, { 643, 64, DIGREQ_NONE }, { 17296, 122, DIGREQ_NONE }, { 942, 6, DIGREQ_NONE }, { 642, 58, DIGREQ_NONE }, { 864, 22, DIGREQ_NONE }, { 843, 4, DIGREQ_NONE }, { 4096, 100, DIGREQ_NONE }, -- all crystals { 845, 122, DIGREQ_BURROW }, { 844, 71, DIGREQ_BURROW }, { 1845, 33, DIGREQ_BURROW }, { 838, 11, DIGREQ_BURROW }, { 902, 6, DIGREQ_BORE }, { 886, 3, DIGREQ_BORE }, { 867, 3, DIGREQ_BORE }, { 1587, 19, DIGREQ_BORE }, { 888, 25, DIGREQ_BORE }, { 1586, 8, DIGREQ_BORE }, { 885, 10, DIGREQ_BORE }, { 866, 3, DIGREQ_BORE }, { 4570, 10, DIGREQ_MODIFIER }, { 4487, 11, DIGREQ_MODIFIER }, { 4409, 12, DIGREQ_MODIFIER }, { 1188, 10, DIGREQ_MODIFIER }, { 4532, 12, DIGREQ_MODIFIER }, }; local messageArray = { DIG_THROW_AWAY, FIND_NOTHING, ITEM_OBTAINED }; ----------------------------------- -- onChocoboDig ----------------------------------- function onChocoboDig(player, precheck) return chocoboDig(player, itemMap, precheck, messageArray); end; ----------------------------------- -- onInitialize ----------------------------------- function onInitialize(zone) local manuals = {17199751,17199752,17199753}; SetFieldManual(manuals); SetRegionalConquestOverseers(zone:getRegionID()) end; ----------------------------------- -- onZoneIn ----------------------------------- function onZoneIn( player, prevZone) local cs = -1; if (player:getXPos() == 0 and player:getYPos() == 0 and player:getZPos() == 0) then player:setPos( 60.989, -4.898, -151.001, 198); end if (triggerLightCutscene(player)) then -- Quest: I Can Hear A Rainbow cs = 0x0003; elseif (player:getCurrentMission(WINDURST) == VAIN and player:getVar("MissionStatus") ==1) then cs = 0x0005; end return cs; end; ----------------------------------- -- onConquestUpdate ----------------------------------- function onConquestUpdate(zone, updatetype) local players = zone:getPlayers(); for name, player in pairs(players) do conquestUpdate(zone, player, updatetype, CONQUEST_BASE); end end; ----------------------------------- -- onRegionEnter ----------------------------------- function onRegionEnter( player, region) end; ----------------------------------- -- onEventUpdate ----------------------------------- function onEventUpdate( player, csid, option) -- printf("CSID: %u",csid); -- printf("RESULT: %u",option); if (csid == 0x0003) then lightCutsceneUpdate(player); -- Quest: I Can Hear A Rainbow elseif (csid == 0x0005) then if (player:getZPos() > 45) then if (player:getZPos() > -301) then player:updateEvent(0,0,0,0,0,1); else player:updateEvent(0,0,0,0,0,3); end end end end; ----------------------------------- -- onEventFinish ----------------------------------- function onEventFinish( player, csid, option) -- printf("CSID: %u",csid); -- printf("RESULT: %u",option); if (csid == 0x0003) then lightCutsceneFinish(player); -- Quest: I Can Hear A Rainbow end end; ----------------------------------- -- onZoneWeatherChange ----------------------------------- function onZoneWeatherChange(weather) local qm1 = GetNPCByID(17199699); -- Quest: An Empty Vessel if (weather == WEATHER_DUST_STORM) then qm1:setStatus(STATUS_NORMAL); else qm1:setStatus(STATUS_DISAPPEAR); end end;
gpl-3.0
RAlexis/ArcEmu_MoP
src/scripts/lua/Lua/Stable Scripts/Azeroth/Karazhan/BOSS_Karazhan_Aran.lua
30
3347
function Aran_Water_Elementals(Unit, event, miscunit, misc) if Unit:GetHealthPct() < 40 and Didthat == 0 then Unit:SpawnCreature(21160, -11167.2, -1914.13, 232.009, 0, 18, 96000000); Unit:SpawnCreature(21160, -11163.2, -1910.13, 232.009, 0, 18, 96000000); Unit:SpawnCreature(21160, -11165.2, -1916.13, 232.009, 0, 18, 96000000); Unit:SpawnCreature(21160, -11162.2, -1911.13, 232.009, 0, 18, 96000000); Didthat = 1 else end end function Aran_Polymorph(Unit, event, miscunit, misc) if Unit:GetManaPct() < 20 and Didthat == 1 then Unit:FullCastSpellOnTarget(23603,Unit:GetClosestPlayer()) Unit:FullCastSpell(32453) Didthat = 2 else end end function Aran_Fireball(Unit, event, miscunit, misc) print "Aran Fireball" Unit:FullCastSpellOnTarget(20678,Unit:GetClosestPlayer()) Unit:SendChatMessage(11, 0, "Fire ball...") end function Aran_Conterspell(Unit, event, miscunit, misc) print "Aran Conterspell" Unit:FullCastSpellOnTarget(29961,Unit:GetClosestPlayer()) Unit:SendChatMessage(11, 0, "Try to cast now...") end function Aran_Conflagration(Unit, event, miscunit, misc) print "Aran Conflagration" Unit:FullCastSpellOnTarget(23023,Unit:GetClosestPlayer()) Unit:SendChatMessage(11, 0, "Your so weak guys...") end function Aran_FrostBolt(Unit, event, miscunit, misc) print "Aran FrostBolt" Unit:FullCastSpellOnTarget(41486,Unit:GetClosestPlayer()) Unit:SendChatMessage(11, 0, "Catch that, if you can...") end function Aran_Chains_Ice(Unit, event, miscunit, misc) print "Aran Chains Ice" Unit:FullCastSpellOnTarget(29991,Unit:GetClosestPlayer()) Unit:SendChatMessage(11, 0, "Ho, guys you cannot move...") end function Aran_Arcane_Missiles(Unit, event, miscunit, misc) print "Aran Arcane Missiles" Unit:FullCastSpellOnTarget(29955,Unit:GetClosestPlayer()) Unit:SendChatMessage(11, 0, "Rain of arcane...") end function Aran_Flame_Wreath(Unit, event, miscunit, misc) print "Aran Flame Wreath" Unit:FullCastSpellOnTarget(30004,Unit:GetRandomPlayer()) Unit:SendChatMessage(11, 0, "My Flame Wreath...") end function Aran_Circular_Blizzard(Unit, event, miscunit, misc) print "Aran Circular Blizzard" Unit:FullCastSpellOnTarget(29952,Unit:GetClosestPlayer()) Unit:SendChatMessage(11, 0, "Blizzard...") end function Aran_Magnetic_Pull(Unit, event, miscunit, misc) print "Aran Magnetic Pull" Unit:FullCastSpellOnTarget(29979,Unit:GetClosestPlayer()) Unit:SendChatMessage(11, 0, "Come to me guys...") end function Aran_Arcane_Explosion(Unit, event, miscunit, misc) print "Aran Arcane Explosion" Unit:FullCastSpellOnTarget(29973,Unit:GetClosestPlayer()) Unit:SendChatMessage(11, 0, "Now, the arcane Explosion...") end function Aran(unit, event, miscunit, misc) print "Aran" unit:RegisterEvent("Aran_Water_Elementals",1000,1) unit:RegisterEvent("Aran_Polymorph",1000,1) unit:RegisterEvent("Aran_Fireball",9000,0) unit:RegisterEvent("Aran_Conterspell",13000,0) unit:RegisterEvent("Aran_Conflagration",15000,0) unit:RegisterEvent("Aran_FrostBolt",17000,0) unit:RegisterEvent("Aran_Chains_Ice",20000,0) unit:RegisterEvent("Aran_Arcane_Missiles",25000,0) unit:RegisterEvent("Aran_Flame_Wreath",30000,0) unit:RegisterEvent("Aran_Circular_Blizzard",60000,0) unit:RegisterEvent("Aran_Magnetic_Pull",90000,0) unit:RegisterEvent("Aran_Arcane_Explosion",91000,0) end RegisterUnitEvent(16524,1,"Aran")
agpl-3.0
RAlexis/ArcEmu_MoP
src/scripts/lua/LuaBridge/Stable Scripts/Azeroth/Karazhan/BOSS_Karazhan_Aran.lua
30
3347
function Aran_Water_Elementals(Unit, event, miscunit, misc) if Unit:GetHealthPct() < 40 and Didthat == 0 then Unit:SpawnCreature(21160, -11167.2, -1914.13, 232.009, 0, 18, 96000000); Unit:SpawnCreature(21160, -11163.2, -1910.13, 232.009, 0, 18, 96000000); Unit:SpawnCreature(21160, -11165.2, -1916.13, 232.009, 0, 18, 96000000); Unit:SpawnCreature(21160, -11162.2, -1911.13, 232.009, 0, 18, 96000000); Didthat = 1 else end end function Aran_Polymorph(Unit, event, miscunit, misc) if Unit:GetManaPct() < 20 and Didthat == 1 then Unit:FullCastSpellOnTarget(23603,Unit:GetClosestPlayer()) Unit:FullCastSpell(32453) Didthat = 2 else end end function Aran_Fireball(Unit, event, miscunit, misc) print "Aran Fireball" Unit:FullCastSpellOnTarget(20678,Unit:GetClosestPlayer()) Unit:SendChatMessage(11, 0, "Fire ball...") end function Aran_Conterspell(Unit, event, miscunit, misc) print "Aran Conterspell" Unit:FullCastSpellOnTarget(29961,Unit:GetClosestPlayer()) Unit:SendChatMessage(11, 0, "Try to cast now...") end function Aran_Conflagration(Unit, event, miscunit, misc) print "Aran Conflagration" Unit:FullCastSpellOnTarget(23023,Unit:GetClosestPlayer()) Unit:SendChatMessage(11, 0, "Your so weak guys...") end function Aran_FrostBolt(Unit, event, miscunit, misc) print "Aran FrostBolt" Unit:FullCastSpellOnTarget(41486,Unit:GetClosestPlayer()) Unit:SendChatMessage(11, 0, "Catch that, if you can...") end function Aran_Chains_Ice(Unit, event, miscunit, misc) print "Aran Chains Ice" Unit:FullCastSpellOnTarget(29991,Unit:GetClosestPlayer()) Unit:SendChatMessage(11, 0, "Ho, guys you cannot move...") end function Aran_Arcane_Missiles(Unit, event, miscunit, misc) print "Aran Arcane Missiles" Unit:FullCastSpellOnTarget(29955,Unit:GetClosestPlayer()) Unit:SendChatMessage(11, 0, "Rain of arcane...") end function Aran_Flame_Wreath(Unit, event, miscunit, misc) print "Aran Flame Wreath" Unit:FullCastSpellOnTarget(30004,Unit:GetRandomPlayer()) Unit:SendChatMessage(11, 0, "My Flame Wreath...") end function Aran_Circular_Blizzard(Unit, event, miscunit, misc) print "Aran Circular Blizzard" Unit:FullCastSpellOnTarget(29952,Unit:GetClosestPlayer()) Unit:SendChatMessage(11, 0, "Blizzard...") end function Aran_Magnetic_Pull(Unit, event, miscunit, misc) print "Aran Magnetic Pull" Unit:FullCastSpellOnTarget(29979,Unit:GetClosestPlayer()) Unit:SendChatMessage(11, 0, "Come to me guys...") end function Aran_Arcane_Explosion(Unit, event, miscunit, misc) print "Aran Arcane Explosion" Unit:FullCastSpellOnTarget(29973,Unit:GetClosestPlayer()) Unit:SendChatMessage(11, 0, "Now, the arcane Explosion...") end function Aran(unit, event, miscunit, misc) print "Aran" unit:RegisterEvent("Aran_Water_Elementals",1000,1) unit:RegisterEvent("Aran_Polymorph",1000,1) unit:RegisterEvent("Aran_Fireball",9000,0) unit:RegisterEvent("Aran_Conterspell",13000,0) unit:RegisterEvent("Aran_Conflagration",15000,0) unit:RegisterEvent("Aran_FrostBolt",17000,0) unit:RegisterEvent("Aran_Chains_Ice",20000,0) unit:RegisterEvent("Aran_Arcane_Missiles",25000,0) unit:RegisterEvent("Aran_Flame_Wreath",30000,0) unit:RegisterEvent("Aran_Circular_Blizzard",60000,0) unit:RegisterEvent("Aran_Magnetic_Pull",90000,0) unit:RegisterEvent("Aran_Arcane_Explosion",91000,0) end RegisterUnitEvent(16524,1,"Aran")
agpl-3.0
ak48disk/wowaddons
Quartz/libs/AceGUI-3.0/widgets/AceGUIWidget-ColorPicker.lua
6
5620
--[[----------------------------------------------------------------------------- ColorPicker Widget -------------------------------------------------------------------------------]] local Type, Version = "ColorPicker", 22 local AceGUI = LibStub and LibStub("AceGUI-3.0", true) if not AceGUI or (AceGUI:GetWidgetVersion(Type) or 0) >= Version then return end -- Lua APIs local pairs = pairs -- WoW APIs local CreateFrame, UIParent = CreateFrame, UIParent -- Global vars/functions that we don't upvalue since they might get hooked, or upgraded -- List them here for Mikk's FindGlobals script -- GLOBALS: ShowUIPanel, HideUIPanel, ColorPickerFrame, OpacitySliderFrame --[[----------------------------------------------------------------------------- Support functions -------------------------------------------------------------------------------]] local function ColorCallback(self, r, g, b, a, isAlpha) if not self.HasAlpha then a = 1 end self:SetColor(r, g, b, a) if ColorPickerFrame:IsVisible() then --colorpicker is still open self:Fire("OnValueChanged", r, g, b, a) else --colorpicker is closed, color callback is first, ignore it, --alpha callback is the final call after it closes so confirm now if isAlpha then self:Fire("OnValueConfirmed", r, g, b, a) end end end --[[----------------------------------------------------------------------------- Scripts -------------------------------------------------------------------------------]] local function Control_OnEnter(frame) frame.obj:Fire("OnEnter") end local function Control_OnLeave(frame) frame.obj:Fire("OnLeave") end local function ColorSwatch_OnClick(frame) HideUIPanel(ColorPickerFrame) local self = frame.obj if not self.disabled then ColorPickerFrame:SetFrameStrata("FULLSCREEN_DIALOG") ColorPickerFrame:SetFrameLevel(frame:GetFrameLevel() + 10) ColorPickerFrame:SetClampedToScreen(true) ColorPickerFrame.func = function() local r, g, b = ColorPickerFrame:GetColorRGB() local a = 1 - OpacitySliderFrame:GetValue() ColorCallback(self, r, g, b, a) end ColorPickerFrame.hasOpacity = self.HasAlpha ColorPickerFrame.opacityFunc = function() local r, g, b = ColorPickerFrame:GetColorRGB() local a = 1 - OpacitySliderFrame:GetValue() ColorCallback(self, r, g, b, a, true) end local r, g, b, a = self.r, self.g, self.b, self.a if self.HasAlpha then ColorPickerFrame.opacity = 1 - (a or 0) end ColorPickerFrame:SetColorRGB(r, g, b) ColorPickerFrame.cancelFunc = function() ColorCallback(self, r, g, b, a, true) end ShowUIPanel(ColorPickerFrame) end AceGUI:ClearFocus() end --[[----------------------------------------------------------------------------- Methods -------------------------------------------------------------------------------]] local methods = { ["OnAcquire"] = function(self) self:SetHeight(24) self:SetWidth(200) self:SetHasAlpha(false) self:SetColor(0, 0, 0, 1) self:SetDisabled(nil) self:SetLabel(nil) end, -- ["OnRelease"] = nil, ["SetLabel"] = function(self, text) self.text:SetText(text) end, ["SetColor"] = function(self, r, g, b, a) self.r = r self.g = g self.b = b self.a = a or 1 self.colorSwatch:SetVertexColor(r, g, b, a) end, ["SetHasAlpha"] = function(self, HasAlpha) self.HasAlpha = HasAlpha end, ["SetDisabled"] = function(self, disabled) self.disabled = disabled if self.disabled then self.frame:Disable() self.text:SetTextColor(0.5, 0.5, 0.5) else self.frame:Enable() self.text:SetTextColor(1, 1, 1) end end } --[[----------------------------------------------------------------------------- Constructor -------------------------------------------------------------------------------]] local function Constructor() local frame = CreateFrame("Button", nil, UIParent) frame:Hide() frame:EnableMouse(true) frame:SetScript("OnEnter", Control_OnEnter) frame:SetScript("OnLeave", Control_OnLeave) frame:SetScript("OnClick", ColorSwatch_OnClick) local colorSwatch = frame:CreateTexture(nil, "OVERLAY") colorSwatch:SetWidth(19) colorSwatch:SetHeight(19) colorSwatch:SetTexture("Interface\\ChatFrame\\ChatFrameColorSwatch") colorSwatch:SetPoint("LEFT") local texture = frame:CreateTexture(nil, "BACKGROUND") texture:SetWidth(16) texture:SetHeight(16) texture:SetTexture(1, 1, 1) texture:SetPoint("CENTER", colorSwatch) texture:Show() local checkers = frame:CreateTexture(nil, "BACKGROUND") checkers:SetWidth(14) checkers:SetHeight(14) checkers:SetTexture("Tileset\\Generic\\Checkers") checkers:SetTexCoord(.25, 0, 0.5, .25) checkers:SetDesaturated(true) checkers:SetVertexColor(1, 1, 1, 0.75) checkers:SetPoint("CENTER", colorSwatch) checkers:Show() local text = frame:CreateFontString(nil,"OVERLAY","GameFontHighlight") text:SetHeight(24) text:SetJustifyH("LEFT") text:SetTextColor(1, 1, 1) text:SetPoint("LEFT", colorSwatch, "RIGHT", 2, 0) text:SetPoint("RIGHT") --local highlight = frame:CreateTexture(nil, "HIGHLIGHT") --highlight:SetTexture("Interface\\QuestFrame\\UI-QuestTitleHighlight") --highlight:SetBlendMode("ADD") --highlight:SetAllPoints(frame) local widget = { colorSwatch = colorSwatch, text = text, frame = frame, type = Type } for method, func in pairs(methods) do widget[method] = func end return AceGUI:RegisterAsWidget(widget) end AceGUI:RegisterWidgetType(Type, Constructor, Version)
mit
gedadsbranch/Darkstar-Mission
scripts/zones/Dynamis-Windurst/mobs/Tzee_Xicu_Idol.lua
11
1290
----------------------------------- -- Area: Dynamis Windurst -- NPC: Tzee Xicu Idol ----------------------------------- require("scripts/globals/titles"); require("scripts/globals/dynamis"); ----------------------------------- -- onMobSpawn Action ----------------------------------- function onMobSpawn(mob) end; ----------------------------------- -- onMobEngaged ----------------------------------- function onMobEngaged(mob,target) SpawnMob(17543597):updateEnmity(target); -- 122 SpawnMob(17543598):updateEnmity(target); -- 123 SpawnMob(17543599):updateEnmity(target); -- 124 SpawnMob(17543600):updateEnmity(target); -- 125 SpawnMob(17543170):updateEnmity(target); -- Maa Febi the Steadfast SpawnMob(17543171):updateEnmity(target); -- Muu Febi the Steadfast end; ----------------------------------- -- onMobDeath ----------------------------------- function onMobDeath(mob,killer) if(alreadyReceived(killer,8) == false) then addDynamisList(killer,128); killer:addTitle(DYNAMISWINDURST_INTERLOPER); -- Add title local npc = GetNPCByID(17543480); -- Spawn ??? npc:setPos(mob:getXPos(),mob:getYPos(),mob:getZPos()); npc:setStatus(0); killer:launchDynamisSecondPart(); -- Spawn dynamis second part end end;
gpl-3.0
gedadsbranch/Darkstar-Mission
scripts/zones/Port_Jeuno/npcs/Supiroro.lua
12
1388
----------------------------------- -- Area: Port Jeuno -- NPC: Supiroro -- Standard Info NPC ----------------------------------- package.loaded["scripts/zones/Port_Jeuno/TextIDs"] = nil; require("scripts/zones/Port_Jeuno/TextIDs"); ----------------------------------- -- onTrade Action ----------------------------------- function onTrade(player,npc,trade) end; ----------------------------------- -- onTrigger Action ----------------------------------- function onTrigger(player,npc) local vHour = VanadielHour(); local vMin = VanadielMinute(); while vHour >= 1 do vHour = vHour - 6; end if( vHour == -5) then vHour = 1; elseif( vHour == -4) then vHour = 2; elseif( vHour == -3) then vHour = 3; elseif( vHour == -2) then vHour = 4; elseif( vHour == -1) then vHour = 5; end local seconds = math.floor(2.4 * ((vHour * 60) + vMin)); player:startEvent( 0x0002, seconds, 0, 0, 0, 0, 0, 0, 0); end; ----------------------------------- -- onEventUpdate ----------------------------------- function onEventUpdate(player,csid,option) -- printf("CSID: %u",csid); -- printf("RESULT: %u",option); end; ----------------------------------- -- onEventFinish ----------------------------------- function onEventFinish(player,csid,option) -- printf("CSID: %u",csid); -- printf("RESULT: %u",option); end;
gpl-3.0
gedadsbranch/Darkstar-Mission
scripts/zones/Abyssea-La_Theine/mobs/Lusion.lua
13
1536
----------------------------------- -- Area: Abyssea - La Theine -- NPC: Luison ----------------------------------- ----------------------------------- -- onMobSpawn Action ----------------------------------- function onMobSpawn(mob) setLocalVar("transformTime", os.time()) end; ----------------------------------- -- onMobRoam Action ----------------------------------- function onMobRoam(mob) local spawnTime = mob:getLocalVar("transformTime"); local roamChance = math.random(1,100); local roamMoonPhase = VanadielMoonPhase(); if(roamChance > 100-roamMoonPhase) then if(mob:AnimationSub() == 0 and os.time() - transformTime > 300) then mob:AnimationSub(1); mob:setLocalVar("transformTime", os.time()); elseif(mob:AnimationSub() == 1 and os.time() - transformTime > 300) then mob:AnimationSub(0); mob:setLocalVar("transformTime", os.time()); end end end; ----------------------------------- -- onMobEngaged -- Change forms every 60 seconds ----------------------------------- function onMobEngaged(mob,target) local changeTime = mob:getLocalVar("changeTime"); local chance = math.random(1,100); local moonPhase = VanadielMoonPhase(); if(chance > 100-moonPhase) then if(mob:AnimationSub() == 0 and mob:getBattleTime() - changeTime > 45) then mob:AnimationSub(1); mob:setLocalVar("changeTime", mob:getBattleTime()); elseif(mob:AnimationSub() == 1 and mob:getBattleTime() - changeTime > 45) then mob:AnimationSub(0); mob:setLocalVar("changeTime", mob:getBattleTime()); end end end;
gpl-3.0
hooksta4/darkstar
scripts/zones/Windurst_Waters/npcs/Chyuk-Kochak.lua
38
1048
----------------------------------- -- Area: Windurst Waters -- NPC: Chyuk-Kochak -- Type: Standard NPC -- @zone: 238 -- @pos -252.162 -6.319 -307.011 -- -- Auto-Script: Requires Verification (Verified 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(0x0298); 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
ld-test/dromozoa-image
dromozoa/image/sips_reader.lua
3
2047
-- Copyright (C) 2015 Tomoyuki Fujimori <moyu@dromozoa.com> -- -- This file is part of dromozoa-image. -- -- dromozoa-image is free software: you can redistribute it and/or modify -- it under the terms of the GNU General Public License as published by -- the Free Software Foundation, either version 3 of the License, or -- (at your option) any later version. -- -- dromozoa-image 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 dromozoa-image. If not, see <http://www.gnu.org/licenses/>. local sequence = require "dromozoa.commons.sequence" local shell = require "dromozoa.commons.shell" local string_reader = require "dromozoa.commons.string_reader" local write_file = require "dromozoa.commons.write_file" local class = {} class.support = shell.exec("sips >/dev/null 2>&1") function class.new(this) if type(this) == "string" then this = string_reader(this) end return { this = this; } end function class:apply() local this = self.this local commands = sequence():push("sips") commands:push("--setProperty", "format", "tga") local tmpin = os.tmpname() assert(write_file(tmpin, this:read("*a"))) commands:push(shell.quote(tmpin)) local tmpout = os.tmpname() commands:push("--out", shell.quote(tmpout)) local command = commands:concat(" ") .. " >/dev/null 2>&1" local result, what, code = shell.exec(command) os.remove(tmpin) if result == nil then os.remove(tmpout) return nil, what, code else local handle = assert(io.open(tmpout, "rb")) os.remove(tmpout) local img = class.super.read_tga(handle) handle:close() return img end end local metatable = { __index = class; } return setmetatable(class, { __call = function (_, this) return setmetatable(class.new(this), metatable) end; })
gpl-3.0
hooksta4/darkstar
scripts/zones/zones/Al_Zahbi/Zone.lua
2
1268
----------------------------------- -- -- Zone: Al_Zahbi (48) -- ----------------------------------- package.loaded["scripts/zones/Al_Zahbi/TextIDs"] = nil; ----------------------------------- require("scripts/globals/settings"); require("scripts/zones/Al_Zahbi/TextIDs"); ----------------------------------- -- onInitialize ----------------------------------- function onInitialize(zone) end; ----------------------------------- -- onZoneIn ----------------------------------- function onZoneIn(player,prevZone) local cs = -1; -- MOG HOUSE EXIT if (player:getXPos() == 0 and player:getYPos() == 0 and player:getZPos() == 0) then position = math.random(1,5) + 37; player:setPos(position,0,-62,192); end return cs; end; ----------------------------------- -- onRegionEnter ----------------------------------- function onRegionEnter(player,region) end; ----------------------------------- -- onEventUpdate ----------------------------------- function onEventUpdate(player,csid,option) -- printf("CSID: %u",csid); -- printf("RESULT: %u",option); end; ----------------------------------- -- onEventFinish ----------------------------------- function onEventFinish(player,csid,option) -- printf("CSID: %u",csid); -- printf("RESULT: %u",option); end;
gpl-3.0
hooksta4/darkstar
scripts/globals/weaponskills/tachi_shoha.lua
30
1753
----------------------------------- -- Tachi: Shoha -- Great Katana weapon skill -- Skill Level: 357 -- Delivers a two-hit attack. Damage varies with TP. -- To obtain Tachi: Shoha, the quest Martial Mastery must be completed and it must be purchased from the Merit Points menu. -- Suspected to have an Attack Bonus similar to Tachi: Yukikaze, Tachi: Gekko, and Tachi: Kasha, but only on the first hit. -- Aligned with the Breeze Gorget, Thunder Gorget & Shadow Gorget. -- Aligned with the Breeze Belt, Thunder Belt & Shadow Belt. -- Element: None -- Modifiers: STR:73~85%, depending on merit points upgrades. -- 100%TP 200%TP 300%TP -- 1.375 2.1875 2.6875 ----------------------------------- require("scripts/globals/status"); require("scripts/globals/settings"); require("scripts/globals/weaponskills"); ----------------------------------- function onUseWeaponSkill(player, target, wsID) local params = {}; params.numHits = 2; params.ftp100 = 1.375; params.ftp200 = 2.1875; params.ftp300 = 2.6875; params.str_wsc = 0.85 + (player:getMerit(MERIT_TACHI_SHOHA) / 100); 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.375; if (USE_ADOULIN_WEAPON_SKILL_CHANGES == true) then params.str_wsc = 0.7 + (player:getMerit(MERIT_TACHI_SHOHA) / 100); end local damage, criticalHit, tpHits, extraHits = doPhysicalWeaponskill(player, target, params); damage = damage * WEAPON_SKILL_POWER return tpHits, extraHits, criticalHit, damage; end
gpl-3.0
hooksta4/darkstar
scripts/zones/zones/La_Theine_Plateau/npcs/Cermet_Headstone.lua
2
2609
----------------------------------- -- Area: La Theine Plateau -- NPC: Cermet Headstone -- Involved in Mission: ZM5 Headstone Pilgrimage (Water Fragment) -- @pos -170 39 -504 102 ----------------------------------- package.loaded["scripts/zones/La_Theine_Plateau/TextIDs"] = nil; ----------------------------------- require("scripts/globals/keyitems"); require("scripts/globals/titles"); require("scripts/globals/missions"); require("scripts/zones/La_Theine_Plateau/TextIDs"); ----------------------------------- -- onTrade Action ----------------------------------- function onTrade(player,npc,trade) end; ----------------------------------- -- onTrigger Action ----------------------------------- function onTrigger(player,npc) if (player:getCurrentMission(ZILART) == HEADSTONE_PILGRIMAGE) then if (player:hasKeyItem(WATER_FRAGMENT) == false) then player:startEvent(0x00C8,WATER_FRAGMENT); elseif (player:hasKeyItem(239) and player:hasKeyItem(240) and player:hasKeyItem(241) and player:hasKeyItem(242) and player:hasKeyItem(243) and player:hasKeyItem(244) and player:hasKeyItem(245) and player:hasKeyItem(246)) then player:messageSpecial(ALREADY_HAVE_ALL_FRAGS); elseif (player:hasKeyItem(WATER_FRAGMENT) == true) then player:messageSpecial(ALREADY_OBTAINED_FRAG,WATER_FRAGMENT); end elseif (player:hasCompletedMission(ZILART,HEADSTONE_PILGRIMAGE)) then player:messageSpecial(ZILART_MONUMENT); else player:messageSpecial(CANNOT_REMOVE_FRAG); 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 == 0x00C8 and option == 1) then player:addKeyItem(WATER_FRAGMENT); -- Check and see if all fragments have been found (no need to check earth and dark frag) if (player:hasKeyItem(FIRE_FRAGMENT) and player:hasKeyItem(EARTH_FRAGMENT) and player:hasKeyItem(ICE_FRAGMENT) and player:hasKeyItem(WIND_FRAGMENT) and player:hasKeyItem(LIGHTNING_FRAGMENT) and player:hasKeyItem(LIGHT_FRAGMENT)) then player:messageSpecial(FOUND_ALL_FRAGS,WATER_FRAGMENT); player:addTitle(BEARER_OF_THE_EIGHT_PRAYERS); player:completeMission(ZILART,HEADSTONE_PILGRIMAGE); player:addMission(ZILART,THROUGH_THE_QUICKSAND_CAVES); else player:messageSpecial(KEYITEM_OBTAINED,WATER_FRAGMENT); end end end;
gpl-3.0