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 |
|---|---|---|---|---|---|
Deadwing888/darkstar | scripts/zones/Yhoator_Jungle/npcs/qm2.lua | 13 | 1933 | -----------------------------------
-- Area: Yhoator Jungle
-- NPC: ??? Used for Norg quest "Stop Your Whining"
-- @pos -94.073 -0.999 22.295 124
-----------------------------------
package.loaded["scripts/zones/Yhoator_Jungle/TextIDs"] = nil;
-----------------------------------
require("scripts/globals/keyitems");
require("scripts/globals/quests");
require("scripts/zones/Yhoator_Jungle/TextIDs");
-----------------------------------
-- onTrade Action
-----------------------------------
function onTrade(player,npc,trade)
end;
-----------------------------------
-- onTrigger Action
-----------------------------------
function onTrigger(player,npc)
local StopWhining = player:getQuestStatus(OUTLANDS,STOP_YOUR_WHINING);
if (StopWhining == QUEST_ACCEPTED and player:hasKeyItem(BARREL_OF_OPOOPO_BREW) == false and player:hasKeyItem(EMPTY_BARREL)) then
player:messageSpecial(TREE_CHECK);
player:addKeyItem(BARREL_OF_OPOOPO_BREW); --Filled Barrel
player:messageSpecial(KEYITEM_OBTAINED,BARREL_OF_OPOOPO_BREW);
player:delKeyItem(EMPTY_BARREL); --Empty Barrel
elseif (StopWhining == QUEST_ACCEPTED and player:hasKeyItem(BARREL_OF_OPOOPO_BREW) == true) then
player:messageSpecial(TREE_FULL); --Already have full barrel
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 == 0x0001) then
player:addKeyItem(SEA_SERPENT_STATUE);
player:messageSpecial(KEYITEM_OBTAINED,SEA_SERPENT_STATUE);
end
end; | gpl-3.0 |
Deadwing888/darkstar | scripts/zones/Metalworks/npcs/Franziska.lua | 15 | 1120 | -----------------------------------
-- Area: Metalworks
-- NPC: Franziska
-- Type: Standard Info NPC
-----------------------------------
package.loaded["scripts/zones/Metalworks/TextIDs"] = nil;
-----------------------------------
require("scripts/zones/Metalworks/TextIDs");
-----------------------------------
-- onTrade Action
-----------------------------------
function onTrade(player,npc,trade)
end;
-----------------------------------
-- onTrigger Action
-----------------------------------
function onTrigger(player,npc)
if (player:getVar("OptionalcsCornelia") ==1) then
player:startEvent(0x0309);
else
player:startEvent(0x026C);
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 == 0x0309) then
player:setVar("OptionalcsCornelia",0);
end
end;
| gpl-3.0 |
destdev/ygopro-scripts | c31328739.lua | 7 | 1125 | --サイキック・インパルス
function c31328739.initial_effect(c)
--Activate
local e1=Effect.CreateEffect(c)
e1:SetCategory(CATEGORY_TODECK+CATEGORY_DRAW)
e1:SetType(EFFECT_TYPE_ACTIVATE)
e1:SetProperty(EFFECT_FLAG_PLAYER_TARGET)
e1:SetCode(EVENT_FREE_CHAIN)
e1:SetCost(c31328739.cost)
e1:SetTarget(c31328739.target)
e1:SetOperation(c31328739.activate)
c:RegisterEffect(e1)
end
function c31328739.cost(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.CheckReleaseGroup(tp,Card.IsRace,1,nil,RACE_PSYCHO) end
local g=Duel.SelectReleaseGroup(tp,Card.IsRace,1,1,nil,RACE_PSYCHO)
Duel.Release(g,REASON_COST)
end
function c31328739.target(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.GetFieldGroupCount(tp,0,LOCATION_HAND)>0 and Duel.IsPlayerCanDraw(1-tp,3) end
Duel.SetTargetPlayer(1-tp)
end
function c31328739.activate(e,tp,eg,ep,ev,re,r,rp)
local p=Duel.GetChainInfo(0,CHAININFO_TARGET_PLAYER)
local g=Duel.GetFieldGroup(p,LOCATION_HAND,0)
if g:GetCount()==0 then return end
Duel.SendtoDeck(g,nil,2,REASON_EFFECT)
Duel.ShuffleDeck(p)
Duel.BreakEffect()
Duel.Draw(p,3,REASON_EFFECT)
end | gpl-2.0 |
sina021/specialtg | plugins/help_fa.lua | 1 | 3719 | do
function run(msg, matches)
if msg.to.type == 'chat' and is_momod(msg) then
return 'SPECIAL Team BOT Command List'.. [[
💙 ليست دستورات به زبان فارسي ❤️
🔴 اخراج [کد،ايدي،ريپلی]
🔹شخص مورد نظر از گروه اخراج ميشود.
🔴 بن [ايدي،کد،ريپلی]
🔹شخص مورد نظر از گروه محروم ميشود
🔴 حذف بن [کد،ايدي،ریپلی]
🔹شخص مورد نظر از محرومیت خارج ميشود
🔴 لیست بن
🔹ليست افرادي که از گروه محروم شده اند
➖➖➖➖➖➖➖
🔴 قفل [نام|تگ|فحش|تبلیغات|ایموجی|
🔸ربات|عربی|اعضا|جوین|رسانه|
🔸چت|انگلیسی|حساسیت|فروارد]
🔹قفل کردن موارد مورد نظر
☜مثال: قفل نام
🔴 باز کردن [نام|فحش|تبلیغات|ایموجی|
🔸ربات|عربی|اعضا|عکس|جوین|رسانه| 🔸چت|تگ|انگلیسی|حساسیت|فروارد]
🔹باز کردن موارد قفل شده
☜مثال: باز کردن نام
➖➖➖➖➖➖➖
🔴حساسیت 2-30
🔹تعیین مقدار حساسیت اسپم
☜مثال: حساسیت 5
➖➖➖➖➖➖➖
🔴 لیست فیلتر
🔹ليست کلمه هاي فيلتر شده
🔴 فيلتر + کلمه
🔹فيلتر کردن کلمه
🔴 فيلتر - کلمه
🔹ازاد کردن از فیلتر
🔴حذف لیست فیلتر
🔹پاک کردن تمام کلمات از لیست فیلتر
➖➖➖➖➖➖➖
🔴 صاحب؟
🔹نمايش آيدي مدير گروه
🔴 ليست مديران
🔹مشاهده ليست مدیران
🔴 افزودن مدير
🔹اضافه کردن مدير
🔴 حذف مدیر
🔹حذف کردن از مديریت
➖➖➖➖➖➖➖
🔴 تغییر عکس
🔹عوض و قفل کردن عکس گروه
🔴تغییر نام (نام مورد نظر)
🔹تعويض نام گروه
➖➖➖➖➖➖➖
🔴 توضيحات
🔹مشاهده توضيحات گروه
🔴 قوانين
🔹مشاهده قوانين گروه
🔴 ثبت توضیحات (متن)
🔹ثبت توضیحات جدید براي گروه
🔴ثبت قوانین (متن)
🔹ثبت قوانین جدید براي گروه
➖➖➖➖➖➖➖
🔴 لينک جديد
🔹ساخت لينک جدید برای گروه
🔴 لينک
🔹دریافت لينک گروه
🔴 لينک خصوصي
🔹ارسال لينک در چت خصوصي
➖➖➖➖➖➖➖
🔴 ايدی
🔹ايدي خود در گروه حتی با (ریپلی|یوزر)
➖➖➖➖➖➖➖
⇦راهنمای فان
مشاهده لیست دستورات سرگرمی به زبان فارسی
⇨!help
برای مشاهده لیست دستورات به زبان انگلیسی
⇨!help
در پیوی ربات این دستور را زده و از پیوی گروه را مدیریت کنید
➖➖➖➖➖➖➖
1_برای ارسال نظر از دستور (ارسال نظر [متن]) استفاده کنيد
مثال: ارسال نظر تست
2_برای عضويت در گروه پشتيبانی کلمه (ساپورت) را در پیوی ربات ارسال کنيد
3_برای دریافت لینک گروه پشتیبانی از دستور (لینک ساپورت) استفاده کنید
4_برای ادد شدن ربات سخنگو ما از دستور🔜🔝
!kosgo
استفاده کنید👌😂
➖➖➖➖➖➖➖
V 5 .1
Team Channel @SPECIAL_TEAM1
Sudo Users : 👤
@SINA_O21
@SUDO1 ]]
end
end
return {
description = "Robot About",
usage = "help: View Robot About",
patterns = {
"^راهنما$"
},
run = run
}
end
| gpl-2.0 |
destdev/ygopro-scripts | c89538537.lua | 2 | 3159 | --オルターガイスト・シルキタス
function c89538537.initial_effect(c)
--to hand
local e1=Effect.CreateEffect(c)
e1:SetCategory(CATEGORY_TOHAND)
e1:SetDescription(aux.Stringid(89538537,0))
e1:SetType(EFFECT_TYPE_QUICK_O)
e1:SetCode(EVENT_FREE_CHAIN)
e1:SetHintTiming(0,TIMINGS_CHECK_MONSTER+TIMING_END_PHASE)
e1:SetProperty(EFFECT_FLAG_CARD_TARGET)
e1:SetRange(LOCATION_MZONE)
e1:SetCountLimit(1,89538537)
e1:SetCost(c89538537.rthcost)
e1:SetTarget(c89538537.rthtg)
e1:SetOperation(c89538537.rthop)
c:RegisterEffect(e1)
--to hand
local e2=Effect.CreateEffect(c)
e2:SetDescription(aux.Stringid(89538537,1))
e2:SetCategory(CATEGORY_TOHAND)
e2:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O)
e2:SetProperty(EFFECT_FLAG_DELAY+EFFECT_FLAG_CARD_TARGET)
e2:SetCode(EVENT_TO_GRAVE)
e2:SetCountLimit(1,89538538)
e2:SetCondition(c89538537.thcon)
e2:SetTarget(c89538537.thtg)
e2:SetOperation(c89538537.thop)
c:RegisterEffect(e2)
end
function c89538537.rthcost(e,tp,eg,ep,ev,re,r,rp,chk)
e:SetLabel(1)
return true
end
function c89538537.rthcfilter(c,tp)
return c:IsFaceup() and c:IsSetCard(0x103) and c:IsAbleToHandAsCost()
and Duel.IsExistingTarget(c89538537.rthtgfilter,tp,0,LOCATION_ONFIELD,1,c,c)
end
function c89538537.rthtgfilter(c,tc)
return c:IsAbleToHand() and c:GetEquipTarget()~=tc
end
function c89538537.rthtg(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
local c=e:GetHandler()
if chkc then return chkc:IsControler(1-tp) and chkc:IsLocation(LOCATION_ONFIELD) and chkc:IsAbleToHand() end
if chk==0 then
if e:GetLabel()==1 then
e:SetLabel(0)
return Duel.IsExistingMatchingCard(c89538537.rthcfilter,tp,LOCATION_ONFIELD,0,1,c,tp)
else
return Duel.IsExistingTarget(Card.IsAbleToHand,tp,0,LOCATION_ONFIELD,1,nil)
end
end
if e:GetLabel()==1 then
e:SetLabel(0)
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_RTOHAND)
local g=Duel.SelectMatchingCard(tp,c89538537.rthcfilter,tp,LOCATION_ONFIELD,0,1,1,c,tp)
Duel.SendtoHand(g,nil,REASON_COST)
end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_RTOHAND)
local g=Duel.SelectTarget(tp,Card.IsAbleToHand,tp,0,LOCATION_ONFIELD,1,1,nil)
Duel.SetOperationInfo(0,CATEGORY_TOHAND,g,1,0,0)
end
function c89538537.rthop(e,tp,eg,ep,ev,re,r,rp)
local tc=Duel.GetFirstTarget()
if tc:IsRelateToEffect(e) then
Duel.SendtoHand(tc,nil,REASON_EFFECT)
end
end
function c89538537.thcon(e,tp,eg,ep,ev,re,r,rp)
return e:GetHandler():IsPreviousLocation(LOCATION_ONFIELD)
end
function c89538537.thfilter(c)
return c:IsSetCard(0x103) and c:IsType(TYPE_TRAP) and c:IsAbleToHand()
end
function c89538537.thtg(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
if chkc then return chkc:IsLocation(LOCATION_GRAVE) and chkc:IsControler(tp) and c89538537.thfilter(chkc) end
if chk==0 then return Duel.IsExistingTarget(c89538537.thfilter,tp,LOCATION_GRAVE,0,1,nil) end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_ATOHAND)
local sg=Duel.SelectTarget(tp,c89538537.thfilter,tp,LOCATION_GRAVE,0,1,1,nil)
Duel.SetOperationInfo(0,CATEGORY_TOHAND,sg,sg:GetCount(),0,0)
end
function c89538537.thop(e,tp,eg,ep,ev,re,r,rp)
local tc=Duel.GetFirstTarget()
if tc:IsRelateToEffect(e) then
Duel.SendtoHand(tc,nil,REASON_EFFECT)
end
end
| gpl-2.0 |
Deadwing888/darkstar | scripts/zones/Kazham/npcs/Lalapp.lua | 13 | 3749 | -----------------------------------
-- Area: Kazham
-- NPC: Lalapp
-- Standard Info NPC
-----------------------------------
package.loaded["scripts/zones/Kazham/TextIDs"] = nil;
require("scripts/zones/Kazham/TextIDs");
require("scripts/globals/pathfind");
local path = {
-63.243702, -11.000023, -97.916130,
-63.970551, -11.000027, -97.229286,
-64.771614, -11.000030, -96.499062
};
function onSpawn(npc)
npc:initNpcAi();
npc:setPos(pathfind.first(path));
onPath(npc);
end;
function onPath(npc)
pathfind.patrol(npc, path);
end;
-----------------------------------
-- onTrade Action
-----------------------------------
-- item IDs
-- 483 Broken Mithran Fishing Rod
-- 22 Workbench
-- 1008 Ten of Coins
-- 1157 Sands of Silence
-- 1158 Wandering Bulb
-- 904 Giant Fish Bones
-- 4599 Blackened Toad
-- 905 Wyvern Skull
-- 1147 Ancient Salt
-- 4600 Lucky Egg
function onTrade(player,npc,trade)
local OpoOpoAndIStatus = player:getQuestStatus(OUTLANDS, THE_OPO_OPO_AND_I);
local progress = player:getVar("OPO_OPO_PROGRESS");
local failed = player:getVar("OPO_OPO_FAILED");
local goodtrade = trade:hasItemQty(1147,1);
local badtrade = (trade:hasItemQty(483,1) or trade:hasItemQty(22,1) or trade:hasItemQty(1157,1) or trade:hasItemQty(1158,1) or trade:hasItemQty(904,1) or trade:hasItemQty(1008,1) or trade:hasItemQty(905,1) or trade:hasItemQty(4599,1) or trade:hasItemQty(4600,1));
if (OpoOpoAndIStatus == QUEST_ACCEPTED) then
if progress == 8 or failed == 9 then
if goodtrade then
player:startEvent(0x00E3);
elseif badtrade then
player:startEvent(0x00ED);
end
end
end
end;
-----------------------------------
-- onTrigger Action
-----------------------------------
function onTrigger(player,npc)
local OpoOpoAndIStatus = player:getQuestStatus(OUTLANDS, THE_OPO_OPO_AND_I);
local progress = player:getVar("OPO_OPO_PROGRESS");
local failed = player:getVar("OPO_OPO_FAILED");
local retry = player:getVar("OPO_OPO_RETRY");
if (OpoOpoAndIStatus == QUEST_ACCEPTED) then
if retry >= 1 then -- has failed on future npc so disregard previous successful trade
player:startEvent(0x00CD);
npc:wait(-1);
elseif (progress == 8 or failed == 9) then
player:startEvent(0x00D6); -- asking for ancient salt
elseif (progress >= 9 or failed >= 10) then
player:startEvent(0x00FA); -- happy with ancient salt
end
else
player:startEvent(0x00CD);
npc:wait(-1);
end
end;
-----------------------------------
-- onEventUpdate
-----------------------------------
function onEventUpdate(player,csid,option)
--printf("CSID: %u",csid);
--printf("RESULT: %u",option);
end;
-----------------------------------
-- onEventFinish
-----------------------------------
function onEventFinish(player,csid,option,npc)
--printf("CSID: %u",csid);
--printf("RESULT: %u",option);
if (csid == 0x00E3) then -- correct trade, onto next opo
if player:getVar("OPO_OPO_PROGRESS") == 8 then
player:tradeComplete();
player:setVar("OPO_OPO_PROGRESS",9);
player:setVar("OPO_OPO_FAILED",0);
else
player:setVar("OPO_OPO_FAILED",10);
end
elseif (csid == 0x00ED) then -- wrong trade, restart at first opo
player:setVar("OPO_OPO_FAILED",1);
player:setVar("OPO_OPO_RETRY",9);
else
npc:wait(0);
end
end;
| gpl-3.0 |
destdev/ygopro-scripts | c12219047.lua | 1 | 2813 | --幻影騎士団カースド・ジャベリン
function c12219047.initial_effect(c)
aux.AddXyzProcedure(c,nil,2,2)
--disable and reduce ATK
local e1=Effect.CreateEffect(c)
e1:SetDescription(aux.Stringid(12219047,0))
e1:SetCategory(CATEGORY_ATKCHANGE+CATEGORY_DISABLE)
e1:SetType(EFFECT_TYPE_IGNITION)
e1:SetRange(LOCATION_MZONE)
e1:SetProperty(EFFECT_FLAG_CARD_TARGET)
e1:SetCountLimit(1,12219047)
e1:SetCondition(c12219047.condition1)
e1:SetCost(c12219047.cost)
e1:SetTarget(c12219047.target)
e1:SetOperation(c12219047.operation)
c:RegisterEffect(e1)
local e2=e1:Clone()
e2:SetType(EFFECT_TYPE_QUICK_O)
e2:SetCode(EVENT_FREE_CHAIN)
e2:SetProperty(EFFECT_FLAG_CARD_TARGET+EFFECT_FLAG_DAMAGE_STEP)
e2:SetHintTiming(TIMING_DAMAGE_STEP,0x21e0)
e2:SetCondition(c12219047.condition2)
c:RegisterEffect(e2)
end
function c12219047.condition1(e,tp,eg,ep,ev,re,r,rp)
return not e:GetHandler():GetOverlayGroup():IsExists(Card.IsSetCard,1,nil,0x10db)
end
function c12219047.cost(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return e:GetHandler():CheckRemoveOverlayCard(tp,1,REASON_COST) end
e:GetHandler():RemoveOverlayCard(tp,1,1,REASON_COST)
end
function c12219047.filter(c)
return c:IsFaceup() and not (c:IsAttack(0) and c:IsDisabled())
end
function c12219047.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
if chkc then return chkc:IsLocation(LOCATION_MZONE) and chkc:IsControler(1-tp) and c12219047.filter(chkc) end
if chk==0 then return Duel.IsExistingTarget(c12219047.filter,tp,0,LOCATION_MZONE,1,nil) end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_FACEUP)
Duel.SelectTarget(tp,c12219047.filter,tp,0,LOCATION_MZONE,1,1,nil)
end
function c12219047.operation(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
local tc=Duel.GetFirstTarget()
if tc:IsFaceup() and tc:IsRelateToEffect(e) then
Duel.NegateRelatedChain(tc,RESET_TURN_SET)
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE)
e1:SetCode(EFFECT_DISABLE)
e1:SetReset(RESET_EVENT+RESETS_STANDARD+RESET_PHASE+PHASE_END)
tc:RegisterEffect(e1)
local e2=Effect.CreateEffect(c)
e2:SetType(EFFECT_TYPE_SINGLE)
e2:SetProperty(EFFECT_FLAG_CANNOT_DISABLE)
e2:SetCode(EFFECT_DISABLE_EFFECT)
e2:SetValue(RESET_TURN_SET)
e2:SetReset(RESET_EVENT+RESETS_STANDARD+RESET_PHASE+PHASE_END)
tc:RegisterEffect(e2)
local e3=Effect.CreateEffect(c)
e3:SetProperty(EFFECT_FLAG_CANNOT_DISABLE)
e3:SetType(EFFECT_TYPE_SINGLE)
e3:SetCode(EFFECT_SET_ATTACK_FINAL)
e3:SetReset(RESET_EVENT+RESETS_STANDARD+RESET_PHASE+PHASE_END)
e3:SetValue(0)
tc:RegisterEffect(e3)
end
end
function c12219047.condition2(e,tp,eg,ep,ev,re,r,rp)
return e:GetHandler():GetOverlayGroup():IsExists(Card.IsSetCard,1,nil,0x10db)
and (Duel.GetCurrentPhase()~=PHASE_DAMAGE or not Duel.IsDamageCalculated())
end
| gpl-2.0 |
Deadwing888/darkstar | scripts/zones/Abyssea-Tahrongi/npcs/qm14.lua | 17 | 1888 | -----------------------------------
-- Zone: Abyssea-Tahrongi
-- NPC: ???
-- Spawns: Glavoid
-----------------------------------
require("scripts/globals/status");
require("scripts/globals/keyitems");
-----------------------------------
-- onTrigger Action
-----------------------------------
function onTrigger(player,npc)
--[[
if (GetMobAction(16961950) == ACTION_NONE) then -- NM not already spawned from this
if (player:hasKeyItem(FAT_LINED_COCKATRICE_SKIN) and player:hasKeyItem(SODDEN_SANDWORM_HUSK)
and player:hasKeyItem(LUXURIANT_MANTICORE_MANE) -- I broke it into 3 lines at the 'and' because it was so long.
and player:hasKeyItem(STICKY_GNAT_WING)) then
player:startEvent(1020, FAT_LINED_COCKATRICE_SKIN, SODDEN_SANDWORM_HUSK, LUXURIANT_MANTICORE_MANE, STICKY_GNAT_WING); -- Ask if player wants to use KIs
else
player:startEvent(1021, FAT_LINED_COCKATRICE_SKIN, SODDEN_SANDWORM_HUSK, LUXURIANT_MANTICORE_MANE, STICKY_GNAT_WING); -- Do not ask, because player is missing at least 1.
end
end
]]
end;
-----------------------------------
-- onEventUpdate
-----------------------------------
function onEventUpdate(player,csid,option)
-- printf("CSID2: %u",csid);
-- printf("RESULT2: %u",option);
end;
-----------------------------------
-- onEventFinish
-----------------------------------
function onEventFinish(player,csid,option)
-- printf("CSID: %u",csid);
-- printf("RESULT: %u",option);
if (csid == 1020 and option == 1) then
SpawnMob(16961950):updateClaim(player); -- Spawn NM, Despawn after inactive for 5 minutes (pt has to reclaim within 5 of a wipe)
player:delKeyItem(FAT_LINED_COCKATRICE_SKIN);
player:delKeyItem(SODDEN_SANDWORM_HUSK);
player:delKeyItem(LUXURIANT_MANTICORE_MANE);
player:delKeyItem(STICKY_GNAT_WING);
end
end; | gpl-3.0 |
destdev/ygopro-scripts | c40253382.lua | 9 | 1517 | --TG-SX1
function c40253382.initial_effect(c)
--Activate
local e1=Effect.CreateEffect(c)
e1:SetCategory(CATEGORY_SPECIAL_SUMMON)
e1:SetProperty(EFFECT_FLAG_CARD_TARGET)
e1:SetType(EFFECT_TYPE_ACTIVATE)
e1:SetCode(EVENT_BATTLE_DESTROYED)
e1:SetCondition(c40253382.condition)
e1:SetTarget(c40253382.target)
e1:SetOperation(c40253382.activate)
c:RegisterEffect(e1)
end
function c40253382.cfilter(c,tp)
local rc=c:GetReasonCard()
return c:IsLocation(LOCATION_GRAVE) and c:IsReason(REASON_BATTLE)
and rc:IsSetCard(0x27) and rc:IsControler(tp) and rc:IsRelateToBattle()
end
function c40253382.condition(e,tp,eg,ep,ev,re,r,rp)
return eg:IsExists(c40253382.cfilter,1,nil,tp)
end
function c40253382.filter(c,e,tp)
return c:IsSetCard(0x27) and c:IsType(TYPE_SYNCHRO) and c:IsCanBeSpecialSummoned(e,0,tp,false,false)
end
function c40253382.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
if chkc then return chkc:IsLocation(LOCATION_GRAVE) and chkc:IsControler(tp) and c40253382.filter(chkc,e,tp) end
if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0
and Duel.IsExistingTarget(c40253382.filter,tp,LOCATION_GRAVE,0,1,nil,e,tp) end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON)
local g=Duel.SelectTarget(tp,c40253382.filter,tp,LOCATION_GRAVE,0,1,1,nil,e,tp)
Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,g,1,0,0)
end
function c40253382.activate(e,tp,eg,ep,ev,re,r,rp)
local tc=Duel.GetFirstTarget()
if tc:IsRelateToEffect(e) then
Duel.SpecialSummon(tc,0,tp,tp,false,false,POS_FACEUP)
end
end
| gpl-2.0 |
Lleafll/ldots | Libs/AceGUI-3.0/widgets/AceGUIWidget-Keybinding.lua | 38 | 6512 | --[[-----------------------------------------------------------------------------
Keybinding Widget
Set Keybindings in the Config UI.
-------------------------------------------------------------------------------]]
local Type, Version = "Keybinding", 24
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 IsShiftKeyDown, IsControlKeyDown, IsAltKeyDown = IsShiftKeyDown, IsControlKeyDown, IsAltKeyDown
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: NOT_BOUND
local wowMoP
do
local _, _, _, interface = GetBuildInfo()
wowMoP = (interface >= 50000)
end
--[[-----------------------------------------------------------------------------
Scripts
-------------------------------------------------------------------------------]]
local function Control_OnEnter(frame)
frame.obj:Fire("OnEnter")
end
local function Control_OnLeave(frame)
frame.obj:Fire("OnLeave")
end
local function Keybinding_OnClick(frame, button)
if button == "LeftButton" or button == "RightButton" then
local self = frame.obj
if self.waitingForKey then
frame:EnableKeyboard(false)
self.msgframe:Hide()
frame:UnlockHighlight()
self.waitingForKey = nil
else
frame:EnableKeyboard(true)
self.msgframe:Show()
frame:LockHighlight()
self.waitingForKey = true
end
end
AceGUI:ClearFocus()
end
local ignoreKeys = {
["BUTTON1"] = true, ["BUTTON2"] = true,
["UNKNOWN"] = true,
["LSHIFT"] = true, ["LCTRL"] = true, ["LALT"] = true,
["RSHIFT"] = true, ["RCTRL"] = true, ["RALT"] = true,
}
local function Keybinding_OnKeyDown(frame, key)
local self = frame.obj
if self.waitingForKey then
local keyPressed = key
if keyPressed == "ESCAPE" then
keyPressed = ""
else
if ignoreKeys[keyPressed] then return end
if IsShiftKeyDown() then
keyPressed = "SHIFT-"..keyPressed
end
if IsControlKeyDown() then
keyPressed = "CTRL-"..keyPressed
end
if IsAltKeyDown() then
keyPressed = "ALT-"..keyPressed
end
end
frame:EnableKeyboard(false)
self.msgframe:Hide()
frame:UnlockHighlight()
self.waitingForKey = nil
if not self.disabled then
self:SetKey(keyPressed)
self:Fire("OnKeyChanged", keyPressed)
end
end
end
local function Keybinding_OnMouseDown(frame, button)
if button == "LeftButton" or button == "RightButton" then
return
elseif button == "MiddleButton" then
button = "BUTTON3"
elseif button == "Button4" then
button = "BUTTON4"
elseif button == "Button5" then
button = "BUTTON5"
end
Keybinding_OnKeyDown(frame, button)
end
--[[-----------------------------------------------------------------------------
Methods
-------------------------------------------------------------------------------]]
local methods = {
["OnAcquire"] = function(self)
self:SetWidth(200)
self:SetLabel("")
self:SetKey("")
self.waitingForKey = nil
self.msgframe:Hide()
self:SetDisabled(false)
self.button:EnableKeyboard(false)
end,
-- ["OnRelease"] = nil,
["SetDisabled"] = function(self, disabled)
self.disabled = disabled
if disabled then
self.button:Disable()
self.label:SetTextColor(0.5,0.5,0.5)
else
self.button:Enable()
self.label:SetTextColor(1,1,1)
end
end,
["SetKey"] = function(self, key)
if (key or "") == "" then
self.button:SetText(NOT_BOUND)
self.button:SetNormalFontObject("GameFontNormal")
else
self.button:SetText(key)
self.button:SetNormalFontObject("GameFontHighlight")
end
end,
["GetKey"] = function(self)
local key = self.button:GetText()
if key == NOT_BOUND then
key = nil
end
return key
end,
["SetLabel"] = function(self, label)
self.label:SetText(label or "")
if (label or "") == "" then
self.alignoffset = nil
self:SetHeight(24)
else
self.alignoffset = 30
self:SetHeight(44)
end
end,
}
--[[-----------------------------------------------------------------------------
Constructor
-------------------------------------------------------------------------------]]
local ControlBackdrop = {
bgFile = "Interface\\Tooltips\\UI-Tooltip-Background",
edgeFile = "Interface\\Tooltips\\UI-Tooltip-Border",
tile = true, tileSize = 16, edgeSize = 16,
insets = { left = 3, right = 3, top = 3, bottom = 3 }
}
local function keybindingMsgFixWidth(frame)
frame:SetWidth(frame.msg:GetWidth() + 10)
frame:SetScript("OnUpdate", nil)
end
local function Constructor()
local name = "AceGUI30KeybindingButton" .. AceGUI:GetNextWidgetNum(Type)
local frame = CreateFrame("Frame", nil, UIParent)
local button = CreateFrame("Button", name, frame, wowMoP and "UIPanelButtonTemplate" or "UIPanelButtonTemplate2")
button:EnableMouse(true)
button:RegisterForClicks("AnyDown")
button:SetScript("OnEnter", Control_OnEnter)
button:SetScript("OnLeave", Control_OnLeave)
button:SetScript("OnClick", Keybinding_OnClick)
button:SetScript("OnKeyDown", Keybinding_OnKeyDown)
button:SetScript("OnMouseDown", Keybinding_OnMouseDown)
button:SetPoint("BOTTOMLEFT")
button:SetPoint("BOTTOMRIGHT")
button:SetHeight(24)
button:EnableKeyboard(false)
local text = button:GetFontString()
text:SetPoint("LEFT", 7, 0)
text:SetPoint("RIGHT", -7, 0)
local label = frame:CreateFontString(nil, "OVERLAY", "GameFontHighlight")
label:SetPoint("TOPLEFT")
label:SetPoint("TOPRIGHT")
label:SetJustifyH("CENTER")
label:SetHeight(18)
local msgframe = CreateFrame("Frame", nil, UIParent)
msgframe:SetHeight(30)
msgframe:SetBackdrop(ControlBackdrop)
msgframe:SetBackdropColor(0,0,0)
msgframe:SetFrameStrata("FULLSCREEN_DIALOG")
msgframe:SetFrameLevel(1000)
msgframe:SetToplevel(true)
local msg = msgframe:CreateFontString(nil, "OVERLAY", "GameFontNormal")
msg:SetText("Press a key to bind, ESC to clear the binding or click the button again to cancel.")
msgframe.msg = msg
msg:SetPoint("TOPLEFT", 5, -5)
msgframe:SetScript("OnUpdate", keybindingMsgFixWidth)
msgframe:SetPoint("BOTTOM", button, "TOP")
msgframe:Hide()
local widget = {
button = button,
label = label,
msgframe = msgframe,
frame = frame,
alignoffset = 30,
type = Type
}
for method, func in pairs(methods) do
widget[method] = func
end
button.obj = widget
return AceGUI:RegisterAsWidget(widget)
end
AceGUI:RegisterWidgetType(Type, Constructor, Version)
| mit |
RwNigma/darkstar | scripts/zones/Port_Windurst/npcs/Pherchabalet.lua | 38 | 1039 | -----------------------------------
-- Area: Port Windurst
-- NPC: Pherchabalet
-- Type: Standard NPC
-- @zone: 240
-- @pos 34.683 -5.999 137.447
--
-- Auto-Script: Requires Verification (Verfied by Brawndo)
-----------------------------------
package.loaded["scripts/zones/Port_Windurst/TextIDs"] = nil;
-----------------------------------
-----------------------------------
-- onTrade Action
-----------------------------------
function onTrade(player,npc,trade)
end;
-----------------------------------
-- onTrigger Action
-----------------------------------
function onTrigger(player,npc)
player:startEvent(0x0229);
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 |
Deadwing888/darkstar | scripts/zones/Selbina/npcs/Tilala.lua | 13 | 1151 | -----------------------------------
-- Area: Selbina
-- NPC: Tilala
-- Guild Merchant NPC: Clothcrafting Guild
-- @pos 14.344 -7.912 10.276 248
-----------------------------------
package.loaded["scripts/zones/Selbina/TextIDs"] = nil;
-----------------------------------
require("scripts/globals/settings");
require("scripts/globals/shop");
require("scripts/zones/Selbina/TextIDs");
-----------------------------------
-- onTrade Action
-----------------------------------
function onTrade(player,npc,trade)
end;
-----------------------------------
-- onTrigger Action
-----------------------------------
function onTrigger(player,npc)
if (player:sendGuild(516,6,21,0)) then
player:showText(npc,CLOTHCRAFT_SHOP_DIALOG);
end
end;
-----------------------------------
-- onEventUpdate
-----------------------------------
function onEventUpdate(player,csid,option)
--printf("CSID: %u",csid);
--printf("RESULT: %u",option);
end;
-----------------------------------
-- onEventFinish
-----------------------------------
function onEventFinish(player,csid,option)
--printf("CSID: %u",csid);
--printf("RESULT: %u",option);
end;
| gpl-3.0 |
destdev/ygopro-scripts | c4896788.lua | 4 | 1310 | --強欲な壺の精霊
function c4896788.initial_effect(c)
--draw
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS)
e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE)
e1:SetCode(EVENT_CHAINING)
e1:SetRange(LOCATION_MZONE)
e1:SetOperation(aux.chainreg)
c:RegisterEffect(e1)
local e2=Effect.CreateEffect(c)
e2:SetCategory(CATEGORY_DRAW)
e2:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_O)
e2:SetCode(EVENT_CHAIN_SOLVING)
e2:SetProperty(EFFECT_FLAG_DELAY)
e2:SetRange(LOCATION_MZONE)
e2:SetCondition(c4896788.drcon)
e2:SetTarget(c4896788.drtg)
e2:SetOperation(c4896788.drop)
c:RegisterEffect(e2)
end
function c4896788.drcon(e,tp,eg,ep,ev,re,r,rp)
return e:GetHandler():IsAttackPos() and e:GetHandler():GetFlagEffect(1)>0
and re:IsHasType(EFFECT_TYPE_ACTIVATE) and re:GetHandler():IsCode(55144522)
end
function c4896788.drtg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.IsPlayerCanDraw(rp,1) end
Duel.SetTargetPlayer(rp)
Duel.SetTargetParam(1)
Duel.SetOperationInfo(0,CATEGORY_DRAW,nil,0,rp,1)
end
function c4896788.drop(e,tp,eg,ep,ev,re,r,rp)
if not e:GetHandler():IsAttackPos() or not e:GetHandler():IsRelateToEffect(e) then return end
local p,d=Duel.GetChainInfo(0,CHAININFO_TARGET_PLAYER,CHAININFO_TARGET_PARAM)
Duel.Draw(p,d,REASON_EFFECT)
end
| gpl-2.0 |
Deadwing888/darkstar | scripts/globals/weaponskills/iron_tempest.lua | 11 | 1350 | -----------------------------------
-- Iron Tempest
-- Great Axe weapon skill
-- Skill Level: 40
-- Delivers a single-hit attack. Damage varies with TP.
-- Will stack with Sneak Attack.
-- Aligned with the Soil Gorget.
-- Aligned with the Soil Belt.
-- Element: None
-- Modifiers: STR:30%
-- 100%TP 200%TP 300%TP
-- 1.00 1.00 1.00
-----------------------------------
require("scripts/globals/status");
require("scripts/globals/settings");
require("scripts/globals/weaponskills");
-----------------------------------
function onUseWeaponSkill(player, target, wsID, tp, primary)
local params = {};
params.numHits = 1;
params.ftp100 = 1; params.ftp200 = 1; params.ftp300 = 1;
params.str_wsc = 0.3; params.dex_wsc = 0.0; params.vit_wsc = 0.0; params.agi_wsc = 0.0; params.int_wsc = 0.0; params.mnd_wsc = 0.0; params.chr_wsc = 0.0;
params.crit100 = 0.0; params.crit200 = 0.0; params.crit300 = 0.0;
params.canCrit = false;
params.acc100 = 0.0; params.acc200= 0.0; params.acc300= 0.0;
params.atkmulti = 1;
if (USE_ADOULIN_WEAPON_SKILL_CHANGES == true) then
params.str_wsc = 0.6;
params.atkmulti = 1.25;
end
local damage, criticalHit, tpHits, extraHits = doPhysicalWeaponskill(player, target, wsID, params, tp, primary);
return tpHits, extraHits, criticalHit, damage;
end
| gpl-3.0 |
RwNigma/darkstar | scripts/zones/RaKaznar_Turris/Zone.lua | 29 | 1324 | -----------------------------------
--
-- Zone: Ra’Kanzar Turris (277)
--
-----------------------------------
package.loaded["scripts/zones/RaKaznar_Turris/TextIDs"] = nil;
-----------------------------------
require("scripts/globals/settings");
require("scripts/zones/RaKaznar_Turris/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(58,30,20,0);
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 |
RwNigma/darkstar | scripts/zones/Waughroon_Shrine/bcnms/shattering_stars.lua | 19 | 1935 | -----------------------------------
-- Area: Waughroon Shrine
-- Name: Shattering stars - Maat Fight
-- @pos -345 104 -260 144
-----------------------------------
package.loaded["scripts/zones/Waughroon_Shrine/TextIDs"] = nil;
-----------------------------------
require("scripts/zones/Waughroon_Shrine/TextIDs");
-----------------------------------
-- After registering the BCNM via bcnmRegister(bcnmid)
function onBcnmRegister(player,instance)
end;
-- Physically entering the BCNM via bcnmEnter(bcnmid)
function onBcnmEnter(player,instance)
-- player:messageSpecial(107);
end;
-- Leaving the BCNM by every mean possible, given by the LeaveCode
-- 1=Select Exit on circle
-- 2=Winning the BC
-- 3=Disconnected or warped out
-- 4=Losing the BC
-- via bcnmLeave(1) or bcnmLeave(2). LeaveCodes 3 and 4 are called
-- from the core when a player disconnects or the time limit is up, etc
function onBcnmLeave(player,instance,leavecode)
-- print("leave code "..leavecode);
if (leavecode == 2) then -- play end CS. Need time and battle id for record keeping + storage
player:startEvent(0x7d01,1,1,1,instance:getTimeInside(),1,1,0);
elseif (leavecode == 4) then
player:startEvent(0x7d02);
end
end;
function onEventUpdate(player,csid,option)
-- print("bc update csid "..csid.." and option "..option);
end;
function onEventFinish(player,csid,option)
-- print("bc finish csid "..csid.." and option "..option);
if (csid == 0x7d01) then
if (player:getQuestStatus(JEUNO,SHATTERING_STARS) == QUEST_ACCEPTED and player:getFreeSlotsCount() > 0) then
player:addItem(4181);
player:messageSpecial(ITEM_OBTAINED,4181);
end
local pjob = player:getMainJob();
player:setVar("maatDefeated",pjob);
local maatsCap = player:getVar("maatsCap")
if (bit.band(maatsCap, bit.lshift(1, (pjob -1))) ~= 1) then
player:setVar("maatsCap",bit.bor(maatsCap, bit.lshift(1, (pjob -1))))
end
player:addTitle(MAAT_MASHER);
end
end;
| gpl-3.0 |
authbox-lib/thrift | lib/lua/TMemoryBuffer.lua | 100 | 2266 | --
-- Licensed to the Apache Software Foundation (ASF) under one
-- or more contributor license agreements. See the NOTICE file
-- distributed with this work for additional information
-- regarding copyright ownership. The ASF licenses this file
-- to you under the Apache License, Version 2.0 (the
-- "License"); you may not use this file except in compliance
-- with the License. You may obtain a copy of the License at
--
-- http://www.apache.org/licenses/LICENSE-2.0
--
-- Unless required by applicable law or agreed to in writing,
-- software distributed under the License is distributed on an
-- "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-- KIND, either express or implied. See the License for the
-- specific language governing permissions and limitations
-- under the License.
--
require 'TTransport'
TMemoryBuffer = TTransportBase:new{
__type = 'TMemoryBuffer',
buffer = '',
bufferSize = 1024,
wPos = 0,
rPos = 0
}
function TMemoryBuffer:isOpen()
return 1
end
function TMemoryBuffer:open() end
function TMemoryBuffer:close() end
function TMemoryBuffer:peak()
return self.rPos < self.wPos
end
function TMemoryBuffer:getBuffer()
return self.buffer
end
function TMemoryBuffer:resetBuffer(buf)
if buf then
self.buffer = buf
self.bufferSize = string.len(buf)
else
self.buffer = ''
self.bufferSize = 1024
end
self.wPos = string.len(buf)
self.rPos = 0
end
function TMemoryBuffer:available()
return self.wPos - self.rPos
end
function TMemoryBuffer:read(len)
local avail = self:available()
if avail == 0 then
return ''
end
if avail < len then
len = avail
end
local val = string.sub(self.buffer, self.rPos + 1, self.rPos + len)
self.rPos = self.rPos + len
return val
end
function TMemoryBuffer:readAll(len)
local avail = self:available()
if avail < len then
local msg = string.format('Attempt to readAll(%d) found only %d available',
len, avail)
terror(TTransportException:new{message = msg})
end
-- read should block so we don't need a loop here
return self:read(len)
end
function TMemoryBuffer:write(buf)
self.buffer = self.buffer .. buf
self.wPos = self.wPos + string.len(buf)
end
function TMemoryBuffer:flush() end
| apache-2.0 |
destdev/ygopro-scripts | c99157310.lua | 1 | 3693 | --ティンダングル・ドロネー
function c99157310.initial_effect(c)
--Activate
local e1=Effect.CreateEffect(c)
e1:SetCategory(CATEGORY_DESTROY+CATEGORY_SPECIAL_SUMMON)
e1:SetType(EFFECT_TYPE_ACTIVATE)
e1:SetCode(EVENT_BATTLE_DAMAGE)
e1:SetCondition(c99157310.condition)
e1:SetTarget(c99157310.target)
e1:SetOperation(c99157310.activate)
c:RegisterEffect(e1)
--special summon
local e2=Effect.CreateEffect(c)
e2:SetDescription(aux.Stringid(99157310,0))
e2:SetCategory(CATEGORY_SPECIAL_SUMMON)
e2:SetType(EFFECT_TYPE_QUICK_O)
e2:SetProperty(EFFECT_FLAG_CARD_TARGET)
e2:SetCode(EVENT_FREE_CHAIN)
e2:SetRange(LOCATION_GRAVE)
e2:SetHintTiming(0,TIMING_END_PHASE)
e2:SetCondition(c99157310.spcon)
e2:SetCost(aux.bfgcost)
e2:SetTarget(c99157310.sptg)
e2:SetOperation(c99157310.spop)
c:RegisterEffect(e2)
end
function c99157310.cfilter1(c)
return c:IsSetCard(0x10b) and c:IsType(TYPE_MONSTER)
end
function c99157310.condition(e,tp,eg,ep,ev,re,r,rp)
return ep==tp and Duel.GetAttacker():IsControler(1-tp)
and Duel.IsExistingMatchingCard(c99157310.cfilter1,tp,LOCATION_GRAVE,0,3,nil)
end
function c99157310.filter(c,e,tp)
return c:IsCode(75119040) and c:IsCanBeSpecialSummoned(e,0,tp,false,false)
end
function c99157310.target(e,tp,eg,ep,ev,re,r,rp,chk)
local tg=Duel.GetAttacker()
if chk==0 then return tg:IsOnField()
and Duel.GetLocationCountFromEx(tp)>0
and Duel.IsExistingMatchingCard(c99157310.filter,tp,LOCATION_EXTRA,0,1,nil,e,tp) end
Duel.SetTargetCard(tg)
Duel.SetOperationInfo(0,CATEGORY_DESTROY,tg,1,0,0)
Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_EXTRA)
end
function c99157310.activate(e,tp,eg,ep,ev,re,r,rp)
local tc=Duel.GetFirstTarget()
if tc:IsRelateToEffect(e) and tc:IsRelateToBattle() and Duel.Destroy(tc,REASON_EFFECT)~=0 then
if Duel.GetLocationCountFromEx(tp)<=0 then return end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON)
local g=Duel.SelectMatchingCard(tp,c99157310.filter,tp,LOCATION_EXTRA,0,1,1,nil,e,tp)
if g:GetCount()>0 then
Duel.SpecialSummon(g,0,tp,tp,false,false,POS_FACEUP)
end
end
end
function c99157310.cfilter2(c)
return c:GetSequence()>=5
end
function c99157310.spcon(e,tp,eg,ep,ev,re,r,rp)
return not Duel.IsExistingMatchingCard(c99157310.cfilter2,tp,LOCATION_MZONE,0,1,nil)
end
function c99157310.spfilter(c,e,tp)
return c:IsSetCard(0x10b) and c:IsCanBeEffectTarget(e) and c:IsCanBeSpecialSummoned(e,0,tp,false,false,POS_FACEDOWN_DEFENSE)
end
function c99157310.sptg(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
if chkc then return false end
local g=Duel.GetMatchingGroup(c99157310.spfilter,tp,LOCATION_GRAVE,0,nil,e,tp)
if chk==0 then return not Duel.IsPlayerAffectedByEffect(tp,59822133)
and Duel.GetLocationCount(tp,LOCATION_MZONE)>2
and g:GetClassCount(Card.GetCode)>2 end
local tg=Group.CreateGroup()
for i=1,3 do
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON)
local sg=g:Select(tp,1,1,nil)
tg:Merge(sg)
g:Remove(Card.IsCode,nil,sg:GetFirst():GetCode())
end
Duel.SetTargetCard(tg)
Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,tg,tg:GetCount(),0,0)
end
function c99157310.spop(e,tp,eg,ep,ev,re,r,rp)
local ft=Duel.GetLocationCount(tp,LOCATION_MZONE)
local g=Duel.GetChainInfo(0,CHAININFO_TARGET_CARDS):Filter(Card.IsRelateToEffect,nil,e)
if ft<=0 or g:GetCount()==0 or (g:GetCount()>1 and Duel.IsPlayerAffectedByEffect(tp,59822133)) then return end
if g:GetCount()<=ft then
Duel.SpecialSummon(g,0,tp,tp,false,false,POS_FACEDOWN_DEFENSE)
Duel.ConfirmCards(1-tp,g)
else
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON)
local sg=g:Select(tp,ft,ft,nil)
Duel.SpecialSummon(sg,0,tp,tp,false,false,POS_FACEDOWN_DEFENSE)
Duel.ConfirmCards(1-tp,sg)
end
end
| gpl-2.0 |
destdev/ygopro-scripts | c64681432.lua | 4 | 3084 | --破壊竜ガンドラ
function c64681432.initial_effect(c)
--cannot special summon
local e1=Effect.CreateEffect(c)
e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE+EFFECT_FLAG_UNCOPYABLE)
e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetCode(EFFECT_SPSUMMON_CONDITION)
c:RegisterEffect(e1)
--summon,flip
local e2=Effect.CreateEffect(c)
e2:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_CONTINUOUS)
e2:SetProperty(EFFECT_FLAG_CANNOT_DISABLE)
e2:SetCode(EVENT_SUMMON_SUCCESS)
e2:SetOperation(c64681432.tgreg1)
c:RegisterEffect(e2)
local e3=e2:Clone()
e3:SetCode(EVENT_FLIP_SUMMON_SUCCESS)
e3:SetOperation(c64681432.tgreg2)
c:RegisterEffect(e3)
--destroy
local e4=Effect.CreateEffect(c)
e4:SetDescription(aux.Stringid(64681432,0))
e4:SetCategory(CATEGORY_DESTROY)
e4:SetType(EFFECT_TYPE_IGNITION)
e4:SetRange(LOCATION_MZONE)
e4:SetCost(c64681432.descost)
e4:SetTarget(c64681432.destg)
e4:SetOperation(c64681432.desop)
c:RegisterEffect(e4)
--to grave
local e5=Effect.CreateEffect(c)
e5:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_F)
e5:SetDescription(aux.Stringid(64681432,1))
e5:SetCategory(CATEGORY_TOGRAVE)
e5:SetCode(EVENT_PHASE+PHASE_END)
e5:SetRange(LOCATION_MZONE)
e5:SetCountLimit(1)
e5:SetCondition(c64681432.tgcon)
e5:SetTarget(c64681432.tgtg)
e5:SetOperation(c64681432.tgop)
c:RegisterEffect(e5)
end
function c64681432.descost(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return true end
Duel.PayLPCost(tp,math.floor(Duel.GetLP(tp)/2))
end
function c64681432.destg(e,tp,eg,ep,ev,re,r,rp,chk)
local c=e:GetHandler()
if chk==0 then return Duel.IsExistingMatchingCard(Card.IsAbleToRemove,tp,LOCATION_ONFIELD,LOCATION_ONFIELD,1,c) end
local sg=Duel.GetMatchingGroup(Card.IsAbleToRemove,tp,LOCATION_ONFIELD,LOCATION_ONFIELD,c)
Duel.SetOperationInfo(0,CATEGORY_DESTROY,sg,sg:GetCount(),0,0)
end
function c64681432.desop(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
local sg=Duel.GetMatchingGroup(nil,tp,LOCATION_ONFIELD,LOCATION_ONFIELD,aux.ExceptThisCard(e))
local ct=Duel.Destroy(sg,REASON_EFFECT,LOCATION_REMOVED)
if ct>0 and c:IsFaceup() and c:IsRelateToEffect(e) then
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetCode(EFFECT_UPDATE_ATTACK)
e1:SetProperty(EFFECT_FLAG_COPY_INHERIT)
e1:SetValue(ct*300)
e1:SetReset(RESET_EVENT+RESETS_STANDARD+RESET_DISABLE)
c:RegisterEffect(e1)
end
end
function c64681432.tgreg1(e,tp,eg,ep,ev,re,r,rp)
e:GetHandler():RegisterFlagEffect(64681432,RESET_EVENT+0x1ec0000+RESET_PHASE+PHASE_END,0,1)
end
function c64681432.tgreg2(e,tp,eg,ep,ev,re,r,rp)
e:GetHandler():RegisterFlagEffect(64681432,RESET_EVENT+RESETS_STANDARD-RESET_TURN_SET+RESET_PHASE+PHASE_END,0,1)
end
function c64681432.tgcon(e,tp,eg,ep,ev,re,r,rp)
return e:GetHandler():GetFlagEffect(64681432)~=0
end
function c64681432.tgtg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return true end
Duel.SetOperationInfo(0,CATEGORY_TOGRAVE,e:GetHandler(),1,0,0)
end
function c64681432.tgop(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
if c:IsRelateToEffect(e) and c:IsFaceup() then
Duel.SendtoGrave(c,REASON_EFFECT)
end
end
| gpl-2.0 |
ffxijuggalo/darkstar | scripts/zones/Caedarva_Mire/mobs/Experimental_Lamia.lua | 9 | 1334 | -----------------------------------
-- Area: Caedarva Mire (79)
-- ZNM: Experimental Lamia
-- !pos -773.369 -11.824 322.298 79
-----------------------------------
local ID = require("scripts/zones/Caedarva_Mire/IDs")
require("scripts/globals/status")
-----------------------------------
local function spawnMinions(mob, target)
mob:setLocalVar("spawnedMinions", 1)
local x = mob:getXPos()
local y = mob:getYPos()
local z = mob:getZPos()
for i = ID.mob.EXPERIMENTAL_LAMIA + 1, ID.mob.EXPERIMENTAL_LAMIA + 3 do
local minion = GetMobByID(i)
minion:setSpawn(x + math.random(-2, 2), y, z + math.random(-2, 2))
minion:spawn()
minion:updateEnmity(target)
end
end
function onMobFight(mob, target)
if mob:getHPP() < 75 and mob:getLocalVar("spawnedMinions") == 0 then
spawnMinions(mob, target)
end
-- make sure minions have a target
for i = ID.mob.EXPERIMENTAL_LAMIA + 1, ID.mob.EXPERIMENTAL_LAMIA + 3 do
local minion = GetMobByID(i)
if minion:getCurrentAction() == dsp.act.ROAMING then
minion:updateEnmity(target)
end
end
end
function onMobWeaponSkill(target, mob, skill)
if mob:getLocalVar("spawnedMinions") == 0 then
spawnMinions(mob, target)
end
end
function onMobDeath(mob, player, isKiller)
end | gpl-3.0 |
RwNigma/darkstar | scripts/zones/Lower_Jeuno/npcs/Amalasanda.lua | 19 | 1284 | -----------------------------------
-- Area: Lower Jeuno
-- NPC: Amalasanda
-- Type: Tenshodo Merchant
-- @pos 28.149 2.899 -44.780 245
-----------------------------------
package.loaded["scripts/zones/Lower_Jeuno/TextIDs"] = nil;
-----------------------------------
require("scripts/globals/settings");
require("scripts/globals/shop");
require("scripts/globals/keyitems");
require("scripts/zones/Lower_Jeuno/TextIDs");
-----------------------------------
-- onTrade Action
-----------------------------------
function onTrade(player,npc,trade)
end;
-----------------------------------
-- onTrigger Action
-----------------------------------
function onTrigger(player,npc)
if (player:hasKeyItem(TENSHODO_MEMBERS_CARD)) then
if (player:sendGuild(60416,1,23,1)) then
player:showText(npc, AMALASANDA_SHOP_DIALOG);
end
else
-- player:startEvent(0x0096);
end
end;
-----------------------------------
-- onEventUpdate
-----------------------------------
function onEventUpdate(player,csid,option)
-- printf("CSID: %u",csid);
-- printf("RESULT: %u",option);
end;
-----------------------------------
-- onEventFinish
-----------------------------------
function onEventFinish(player,csid,option)
-- printf("CSID: %u",csid);
-- printf("RESULT: %u",option);
end;
| gpl-3.0 |
RwNigma/darkstar | scripts/globals/mobskills/Pile_Pitch.lua | 17 | 1246 | ---------------------------------------------------
-- Guided_Missile
--
-- Description: Reduces target's HP to 5% of its maximum value, ignores Utsusemi ,Bind (30 sec)
-- Type: Magical
--
---------------------------------------------------
require("scripts/globals/settings");
require("scripts/globals/status");
require("scripts/globals/monstertpmoves");
---------------------------------------------------
function onMobSkillCheck(target,mob,skill)
local mobID = mob:getID(); --(16908294 ,16908301 ,16908308 =omega ,16933124=proto-omega)
local mobhp = mob:getHPP();
if ((mobID == 16908294 or mobID ==16908301 or mobID ==16908308)and mobhp < 26 ) then --omega
return 0;
elseif (mobID == 16933124 and mobhp > 70 ) then -- omega first bipedform
return 0;
end
return 1;
end;
function onMobWeaponSkill(target, mob, skill)
local targetcurrentHP = target:getHP();
local targetmaxHP = target:getMaxHP();
local hpset=targetmaxHP*0.05;
local typeEffect = EFFECT_BIND;
MobStatusEffectMove(mob, target, typeEffect, 1, 0, 30);
if (targetcurrentHP > hpset) then
dmg= targetcurrentHP - hpset;
else
dmg=0;
end
target:delHP(dmg);
return dmg;
end
| gpl-3.0 |
destdev/ygopro-scripts | c63789924.lua | 7 | 2250 | --盗人の煙玉
function c63789924.initial_effect(c)
--Activate
local e1=Effect.CreateEffect(c)
e1:SetCategory(CATEGORY_EQUIP)
e1:SetType(EFFECT_TYPE_ACTIVATE)
e1:SetCode(EVENT_FREE_CHAIN)
e1:SetProperty(EFFECT_FLAG_CARD_TARGET)
e1:SetTarget(c63789924.target)
e1:SetOperation(c63789924.operation)
c:RegisterEffect(e1)
--Equip limit
local e2=Effect.CreateEffect(c)
e2:SetType(EFFECT_TYPE_SINGLE)
e2:SetCode(EFFECT_EQUIP_LIMIT)
e2:SetProperty(EFFECT_FLAG_CANNOT_DISABLE)
e2:SetValue(1)
c:RegisterEffect(e2)
--Check & Discard
local e3=Effect.CreateEffect(c)
e3:SetDescription(aux.Stringid(63789924,0))
e3:SetCategory(CATEGORY_HANDES)
e3:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_F)
e3:SetProperty(EFFECT_FLAG_PLAYER_TARGET)
e3:SetCode(EVENT_LEAVE_FIELD)
e3:SetCondition(c63789924.discon)
e3:SetTarget(c63789924.distg)
e3:SetOperation(c63789924.disop)
c:RegisterEffect(e3)
end
function c63789924.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
if chkc then return chkc:IsLocation(LOCATION_MZONE) and chkc:IsFaceup() end
if chk==0 then return Duel.IsExistingTarget(Card.IsFaceup,tp,LOCATION_MZONE,LOCATION_MZONE,1,nil) end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_EQUIP)
Duel.SelectTarget(tp,Card.IsFaceup,tp,LOCATION_MZONE,LOCATION_MZONE,1,1,nil)
Duel.SetOperationInfo(0,CATEGORY_EQUIP,e:GetHandler(),1,0,0)
end
function c63789924.operation(e,tp,eg,ep,ev,re,r,rp)
local tc=Duel.GetFirstTarget()
if e:GetHandler():IsRelateToEffect(e) and tc:IsRelateToEffect(e) and tc:IsFaceup() then
Duel.Equip(tp,e:GetHandler(),tc)
end
end
function c63789924.discon(e,tp,eg,ep,ev,re,r,rp)
return bit.band(r,0x41)==0x41 and e:GetHandler():GetEquipTarget()~=nil and e:GetHandler():IsLocation(LOCATION_GRAVE)
end
function c63789924.distg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return true end
Duel.SetTargetPlayer(tp)
Duel.SetOperationInfo(0,CATEGORY_HANDES,nil,0,1-tp,1)
end
function c63789924.disop(e,tp,eg,ep,ev,re,r,rp)
local p=Duel.GetChainInfo(0,CHAININFO_TARGET_PLAYER)
local g=Duel.GetFieldGroup(p,0,LOCATION_HAND)
if g:GetCount()>0 then
Duel.ConfirmCards(p,g)
Duel.Hint(HINT_SELECTMSG,p,HINTMSG_DISCARD)
local sg=g:Select(p,1,1,nil)
Duel.SendtoGrave(sg,REASON_EFFECT+REASON_DISCARD)
Duel.ShuffleHand(1-p)
end
end
| gpl-2.0 |
Deadwing888/darkstar | scripts/globals/weaponskills/evisceration.lua | 9 | 1547 | -----------------------------------
-- Evisceration
-- Dagger weapon skill
-- Skill level: 230
-- In order to obtain Evisceration, the quest Cloak and Dagger must be completed.
-- Delivers a fivefold attack. Chance of params.critical hit varies with TP.
-- Will stack with Sneak Attack.
-- Aligned with the Shadow Gorget, Soil Gorget & Light Gorget.
-- Aligned with the Shadow Belt, Soil Belt & Light Belt.
-- Element: None
-- Modifiers: DEX:30%
-- 100%TP 200%TP 300%TP
-- 1.00 1.00 1.00
-----------------------------------
require("scripts/globals/status");
require("scripts/globals/settings");
require("scripts/globals/weaponskills");
-----------------------------------
function onUseWeaponSkill(player, target, wsID, tp, primary)
local params = {};
params.numHits = 5;
params.ftp100 = 1; params.ftp200 = 1; params.ftp300 = 1;
params.str_wsc = 0.0; params.dex_wsc = 0.3; params.vit_wsc = 0.0; params.agi_wsc = 0.0; params.int_wsc = 0.0; params.mnd_wsc = 0.0; params.chr_wsc = 0.0;
params.crit100 = 0.1; params.crit200 = 0.3; params.crit300 = 0.5;
params.canCrit = true;
params.acc100 = 0.0; params.acc200= 0.0; params.acc300= 0.0;
params.atkmulti = 1;
if (USE_ADOULIN_WEAPON_SKILL_CHANGES == true) then
params.ftp100 = 1.25; params.ftp200 = 1.25; params.ftp300 = 1.25;
params.dex_wsc = 0.5;
end
local damage, criticalHit, tpHits, extraHits = doPhysicalWeaponskill(player, target, wsID, params, tp, primary);
return tpHits, extraHits, criticalHit, damage;
end
| gpl-3.0 |
RwNigma/darkstar | scripts/zones/Temenos/mobs/Enhanced_Ahriman.lua | 16 | 1291 | -----------------------------------
-- Area: Temenos Central 1floor
-- NPC: Enhanced_Ahriman
-----------------------------------
package.loaded["scripts/zones/Temenos/TextIDs"] = nil;
-----------------------------------
require("scripts/globals/limbus");
require("scripts/zones/Temenos/TextIDs");
-----------------------------------
-- onMobSpawn Action
-----------------------------------
function onMobSpawn(mob)
end;
-----------------------------------
-- onMobEngaged
-----------------------------------
function onMobEngaged(mob,target)
if (IsMobDead(16929050)==true) then
mob:addStatusEffect(EFFECT_REGAIN,7,3,0);
mob:addStatusEffect(EFFECT_REGEN,50,3,0);
end
end;
-----------------------------------
-- onMobDeath
-----------------------------------
function onMobDeath(mob,killer)
local mobX = mob:getXPos();
local mobY = mob:getYPos();
local mobZ = mob:getZPos();
if (IsMobDead(16929046)==true and IsMobDead(16929047)==true and IsMobDead(16929048)==true and IsMobDead(16929049)==true and IsMobDead(16929050)==true and IsMobDead(16929051)==true) then
GetNPCByID(16928768+71):setPos(mobX,mobY,mobZ);
GetNPCByID(16928768+71):setStatus(STATUS_NORMAL);
GetNPCByID(16928770+471):setStatus(STATUS_NORMAL);
end
end;
| gpl-3.0 |
ffxijuggalo/darkstar | scripts/zones/QuBia_Arena/bcnms/brothers_d_aurphe.lua | 9 | 1064 | -----------------------------------
-- Brothers D'Aurphe
-- Qu'Bia Arena BCNM60, Moon Orb
-- !additem 1130
-----------------------------------
require("scripts/globals/battlefield")
-----------------------------------
function onBattlefieldInitialise(battlefield)
battlefield:setLocalVar("loot", 1)
end
function onBattlefieldTick(battlefield, tick)
dsp.battlefield.onBattlefieldTick(battlefield, tick)
end
function onBattlefieldRegister(player, battlefield)
end
function onBattlefieldEnter(player, battlefield)
end
function onBattlefieldLeave(player, battlefield, leavecode)
if leavecode == dsp.battlefield.leaveCode.WON then
local name, clearTime, partySize = battlefield:getRecord()
player:startEvent(32001, battlefield:getArea(), clearTime, partySize, battlefield:getTimeInside(), 1, battlefield:getLocalVar("[cs]bit"), 0)
elseif leavecode == dsp.battlefield.leaveCode.LOST then
player:startEvent(32002)
end
end
function onEventUpdate(player, csid, option)
end
function onEventFinish(player, csid, option)
end
| gpl-3.0 |
Deadwing888/darkstar | scripts/globals/effects/sigil.lua | 32 | 3008 | -----------------------------------
--
-- EFFECT_SIGIL
--
-----------------------------------
-----------------------------------
-- onEffectGain Action
-----------------------------------
function onEffectGain(target,effect)
local power = effect:getPower(); -- Tracks which bonus effects are in use.
local subPower = effect:getSubPower(); -- subPower sets % required to trigger regen/refresh.
if (power == 1 or power == 3 or power == 5 or power == 7 or power == 9 or power == 11 or power == 13 or power == 15) then
-- target:addLatent(LATENT_SIGIL_REGEN, subPower+10, MOD_REGEN, 1);
-- Not yet implemented
end
if (power == 2 or power == 3 or power == 6 or power == 7 or power == 10 or power == 11 or power >= 14) then
-- target:addLatent(LATENT_SIGIL_REFRESH, subPower, MOD_REFRESH, 1);
-- Not yet implemented
end
if (power >= 4 and power <= 7) then
-- target:addMod(MOD_FOOD_DURATION), ???);
-- food duration not implemented.
elseif (power >= 8 and power <= 11) then
-- target:addMod(MOD_EXPLOSS_REDUCTION), ???);
-- exp loss reduction not implemented.
elseif (power >= 12) then
-- Possibly handle exp loss reduction in core instead..Maybe the food bonus also?
-- target:addMod(MOD_FOOD_DURATION), ???);
-- food duration not implemented.
-- target:addLatent(LATENT_SIGIL_EXPLOSS, ?, MOD_EXPLOSS_REDUCTION, ?);
-- exp loss reduction not implemented.
end
end;
-----------------------------------
-- onEffectTick Action
-----------------------------------
function onEffectTick(target,effect)
end;
-----------------------------------
-- onEffectLose Action
-----------------------------------
function onEffectLose(target,effect)
local power = effect:getPower(); -- Tracks which bonus effects are in use.
local subPower = effect:getSubPower(); -- subPower sets % required to trigger regen/refresh.
if (power == 1 or power == 3 or power == 5 or power == 7 or power == 9 or power == 11 or power == 13 or power == 15) then
-- target:delLatent(LATENT_SIGIL_REGEN, subPower+10, MOD_REGEN, 1);
-- Not yet implemented
end
if (power == 2 or power == 3 or power == 6 or power == 7 or power == 10 or power == 11 or power >= 14) then
-- target:delLatent(LATENT_SIGIL_REFRESH, subPower, MOD_REFRESH, 1);
-- Not yet implemented
end
if (effect:getPower() >= 4 and effect:getPower() <= 7) then
-- target:delMod(MOD_FOOD_DURATION), ???);
-- food duration not implemented.
elseif (effect:getPower() >= 8 and effect:getPower() <= 11) then
-- target:delMod(MOD_EXPLOSS_REDUCTION), ???);
-- exp loss reduction not implemented.
elseif (effect:getPower() >= 12) then
-- target:delMod(MOD_FOOD_DURATION), ???);
-- food duration not implemented.
-- target:delMod(MOD_EXPLOSS_REDUCTION), ???);
-- exp loss reduction not implemented.
end
end;
| gpl-3.0 |
RwNigma/darkstar | scripts/zones/Windurst_Waters_[S]/npcs/Lutete.lua | 38 | 1110 | -----------------------------------
-- Area: Windurst Waters (S)
-- NPC: Lutete
-- Type: Standard NPC
-- @zone: 94
-- @pos 169.205 -0.879 -9.107
--
-- Auto-Script: Requires Verification (Verified by Brawndo)
-----------------------------------
package.loaded["scripts/zones/Windurst_Waters_[S]/TextIDs"] = nil;
-----------------------------------
require("scripts/zones/Windurst_Waters_[S]/TextIDs");
-----------------------------------
-- onTrade Action
-----------------------------------
function onTrade(player,npc,trade)
end;
-----------------------------------
-- onTrigger Action
-----------------------------------
function onTrigger(player,npc)
player:showText(npc, LUTETE_DIALOG);
end;
-----------------------------------
-- onEventUpdate
-----------------------------------
function onEventUpdate(player,csid,option)
-- printf("CSID: %u",csid);
-- printf("RESULT: %u",option);
end;
-----------------------------------
-- onEventFinish
-----------------------------------
function onEventFinish(player,csid,option)
-- printf("CSID: %u",csid);
-- printf("RESULT: %u",option);
end;
| gpl-3.0 |
RwNigma/darkstar | scripts/zones/Carpenters_Landing/npcs/Beugungel.lua | 19 | 1190 | -----------------------------------
-- Area: Carpenters' Landing
-- NPC: Beugungel
-- Type: Guild Merchant NPC (Woodworking Guild)
-- @pos -333.729, -5.512, 475.647 2
-----------------------------------
package.loaded["scripts/zones/Carpenters_Landing/TextIDs"] = nil;
-----------------------------------
require("scripts/globals/settings");
require("scripts/globals/shop");
require("scripts/zones/Carpenters_Landing/TextIDs");
-----------------------------------
-- onTrade Action
-----------------------------------
function onTrade(player,npc,trade)
end;
-----------------------------------
-- onTrigger Action
-----------------------------------
function onTrigger(player,npc)
if (player:sendGuild(534,5,22,0)) then
player:showText(npc,BEUGUNGEL_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 |
RwNigma/darkstar | scripts/globals/items/bowl_of_loach_gruel.lua | 36 | 1567 | -----------------------------------------
-- ID: 5670
-- Item: Bowl of Loach Gruel
-- Food Effect: 4 Hrs, All Races
-----------------------------------------
-- TODO: Make Group Effect
-- Dexterity 2
-- Agility 2
-- Accuracy 7% Cap 30
-- HP 7% Cap 30
-- Evasion 4
-----------------------------------------
require("scripts/globals/status");
-----------------------------------------
-- OnItemCheck
-----------------------------------------
function onItemCheck(target)
result = 0;
if (target:hasStatusEffect(EFFECT_FOOD) == true or target:hasStatusEffect(EFFECT_FIELD_SUPPORT_FOOD) == true) then
result = 246;
end
return result;
end;
-----------------------------------------
-- OnItemUse
-----------------------------------------
function onItemUse(target)
target:addStatusEffect(EFFECT_FOOD,0,0,14400,5670);
end;
-----------------------------------
-- onEffectGain Action
-----------------------------------
function onEffectGain(target,effect)
target:addMod(MOD_DEX, 2);
target:addMod(MOD_AGI, 2);
target:addMod(MOD_FOOD_ACCP, 7);
target:addMod(MOD_FOOD_ACC_CAP, 30);
target:addMod(MOD_FOOD_HPP, 7);
target:addMod(MOD_FOOD_HP_CAP, 30);
target:addMod(MOD_EVA, 4);
end;
-----------------------------------------
-- onEffectLose Action
-----------------------------------------
function onEffectLose(target,effect)
target:delMod(MOD_DEX, 2);
target:delMod(MOD_AGI, 2);
target:delMod(MOD_FOOD_ACCP, 7);
target:delMod(MOD_FOOD_ACC_CAP, 30);
target:delMod(MOD_FOOD_HPP, 7);
target:delMod(MOD_FOOD_HP_CAP, 30);
target:delMod(MOD_EVA, 4);
end;
| gpl-3.0 |
destdev/ygopro-scripts | c296499.lua | 2 | 1530 | --一族の掟
function c296499.initial_effect(c)
--Activate
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_ACTIVATE)
e1:SetCode(EVENT_FREE_CHAIN)
e1:SetTarget(c296499.target)
c:RegisterEffect(e1)
--cannot attack
local e2=Effect.CreateEffect(c)
e2:SetType(EFFECT_TYPE_FIELD)
e2:SetCode(EFFECT_CANNOT_ATTACK)
e2:SetRange(LOCATION_SZONE)
e2:SetTargetRange(LOCATION_MZONE,LOCATION_MZONE)
e2:SetTarget(c296499.atktarget)
c:RegisterEffect(e2)
e2:SetLabelObject(e1)
--maintain
local e3=Effect.CreateEffect(c)
e3:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS)
e3:SetProperty(EFFECT_FLAG_CANNOT_DISABLE+EFFECT_FLAG_UNCOPYABLE)
e3:SetCode(EVENT_PHASE+PHASE_STANDBY)
e3:SetRange(LOCATION_SZONE)
e3:SetCountLimit(1)
e3:SetCondition(c296499.mtcon)
e3:SetOperation(c296499.mtop)
c:RegisterEffect(e3)
end
function c296499.target(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return true end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_RACE)
local rc=Duel.AnnounceRace(tp,1,RACE_ALL)
e:SetLabel(rc)
e:GetHandler():SetHint(CHINT_RACE,rc)
end
function c296499.atktarget(e,c)
return c:GetRace()==e:GetLabelObject():GetLabel()
end
function c296499.mtcon(e,tp,eg,ep,ev,re,r,rp)
return Duel.GetTurnPlayer()==tp
end
function c296499.mtop(e,tp,eg,ep,ev,re,r,rp)
if Duel.CheckReleaseGroup(tp,Card.IsReleasable,1,nil) and Duel.SelectYesNo(tp,aux.Stringid(296499,0)) then
local g=Duel.SelectReleaseGroup(tp,Card.IsReleasable,1,1,nil)
Duel.Release(g,REASON_COST)
else
Duel.Destroy(e:GetHandler(),REASON_COST)
end
end
| gpl-2.0 |
RwNigma/darkstar | scripts/zones/West_Ronfaure/npcs/Laillera.lua | 17 | 1111 | -----------------------------------
-- Area: West Ronfaure
-- NPC: Laillera
-- @pos -127.297 -62.000 266.800 100
-----------------------------------
package.loaded["scripts/zones/West_Ronfaure/TextIDs"] = nil;
-----------------------------------
require("scripts/globals/settings");
require("scripts/zones/West_Ronfaure/TextIDs");
-----------------------------------
-- onTrade Action
-----------------------------------
function onTrade(player,npc,trade)
end;
-----------------------------------
-- onTrigger Action
-----------------------------------
function onTrigger(player,npc)
local thePickpocket = player:getQuestStatus(SANDORIA, THE_PICKPOCKET);
if (thePickpocket > 0) then
player:showText(npc, 7264);
else
player:showText(npc, LAILLERA_DIALOG);
end
end;
-----------------------------------
-- onEventUpdate
-----------------------------------
function onEventUpdate(player,csid,option)
end;
-----------------------------------
-- onEventFinish
-----------------------------------
function onEventFinish(player,csid,option)
end;
| gpl-3.0 |
nikai3d/naev | dat/ai/proteron.lua | 6 | 2651 | include("dat/ai/tpl/generic.lua")
include("dat/ai/personality/patrol.lua")
-- Settings
mem.armour_run = 40
mem.armour_return = 70
mem.aggressive = true
function create ()
-- Not too many credits.
ai.setcredits( rnd.rnd(ai.pilot():ship():price()/300, ai.pilot():ship():price()/70) )
-- Get refuel chance
p = player.pilot()
if p:exists() then
standing = ai.getstanding( p ) or -1
mem.refuel = rnd.rnd( 2000, 4000 )
if standing < 20 then
mem.refuel_no = "\"My fuel isn't for sale.\""
elseif standing < 70 then
if rnd.rnd() > 0.2 then
mem.refuel_no = "\"Sorry, my fuel isn't for sale.\""
end
else
mem.refuel = mem.refuel * 0.6
end
-- Most likely no chance to refuel
mem.refuel_msg = string.format( "\"I can transfer some fuel for %d credits.\"", mem.refuel )
end
-- See if can be bribed
if rnd.rnd() > 0.6 then
mem.bribe = math.sqrt( ai.pilot():stats().mass ) * (500. * rnd.rnd() + 1750.)
mem.bribe_prompt = string.format("\"House Proteron can always use some income. %d credits and you were never here.\"", mem.bribe )
mem.bribe_paid = "\"Get lost before I have to dispose of you.\""
else
bribe_no = {
"\"You won't buy your way out of this one.\"",
"\"House Proteron likes to make examples out of scum like you.\"",
"\"You've made a huge mistake.\"",
"\"Bribery carries a harsh penalty, scum.\"",
"\"I'm not interested in your blood money!\"",
"\"All the money in the world won't save you now!\""
}
mem.bribe_no = bribe_no[ rnd.rnd(1,#bribe_no) ]
end
mem.loiter = 3 -- This is the amount of waypoints the pilot will pass through before leaving the system
-- Finish up creation
create_post()
end
-- taunts
function taunt ( target, offense )
-- Only 50% of actually taunting.
if rnd.rnd(0,1) == 0 then
return
end
-- some taunts
if offense then
taunts = {
"There is no room in this universe for scum like you!",
"House Proteron will enjoy your death!",
"Your head will make a fine addition to my collection!",
"None survive the wrath of House Proteron!",
"Enjoy your last moments, criminal!"
}
else
taunts = {
"You dare attack me!",
"You are no match for House Proteron!",
"The Empire will have your head!",
"You'll regret that!",
"That was a fatal mistake!"
}
end
ai.pilot():comm(target, taunts[ rnd.rnd(1,#taunts) ])
end
| gpl-3.0 |
destdev/ygopro-scripts | c61665245.lua | 2 | 4916 | --サモン・ソーサレス
function c61665245.initial_effect(c)
--link summon
aux.AddLinkProcedure(c,aux.NOT(aux.FilterBoolFunction(Card.IsLinkType,TYPE_TOKEN)),2,99,c61665245.lcheck)
c:EnableReviveLimit()
--special summon
local e1=Effect.CreateEffect(c)
e1:SetDescription(aux.Stringid(61665245,0))
e1:SetCategory(CATEGORY_SPECIAL_SUMMON)
e1:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O)
e1:SetCode(EVENT_SPSUMMON_SUCCESS)
e1:SetProperty(EFFECT_FLAG_DELAY)
e1:SetCondition(c61665245.spcon1)
e1:SetTarget(c61665245.sptg1)
e1:SetOperation(c61665245.spop1)
c:RegisterEffect(e1)
--special summon
local e2=Effect.CreateEffect(c)
e2:SetDescription(aux.Stringid(61665245,1))
e2:SetCategory(CATEGORY_SPECIAL_SUMMON)
e2:SetType(EFFECT_TYPE_IGNITION)
e2:SetProperty(EFFECT_FLAG_CARD_TARGET)
e2:SetRange(LOCATION_MZONE)
e2:SetCountLimit(1,61665245)
e2:SetTarget(c61665245.sptg2)
e2:SetOperation(c61665245.spop2)
c:RegisterEffect(e2)
end
function c61665245.lcheck(g)
return g:GetClassCount(Card.GetLinkRace)==1
end
function c61665245.spcon1(e,tp,eg,ep,ev,re,r,rp)
return e:GetHandler():IsSummonType(SUMMON_TYPE_LINK)
end
function c61665245.spfilter1(c,e,tp,zone)
return c:IsCanBeSpecialSummoned(e,0,tp,false,false,POS_FACEUP_DEFENSE,1-tp,zone)
end
function c61665245.sptg1(e,tp,eg,ep,ev,re,r,rp,chk)
local zone=e:GetHandler():GetLinkedZone(1-tp)
if chk==0 then return Duel.GetLocationCount(1-tp,LOCATION_MZONE,tp,LOCATION_REASON_TOFIELD,zone)>0
and Duel.IsExistingMatchingCard(c61665245.spfilter1,tp,LOCATION_HAND,0,1,nil,e,tp,zone) end
Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_HAND)
end
function c61665245.spop1(e,tp,eg,ep,ev,re,r,rp)
local zone=e:GetHandler():GetLinkedZone(1-tp)
if Duel.GetLocationCount(1-tp,LOCATION_MZONE,tp,LOCATION_REASON_TOFIELD,zone)<=0 then return end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON)
local g=Duel.SelectMatchingCard(tp,c61665245.spfilter1,tp,LOCATION_HAND,0,1,1,nil,e,tp,zone)
if g:GetCount()>0 then
Duel.SpecialSummon(g,0,tp,1-tp,false,false,POS_FACEUP_DEFENSE,zone)
end
end
function c61665245.spfilter2(c,e,tp,lg)
return c:IsFaceup() and lg:IsContains(c) and Duel.IsExistingMatchingCard(c61665245.spfilter3,tp,LOCATION_DECK,0,1,nil,e,tp,c:GetRace())
end
function c61665245.spfilter_chkc(c,e,tp,lg,rc)
return c:IsFaceup() and lg:IsContains(c) and (c:GetRace()&rc)==rc
end
function c61665245.spfilter3(c,e,tp,rac)
if not c:IsRace(rac) then return false end
local ok=false
for p=0,1 do
local zone=e:GetHandler():GetLinkedZone(p)&0xff
ok=ok or (Duel.GetLocationCount(p,LOCATION_MZONE,tp,LOCATION_REASON_TOFIELD,zone)>0 and c:IsCanBeSpecialSummoned(e,0,tp,false,false,POS_FACEUP_DEFENSE,p,zone))
end
return ok
end
function c61665245.sptg2(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
local c=e:GetHandler()
local zone={}
zone[0]=c:GetLinkedZone(0)
zone[1]=c:GetLinkedZone(1)
local lg=c:GetLinkedGroup()
if chkc then return chkc:IsLocation(LOCATION_MZONE) and chkc:IsControler(tp) and c61665245.spfilter_chkc(chkc,e,tp,lg,e:GetLabel()) end
if chk==0 then return Duel.IsExistingTarget(c61665245.spfilter2,tp,LOCATION_MZONE,LOCATION_MZONE,1,nil,e,tp,lg) end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TARGET)
local g=Duel.SelectTarget(tp,c61665245.spfilter2,tp,LOCATION_MZONE,LOCATION_MZONE,1,1,nil,e,tp,lg)
Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_DECK)
e:SetLabel(g:GetFirst():GetRace())
end
function c61665245.spop2(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
local tc=Duel.GetFirstTarget()
if not c:IsRelateToEffect(e) or not tc:IsRelateToEffect(e) or tc:IsFacedown() then return end
local zone={}
local flag={}
for p=0,1 do
zone[p]=c:GetLinkedZone(p)&0xff
local _,flag_tmp=Duel.GetLocationCount(p,LOCATION_MZONE,tp,LOCATION_REASON_TOFIELD,zone[p])
flag[p]=(~flag_tmp)&0x7f
end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON)
local g=Duel.SelectMatchingCard(tp,c61665245.spfilter3,tp,LOCATION_DECK,0,1,1,nil,e,tp,tc:GetRace())
local sc=g:GetFirst()
if sc then
local ava_zone=0
for p=0,1 do
if sc:IsCanBeSpecialSummoned(e,0,tp,false,false,POS_FACEUP_DEFENSE,p,zone[p]) then
ava_zone=ava_zone|(flag[p]<<(p==tp and 0 or 16))
end
end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TOZONE)
local sel_zone=Duel.SelectDisableField(tp,1,LOCATION_MZONE,LOCATION_MZONE,0x00ff00ff&(~ava_zone))
local sump=0
if sel_zone&0xff>0 then
sump=tp
else
sump=1-tp
sel_zone=sel_zone>>16
end
if Duel.SpecialSummonStep(sc,0,tp,sump,false,false,POS_FACEUP_DEFENSE,sel_zone) then
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetCode(EFFECT_DISABLE)
e1:SetReset(RESET_EVENT+RESETS_STANDARD)
sc:RegisterEffect(e1)
local e2=Effect.CreateEffect(c)
e2:SetType(EFFECT_TYPE_SINGLE)
e2:SetCode(EFFECT_DISABLE_EFFECT)
e2:SetReset(RESET_EVENT+RESETS_STANDARD)
sc:RegisterEffect(e2)
Duel.SpecialSummonComplete()
end
end
end
| gpl-2.0 |
destdev/ygopro-scripts | c66789970.lua | 6 | 2302 | --聖刻龍-セテクドラゴン
function c66789970.initial_effect(c)
c:EnableReviveLimit()
--spsummon from hand
local e1=Effect.CreateEffect(c)
e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE+EFFECT_FLAG_UNCOPYABLE)
e1:SetType(EFFECT_TYPE_FIELD)
e1:SetRange(LOCATION_HAND)
e1:SetCode(EFFECT_SPSUMMON_PROC)
e1:SetCondition(c66789970.hspcon)
e1:SetOperation(c66789970.hspop)
c:RegisterEffect(e1)
--destroy
local e2=Effect.CreateEffect(c)
e2:SetDescription(aux.Stringid(66789970,0))
e2:SetCategory(CATEGORY_DESTROY)
e2:SetType(EFFECT_TYPE_IGNITION)
e2:SetProperty(EFFECT_FLAG_CARD_TARGET)
e2:SetRange(LOCATION_MZONE)
e2:SetCountLimit(1)
e2:SetCost(c66789970.descost)
e2:SetTarget(c66789970.destg)
e2:SetOperation(c66789970.desop)
c:RegisterEffect(e2)
end
function c66789970.rfilter(c)
return c:IsType(TYPE_NORMAL) and c:IsRace(RACE_DRAGON) and c:IsAbleToRemoveAsCost()
end
function c66789970.hspcon(e,c)
if c==nil then return true end
local tp=c:GetControler()
return Duel.GetLocationCount(tp,LOCATION_MZONE)>0
and Duel.IsExistingMatchingCard(c66789970.rfilter,tp,LOCATION_GRAVE,0,3,nil)
end
function c66789970.hspop(e,tp,eg,ep,ev,re,r,rp,c)
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_REMOVE)
local g=Duel.SelectMatchingCard(tp,c66789970.rfilter,tp,LOCATION_GRAVE,0,3,3,nil)
Duel.Remove(g,POS_FACEUP,REASON_COST)
end
function c66789970.cfilter(c)
return c:IsRace(RACE_DRAGON) and c:IsAbleToRemoveAsCost()
end
function c66789970.descost(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.IsExistingMatchingCard(c66789970.cfilter,tp,LOCATION_GRAVE,0,1,nil) end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_REMOVE)
local g=Duel.SelectMatchingCard(tp,c66789970.cfilter,tp,LOCATION_GRAVE,0,1,1,nil)
Duel.Remove(g,POS_FACEUP,REASON_COST)
end
function c66789970.destg(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
if chkc then return chkc:IsOnField() end
if chk==0 then return Duel.IsExistingTarget(aux.TRUE,tp,LOCATION_ONFIELD,LOCATION_ONFIELD,1,nil) end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_DESTROY)
local g=Duel.SelectTarget(tp,aux.TRUE,tp,LOCATION_ONFIELD,LOCATION_ONFIELD,1,1,nil)
Duel.SetOperationInfo(0,CATEGORY_DESTROY,g,1,0,0)
end
function c66789970.desop(e,tp,eg,ep,ev,re,r,rp)
local tc=Duel.GetFirstTarget()
if tc and tc:IsRelateToEffect(e) then
Duel.Destroy(tc,REASON_EFFECT)
end
end
| gpl-2.0 |
RwNigma/darkstar | scripts/zones/La_Theine_Plateau/npcs/Dimensional_Portal.lua | 12 | 1393 | -----------------------------------
-- Area: La Theine Plateau
-- NPC: Dimensional Portal
-----------------------------------
package.loaded["scripts/zones/La_Theine_Plateau/TextIDs"] = nil;
-----------------------------------
require("scripts/globals/settings");
require("scripts/globals/keyitems");
require("scripts/zones/La_Theine_Plateau/TextIDs");
-----------------------------------
-- onTrade Action
-----------------------------------
function onTrade(player,npc,trade)
end;
-----------------------------------
-- onTrigger Action
-----------------------------------
function onTrigger(player,npc)
if (player:getCurrentMission(COP) > THE_WARRIOR_S_PATH) or (DIMENSIONAL_PORTAL_UNLOCK == true) then
player:startEvent(0x00CC);
else
player:messageSpecial(ALREADY_OBTAINED_TELE+1); -- Telepoint Disappeared
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 == 0x00CC and option == 1) then
player:setPos(25.299,-2.799,579,193,33); -- To AlTaieu {R}
end
end; | gpl-3.0 |
yahoo/fili | luthier/src/test/resources/app/defaults.lua | 2 | 4746 | -- Copyright 2019 Oath Inc.
-- Licensed under the terms of the Apache license. Please see LICENSE.md file distributed with this work for terms.
--- a module provides default strategies, including constants and variables, in a centralized way.
-- @module Utils
local misc = require 'lib.misc'
local M = {}
--- Constants in all lua files:
-- Dimensions
M.DEFAULT_DIMENSION_TYPE = "KeyValueStoreDimension"
M.DEFAULT_DIMENSION_CATEGORY = "UNKNOWN_CATEGORY"
M.DEFAULT_DIMENSION_IS_AGGREGATABLE = true
M.DEFAULT_DIMENSION_FIELDS = {}
M.DEFAULT_DIMENSION_KEY_VALUE_STORE = "memory"
M.DEFAULT_DIMENSION_SKIP_LOADING = false
M.DEFAULT_DIMENSION_STORAGE_STRATEGY = "LOADED"
-- Physical Tables
M.DEFAULT_PHYSICAL_TYPE = "strict"
M.DEFAULT_PHYSICAL_DEPENDENT_TABLE = {}
M.DEFAULT_PHYSICAL_DATE_TIME_ZONE = "UTC"
M.DEFAULT_PHYSICAL_GRANULARITY = "day"
M.DEFAULT_PHYSICAL_COLUMN_NAME_MAP = {}
-- Logical Tables
M.DEFAULT_LOGICAL_TYPE = "default"
M.DEFAULT_LOGICAL_CATEGORY = "GENERAL"
M.DEFAULT_LOGICAL_RETENTION = "P1Y"
M.DEFAULT_LOGICAL_DEPENDENT_TABLE = {}
M.DEFAULT_LOGICAL_DATE_TIME_ZONE = "UTC"
-- Metrics
M.DEFAULT_METRIC_TYPE = "default"
M.DEFAULT_METRIC_CATEGORY = "GENERAL"
M.DEFAULT_METRIC_DEPENDENCY_NAMES = {}
--- Defaulting methods:
-- Dimensions
function M.dimension_defaulting(dimension_name, dimension)
local dim_config = misc.shallow_copy(dimension)
dim_config.longName = dim_config.longName or dimension_name
dim_config.description = dim_config.description or dim_config.longName -- this line must follow the previous one
dim_config.dimensionDomain = dim_config.dimensionDomain or dimension_name
dim_config.type = dim_config.type or M.DEFAULT_DIMENSION_TYPE
dim_config.category = dim_config.category or M.DEFAULT_DIMENSION_CATEGORY
dim_config.defaultFields = dim_config.defaultFields or M.DEFAULT_DIMENSION_FIELDS
dim_config.keyValueStore = dim_config.keyValueStore or M.DEFAULT_DIMENSION_KEY_VALUE_STORE
if dim_config.isAggregatable == nil then
dim_config.isAggregatable = M.DEFAULT_DIMENSION_IS_AGGREGATABLE
end
if dim_config.skipLoading == nil then
dim_config.skipLoading = M.DEFAULT_DIMENSION_SKIP_LOADING
end
dim_config.storageStrategy = dim_config.storageStrategy or M.DEFAULT_DIMENSION_STORAGE_STRATEGY
return dim_config
end
function M.physical_table_defaulting(physical_table_name, physical_table)
local phys_config = misc.shallow_copy(physical_table)
phys_config.description = phys_config.description or physical_table_name
phys_config.type = phys_config.type or M.DEFAULT_PHYSICAL_TYPE
phys_config.physicalTables = phys_config.physicalTables or M.DEFAULT_PHYSICAL_DEPENDENT_TABLE
phys_config.dateTimeZone = phys_config.dateTimeZone or M.DEFAULT_PHYSICAL_DATE_TIME_ZONE
phys_config.granularity = phys_config.granularity or M.DEFAULT_PHYSICAL_GRANULARITY
phys_config.logicalToPhysicalColumnNames = phys_config.logicalToPhysicalColumnNames
or M.DEFAULT_PHYSICAL_COLUMN_NAME_MAP
return phys_config
end
function M.logical_table_defaulting(logical_table_name, logical_table)
local logi_config = misc.shallow_copy(logical_table)
logi_config.description = logi_config.description or logical_table_name
logi_config.type = logi_config.type or M.DEFAULT_LOGICAL_TYPE
logi_config.category = logi_config.category or M.DEFAULT_LOGICAL_CATEGORY
logi_config.retention = logi_config.retention or M.DEFAULT_LOGICAL_RETENTION
logi_config.longName = logi_config.longName or logical_table_name
logi_config.description = logi_config.description or logi_config.longName -- this line must follow the previous one
logi_config.physicalTables = logi_config.physicalTables or M.DEFAULT_LOGICAL_DEPENDENT_TABLE
logi_config.dateTimeZone = logi_config.dateTimeZone or M.DEFAULT_LOGICAL_DATE_TIME_ZONE
return logi_config
end
function M.metric_defaulting(metric_name, metric)
local metric_config = misc.shallow_copy(metric)
metric_config.type = metric_config.type or M.DEFAULT_METRIC_TYPE
metric_config.longName = metric_config.longName or metric_name
metric_config.description = metric_config.description or metric_config.longName -- this line must follow the previous one
metric_config.category = metric_config.category or M.DEFAULT_METRIC_CATEGORY
metric_config.dependencyMetricNames = metric_config.druidMetric and {metric_config.druidMetric}
or metric_config.dependencies -- if druidMetric exists: use {druidMetric}
or M.DEFAULT_METRIC_DEPENDENCY_NAMES -- else: if dependencies exists: use dependencies
-- else: use an empty table {}
return metric_config
end
return M
| apache-2.0 |
Deadwing888/darkstar | scripts/zones/Dynamis-Xarcabard/mobs/Yang.lua | 5 | 1296 | -----------------------------------
-- Area: Dynamis Xarcabard
-- NM: Yang
-----------------------------------
require("scripts/globals/status");
-----------------------------------
-- onMobInitialize Action
-----------------------------------
function onMobInitialize(mob,target)
end;
-----------------------------------
-- onMobFight Action
-----------------------------------
function onMobFight(mob,target)
local YingID = 17330183;
local YingToD = mob:getLocalVar("YingToD");
-- Repop Ying every 30 seconds if Yang is up and Ying is not.
if (mob:getBattleTime() > YingToD+30 and GetMobAction(YingID) == ACTION_NONE) then
SpawnMob(YingID):updateEnmity(target);
end
end;
-----------------------------------
-- onMobDeath
-----------------------------------
function onMobDeath(mob,killer,ally)
local YingID = 17330183;
-- localVars clear on death, so setting it on its partner
GetMobByID(YingID):setLocalVar("YangToD", os.time());
-- This is not retail, this is not how you pop DynaLord:
if (GetMobAction(17330177) == ACTION_NONE and GetMobAction(YingID) == ACTION_NONE) then
-- GetMobByID(17330177):setLocalVar("timeLimit", os.time() + 1800); -- Time for the 30min limit
SpawnMob(17330177); -- Dynamis Lord
end
end; | gpl-3.0 |
Deadwing888/darkstar | scripts/zones/Castle_Oztroja/npcs/_47m.lua | 13 | 1612 | -----------------------------------
-- Area: Castle Oztroja
-- NPC: _47m (Torch Stand)
-- Notes: Opens door _471 near password #3
-- @pos -45.230 -17.832 17.668 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(17396174):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 |
RwNigma/darkstar | scripts/zones/Konschtat_Highlands/mobs/Ghillie_Dhu.lua | 15 | 2301 | -----------------------------------
-- Area: Konschtat Highlands
-- NM: Ghillie Dhu
-----------------------------------
require("scripts/globals/utils");
require("scripts/globals/status");
require("scripts/globals/fieldsofvalor");
-----------------------------------
-- onMobInitialize
-----------------------------------
function onMobInitialize(mob)
-- For its TP drain melee.
mob:setMobMod(MOBMOD_ADD_EFFECT,mob:getShortID());
-- Hits especially hard for his level, even by NM standards.
mob:addMod(MOD_ATT, 50); -- May need adjustment along with cmbDmgMult in mob_pools.sql
end;
-----------------------------------
-- onMobSpawn
-----------------------------------
function onMobSpawn(mob)
end;
-----------------------------------
-- onMobRoam
-----------------------------------
function onMobRoam(mob)
-- Fairly sure he shouldn't be storing up max TP while idle.
if (mob:getMod(MOD_REGAIN) ~= 0) then
mob:setMod(MOD_REGAIN,0);
end
end;
-----------------------------------
-- onMobFight
-----------------------------------
function onMobFight(mob,target)
-- Guesstimating the regain scales from 1-100,
-- nobody has the excact values but it scales with HP.
local TP = ((100 - mob:getHPP())*0.5)
if (mob:getMod(MOD_REGAIN) ~= utils.clamp(TP,1,100)) then
mob:setMod(MOD_REGAIN,utils.clamp(TP,1,100));
end
end;
-----------------------------------
-- onAdditionalEffect Action
-----------------------------------
function onAdditionalEffect(mob,target,damage)
-- wiki just says "29%" so thats what I am using (for now).
local CHANCE = 29;
if (CHANCE > math.random(0,99)) then
local DRAIN = math.random(1,3); -- Its a pretty weaksauce drain.
target:delTP(DRAIN);
return SUBEFFECT_TP_DRAIN, MSGBASIC_ADD_EFFECT_TP_DRAIN, DRAIN;
else
return 0,0,0;
end
end;
-----------------------------------
-- onMobDeath
-----------------------------------
function onMobDeath(mob,killer)
-- I think he still counts for the FoV page? Most NM's do not though.
checkRegime(killer,mob,81,1);
UpdateNMSpawnPoint(mob:getID());
mob:setRespawnTime(math.random(3600,4200)); -- 60~70 min repop.
end; | gpl-3.0 |
ffxijuggalo/darkstar | scripts/zones/Southern_San_dOria/npcs/Lusiane.lua | 11 | 1154 | -----------------------------------
-- Area: Southern San d'Oria
-- NPC: Lusiane
-- Standard Merchant NPC
-----------------------------------
local ID = require("scripts/zones/Southern_San_dOria/IDs")
require("scripts/globals/npc_util")
require("scripts/globals/quests")
require("scripts/globals/shop")
function onTrade(player,npc,trade)
if player:getQuestStatus(SANDORIA, dsp.quest.id.sandoria.FLYERS_FOR_REGINE) == QUEST_ACCEPTED and npcUtil.tradeHas(trade, 532) then
player:messageSpecial(ID.text.FLYER_REFUSED)
end
end
function onTrigger(player,npc)
local stock =
{
17389, 496, 1, -- Bamboo Fishing Rod
17395, 9, 2, -- Lugworm
17390, 217, 2, -- Yew Fishing Rod
17396, 3, 3, -- Little Worm
5068, 110, 3, -- Scroll of Light Threnoldy
5066, 1265, 3, -- Scroll of Lightning Threnoldy
17391, 66, 3, -- Willow Fishing Rod
}
player:showText(npc, ID.text.LUSIANE_SHOP_DIALOG)
dsp.shop.nation(player, stock, dsp.nation.SANDORIA)
end
function onEventUpdate(player,csid,option)
end
function onEventFinish(player,csid,option)
end
| gpl-3.0 |
ffxijuggalo/darkstar | scripts/zones/Chateau_dOraguille/npcs/_6h0.lua | 9 | 4595 | -----------------------------------
-- Area: Chateau d'Oraguille
-- Door: Prince Royal's
-- Finishes Quest: A Boy's Dream, Under Oath
-- Involved in Missions: 3-1, 5-2, 8-2
-- !pos -38 -3 73 233
-----------------------------------
require("scripts/globals/status");
require("scripts/globals/settings");
require("scripts/globals/keyitems");
require("scripts/globals/missions");
require("scripts/globals/quests");
require("scripts/globals/titles");
local ID = require("scripts/zones/Chateau_dOraguille/IDs");
-----------------------------------
function onTrade(player,npc,trade)
end;
function onTrigger(player,npc)
local currentMission = player:getCurrentMission(SANDORIA);
local MissionStatus = player:getCharVar("MissionStatus");
local infiltrateDavoi = player:hasCompletedMission(SANDORIA,dsp.mission.id.sandoria.INFILTRATE_DAVOI);
local Wait1DayRanperre = player:getCharVar("Wait1DayForRanperre_date");
local osdate = tonumber(os.date("%j"));
if (player:getCharVar("aBoysDreamCS") == 8) then
player:startEvent(88);
elseif (player:getQuestStatus(SANDORIA,dsp.quest.id.sandoria.A_BOY_S_DREAM) == QUEST_COMPLETED and player:getQuestStatus(SANDORIA,dsp.quest.id.sandoria.UNDER_OATH) == QUEST_AVAILABLE and player:getMainJob() == dsp.job.PLD) then
player:startEvent(90);
elseif (player:getCharVar("UnderOathCS") == 8) then
player:startEvent(89);
elseif (currentMission == dsp.mission.id.sandoria.INFILTRATE_DAVOI and infiltrateDavoi == false and MissionStatus == 0) then
player:startEvent(553,0,dsp.ki.ROYAL_KNIGHTS_DAVOI_REPORT);
elseif (currentMission == dsp.mission.id.sandoria.INFILTRATE_DAVOI and MissionStatus == 4) then
player:startEvent(554,0,dsp.ki.ROYAL_KNIGHTS_DAVOI_REPORT);
elseif (currentMission == dsp.mission.id.sandoria.THE_SHADOW_LORD and MissionStatus == 1) then
player:startEvent(547);
elseif (currentMission == dsp.mission.id.sandoria.RANPERRE_S_FINAL_REST and MissionStatus == 0) then
player:startEvent(81);
elseif (currentMission == dsp.mission.id.sandoria.RANPERRE_S_FINAL_REST and MissionStatus == 4 and Wait1DayRanperre ~= osdate) then -- Ready now.
player:startEvent(21);
elseif (currentMission == dsp.mission.id.sandoria.RANPERRE_S_FINAL_REST and MissionStatus == 7) then
player:startEvent(21);
elseif (player:hasCompletedMission(SANDORIA,dsp.mission.id.sandoria.LIGHTBRINGER) and player:getRank() == 9 and player:getCharVar("Cutscenes_8-2") == 0) then
player:startEvent(63);
else
player:startEvent(522);
end
return 1;
end;
function onEventUpdate(player,csid,option)
end;
function onEventFinish(player,csid,option)
if (csid == 553) then
player:setCharVar("MissionStatus",2);
elseif (csid == 547) then
player:setCharVar("MissionStatus",2);
elseif (csid == 554) then
finishMissionTimeline(player,3,csid,option);
elseif (csid == 88) then
if (player:getFreeSlotsCount() == 0) then
player:messageSpecial(ID.text.ITEM_CANNOT_BE_OBTAINED,14095);
else
if (player:getMainJob() == dsp.job.PLD) then
player:addQuest(SANDORIA,dsp.quest.id.sandoria.UNDER_OATH);
end
player:delKeyItem(dsp.ki.KNIGHTS_BOOTS);
player:addItem(14095);
player:messageSpecial(ID.text.ITEM_OBTAINED,14095); -- Gallant Leggings
player:setCharVar("aBoysDreamCS",0);
player:addFame(SANDORIA,40);
player:completeQuest(SANDORIA,dsp.quest.id.sandoria.A_BOY_S_DREAM);
end
elseif (csid == 90 and option ==1) then
player:addQuest(SANDORIA,dsp.quest.id.sandoria.UNDER_OATH);
player:setCharVar("UnderOathCS",0);
elseif (csid == 89) then
if (player:getFreeSlotsCount() == 0) then
player:messageSpecial(ID.text.ITEM_CANNOT_BE_OBTAINED,12644);
else
player:addItem(12644);
player:messageSpecial(ID.text.ITEM_OBTAINED,12644); -- Gallant Surcoat
player:setCharVar("UnderOathCS",9);
player:addFame(SANDORIA,60);
player:setTitle(dsp.title.PARAGON_OF_PALADIN_EXCELLENCE);
player:completeQuest(SANDORIA,dsp.quest.id.sandoria.UNDER_OATH);
end
elseif (csid == 81) then
player:setCharVar("MissionStatus",1);
elseif (csid == 21) then
player:setCharVar("Wait1DayForRanperre_date",0);
player:setCharVar("MissionStatus",8);
elseif (csid == 63) then
player:setCharVar("Cutscenes_8-2",1)
end
end;
| gpl-3.0 |
destdev/ygopro-scripts | c74371660.lua | 2 | 2141 | --水精鱗-ガイオアビス
function c74371660.initial_effect(c)
--xyz summon
aux.AddXyzProcedure(c,aux.FilterBoolFunction(Card.IsAttribute,ATTRIBUTE_WATER),7,2)
c:EnableReviveLimit()
--atklimit
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_FIELD)
e1:SetCode(EFFECT_CANNOT_ATTACK)
e1:SetRange(LOCATION_MZONE)
e1:SetTargetRange(LOCATION_MZONE,LOCATION_MZONE)
e1:SetTarget(aux.TargetBoolFunction(Card.IsLevelAbove,5))
e1:SetCondition(c74371660.dscon)
c:RegisterEffect(e1)
--negate
local e2=Effect.CreateEffect(c)
e2:SetDescription(aux.Stringid(74371660,0))
e2:SetType(EFFECT_TYPE_QUICK_O)
e2:SetCode(EVENT_FREE_CHAIN)
e2:SetCountLimit(1)
e2:SetRange(LOCATION_MZONE)
e2:SetHintTiming(0,TIMINGS_CHECK_MONSTER)
e2:SetCost(c74371660.cost)
e2:SetTarget(c74371660.target)
e2:SetOperation(c74371660.operation)
c:RegisterEffect(e2)
end
function c74371660.dscon(e)
return e:GetHandler():GetOverlayCount()~=0
end
function c74371660.cost(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return e:GetHandler():CheckRemoveOverlayCard(tp,1,REASON_COST) end
e:GetHandler():RemoveOverlayCard(tp,1,1,REASON_COST)
end
function c74371660.filter(c,atk)
return aux.disfilter1(c) and c:GetAttack()<atk
end
function c74371660.target(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.IsExistingMatchingCard(c74371660.filter,tp,0,LOCATION_MZONE,1,nil,e:GetHandler():GetAttack()) end
end
function c74371660.operation(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
if not c:IsRelateToEffect(e) or c:IsFacedown() then return end
local g=Duel.GetMatchingGroup(c74371660.filter,tp,0,LOCATION_MZONE,nil,c:GetAttack())
local tc=g:GetFirst()
while tc do
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetCode(EFFECT_DISABLE)
e1:SetReset(RESET_EVENT+RESETS_STANDARD+RESET_PHASE+PHASE_END)
tc:RegisterEffect(e1)
local e2=Effect.CreateEffect(c)
e2:SetType(EFFECT_TYPE_SINGLE)
e2:SetCode(EFFECT_DISABLE_EFFECT)
e2:SetValue(RESET_TURN_SET)
e2:SetReset(RESET_EVENT+RESETS_STANDARD+RESET_PHASE+PHASE_END)
tc:RegisterEffect(e2)
Duel.NegateRelatedChain(tc,RESET_TURN_SET)
tc=g:GetNext()
end
end
| gpl-2.0 |
destdev/ygopro-scripts | c45195443.lua | 4 | 2631 | --E・HERO ソリッドマン
function c45195443.initial_effect(c)
--special summon
local e1=Effect.CreateEffect(c)
e1:SetDescription(aux.Stringid(45195443,0))
e1:SetCategory(CATEGORY_SPECIAL_SUMMON)
e1:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O)
e1:SetCode(EVENT_SUMMON_SUCCESS)
e1:SetTarget(c45195443.sptg1)
e1:SetOperation(c45195443.spop1)
c:RegisterEffect(e1)
--special summon
local e2=Effect.CreateEffect(c)
e2:SetDescription(aux.Stringid(45195443,1))
e2:SetCategory(CATEGORY_SPECIAL_SUMMON)
e2:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O)
e2:SetProperty(EFFECT_FLAG_DELAY+EFFECT_FLAG_CARD_TARGET)
e2:SetCode(EVENT_TO_GRAVE)
e2:SetCountLimit(1,45195443)
e2:SetCondition(c45195443.spcon2)
e2:SetTarget(c45195443.sptg2)
e2:SetOperation(c45195443.spop2)
c:RegisterEffect(e2)
end
function c45195443.spfilter1(c,e,tp)
return c:IsLevelBelow(4) and c:IsSetCard(0x8) and c:IsCanBeSpecialSummoned(e,0,tp,false,false)
end
function c45195443.sptg1(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0
and Duel.IsExistingMatchingCard(c45195443.spfilter1,tp,LOCATION_HAND,0,1,nil,e,tp) end
Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_HAND)
end
function c45195443.spop1(e,tp,eg,ep,ev,re,r,rp)
if Duel.GetLocationCount(tp,LOCATION_MZONE)<=0 then return end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON)
local g=Duel.SelectMatchingCard(tp,c45195443.spfilter1,tp,LOCATION_HAND,0,1,1,nil,e,tp)
if g:GetCount()>0 then
Duel.SpecialSummon(g,0,tp,tp,false,false,POS_FACEUP)
end
end
function c45195443.spcon2(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
return re and re:GetHandler():IsType(TYPE_SPELL) and c:IsReason(REASON_EFFECT) and c:IsPreviousLocation(LOCATION_MZONE)
end
function c45195443.spfilter2(c,e,tp)
return c:IsSetCard(0x8) and not c:IsCode(45195443) and c:IsCanBeSpecialSummoned(e,0,tp,false,false,POS_FACEUP_DEFENSE)
end
function c45195443.sptg2(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
if chkc then return chkc:IsLocation(LOCATION_GRAVE) and chkc:IsControler(tp) and c45195443.spfilter2(chkc,e,tp) end
if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0
and Duel.IsExistingTarget(c45195443.spfilter2,tp,LOCATION_GRAVE,0,1,nil,e,tp) end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON)
local g=Duel.SelectTarget(tp,c45195443.spfilter2,tp,LOCATION_GRAVE,0,1,1,nil,e,tp)
Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,g,1,0,0)
end
function c45195443.spop2(e,tp,eg,ep,ev,re,r,rp)
local tc=Duel.GetFirstTarget()
if tc:IsRelateToEffect(e) then
Duel.SpecialSummon(tc,0,tp,tp,false,false,POS_FACEUP_DEFENSE)
end
end
| gpl-2.0 |
RwNigma/darkstar | scripts/zones/Marjami_Ravine/Zone.lua | 34 | 1245 | -----------------------------------
--
-- Zone: Marjami Ravine
--
-----------------------------------
require("scripts/globals/settings");
package.loaded["scripts/zones/Marjami_Ravine/TextIDs"] = nil;
require("scripts/zones/Marjami_Ravine/TextIDs");
-----------------------------------
-- onInitialize
-----------------------------------
function onInitialize(zone)
end;
-----------------------------------
-- onZoneIn
-----------------------------------
function onZoneIn(player,prevZone)
cs = -1;
if ((player:getXPos() == 0) and (player:getYPos() == 0) and (player:getZPos() == 0)) then
player:setPos(429,-60,298,99);
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 |
destdev/ygopro-scripts | c59965151.lua | 4 | 2032 | --デッド・ガードナー
function c59965151.initial_effect(c)
--change battle target
local e1=Effect.CreateEffect(c)
e1:SetDescription(aux.Stringid(59965151,0))
e1:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_O)
e1:SetCode(EVENT_BE_BATTLE_TARGET)
e1:SetRange(LOCATION_MZONE)
e1:SetCondition(c59965151.cbcon)
e1:SetTarget(c59965151.cbtg)
e1:SetOperation(c59965151.cbop)
c:RegisterEffect(e1)
--atkdown
local e2=Effect.CreateEffect(c)
e2:SetDescription(aux.Stringid(59965151,1))
e2:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_F)
e2:SetCode(EVENT_TO_GRAVE)
e2:SetProperty(EFFECT_FLAG_CARD_TARGET)
e2:SetCondition(c59965151.atkcon)
e2:SetTarget(c59965151.atktg)
e2:SetOperation(c59965151.atkop)
c:RegisterEffect(e2)
end
function c59965151.cbcon(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
local bt=eg:GetFirst()
return c~=bt and bt:IsFaceup() and bt:GetControler()==c:GetControler()
end
function c59965151.cbtg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.GetAttacker():GetAttackableTarget():IsContains(e:GetHandler()) end
end
function c59965151.cbop(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
if c:IsRelateToEffect(e) and not Duel.GetAttacker():IsImmuneToEffect(e) then
Duel.ChangeAttackTarget(c)
end
end
function c59965151.atkcon(e,tp,eg,ep,ev,re,r,rp)
return e:GetHandler():IsReason(REASON_DESTROY)
end
function c59965151.atktg(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
if chkc then return chkc:IsControler(1-tp) and chkc:IsLocation(LOCATION_MZONE) and chkc:IsFaceup() end
if chk==0 then return true end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_FACEUP)
Duel.SelectTarget(tp,Card.IsFaceup,tp,0,LOCATION_MZONE,1,1,nil)
end
function c59965151.atkop(e,tp,eg,ep,ev,re,r,rp)
local tc=Duel.GetFirstTarget()
if tc and tc:IsFaceup() and tc:IsRelateToEffect(e) then
local e1=Effect.CreateEffect(e:GetHandler())
e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetCode(EFFECT_UPDATE_ATTACK)
e1:SetValue(-1000)
e1:SetReset(RESET_EVENT+RESETS_STANDARD+RESET_PHASE+PHASE_END)
tc:RegisterEffect(e1)
end
end
| gpl-2.0 |
simonfork/aquaria | game_scripts/scripts/entities/greenseadragon.lua | 6 | 6527 | -- Copyright (C) 2007, 2010 - Bit-Blot
--
-- This file is part of Aquaria.
--
-- Aquaria 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
if not v then v = {} end
if not AQUARIA_VERSION then dofile("scripts/entities/entityinclude.lua") end
v.dir = 0
v.dirTimer = 0
v.attackDelay = 2
v.fireDelay = 0
v.n = 0
v.dodgePhase = 0
v.bone_body = 0
v.rideTimer = 0
v.maxRideTime = 20
v.throwOffTimer = 0
v.maxThrowOffTime = 15
local STATE_THROWOFF = 1000
v.roarDelay = 0
v.aggro = 0
v.firstSeen = true
function init(me)
setupBasicEntity(
me,
"", -- texture
64, -- health
1, -- manaballamount
1, -- exp
1, -- money
32, -- collideRadius
STATE_IDLE, -- initState
0, -- sprite width
0, -- sprite height
0, -- particle "explosion" type, maps to particleEffects.txt -1 = none
0, -- 0/1 hit other entities off/on (uses collideRadius)
3000
)
entity_initSkeletal(me, "GreenSeaDragon")
entity_generateCollisionMask(me)
entity_animate(me, "idle", LOOP_INF)
entity_setMaxSpeed(me, 800)
v.fireLoc = entity_getBoneByName(me, "FireLoc")
bone_alpha(v.fireLoc)
entity_setDeathParticleEffect(me, "GreenSeaDragonExplode")
bone_setSegs(entity_getBoneByName(me, "Weeds1"), 2, 16, 0.5, 0.3, -0.018, 0, 12, 1)
bone_setSegs(entity_getBoneByName(me, "Weeds2"), 2, 16, 0.5, 0.3, -0.018, 0, 12, 1)
v.bone_body = entity_getBoneByName(me, "Body")
entity_setCullRadius(me, 1024)
loadSound("greenseadragon-die")
loadSound("greenseadragon-roar")
loadSound("greenseadragon-fire")
entity_setDeathSound(me, "greenseadragon-die")
end
function postInit(me)
v.n = getNaija()
entity_setTarget(me, v.n)
end
function dieNormal(me)
if chance(5) then
spawnIngredient("SpicyRoll", entity_getPosition(me))
else
if chance(10) then
spawnIngredient("SpecialBulb", entity_getPosition(me))
else
if chance(10) then
spawnIngredient("Poultice", entity_getPosition(me))
else
for i=1,3,1 do
spawnIngredient("PlantLeaf", entity_getPosition(me))
end
end
end
end
end
function update(me, dt)
--entity_handleShotCollisions(me)
--entity_touchAvatarDamage(me, entity_getCollideRadius(me), 0, 1000)
if not isForm(FORM_FISH) then
v.aggro = 1
elseif isForm(FORM_FISH) and not entity_isEntityInRange(me, v.n, 1024) then
v.aggro = 0
end
if v.firstSeen and entity_isTargetInRange(me, 800) then
v.roarDelay = v.roarDelay - dt
if v.roarDelay < 0 then
playSfx("greenseadragon-roar")
shakeCamera(6, 3)
v.roarDelay = 5 + math.random(3)
avatar_fallOffWall()
end
--v.firstSeen = false
end
--[[
if dir == 0 then
entity_addVel(me, -100*dt, 0)
else
entity_addVel(me, 100*dt, 0)
end
v.dirTimer = v.dirTimer - dt
if v.dirTimer < 0 then
v.dirTimer = 1
if dir == 0 then
dir = 1
else
dir = 0
end
end
]]--
v.dodgePhase = v.dodgePhase + dt
if v.dodgePhase > 6 then
v.dodgePhase = 0
end
if entity_isTargetInRange(me, 256)
and v.aggro == 1 then
entity_moveTowardsTarget(me, dt, -1000)
elseif entity_isTargetInRange(me, 1024)
and v.aggro == 1 then
entity_moveTowardsTarget(me, dt, 500)
end
if v.dodgePhase > 3 then
--entity_doSpellAvoidance(me, dt, 128, 0.5)
end
entity_doCollisionAvoidance(me, dt, 4, 1.0)
if (math.abs(entity_x(v.n) - entity_x(me)) > 140) then
entity_flipToEntity(me, v.n)
end
if entity_isState(me, STATE_IDLE)
and v.aggro == 1 then
v.attackDelay = v.attackDelay - dt
if v.attackDelay < 0 then
entity_setState(me, STATE_ATTACK)
end
elseif entity_isState(me, STATE_ATTACK) then
v.fireDelay = v.fireDelay - dt
if v.fireDelay < 0 then
v.fireDelay = 0.2
local vx, vy = bone_getNormal(v.fireLoc)
local x, y = bone_getWorldPosition(v.fireLoc)
local s = createShot("GreenSeaDragon", me, entity_getTarget(me), x, y)
shot_setAimVector(s, vx, vy)
--local s = entity_fireAtTarget(me, "", 1, 100, 0, 3, 32, 0, 0, vx, vy, x, y)
--shot_setNice(s, "Shots/HotEnergy", "HeatTrailSmall", "HeatHit")
end
elseif entity_isState(me, STATE_THROWOFF) then
local range = 5 + v.throwOffTimer * 10
if range > 30 then
range = 30
end
entity_offset(me, math.random(range/2)-range, math.random(range/2)-range)
v.throwOffTimer = v.throwOffTimer + dt * math.random(3)
if v.throwOffTimer > v.maxThrowOffTime then
avatar_fallOffWall()
entity_moveTowards(v.n, entity_x(me), entity_y(me), 1, -2000)
entity_moveTowards(me, entity_x(v.n), entity_y(v.n), 1, -1200)
end
end
entity_updateMovement(me, dt)
local ent = entity_getBoneLockEntity(v.n)
if ent == me then
v.rideTimer = v.rideTimer + dt
if v.rideTimer > v.maxRideTime and not entity_isState(me, STATE_THROWOFF) then
entity_setState(me, STATE_THROWOFF)
end
else
if entity_isState(me, STATE_THROWOFF) then
entity_setState(me, STATE_IDLE)
end
v.rideTimer = 0
end
local bone = entity_collideSkeletalVsCircle(me, v.n)
if avatar_isBursting() and bone == v.bone_body and entity_setBoneLock(v.n, me, bone) then
else
entity_touchAvatarDamage(me, entity_getCollideRadius(me), 0, 1000)
end
entity_handleShotCollisionsSkeletal(me)
end
function hitSurface(me)
end
function enterState(me, state)
if entity_isState(me, STATE_IDLE) then
entity_animate(me, "idle", -1)
elseif entity_isState(me, STATE_ATTACK) then
entity_setStateTime(me, entity_animate(me, "attack"))
v.attackDelay = 0.5 + math.random(150)/100.0
v.fireDelay = 0.3
elseif entity_isState(me, STATE_THROWOFF) then
v.throwOffTimer = v.throwOffTimer - 5
if v.throwOffTimer < 0 then
v.throwOffTimer = 0
end
elseif entity_isState(me, STATE_DEAD) then
shakeCamera(10, 3)
end
end
function exitState(me, state)
if entity_isState(me, STATE_ATTACK) then
entity_setState(me, STATE_IDLE)
end
end
function damage(me)
v.rideTimer = v.rideTimer + 1.5
v.aggro = 1
return true
end
| gpl-2.0 |
liv3dn8as/captivePortal | httpserver-basicauth.lua | 1 | 1438 | -- httpserver-basicauth.lua
-- Part of nodemcu-httpserver, authenticates a user using http basic auth.
-- Author: Sam Dieck
basicAuth = {}
-- Returns true if the user/password match one of the users/passwords in httpserver-conf.lua.
-- Returns false otherwise.
function loginIsValid(user, pwd, users)
if user == nil then return false end
if pwd == nil then return false end
if users[user] == nil then return false end
if users[user] ~= pwd then return false end
return true
end
-- Parse basic auth http header.
-- Returns the username if header contains valid credentials,
-- nil otherwise.
function basicAuth.authenticate(header)
local conf = dofile("httpserver-conf.lc")
local credentials_enc = header:match("Authorization: Basic ([A-Za-z0-9+/=]+)")
if not credentials_enc then
return nil
end
local credentials = dofile("httpserver-b64decode.lc")(credentials_enc)
local user, pwd = credentials:match("^(.*):(.*)$")
if loginIsValid(user, pwd, conf.auth.users) then
print("httpserver-basicauth: User \"" .. user .. "\": Authenticated.")
return user
else
print("httpserver-basicauth: User \"" .. user .. "\": Access denied.")
return nil
end
end
function basicAuth.authErrorHeader()
local conf = dofile("httpserver-conf.lc")
return "WWW-Authenticate: Basic realm=\"" .. conf.auth.realm .. "\""
end
return basicAuth
| gpl-2.0 |
destdev/ygopro-scripts | c85239662.lua | 1 | 1297 | --神秘の妖精 エルフィリア
function c85239662.initial_effect(c)
--xyz limit
local e2=Effect.CreateEffect(c)
e2:SetDescription(aux.Stringid(85239662,0))
e2:SetType(EFFECT_TYPE_IGNITION)
e2:SetRange(LOCATION_MZONE)
e2:SetCountLimit(1)
e2:SetCost(c85239662.cost)
e2:SetOperation(c85239662.operation)
c:RegisterEffect(e2)
end
function c85239662.cfilter(c)
return c:IsAttribute(ATTRIBUTE_WIND) and not c:IsPublic()
end
function c85239662.cost(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.IsExistingMatchingCard(c85239662.cfilter,tp,LOCATION_HAND,0,1,nil) end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_CONFIRM)
local g=Duel.SelectMatchingCard(tp,c85239662.cfilter,tp,LOCATION_HAND,0,1,1,nil)
Duel.ConfirmCards(1-tp,g)
e:SetLabel(g:GetFirst():GetLevel())
Duel.ShuffleHand(tp)
end
function c85239662.operation(e,tp,eg,ep,ev,re,r,rp)
local e1=Effect.CreateEffect(e:GetHandler())
e1:SetType(EFFECT_TYPE_FIELD)
e1:SetCode(EFFECT_CANNOT_BE_XYZ_MATERIAL)
e1:SetProperty(EFFECT_FLAG_IGNORE_IMMUNE)
e1:SetTargetRange(LOCATION_MZONE,LOCATION_MZONE)
e1:SetTarget(c85239662.target)
e1:SetLabel(e:GetLabel())
e1:SetReset(RESET_PHASE+PHASE_END+RESET_OPPO_TURN)
e1:SetValue(1)
Duel.RegisterEffect(e1,tp)
end
function c85239662.target(e,c)
return not c:IsLevel(e:GetLabel())
end
| gpl-2.0 |
ffxijuggalo/darkstar | scripts/zones/Nyzul_Isle/instances/path_of_darkness.lua | 9 | 2307 | -----------------------------------
--
-- TOAU-42: Path of Darkness
--
-----------------------------------
local ID = require("scripts/zones/Nyzul_Isle/IDs")
require("scripts/globals/instance")
require("scripts/globals/keyitems");
-----------------------------------
function afterInstanceRegister(player)
local instance = player:getInstance();
player:messageSpecial(ID.text.TIME_TO_COMPLETE, instance:getTimeLimit());
end;
function onInstanceCreated(instance)
SpawnMob(ID.mob[58].AMNAF_BLU, instance);
SpawnMob(ID.mob[58].NAJA, instance);
end;
function onInstanceTimeUpdate(instance, elapsed)
updateInstanceTime(instance, elapsed, ID.text)
end;
function onInstanceFailure(instance)
local chars = instance:getChars();
for i,v in pairs(chars) do
v:messageSpecial(ID.text.MISSION_FAILED,10,10);
v:startEvent(1);
end
end;
function onInstanceProgressUpdate(instance, progress)
if(progress >= 10 and progress < 20) then
DespawnMob(ID.mob[58].AMNAF_BLU, instance);
elseif(progress == 24) then
local v = instance:getEntity(bit.band(ID.mob[58].NAJA, 0xFFF), dsp.objType.MOB)
v:setLocalVar("ready",0);
v:setLocalVar("Stage",2);
SpawnMob(ID.mob[58].AMNAF_BLU, instance);
elseif(progress >= 30 and progress < 40) then
DespawnMob(ID.mob[58].AMNAF_BLU, instance);
elseif(progress == 48) then
SpawnMob(ID.mob[58].AMNAF_PSYCHEFLAYER, instance);
local v = instance:getEntity(bit.band(ID.mob[58].NAJA, 0xFFF), dsp.objType.MOB)
v:setLocalVar("ready",0);
v:setLocalVar("Stage",3);
local npcs = instance:getNpcs();
for i,v in pairs(npcs) do
if(v:getID() == ID.npc._259) then
v:setAnimation(8);
end
end
elseif(progress == 50) then
instance:complete();
end
end;
function onInstanceComplete(instance)
local chars = instance:getChars();
for i,v in pairs(chars) do
if (v:getCurrentMission(TOAU) == dsp.mission.id.toau.PATH_OF_DARKNESS and v:getCharVar("AhtUrganStatus") == 1) then
v:setCharVar("AhtUrganStatus", 2);
end
v:setPos(0,0,0,0,72);
end
end;
function onEventUpdate(player,csid,option)
end
function onEventFinish(player,csid,option)
end | gpl-3.0 |
destdev/ygopro-scripts | c25880422.lua | 4 | 1084 | --『攻撃』封じ
function c25880422.initial_effect(c)
--Activate
local e1=Effect.CreateEffect(c)
e1:SetCategory(CATEGORY_POSITION)
e1:SetType(EFFECT_TYPE_ACTIVATE)
e1:SetProperty(EFFECT_FLAG_CARD_TARGET)
e1:SetCode(EVENT_FREE_CHAIN)
e1:SetTarget(c25880422.target)
e1:SetOperation(c25880422.activate)
c:RegisterEffect(e1)
end
function c25880422.filter(c)
return c:IsPosition(POS_FACEUP_ATTACK) and c:IsCanChangePosition()
end
function c25880422.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
if chkc then return chkc:IsLocation(LOCATION_MZONE) and chkc:IsControler(1-tp) and c25880422.filter(chkc) end
if chk==0 then return Duel.IsExistingTarget(c25880422.filter,tp,0,LOCATION_MZONE,1,nil) end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_FACEUP)
local g=Duel.SelectTarget(tp,c25880422.filter,tp,0,LOCATION_MZONE,1,1,nil)
Duel.SetOperationInfo(0,CATEGORY_POSITION,g,1,0,0)
end
function c25880422.activate(e,tp,eg,ep,ev,re,r,rp)
local tc=Duel.GetFirstTarget()
if tc:IsRelateToEffect(e) and tc:IsPosition(POS_FACEUP_ATTACK) then
Duel.ChangePosition(tc,POS_FACEUP_DEFENSE)
end
end
| gpl-2.0 |
Deadwing888/darkstar | scripts/zones/Giddeus/npcs/Harvesting_Point.lua | 13 | 1059 | -----------------------------------
-- Area: Giddeus
-- NPC: Harvesting Point
-----------------------------------
package.loaded["scripts/zones/Giddeus/TextIDs"] = nil;
-------------------------------------
require("scripts/globals/harvesting");
require("scripts/zones/Giddeus/TextIDs");
-----------------------------------
-- onTrade
-----------------------------------
function onTrade(player,npc,trade)
startHarvesting(player,player:getZoneID(),npc,trade,0x0046);
end;
-----------------------------------
-- onTrigger
-----------------------------------
function onTrigger(player,npc)
player:messageSpecial(HARVESTING_IS_POSSIBLE_HERE,1020);
end;
-----------------------------------
-- onEventUpdate
-----------------------------------
function onEventUpdate(player,csid,option)
--printf("CSID: %u",csid);
--printf("RESULT: %u",option);
end;
-----------------------------------
-- onEventFinish
-----------------------------------
function onEventFinish(player,csid,option)
--printf("CSID: %u",csid);
--printf("RESULT: %u",option);
end; | gpl-3.0 |
SIGNALTEAM/SignalTG | plugins/Warn.lua | 9 | 7697 | local function warn_by_username(extra, success, result) -- /warn <@username>
if success == 1 then
local msg = result
local target = extra.target
local receiver = extra.receiver
local hash = 'warn:'..target
local value = redis:hget(hash, msg.id)
local text = ''
local name = ''
if msg.first_name then
name = string.sub(msg.first_name, 1, 40)
else
name = string.sub(msg.last_name, 1, 40)
end
----------------------------------
if is_momod2(msg.id, target) and not is_admin2(extra.fromid) then
return send_msg(receiver, 'شما نمیتوانید به مدیر گروه اخطار بدهید!', ok_cb, false) end
--endif--
if is_admin2(msg.id) then return send_msg(receiver, 'شما نمیتوانید به ادمین ربات اخطار بدهید!', ok_cb, false) end
--endif--
if value then
if value == '1' then
redis:hset(hash, msg.id, '2')
text = '[ '..name..' ]\n شما به دلیل رعایت نکردن قوانین اخطار دریافت میکنید\nتعداد اخطار های شما : ۲/۴'
elseif value == '2' then
redis:hset(hash, msg.id, '3')
text = '[ '..name..' ]\n شما به دلیل رعایت نکردن قوانین اخطار دریافت میکنید\nتعداد اخطار های شما : ۳/۴'
elseif value == '3' then
redis:hdel(hash, msg.id, '0')
local hash = 'banned:'..target
redis:sadd(hash, msg.id)
text = '[ '..name..' ]\n به دلیل رعایت نکردن قوانین از گروه اخراج شد (banned)\nتعداد اخطار ها : ۴/۴'
chat_del_user(receiver, 'user#id'..msg.id, ok_cb, false)
end
else
redis:hset(hash, msg.id, '1')
text = '[ '..name..' ]\n شما به دلیل رعایت نکردن قوانین اخطار دریافت میکنید\nتعداد اخطار های شما : ۱/۴'
end
send_msg(receiver, text, ok_cb, false)
else
send_msg(receiver, ' نام کاربری پیدا نشد.', ok_cb, false)
end
end
--
local function warn_by_reply(extra, success, result) -- (on reply) /warn
local msg = result
local target = extra.target
local receiver = extra.receiver
local hash = 'warn:'..msg.to.id
local value = redis:hget(hash, msg.from.id)
local text = ''
local name = ''
if msg.from.first_name then
name = string.sub(msg.from.first_name, 1, 40)
else
name = string.sub(msg.from.last_name, 1, 40)
end
----------------------------------
if is_momod2(msg.from.id, msg.to.id) and not is_admin2(extra.fromid) then
return send_msg(receiver, 'شما نمیتوانید به مدیر گروه اخطار بدهید!', ok_cb, false) end
--endif--
if is_admin2(msg.from.id) then return send_msg(receiver, 'شما نمیتوانید به ادمین ربات اخطار بدهید!', ok_cb, false) end
--endif--
if value then
if value == '1' then
redis:hset(hash, msg.from.id, '2')
text = '[ '..name..' ]\n .شما به دلیل رعایت نکردن قوانین اخطار دریافت میکنید\nتعداد اخطار های شما : ۲/۴'
elseif value == '2' then
redis:hset(hash, msg.from.id, '3')
text = '[ '..name..' ]\n شما به دلیل رعایت نکردن قوانین اخطار دریافت میکنید.\nتعداد اخطار های شما : ۳/۴'
elseif value == '3' then
redis:hdel(hash, msg.from.id, '0')
text = '[ '..name..' ]\n به دلیل رعایت نکردن قوانین از گروه اخراج شد. (banned)\nتعداد اخطار ها : ۴/۴'
local hash = 'banned:'..target
redis:sadd(hash, msg.from.id)
chat_del_user(receiver, 'user#id'..msg.from.id, ok_cb, false)
end
else
redis:hset(hash, msg.from.id, '1')
text = '[ '..name..' ]\n شما به دلیل رعایت نکردن قوانین اخطار دریافت میکنید.\nتعداد اخطار های شما : ۱/۴'
end
reply_msg(extra.Reply, text, ok_cb, false)
end
--
local function unwarn_by_username(extra, success, result) -- /unwarn <@username>
if success == 1 then
local msg = result
local target = extra.target
local receiver = extra.receiver
local hash = 'warn:'..target
local value = redis:hget(hash, msg.id)
local text = ''
----------------------------------
if is_momod2(msg.id, target) and not is_admin2(extra.fromid) then return end
--endif--
if is_admin2(msg.id) then return end
--endif--
if value then
redis:hdel(hash, msg.id, '0')
text = 'اخطار های کاربر ('..msg.id..') پاک شد\nتعداد اخطار ها : ۰/۴'
else
text = 'این کاربر اخطاری دریافت نکرده است'
end
send_msg(receiver, text, ok_cb, false)
else
send_msg(receiver, ' نام کاربری پیدا نشد.', ok_cb, false)
end
end
--
local function unwarn_by_reply(extra, success, result) -- (on reply) /unwarn
local msg = result
local target = extra.target
local receiver = extra.receiver
local hash = 'warn:'..msg.to.id
local value = redis:hget(hash, msg.from.id)
local text = ''
----------------------------------
if is_momod2(msg.from.id, msg.to.id) and not is_admin2(extra.fromid) then
return end
--endif--
if is_admin2(msg.from.id) then return end
--endif--
if value then
redis:hdel(hash, msg.from.id, '0')
text = 'اخطار های کاربر ('..msg.from.id..') پاک شد\nتعداد اخطار ها : ۰/۴'
else
text = 'این کاربر اخطاری دریافت نکرده است'
end
reply_msg(extra.Reply, text, ok_cb, false)
end
--
local function run(msg, matches)
local target = msg.to.id
local fromid = msg.from.id
local user = matches[2]
local target = msg.to.id
local receiver = get_receiver(msg)
if msg.to.type == 'user' then return end
--endif--
if not is_momod(msg) then return 'شما مدیر نیستید' end
--endif--
----------------------------------
if matches[1]:lower() == 'warn' and not matches[2] then -- (on reply) /warn
if msg.reply_id then
local Reply = msg.reply_id
msgr = get_message(msg.reply_id, warn_by_reply, {receiver=receiver, Reply=Reply, target=target, fromid=fromid})
else return 'از نام کاربری یا ریپلی کردن پیام کاربر برای اخطار دادن استفاده کنید' end
--endif--
end
if matches[1]:lower() == 'warn' and matches[2] then -- /warn <@username>
if string.match(user, '^%d+$') then
return 'از نام کاربری یا ریپلی کردن پیام کاربر برای اخطار دادن استفاده کنید'
elseif string.match(user, '^@.+$') then
username = string.gsub(user, '@', '')
msgr = res_user(username, warn_by_username, {receiver=receiver, user=user, target=target, fromid=fromid})
end
end
if matches[1]:lower() == 'unwarn' and not matches[2] then -- (on reply) /unwarn
if msg.reply_id then
local Reply = msg.id
msgr = get_message(msg.reply_id, unwarn_by_reply, {receiver=receiver, Reply=Reply, target=target, fromid=fromid})
else return 'از نام کاربری یا ریپلی کردن استفاده کنید' end
--endif--
end
if matches[1]:lower() == 'unwarn' and matches[2] then -- /unwarn <@username>
if string.match(user, '^%d+$') then
return 'از نام کاربری یا ریپلی کردن استفاده کنید'
elseif string.match(user, '^@.+$') then
username = string.gsub(user, '@', '')
msgr = res_user(username, unwarn_by_username, {receiver=receiver, user=user, target=target, fromid=fromid})
end
end
end
return {
patterns = {
"^[!/#]([Ww][Aa][Rr][Nn])$",
"^[!/#]([Ww][Aa][Rr][Nn]) (.*)$",
"^[!/#]([Uu][Nn][Ww][Aa][Rr][Nn])$",
"^[!/#]([Uu][Nn][Ww][Aa][Rr][Nn]) (.*)$"
},
run = run
}
--By Arian
| gpl-2.0 |
destdev/ygopro-scripts | c77826734.lua | 2 | 1350 | --ペンデュラム・リボーン
function c77826734.initial_effect(c)
--Activate
local e1=Effect.CreateEffect(c)
e1:SetCategory(CATEGORY_SPECIAL_SUMMON)
e1:SetType(EFFECT_TYPE_ACTIVATE)
e1:SetCode(EVENT_FREE_CHAIN)
e1:SetTarget(c77826734.target)
e1:SetOperation(c77826734.activate)
c:RegisterEffect(e1)
end
function c77826734.filter(c,e,tp)
return c:IsType(TYPE_PENDULUM) and (c:IsLocation(LOCATION_GRAVE) or c:IsFaceup())
and c:IsCanBeSpecialSummoned(e,0,tp,false,false)
end
function c77826734.target(e,tp,eg,ep,ev,re,r,rp,chk)
local loc=0
if Duel.GetLocationCount(tp,LOCATION_MZONE)>0 then loc=loc+LOCATION_GRAVE end
if Duel.GetLocationCountFromEx(tp)>0 then loc=loc+LOCATION_EXTRA end
if chk==0 then return loc~=0 and Duel.IsExistingMatchingCard(c77826734.filter,tp,loc,0,1,nil,e,tp) end
Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,loc)
end
function c77826734.activate(e,tp,eg,ep,ev,re,r,rp)
local loc=0
if Duel.GetLocationCount(tp,LOCATION_MZONE)>0 then loc=loc+LOCATION_GRAVE end
if Duel.GetLocationCountFromEx(tp)>0 then loc=loc+LOCATION_EXTRA end
if loc==0 then return end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON)
local g=Duel.SelectMatchingCard(tp,aux.NecroValleyFilter(c77826734.filter),tp,loc,0,1,1,nil,e,tp)
if g:GetCount()>0 then
Duel.SpecialSummon(g,0,tp,tp,false,false,POS_FACEUP)
end
end
| gpl-2.0 |
Deadwing888/darkstar | scripts/globals/spells/bluemagic/metallic_body.lua | 45 | 1520 | -----------------------------------------
-- Spell: Metallic Body
-- Absorbs an certain amount of damage from physical and magical attacks
-- Spell cost: 19 MP
-- Monster Type: Aquans
-- Spell Type: Magical (Earth)
-- Blue Magic Points: 1
-- Stat Bonus: None
-- Level: 8
-- Casting Time: 7 seconds
-- Recast Time: 60 seconds
-- Duration: 5 minutes
--
-- Combos: Max MP Boost
-----------------------------------------
require("scripts/globals/settings");
require("scripts/globals/status");
require("scripts/globals/bluemagic");
-----------------------------------------
-- OnMagicCastingCheck
-----------------------------------------
function onMagicCastingCheck(caster,target,spell)
return 0;
end;
-----------------------------------------
-- OnSpellCast
-----------------------------------------
function onSpellCast(caster,target,spell)
local typeEffect = EFFECT_STONESKIN
local blueskill = caster:getSkillLevel(BLUE_SKILL);
local power = (blueskill/3) + (caster:getMainLvl()/3) + 10;
local duration = 300;
if (power > 150) then
power = 150;
end;
if (caster:hasStatusEffect(EFFECT_DIFFUSION)) then
local diffMerit = caster:getMerit(MERIT_DIFFUSION);
if (diffMerit > 0) then
duration = duration + (duration/100)* diffMerit;
end;
caster:delStatusEffect(EFFECT_DIFFUSION);
end;
if (target:addStatusEffect(typeEffect,power,0,duration) == false) then
spell:setMsg(75);
end;
return typeEffect;
end; | gpl-3.0 |
destdev/ygopro-scripts | c66994718.lua | 6 | 1133 | --ラプターズ・ガスト
function c66994718.initial_effect(c)
--activate
local e1=Effect.CreateEffect(c)
e1:SetCategory(CATEGORY_NEGATE+CATEGORY_DESTROY)
e1:SetType(EFFECT_TYPE_ACTIVATE)
e1:SetCode(EVENT_CHAINING)
e1:SetProperty(EFFECT_FLAG_DAMAGE_STEP+EFFECT_FLAG_DAMAGE_CAL)
e1:SetCondition(c66994718.condition)
e1:SetTarget(c66994718.target)
e1:SetOperation(c66994718.activate)
c:RegisterEffect(e1)
end
function c66994718.cfilter(c)
return c:IsFaceup() and c:IsSetCard(0xba)
end
function c66994718.condition(e,tp,eg,ep,ev,re,r,rp)
return re:IsHasType(EFFECT_TYPE_ACTIVATE) and Duel.IsChainNegatable(ev)
and Duel.IsExistingMatchingCard(c66994718.cfilter,tp,LOCATION_ONFIELD,0,1,nil)
end
function c66994718.target(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return true end
if re:GetHandler():IsRelateToEffect(re) and re:GetHandler():IsDestructable() then
Duel.SetOperationInfo(0,CATEGORY_DESTROY,re:GetHandler(),1,0,0)
end
end
function c66994718.activate(e,tp,eg,ep,ev,re,r,rp)
if Duel.NegateActivation(ev) and re:GetHandler():IsRelateToEffect(re) then
Duel.Destroy(re:GetHandler(),REASON_EFFECT)
end
end
| gpl-2.0 |
nikai3d/naev | dat/ai/tpl/merchant.lua | 6 | 2284 | include("dat/ai/include/basic.lua")
-- Variables
mem.enemy_close = 500 -- Distance enemy is too close for comfort
-- Required control rate
control_rate = 2
-- Required "control" function
function control ()
task = ai.taskname()
enemy = ai.getenemy()
-- Runaway if enemy is near
if task ~= "runaway" and enemy ~= nil and
(ai.dist(enemy) < mem.enemy_close or ai.haslockon()) then
if task ~= "none" then
ai.poptask()
end
ai.pushtask("runaway",enemy)
-- Try to jump when far enough away
elseif task == "runaway" then
target = ai.target()
-- Check if should still run.
if not target:exists() then
ai.poptask()
return
end
dist = ai.dist( target )
if mem.attacked then
-- Increment distress
if mem.distressed == nil then
mem.distressed = 10 -- Distresses more quickly at first
else
mem.distressed = mem.distressed + 1
end
-- Check to see if should send distress signal.
if mem.distressed > 10 then
sos()
mem.distressed = 1
end
end
-- See if another enemy is closer
if enemy ~= nil and enemy ~= target then
ai.poptask()
ai.pushtask("runaway",enemy)
end
-- Try to jump.
if dist > 400 then
ai.hyperspace()
end
-- Find something to do
elseif task == "none" then
planet = ai.landplanet()
-- planet must exist
if planet == nil then
ai.settimer(0, rnd.int(1000, 3000))
ai.pushtask("enterdelay")
else
mem.land = planet:pos()
ai.pushtask("hyperspace")
ai.pushtask("land")
end
end
end
-- Delays the ship when entering systems so that it doesn't leave right away
function enterdelay ()
if ai.timeup(0) then
ai.pushtask("hyperspace")
end
end
function sos ()
end
-- Required "attacked" function
function attacked ( attacker )
mem.attacked = true
if ai.taskname() ~= "runaway" then
-- Sir Robin bravely ran away
ai.pushtask("runaway", attacker)
else -- run away from the new baddie
ai.poptask()
ai.pushtask("runaway", attacker)
end
end
function create ()
end
| gpl-3.0 |
destdev/ygopro-scripts | c6022371.lua | 2 | 3162 | --ウォーター・ドラゴン-クラスター
function c6022371.initial_effect(c)
c:EnableReviveLimit()
--cannot special summon
local e1=Effect.CreateEffect(c)
e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE+EFFECT_FLAG_UNCOPYABLE)
e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetCode(EFFECT_SPSUMMON_CONDITION)
e1:SetValue(c6022371.splimit)
c:RegisterEffect(e1)
--atk change
local e2=Effect.CreateEffect(c)
e2:SetDescription(aux.Stringid(6022371,0))
e2:SetCategory(CATEGORY_ATKCHANGE)
e2:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O)
e2:SetCode(EVENT_SPSUMMON_SUCCESS)
e2:SetProperty(EFFECT_FLAG_DELAY)
e2:SetTarget(c6022371.atktg)
e2:SetOperation(c6022371.atkop)
c:RegisterEffect(e2)
--spsummon
local e3=Effect.CreateEffect(c)
e3:SetDescription(aux.Stringid(6022371,1))
e3:SetCategory(CATEGORY_SPECIAL_SUMMON)
e3:SetType(EFFECT_TYPE_QUICK_O)
e3:SetCode(EVENT_FREE_CHAIN)
e3:SetRange(LOCATION_MZONE)
e3:SetCost(c6022371.spcost)
e3:SetTarget(c6022371.sptg)
e3:SetOperation(c6022371.spop)
c:RegisterEffect(e3)
end
function c6022371.splimit(e,se,sp,st)
local sc=se:GetHandler()
return sc and sc:IsType(TYPE_SPELL+TYPE_TRAP) and sc:IsSetCard(0x100)
end
function c6022371.atkfilter(c)
return c:IsFaceup() and c:IsType(TYPE_EFFECT)
end
function c6022371.atktg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.IsExistingMatchingCard(c6022371.atkfilter,tp,0,LOCATION_MZONE,1,nil) end
end
function c6022371.atkop(e,tp,eg,ep,ev,re,r,rp)
local g=Duel.GetMatchingGroup(c6022371.atkfilter,tp,0,LOCATION_MZONE,nil)
local tc=g:GetFirst()
while tc do
local e1=Effect.CreateEffect(e:GetHandler())
e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetCode(EFFECT_SET_ATTACK_FINAL)
e1:SetValue(0)
e1:SetReset(RESET_EVENT+RESETS_STANDARD+RESET_PHASE+PHASE_END)
tc:RegisterEffect(e1)
local e2=Effect.CreateEffect(e:GetHandler())
e2:SetType(EFFECT_TYPE_SINGLE)
e2:SetCode(EFFECT_CANNOT_TRIGGER)
e2:SetProperty(EFFECT_FLAG_SINGLE_RANGE)
e2:SetRange(LOCATION_MZONE)
e2:SetReset(RESET_EVENT+RESETS_STANDARD+RESET_PHASE+PHASE_END)
tc:RegisterEffect(e2)
tc=g:GetNext()
end
end
function c6022371.spcost(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return e:GetHandler():IsReleasable() end
Duel.Release(e:GetHandler(),REASON_COST)
end
function c6022371.spfilter(c,e,tp)
return c:IsCode(85066822) and c:IsCanBeSpecialSummoned(e,0,tp,true,false,POS_FACEUP_DEFENSE)
end
function c6022371.sptg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>1
and Duel.IsExistingMatchingCard(c6022371.spfilter,tp,LOCATION_HAND+LOCATION_DECK,0,2,nil,e,tp)
and not Duel.IsPlayerAffectedByEffect(tp,59822133) end
Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,2,tp,LOCATION_HAND+LOCATION_DECK)
end
function c6022371.spop(e,tp,eg,ep,ev,re,r,rp)
if Duel.GetLocationCount(tp,LOCATION_MZONE)<2 then return end
if Duel.IsPlayerAffectedByEffect(tp,59822133) then return end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON)
local g=Duel.SelectMatchingCard(tp,c6022371.spfilter,tp,LOCATION_HAND+LOCATION_DECK,0,2,2,nil,e,tp)
if g:GetCount()==2 then
Duel.SpecialSummon(g,0,tp,tp,true,false,POS_FACEUP_DEFENSE)
end
end
| gpl-2.0 |
kosicki123/forgottenserver | data/talkactions/scripts/deathlist.lua | 43 | 2176 | local function getArticle(str)
return str:find("[AaEeIiOoUuYy]") == 1 and "an" or "a"
end
local function getMonthDayEnding(day)
if day == "01" or day == "21" or day == "31" then
return "st"
elseif day == "02" or day == "22" then
return "nd"
elseif day == "03" or day == "23" then
return "rd"
else
return "th"
end
end
local function getMonthString(m)
return os.date("%B", os.time{year = 1970, month = m, day = 1})
end
function onSay(player, words, param)
local resultId = db.storeQuery("SELECT `id`, `name` FROM `players` WHERE `name` = " .. db.escapeString(param))
if resultId ~= false then
local targetGUID = result.getDataInt(resultId, "id")
local targetName = result.getDataString(resultId, "name")
result.free(resultId)
local str = ""
local breakline = ""
local resultId = db.storeQuery("SELECT `time`, `level`, `killed_by`, `is_player` FROM `player_deaths` WHERE `player_id` = " .. targetGUID .. " ORDER BY `time` DESC")
if resultId ~= false then
repeat
if str ~= "" then
breakline = "\n"
end
local date = os.date("*t", result.getDataInt(resultId, "time"))
local article = ""
local killed_by = result.getDataString(resultId, "killed_by")
if result.getDataInt(resultId, "is_player") == 0 then
article = getArticle(killed_by) .. " "
killed_by = string.lower(killed_by)
end
if date.day < 10 then date.day = "0" .. date.day end
if date.hour < 10 then date.hour = "0" .. date.hour end
if date.min < 10 then date.min = "0" .. date.min end
if date.sec < 10 then date.sec = "0" .. date.sec end
str = str .. breakline .. " " .. date.day .. getMonthDayEnding(date.day) .. " " .. getMonthString(date.month) .. " " .. date.year .. " " .. date.hour .. ":" .. date.min .. ":" .. date.sec .. " Died at Level " .. result.getDataInt(resultId, "level") .. " by " .. article .. killed_by .. "."
until not result.next(resultId)
result.free(resultId)
end
if str == "" then
str = "No deaths."
end
player:popupFYI("Deathlist for player, " .. targetName .. ".\n\n" .. str)
else
player:sendCancelMessage("A player with that name does not exist.")
end
return false
end
| gpl-2.0 |
Jokler/JC2MP-Scripts | Racing/client/OBJLoader/cMeshRequester.lua | 2 | 1203 | function OBJLoader.MeshRequester:__init(modelPath , callback , callbackInstance)
self.modelPath = modelPath
self.callback = callback
self.callbackInstance = callbackInstance
Network:Send("OBJLoaderRequest" , modelPath)
self.sub = Network:Subscribe("OBJLoaderReceive" , self , self.Receive)
end
function OBJLoader.MeshRequester:Receive(mesh)
-- Convert the OBJLoader.Mesh into a Model.
local vertices = {}
for n = 1 , #mesh.triangleData do
local triangleData = mesh.triangleData[n]
local vert1 = mesh.vertices[triangleData[1][1]]
local vert2 = mesh.vertices[triangleData[1][2]]
local vert3 = mesh.vertices[triangleData[1][3]]
table.insert(vertices , Vertex(vert1 , mesh.colors[triangleData[2]]))
table.insert(vertices , Vertex(vert2 , mesh.colors[triangleData[2]]))
table.insert(vertices , Vertex(vert3 , mesh.colors[triangleData[2]]))
end
local model = Model.Create(vertices)
model:SetTopology(Topology.TriangleList)
-- Call our callback function with the model.
if self.callbackInstance then
self.callback(self.callbackInstance , model , mesh.name)
else
self.callback(model , mesh.name)
end
-- Unsubscribe from our network event.
Network:Unsubscribe(self.sub)
end
| mit |
Seadragon91/SkyBlock | SkyBlock.lua | 1 | 8559 | -- SkyBlock plugin for cuberite.
-- Before starting the server, you need to add a (configurable world name in Config.ini)
-- world in the settings.ini under the section [Worlds]
-- Example: World=skyblock
PLUGIN = nil
ISLAND_NUMBER = nil -- Gets increased, before a new island is created
ISLAND_DISTANCE = nil -- Distance betweens the islands
ISLAND_SCHEMATIC = nil -- Schematic file for islands
SPAWN_SCHEMATIC = nil -- Schematic file for the spawn
SPAWN_CREATED = nil -- Check value, if spawn has already been created
SKYBLOCK = nil -- Instance of a world
PLAYERS = nil -- A table that contains player uuid and PlayerInfos
ISLANDS = nil -- A table contains island numbers and IslandInfo
WORLD_NAME = nil -- The world that the plugin is using
LEVELS = nil -- Store all levels
CONFIG_FILE = nil -- Config file for SkyBlock
BLOCK_VALUES = nil -- Store the points of block / meta
LANGUAGES = nil -- Contains a list of languages
LANGUAGE_DEFAULT = nil -- Default language file
LANGUAGE_OTHERS = nil -- Enable other language files
ISLAND_AREA = nil -- The island file
ISLAND_RESTART_SCHEDULER = nil -- Scheduler for restarting a island
PATH_PLUGIN_DATA = nil -- Folder to store players, islands folders and config file
ISLAND_GUESTS = nil -- Invite list for island guests
function Initialize(Plugin)
Plugin:SetName("SkyBlock")
Plugin:SetVersion(4)
PLUGIN = Plugin
PATH_PLUGIN_DATA = "PluginData/SkyBlock"
ISLAND_NUMBER = 0
ISLAND_DISTANCE = 96
ISLAND_SCHEMATIC = ""
SPAWN_SCHEMATIC = ""
SPAWN_CREATED = false
PLAYERS = {}
ISLANDS = {}
WORLD_NAME = "skyblock"
LEVELS = {}
CONFIG_FILE = PATH_PLUGIN_DATA .. "/Config.ini"
BLOCK_VALUES = {}
LANGUAGES = {}
LANGUAGE_DEFAULT = "english.ini"
LANGUAGE_OTHERS = 1
ISLAND_GUESTS = {}
-- Load all lua files
LoadLuaFiles()
if (not (cFile:IsFolder(PATH_PLUGIN_DATA))) then
cFile:CreateFolderRecursive(PATH_PLUGIN_DATA)
end
-- Load Config file
LoadConfiguration()
-- Check for world <WORLD NAME>
SKYBLOCK = cRoot:Get():GetWorld(WORLD_NAME)
if (SKYBLOCK == nil) then
LOGERROR("The plugin SkyBlock requires the world " .. WORLD_NAME .. ". Please add this line")
LOGERROR("World=" .. WORLD_NAME)
LOGERROR("to the section [Worlds] in the settings.ini.")
LOGERROR("Then stop and start the server again.")
return false
end
ISLAND_RESTART_SCHEDULER = cIslandRestartScheduler.new()
ISLAND_AREA = cBlockArea()
if not(ISLAND_AREA:LoadFromSchematicFile(PLUGIN:GetLocalFolder() .. "/" .. ISLAND_SCHEMATIC)) then
ISLAND_AREA = nil
end
LoadLanguageFiles()
-- Load the points for block / meta
LoadBlockValues()
-- Load all ChallengeInfos
LoadAllLevels(PLUGIN:GetLocalFolder() .. "/challenges/Config.json")
-- Load all PlayerInfos and IslandInfos from players who are in the world
LoadPlayerInfos()
-- Register hooks
cPluginManager:AddHook(cPluginManager.HOOK_CHUNK_GENERATING, OnChunkGenerating)
cPluginManager:AddHook(cPluginManager.HOOK_PLAYER_DESTROYED, OnPlayerQuit)
cPluginManager:AddHook(cPluginManager.HOOK_PLAYER_SPAWNED, OnPlayerSpawn)
cPluginManager:AddHook(cPluginManager.HOOK_WORLD_STARTED, OnWorldLoaded)
cPluginManager:AddHook(cPluginManager.HOOK_TAKE_DAMAGE, OnTakeDamage)
cPluginManager:AddHook(cPluginManager.HOOK_ENTITY_CHANGED_WORLD, OnPlayerChangedWorld)
-- This below are required for checking the permission in the island area
cPluginManager:AddHook(cPluginManager.HOOK_PLAYER_PLACING_BLOCK, OnBlockPlacing)
cPluginManager:AddHook(cPluginManager.HOOK_PLAYER_LEFT_CLICK, OnPlayerLeftClick)
cPluginManager:AddHook(cPluginManager.HOOK_PLAYER_RIGHT_CLICK, OnPlayerRightClick)
-- Command Bindings
cPluginManager:BindCommand("/skyblock", "skyblock.command", CommandSkyBlock , " - Access to the skyblock plugin")
cPluginManager:BindCommand("/sb", "skyblock.command", CommandSkyBlock , " - Access to the skyblock plugin")
cPluginManager:BindCommand("/island", "skyblock.command", CommandIsland , " - Access to the island commands")
cPluginManager:BindCommand("/is", "skyblock.command", CommandIsland , " - Access to the island commands")
cPluginManager:BindCommand("/challenges", "skyblock.command",
function(a_Split, a_Player)
cChallengeWindow.Open(a_Player)
return true
end,
" - Access to the challenges")
LOG("Initialised " .. Plugin:GetName() .. " v." .. Plugin:GetVersion())
return true
end
function OnDisable()
LOG(PLUGIN:GetName() .. " is shutting down...")
end
function LoadConfiguration()
-- Create players folder
if (not cFile:IsFolder(PATH_PLUGIN_DATA .. "/players/")) then
cFile:CreateFolder(PATH_PLUGIN_DATA .. "/players/")
end
-- Create islands folder
if (not cFile:IsFolder(PATH_PLUGIN_DATA .. "/islands/")) then
cFile:CreateFolder(PATH_PLUGIN_DATA .. "/islands/")
end
local configIni = cIniFile()
configIni:ReadFile(CONFIG_FILE)
ISLAND_NUMBER = configIni:GetValueSetI("Island", "Number", 0)
ISLAND_DISTANCE = configIni:GetValueSetI("Island", "Distance", 96)
ISLAND_SCHEMATIC = "schematics/" .. configIni:GetValueSet("Schematic", "Island", "island.schematic")
SPAWN_SCHEMATIC = "schematics/" .. configIni:GetValueSet("Schematic", "Spawn", "spawn.schematic")
WORLD_NAME = configIni:GetValueSet("General", "Worldname", "skyblock")
SPAWN_CREATED = configIni:GetValueSetB("PluginValues", "SpawnCreated", false)
LANGUAGE_DEFAULT = configIni:GetValueSet("Language", "Default", "english.ini")
LANGUAGE_OTHERS = configIni:GetValueSetB("Language", "EnableOthers", true)
configIni:WriteFile(CONFIG_FILE)
end
-- Save settings who gets changed trough the plugin
function SaveConfiguration()
local configIni = cIniFile()
configIni:ReadFile(CONFIG_FILE)
configIni:SetValue("Island", "Number", ISLAND_NUMBER, true)
configIni:SetValueB("PluginValues", "SpawnCreated", SPAWN_CREATED, true)
configIni:WriteFile(CONFIG_FILE)
end
-- Only for the world that the plugin is using
function LoadPlayerInfos()
SKYBLOCK:ForEachPlayer(
function(a_Player)
GetPlayerInfo(a_Player)
end);
end
-- Loads all level challenges
function LoadAllLevels(a_File)
local fileLevels = io.open(a_File, "rb")
local content = fileLevels:read("*a")
fileLevels:close()
local jsonLevels = cJson:Parse(content)
for counter = 1, #jsonLevels.levels do
local levelName = jsonLevels.levels[counter]
LEVELS[counter] = cLevel.new(levelName, jsonLevels[levelName])
end
end
function LoadBlockValues()
local f = io.open(PLUGIN:GetLocalFolder() .. "/blockvalues.txt")
while true do
local line = f:read()
if (line == nil) then break end
local values = StringSplit(line, ":")
local point = tonumber(values[2])
if (string.find(values[1], "#") == nil) then
local id = tonumber(values[1])
BLOCK_VALUES[id] = {}
BLOCK_VALUES[id][0] = point
else
local idMeta = StringSplit(values[1], "#")
local id = tonumber(idMeta[1])
local meta = tonumber(idMeta[2])
if (BLOCK_VALUES[id] == nil) then
BLOCK_VALUES[id] = {}
end
BLOCK_VALUES[id][meta] = point
end
end
f:close()
end
function LoadLanguageFiles()
if not cFile:IsFile(PATH_PLUGIN_DATA .. "/languages/english.ini") then
if not cFile:IsFolder(PATH_PLUGIN_DATA .. "/languages/") then
cFile:CreateFolder(PATH_PLUGIN_DATA .. "/languages/")
end
-- Copy other language files
local files = cFile:GetFolderContents(PLUGIN:GetLocalFolder() .. "/languages")
for _, file in pairs(files) do
if (string.sub(file, #file -3, #file) == ".ini") then
if not cFile:IsFile(PATH_PLUGIN_DATA .. "/languages/" .. file) then
cFile:Copy(PLUGIN:GetLocalFolder() .. "/languages/" .. file, PATH_PLUGIN_DATA .. "/languages/" .. file)
end
end
end
-- Write english language file
LANGUAGES["english.ini"] = cLanguage.new()
if (LANGUAGE_DEFAULT ~= "english.ini") then
LANGUAGES[LANGUAGE_DEFAULT] = cLanguage.new(LANGUAGE_DEFAULT)
end
return
end
if (LANGUAGE_OTHERS) then
local files = cFile:GetFolderContents(PATH_PLUGIN_DATA .. "/languages")
for i = 1, #files do
if (cFile:IsFile(PATH_PLUGIN_DATA .. "/languages/" .. files[i])) then
LANGUAGES[files[i]] = cLanguage.new(files[i])
end
end
else
LANGUAGES[LANGUAGE_DEFAULT] = cLanguage.new(LANGUAGE_DEFAULT)
end
end
function LoadLuaFiles()
local folders = { "/code", "/code/classes", "/code/commands", "/code/API" }
for _, folder in pairs(folders) do
local files = cFile:GetFolderContents(PLUGIN:GetLocalFolder() .. folder)
for _, file in pairs(files) do
if (string.sub(file, #file -3, #file) == ".lua") then
dofile(PLUGIN:GetLocalFolder() .. folder .. "/" .. file)
end
end
end
end
| apache-2.0 |
destdev/ygopro-scripts | c98585345.lua | 3 | 1897 | --ハネクリボー LV10
function c98585345.initial_effect(c)
c:EnableReviveLimit()
--cannot special summon
local e1=Effect.CreateEffect(c)
e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE+EFFECT_FLAG_UNCOPYABLE)
e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetCode(EFFECT_SPSUMMON_CONDITION)
e1:SetValue(aux.FALSE)
c:RegisterEffect(e1)
--destroy
local e2=Effect.CreateEffect(c)
e2:SetDescription(aux.Stringid(98585345,0))
e2:SetCategory(CATEGORY_DESTROY)
e2:SetType(EFFECT_TYPE_QUICK_O)
e2:SetCode(EVENT_FREE_CHAIN)
e2:SetHintTiming(TIMING_BATTLE_PHASE)
e2:SetRange(LOCATION_MZONE)
e2:SetCondition(c98585345.descon)
e2:SetCost(c98585345.descost)
e2:SetTarget(c98585345.destg)
e2:SetOperation(c98585345.desop)
c:RegisterEffect(e2)
end
c98585345.lvdncount=1
c98585345.lvdn={33776734}
function c98585345.descon(e,tp,eg,ep,ev,re,r,rp)
return Duel.GetTurnPlayer()~=tp and (Duel.GetCurrentPhase()>=PHASE_BATTLE_START and Duel.GetCurrentPhase()<=PHASE_BATTLE)
end
function c98585345.descost(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return e:GetHandler():IsReleasable() end
Duel.Release(e:GetHandler(),REASON_COST)
end
function c98585345.dfilter(c)
return c:IsAttackPos()
end
function c98585345.destg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.IsExistingMatchingCard(c98585345.dfilter,tp,0,LOCATION_MZONE,1,nil) end
local g=Duel.GetMatchingGroup(c98585345.dfilter,tp,0,LOCATION_MZONE,nil)
Duel.SetOperationInfo(0,CATEGORY_DESTROY,g,g:GetCount(),0,0)
Duel.SetOperationInfo(0,CATEGORY_DAMAGE,nil,0,1-tp,0)
end
function c98585345.desop(e,tp,eg,ep,ev,re,r,rp)
local g=Duel.GetMatchingGroup(c98585345.dfilter,tp,0,LOCATION_MZONE,nil)
Duel.Destroy(g,REASON_EFFECT)
local dg=Duel.GetOperatedGroup()
local tc=dg:GetFirst()
local dam=0
while tc do
local atk=tc:GetTextAttack()
if atk<0 then atk=0 end
dam=dam+atk
tc=dg:GetNext()
end
Duel.Damage(1-tp,dam,REASON_EFFECT)
end
| gpl-2.0 |
destdev/ygopro-scripts | c87257460.lua | 1 | 3909 | --魅惑の女王 LV3
function c87257460.initial_effect(c)
--equip
local e1=Effect.CreateEffect(c)
e1:SetDescription(aux.Stringid(87257460,0))
e1:SetCategory(CATEGORY_EQUIP)
e1:SetType(EFFECT_TYPE_IGNITION)
e1:SetProperty(EFFECT_FLAG_CARD_TARGET)
e1:SetRange(LOCATION_MZONE)
e1:SetCountLimit(1)
e1:SetCondition(c87257460.eqcon)
e1:SetTarget(c87257460.eqtg)
e1:SetOperation(c87257460.eqop)
c:RegisterEffect(e1)
--special summon
local e2=Effect.CreateEffect(c)
e2:SetDescription(aux.Stringid(87257460,1))
e2:SetCategory(CATEGORY_SPECIAL_SUMMON)
e2:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_O)
e2:SetRange(LOCATION_MZONE)
e2:SetCode(EVENT_PHASE+PHASE_STANDBY)
e2:SetCondition(c87257460.spcon)
e2:SetCost(c87257460.spcost)
e2:SetTarget(c87257460.sptg)
e2:SetOperation(c87257460.spop)
e2:SetLabelObject(e1)
c:RegisterEffect(e2)
end
c87257460.lvupcount=1
c87257460.lvup={23756165}
function c87257460.eqcon(e,tp,eg,ep,ev,re,r,rp)
local ec=e:GetLabelObject()
return ec==nil or ec:GetFlagEffect(87257460)==0
end
function c87257460.filter(c)
return c:IsLevelBelow(3) and c:IsFaceup() and c:IsAbleToChangeControler()
end
function c87257460.eqtg(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
if chkc then return chkc:IsLocation(LOCATION_MZONE) and chkc:IsControler(1-tp) and c87257460.filter(chkc) end
if chk==0 then return Duel.GetLocationCount(tp,LOCATION_SZONE)>0
and Duel.IsExistingTarget(c87257460.filter,tp,0,LOCATION_MZONE,1,nil) end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_EQUIP)
local g=Duel.SelectTarget(tp,c87257460.filter,tp,0,LOCATION_MZONE,1,1,nil)
Duel.SetOperationInfo(0,CATEGORY_EQUIP,g,1,0,0)
end
function c87257460.eqlimit(e,c)
return e:GetOwner()==c and not c:IsDisabled()
end
function c87257460.eqop(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
local tc=Duel.GetFirstTarget()
if tc:IsFaceup() and tc:IsRelateToEffect(e) then
if c:IsFaceup() and c:IsRelateToEffect(e) then
if not Duel.Equip(tp,tc,c,false) then return end
--Add Equip limit
tc:RegisterFlagEffect(87257460,RESET_EVENT+RESETS_STANDARD,0,0)
e:SetLabelObject(tc)
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetProperty(EFFECT_FLAG_COPY_INHERIT+EFFECT_FLAG_OWNER_RELATE)
e1:SetCode(EFFECT_EQUIP_LIMIT)
e1:SetReset(RESET_EVENT+RESETS_STANDARD)
e1:SetValue(c87257460.eqlimit)
tc:RegisterEffect(e1)
local e2=Effect.CreateEffect(c)
e2:SetType(EFFECT_TYPE_EQUIP)
e2:SetCode(EFFECT_DESTROY_SUBSTITUTE)
e2:SetProperty(EFFECT_FLAG_IGNORE_IMMUNE+EFFECT_FLAG_OWNER_RELATE)
e2:SetReset(RESET_EVENT+RESETS_STANDARD)
e2:SetValue(c87257460.repval)
tc:RegisterEffect(e2)
else Duel.SendtoGrave(tc,REASON_RULE) end
end
end
function c87257460.repval(e,re,r,rp)
return bit.band(r,REASON_BATTLE)~=0
end
function c87257460.spcon(e,tp,eg,ep,ev,re,r,rp)
local ec=e:GetLabelObject():GetLabelObject()
return Duel.GetTurnPlayer()==tp and ec and ec:GetFlagEffect(87257460)~=0
end
function c87257460.spcost(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return e:GetHandler():IsAbleToGraveAsCost() end
Duel.SendtoGrave(e:GetHandler(),REASON_COST)
end
function c87257460.spfilter(c,e,tp)
return c:IsCode(23756165) and c:IsCanBeSpecialSummoned(e,1,tp,true,false)
end
function c87257460.sptg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>-1
and Duel.IsExistingMatchingCard(c87257460.spfilter,tp,LOCATION_HAND+LOCATION_DECK,0,1,nil,e,tp) end
Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_HAND+LOCATION_DECK)
end
function c87257460.spop(e,tp,eg,ep,ev,re,r,rp)
if Duel.GetLocationCount(tp,LOCATION_MZONE)<=0 then return end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON)
local g=Duel.SelectMatchingCard(tp,c87257460.spfilter,tp,LOCATION_HAND+LOCATION_DECK,0,1,1,nil,e,tp)
local tc=g:GetFirst()
if tc then
Duel.SpecialSummon(tc,1,tp,tp,true,false,POS_FACEUP)
tc:CompleteProcedure()
end
end
| gpl-2.0 |
simonfork/aquaria | game_scripts/scripts/maps/_unused/node_memorycrystalscene.lua | 6 | 2197 | -- Copyright (C) 2007, 2010 - Bit-Blot
--
-- This file is part of Aquaria.
--
-- Aquaria 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
if not v then v = {} end
if not AQUARIA_VERSION then dofile("scripts/entities/entityinclude.lua") end
function init(me)
end
function activate(me)
end
function run(me)
if isFlag(FLAG_NAIJA_MEMORYCRYSTAL, 0) then
setFlag(FLAG_NAIJA_MEMORYCRYSTAL, 1)
local n = getNaija()
entity_idle(n)
entity_flipToNode(n, getNode("SAVEPOINT"))
local camNode = getNode("MEMORYCRYSTALCAM1")
local camNode2 = getNode("MEMORYCRYSTALCAM2")
local camNode3 = getNode("MEMORYCRYSTALCAM3")
local camNode4 = getNode("SAVEPOINT")
local camDummy = createEntity("Empty")
entity_warpToNode(camDummy, camNode)
setCameraLerpDelay(1.0)
cam_toEntity(camDummy)
overrideZoom(0.75, 1)
entity_animate(getNaija(), "look45", LOOP_INF, LAYER_HEAD)
entity_swimToNode(camDummy, camNode2, SPEED_SLOW)
entity_watchForPath(camDummy)
voice("naija_memorycrystal")
entity_swimToNode(camDummy, camNode3, SPEED_SLOW)
entity_watchForPath(camDummy)
entity_swimToNode(camDummy, camNode4, SPEED_SLOW)
entity_watchForPath(camDummy)
overrideZoom(0.6, 9)
watch(9)
screenFadeCapture()
--overrideZoom(1, 4)
overrideZoom(0)
setCameraLerpDelay(0.0001)
cam_toEntity(n)
screenFadeGo(6)
watch(6)
entity_idle(n)
setCameraLerpDelay(0)
entity_delete(camDummy)
end
end
function update(me, dt)
if node_isEntityIn(me, getNaija()) then
run(me)
end
end
| gpl-2.0 |
RwNigma/darkstar | scripts/zones/Port_Windurst/npcs/Taniko-Maniko.lua | 36 | 1836 | -----------------------------------
-- Area: Port Windurst
-- NPC: Taniko-Maniko
-- Standard Merchant NPC
-- Confirmed shop stock, August 2013
-----------------------------------
require("scripts/globals/shop");
package.loaded["scripts/zones/Port_Windurst/TextIDs"] = nil;
require("scripts/zones/Port_Windurst/TextIDs");
-----------------------------------
-- onTrade Action
-----------------------------------
function onTrade(player,npc,trade)
end;
-----------------------------------
-- onTrigger Action
-----------------------------------
function onTrigger(player,npc)
player:showText(npc,TANIKOMANIKO_SHOP_DIALOG);
stock = {
0x4181, 2542,1, --Brass Zaghnal
0x4302, 7128,1, --Wrapped Bow
0x43AB, 162,1, --Ice Arrow
0x43AC, 162,1, --Lightning Arrow
0x4015, 104,2, --Cat Baghnakhs
0x4001, 129,2, --Cesti
0x4109, 5864,2, --Bone Pick
0x4301, 482,2, --Self Bow
0x43A6, 3,2, --Wooden Arrow
0x439C, 54,2, --Hawkeye
0x4380, 1575,2, --Boomerang
0x4102, 4198,3, --Bone Axe
0x4180, 309,3, --Bronze Zaghnal
0x41C0, 97,3, --Harpoon
0x4300, 39,3, --Shortbow
0x43A7, 4,3 --Bone Arrow
}
showNationShop(player, WINDURST, 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 |
AenAllAin/factorio-walls | release/n^3_walls_0.0.9/prototypes/entity/concrete-wall.lua | 2 | 8650 | -- Concrete Walls
data:extend (
{
{
type = "wall",
name = "concrete-wall",
icon = "__n^3_walls__/graphics/icons/concrete-wall.png",
flags = {"placeable-neutral", "player-creation"},
collision_box = {{-0.29, -0.29}, {0.29, 0.29}},
selection_box = {{-0.5, -0.5}, {0.5, 0.5}},
minable = {mining_time = 1, result = "concrete-wall"},
fast_replaceable_group = "wall",
max_health = 500,
repair_speed_modifier = 2,
corpse = "wall-remnants",
repair_sound = { filename = "__base__/sound/manual-repair-simple.ogg" },
mined_sound = { filename = "__base__/sound/deconstruct-bricks.ogg" },
vehicle_impact_sound = { filename = "__base__/sound/car-stone-impact.ogg", volume = 1.0 },
resistances =
{
{
type = "physical",
decrease = 10,
percent = 40
},
{
type = "impact",
decrease = 60,
percent = 75
},
{
type = "explosion",
decrease = 20,
percent = 35
},
{
type = "fire",
percent = 100
},
{
type = "laser",
percent = 75
},
{
type = "acid",
percent = 5
}
},
pictures =
{
single =
{
layers =
{
{
filename = "__n^3_walls__/graphics/entity/concrete-wall/wall-single.png",
priority = "extra-high",
width = 22,
height = 42,
shift = {0, -0.15625}
},
{
filename = "__n^3_walls__/graphics/entity/concrete-wall/wall-single-shadow.png",
priority = "extra-high",
width = 47,
height = 32,
shift = {0.359375, 0.5},
draw_as_shadow = true
}
}
},
straight_vertical =
{
{
layers =
{
{
filename = "__n^3_walls__/graphics/entity/concrete-wall/wall-straight-vertical-1.png",
priority = "extra-high",
width = 22,
height = 42,
shift = {0, -0.15625}
},
{
filename = "__n^3_walls__/graphics/entity/concrete-wall/wall-straight-vertical-shadow.png",
priority = "extra-high",
width = 47,
height = 60,
shift = {0.390625, 0.625},
draw_as_shadow = true
}
}
},
{
layers =
{
{
filename = "__n^3_walls__/graphics/entity/concrete-wall/wall-straight-vertical-2.png",
priority = "extra-high",
width = 22,
height = 42,
shift = {0, -0.15625}
},
{
filename = "__n^3_walls__/graphics/entity/concrete-wall/wall-straight-vertical-shadow.png",
priority = "extra-high",
width = 47,
height = 60,
shift = {0.390625, 0.625},
draw_as_shadow = true
}
}
},
{
layers =
{
{
filename = "__n^3_walls__/graphics/entity/concrete-wall/wall-straight-vertical-3.png",
priority = "extra-high",
width = 22,
height = 42,
shift = {0, -0.15625}
},
{
filename = "__n^3_walls__/graphics/entity/concrete-wall/wall-straight-vertical-shadow.png",
priority = "extra-high",
width = 47,
height = 60,
shift = {0.390625, 0.625},
draw_as_shadow = true
}
}
}
},
straight_horizontal =
{
{
layers =
{
{
filename = "__n^3_walls__/graphics/entity/concrete-wall/wall-straight-horizontal-1.png",
priority = "extra-high",
width = 32,
height = 42,
shift = {0, -0.15625}
},
{
filename = "__n^3_walls__/graphics/entity/concrete-wall/wall-straight-horizontal-shadow.png",
priority = "extra-high",
width = 59,
height = 32,
shift = {0.421875, 0.5},
draw_as_shadow = true
}
}
},
{
layers =
{
{
filename = "__n^3_walls__/graphics/entity/concrete-wall/wall-straight-horizontal-2.png",
priority = "extra-high",
width = 32,
height = 42,
shift = {0, -0.15625}
},
{
filename = "__n^3_walls__/graphics/entity/concrete-wall/wall-straight-horizontal-shadow.png",
priority = "extra-high",
width = 59,
height = 32,
shift = {0.421875, 0.5},
draw_as_shadow = true
}
}
},
{
layers =
{
{
filename = "__n^3_walls__/graphics/entity/concrete-wall/wall-straight-horizontal-3.png",
priority = "extra-high",
width = 32,
height = 42,
shift = {0, -0.15625}
},
{
filename = "__n^3_walls__/graphics/entity/concrete-wall/wall-straight-horizontal-shadow.png",
priority = "extra-high",
width = 59,
height = 32,
shift = {0.421875, 0.5},
draw_as_shadow = true
}
}
}
},
corner_right_down =
{
layers =
{
{
filename = "__n^3_walls__/graphics/entity/concrete-wall/wall-corner-right-down.png",
priority = "extra-high",
width = 27,
height = 42,
shift = {0.078125, -0.15625}
},
{
filename = "__n^3_walls__/graphics/entity/concrete-wall/wall-corner-right-down-shadow.png",
priority = "extra-high",
width = 53,
height = 61,
shift = {0.484375, 0.640625},
draw_as_shadow = true
}
}
},
corner_left_down =
{
layers =
{
{
filename = "__n^3_walls__/graphics/entity/concrete-wall/wall-corner-left-down.png",
priority = "extra-high",
width = 27,
height = 42,
shift = {-0.078125, -0.15625}
},
{
filename = "__n^3_walls__/graphics/entity/concrete-wall/wall-corner-left-down-shadow.png",
priority = "extra-high",
width = 53,
height = 60,
shift = {0.328125, 0.640625},
draw_as_shadow = true
}
}
},
t_up =
{
layers =
{
{
filename = "__n^3_walls__/graphics/entity/concrete-wall/wall-t-down.png",
priority = "extra-high",
width = 32,
height = 42,
shift = {0, -0.15625}
},
{
filename = "__n^3_walls__/graphics/entity/concrete-wall/wall-t-down-shadow.png",
priority = "extra-high",
width = 71,
height = 61,
shift = {0.546875, 0.640625},
draw_as_shadow = true
}
}
},
ending_right =
{
layers =
{
{
filename = "__n^3_walls__/graphics/entity/concrete-wall/wall-ending-right.png",
priority = "extra-high",
width = 27,
height = 42,
shift = {0.078125, -0.15625}
},
{
filename = "__n^3_walls__/graphics/entity/concrete-wall/wall-ending-right-shadow.png",
priority = "extra-high",
width = 53,
height = 32,
shift = {0.484375, 0.5},
draw_as_shadow = true
}
}
},
ending_left =
{
layers =
{
{
filename = "__n^3_walls__/graphics/entity/concrete-wall/wall-ending-left.png",
priority = "extra-high",
width = 27,
height = 42,
shift = {-0.078125, -0.15625}
},
{
filename = "__n^3_walls__/graphics/entity/concrete-wall/wall-ending-left-shadow.png",
priority = "extra-high",
width = 53,
height = 32,
shift = {0.328125, 0.5},
draw_as_shadow = true
}
}
}
}
},
}
)
| gpl-3.0 |
ffxijuggalo/darkstar | scripts/globals/mobskills/pelagic_tempest.lua | 11 | 1182 | ---------------------------------------------
-- Pelagic Tempest
--
-- Description: Delivers an area attack that inflicts Shock and Terror.
-- Type: Physical?
-- Utsusemi/Blink absorb: Ignores shadows
-- Range: 10' cone
-- Notes: Used by Murex affiliated with lightning element. Shock effect is fairly strong (28/tick).
---------------------------------------------
require("scripts/globals/settings")
require("scripts/globals/status")
require("scripts/globals/monstertpmoves")
---------------------------------------------
function onMobSkillCheck(target,mob,skill)
return 0
end
function onMobWeaponSkill(target, mob, skill)
local numhits = 1
local accmod = 2
local dmgmod = 3
local info = MobPhysicalMove(mob,target,skill,numhits,accmod,dmgmod,TP_NO_EFFECT)
local dmg = MobFinalAdjustments(info.dmg,mob,skill,target,dsp.attackType.PHYSICAL,dsp.damageType.BLUNT,info.hitslanded)
MobPhysicalStatusEffectMove(mob, target, skill, dsp.effect.SHOCK, 28, 3, 180)
MobPhysicalStatusEffectMove(mob, target, skill, dsp.effect.TERROR, 1, 0, 180)
target:takeDamage(dmg, mob, dsp.attackType.PHYSICAL, dsp.damageType.BLUNT)
return dmg
end
| gpl-3.0 |
ffxijuggalo/darkstar | scripts/zones/Southern_San_dOria/npcs/Nokkhi_Jinjahl.lua | 12 | 5151 | -----------------------------------
-- Area: Southern San d'Oria
-- NPC: Nokkhi Jinjahl
-- Type: Travelling Merchant NPC / NPC Quiver Maker / San d'Oria 1st Place
-- !pos 23 2 -13 230
-----------------------------------
local ID = require("scripts/zones/Southern_San_dOria/IDs");
-----------------------------------
function onTrade(player,npc,trade)
local ammoList =
{
{21307, 6199}, -- arrow, achiyalabopa
{21306, 6200}, -- arrow, adlivun
{19195, 5819}, -- arrow, antlion
{18154, 4221}, -- arrow, beetle
{21309, 6137}, -- arrow, chapuli
{18159, 4224}, -- arrow, demon
{21302, 6269}, -- arrow, eminent
{19800, 5912}, -- arrow, gargouille
{18156, 4222}, -- arrow, horn
{17320, 4225}, -- arrow, iron
{17325, 5332}, -- arrow, kabura
{21308, 6138}, -- arrow, mantid
{21303, 6280}, -- arrow, ra'kaznar
{21304, 6202}, -- arrow, raaz
{19182, 5871}, -- arrow, ruszor
{18155, 4223}, -- arrow, scorpion
{17321, 4226}, -- arrow, silver
{18158, 5333}, -- arrow, sleep
{17330, 4219}, -- arrow, stone
{21305, 6201}, -- arrow, tulfaire
{21314, 6278}, -- bolt, abrasion
{21321, 6203}, -- bolt, achiyalabopa
{18148, 5335}, -- bolt, acid
{19801, 5913}, -- bolt, adaman
{21320, 6204}, -- bolt, adlivun
{21318, 6206}, -- bolt, bismuth
{18150, 5334}, -- bolt, blind
{18151, 5339}, -- bolt, bloody
{21322, 6140}, -- bolt, damascus
{19183, 5872}, -- bolt, dark adaman
{19196, 5820}, -- bolt, darkling
{17338, 4229}, -- bolt, darksteel
{21316, 6270}, -- bolt, eminent
{19197, 5821}, -- bolt, fusion
{21313, 6310}, -- bolt, gashing
{18153, 5336}, -- bolt, holy
{21324, 6139}, -- bolt, midrium
{17337, 4228}, -- bolt, mythril
{21323, 6141}, -- bolt, oxidant
{21317, 6281}, -- bolt, ra'kaznar
{21315, 6279}, -- bolt, righteous
{18149, 5337}, -- bolt, sleep
{21319, 6205}, -- bolt, titanium
{18152, 5338}, -- bolt, venom
{19803, 5915}, -- bullet, adaman
{21336, 6208}, -- bullet, adlivun
{21337, 6207}, -- bullet, achiyalabopa
{17340, 5363}, -- bullet
{21333, 6210}, -- bullet, bismuth
{17343, 5359}, -- bullet, bronze
{21338, 6143}, -- bullet, damascus
{19184, 5873}, -- bullet, dark adaman
{21330, 6311}, -- bullet, decimating
{21328, 6437}, -- bullet, divine
{19198, 5822}, -- bullet, dweomer
{21331, 6271}, -- bullet, eminent
{17312, 5353}, -- bullet, iron
{19802, 5914}, -- bullet, orichalcum
{19199, 5823}, -- bullet, oberon's
{21332, 6282}, -- bullet, ra'kaznar
{17341, 5340}, -- bullet, silver
{18723, 5416}, -- bullet, steel
{18160, 5341}, -- bullet, spartan
{21335, 6209}, -- bullet, titanium
{2176, 5402}, -- card, fire
{2177, 5403}, -- card, ice
{2178, 5404}, -- card, wind
{2179, 5405}, -- card, earth
{2180, 5406}, -- card, thunder
{2181, 5407}, -- card, water
{2182, 5408}, -- card, light
{2183, 5409}, -- card, dark
};
local carnationsNeeded = 0;
local giveToPlayer = {};
-- check for invalid items
for i = 0,8,1 do
local itemId = trade:getItemId(i);
if (itemId > 0 and itemId ~= 948) then
local validSlot = false;
for k, v in pairs(ammoList) do
if (v[1] == itemId) then
local itemQty = trade:getSlotQty(i);
if (itemQty % 99 ~= 0) then
player:messageSpecial(ID.text.NOKKHI_BAD_COUNT);
return;
end;
local stacks = itemQty / 99;
carnationsNeeded = carnationsNeeded + stacks;
giveToPlayer[#giveToPlayer+1] = {v[2], stacks};
validSlot = true;
break;
end
end
if (not validSlot) then
player:messageSpecial(ID.text.NOKKHI_BAD_ITEM);
return;
end
end
end
-- check for correct number of carnations
if (carnationsNeeded == 0 or trade:getItemQty(948) ~= carnationsNeeded) then
player:messageSpecial(ID.text.NOKKHI_BAD_COUNT);
return;
end
-- check for enough inventory space
if (player:getFreeSlotsCount() < carnationsNeeded) then
player:messageSpecial(ID.text.ITEM_CANNOT_BE_OBTAINED, giveToPlayer[1][1]);
return;
end
-- make the trade
player:messageSpecial(ID.text.NOKKHI_GOOD_TRADE);
for k, v in pairs(giveToPlayer) do
player:addItem(v[1], v[2]);
player:messageSpecial(ID.text.ITEM_OBTAINED,v[1]);
end
player:tradeComplete();
end;
function onTrigger(player,npc)
player:startEvent(683,npc:getID());
end;
function onEventUpdate(player,csid,option)
end;
function onEventFinish(player,csid,option)
end
| gpl-3.0 |
ffxijuggalo/darkstar | scripts/zones/Dynamis-Xarcabard/IDs.lua | 9 | 8606 | -----------------------------------
-- Area: Dynamis-Xarcabard
-----------------------------------
require("scripts/globals/keyitems")
require("scripts/globals/dynamis")
require("scripts/globals/zone")
-----------------------------------
zones = zones or {}
zones[dsp.zone.DYNAMIS_XARCABARD] =
{
text =
{
ITEM_CANNOT_BE_OBTAINED = 6382, -- You cannot obtain the <item>. Come back after sorting your inventory.
ITEM_OBTAINED = 6388, -- Obtained: <item>.
GIL_OBTAINED = 6389, -- Obtained <number> gil.
KEYITEM_OBTAINED = 6391, -- Obtained key item: <keyitem>.
CONQUEST_BASE = 7055, -- Tallying conquest results...
DYNAMIS_TIME_BEGIN = 7214, -- The sands of the <item> have begun to fall. You have <number> minutes (Earth time) remaining in Dynamis.
DYNAMIS_TIME_EXTEND = 7215, -- our stay in Dynamis has been extended by <number> minute[/s].
DYNAMIS_TIME_UPDATE_1 = 7216, -- ou will be expelled from Dynamis in <number> [second/minute] (Earth time).
DYNAMIS_TIME_UPDATE_2 = 7217, -- ou will be expelled from Dynamis in <number> [seconds/minutes] (Earth time).
DYNAMIS_TIME_EXPIRED = 7219, -- The sands of the hourglass have emptied...
OMINOUS_PRESENCE = 7230, -- You feel an ominous presence, as if something might happen if you possessed <item>.
ANIMATED_KNUCKLES_DIALOG = 7297, -- I am known as the Fists of Mystics. Come, show me your fighting spirit.
ANIMATED_DAGGER_DIALOG = 7329, -- I am called the Ornate Blade. Now, show me your strength.
ANIMATED_LONGSWORD_DIALOG = 7361, -- People have named me the Holy Blade. I will try thy resolution.
ANIMATED_CLAYMORE_DIALOG = 7393, -- I am the Intricate Blade. Show me the depths of your fury!
ANIMATED_TABAR_DIALOG = 7425, -- Me, axe. Runaeic, Axe. You, die?
ANIMATED_GREATAXE_DIALOG = 7457, -- I have been given the title of Seraphic Axe. Will you attempt to survive my love?
ANIMATED_SPEAR_DIALOG = 7489, -- I am the Stellar Spear. It is time to test your courage.
ANIMATED_SCYTHE_DIALOG = 7521, -- I am known as the Tenebrous Scythe. Overwhelm me with your greed for power.
ANIMATED_KUNAI_DIALOG = 7553, -- I am called the Demoniac Blade. Allow me to witness your technique.
ANIMATED_TACHI_DIALOG = 7585, -- I am the Divine Blade. I demand a test of your will.
ANIMATED_HAMMER_DIALOG = 7617, -- People have named me the Heavenly Hammer. I will test your might to its very limits.
ANIMATED_STAFF_DIALOG = 7649, -- I am called the Celestial Staff. I will glimpse into your mind's eye...
ANIMATED_LONGBOW_DIALOG = 7681, -- I am known as the Snarled Bow. I will measure the limits of your determination.
ANIMATED_GUN_DIALOG = 7713, -- I am known as the Ethereal Rifle. Do you realize my incredible value?
ANIMATED_HORN_DIALOG = 7745, -- I am called the Mysterial Horn. Show me your true intentions.
ANIMATED_SHIELD_DIALOG = 7777, -- I am Aegis, the impervious shield of everlasting.
PRISON_OF_SOULS_HAS_SET_FREE = 7809, -- e prison of souls has set free its captive spirits!
},
mob =
{
TIME_EXTENSION =
{
{minutes = 10, ki = dsp.ki.CRIMSON_GRANULES_OF_TIME, mob = 17330531},
{minutes = 10, ki = dsp.ki.AZURE_GRANULES_OF_TIME, mob = 17330532},
{minutes = 10, ki = dsp.ki.AMBER_GRANULES_OF_TIME, mob = 17330533},
{minutes = 10, ki = dsp.ki.ALABASTER_GRANULES_OF_TIME, mob = 17330534},
{minutes = 20, ki = dsp.ki.OBSIDIAN_GRANULES_OF_TIME, mob = 17330535},
},
REFILL_STATUE =
{
{
{mob = 17330230, eye = dynamis.eye.RED }, -- Adamantking_Effigy
{mob = 17330231, eye = dynamis.eye.GREEN},
},
{
{mob = 17330240, eye = dynamis.eye.RED }, -- Adamantking_Effigy
{mob = 17330241, eye = dynamis.eye.BLUE },
},
{
{mob = 17330248, eye = dynamis.eye.RED }, -- Serjeant_Tombstone
{mob = 17330249, eye = dynamis.eye.GREEN},
},
{
{mob = 17330256, eye = dynamis.eye.RED }, -- Serjeant_Tombstone
{mob = 17330257, eye = dynamis.eye.BLUE },
},
{
{mob = 17330273, eye = dynamis.eye.RED }, -- Avatar_Icon
{mob = 17330274, eye = dynamis.eye.GREEN},
},
{
{mob = 17330285, eye = dynamis.eye.RED }, -- Avatar_Icon
{mob = 17330286, eye = dynamis.eye.BLUE },
},
{
{mob = 17330471, eye = dynamis.eye.RED }, -- Goblin_Replica
{mob = 17330472, eye = dynamis.eye.GREEN},
},
{
{mob = 17330483, eye = dynamis.eye.RED }, -- Goblin_Replica
{mob = 17330484, eye = dynamis.eye.BLUE },
},
},
YING = 17330183,
COUNT_ZAEBOS_PH = {[17330376] = 17330377}, -- Kindred_Warrior
DUKE_GOMORY_PH = {[17330303] = 17330304}, -- Kindred_Monk
PRINCE_SEERE_PH = {[17330331] = 17330332}, -- Kindred_White_Mage
MARQUIS_ORIAS_PH = {[17330333] = 17330343}, -- Kindred_Black_Mage
DUKE_BERITH_PH = {[17330352] = 17330353}, -- Kindred_Red_Mage
COUNT_RAUM_PH = {[17330314] = 17330315}, -- Kindred_Thief
MARQUIS_SABNAK_PH = {[17330359] = 17330360}, -- Kindred_Paladin
DUKE_SCOX_PH = {[17330427] = 17330417}, -- Kindred_Dark_Knight
MARQUIS_ANDRAS_PH = {[17330388] = 17330390}, -- Kindred_Beastmaster
MARQUIS_DECARABIA_PH = {[17330222] = 17330223}, -- Kindred_Bard
MARQUIS_CIMERIES_PH = {[17330414] = 17330415}, -- Kindred_Ranger
COUNT_VINE_PH = {[17330439] = 17330440}, -- Kindred_Samurai
MARQUIS_GAMYGYN_PH = {[17330450] = 17330451}, -- Kindred_Ninja
KING_ZAGAN_PH = {[17330418] = 17330430}, -- Kindred_Dragoon
MARQUIS_NEBIROS_PH = {[17330479] = 17330481}, -- Kindred_Summoner
},
npc =
{
QM =
{
[17330780] =
{
param = {3358, 3429, 3430, 3431, 3432, 3433},
trade =
{
{item = 3358, mob = 17330177}, -- Dynamis Lord
{item = {3429, 3430, 3431, 3432, 3433}, mob = 17330191}, -- Arch Dynamis Lord
}
},
[17330781] = {trade = {{item = 3400, mob = 17330185}}}, -- Duke Haures
[17330782] = {trade = {{item = 3401, mob = 17330186}}}, -- Marquis Caim
[17330783] = {trade = {{item = 3402, mob = 17330188}}}, -- Baron Avnas
[17330784] = {trade = {{item = 3403, mob = 17330189}}}, -- Count Haagenti
[17330785] = {trade = {{item = 3364, mob = 17330199}}}, -- Animated Knuckles
[17330786] = {trade = {{item = 3365, mob = 17330200}}}, -- Animated Dagger
[17330787] = {trade = {{item = 3366, mob = 17330201}}}, -- Animated Longsword
[17330788] = {trade = {{item = 3367, mob = 17330202}}}, -- Animated Claymore
[17330789] = {trade = {{item = 3368, mob = 17330203}}}, -- Animated Tabar
[17330790] = {trade = {{item = 3369, mob = 17330204}}}, -- Animated Great Axe
[17330791] = {trade = {{item = 3371, mob = 17330205}}}, -- Animated Spear
[17330792] = {trade = {{item = 3370, mob = 17330206}}}, -- Animated Scythe
[17330793] = {trade = {{item = 3372, mob = 17330207}}}, -- Animated Kunai
[17330794] = {trade = {{item = 3373, mob = 17330208}}}, -- Animated Tachi
[17330795] = {trade = {{item = 3374, mob = 17330209}}}, -- Animated Hammer
[17330796] = {trade = {{item = 3375, mob = 17330210}}}, -- Animated Staff
[17330797] = {trade = {{item = 3376, mob = 17330211}}}, -- Animated Longbow
[17330798] = {trade = {{item = 3377, mob = 17330212}}}, -- Animated Gun
[17330799] = {trade = {{item = 3378, mob = 17330213}}}, -- Animated Horn
[17330800] = {trade = {{item = 3379, mob = 17330214}}}, -- Animated Shield
},
},
}
return zones[dsp.zone.DYNAMIS_XARCABARD] | gpl-3.0 |
ld-test/lua-xmlreader | doc/extract_doc.lua | 3 | 2184 | modules={}
function module(name)
if modules[name] then
current_module=modules[name]
else
current_module={name=name, description=""}
modules[#modules+1]=name
modules[name]=current_module
end
current_obj=current_module
end
function signature(name)
current_obj = {name=name, params={}, returns={}}
current_module[#current_module+1]=current_obj
end
function description(str)
current_obj.description=str
end
function param(name, desc)
current_obj.params[#current_obj.params+1]=name
current_obj.params[name]=desc
end
function returns(name, desc)
current_obj.returns[#current_obj.returns+1]=name
current_obj.returns[name]=desc
end
local fn = arg[1]
assert(fn, "Usage: extract_doc filename")
local lines={}
local in_lua = false
for line in io.lines(fn) do
if line:match("^%?%*/") then
in_lua = false
end
lines[#lines+1] = in_lua and line or ""
if line:match("^/%*%?lua") then
in_lua = true
end
end
assert(loadstring(table.concat(lines, "\n")))()
function fwrite(fmt, ...) io.write(fmt:format(...)) end
table.sort(modules)
fwrite([[
<!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
<head>
<title>%s</title>
<link rel="stylesheet" href="doc_style.css" type="text/css" />
</head>
<body>
]], lib_name)
for _,n in ipairs(modules) do
local m = modules[n]
fwrite("<h1>%s</h1>\n<p>%s</p>\n", m.name, m.description)
fwrite("<dl class=\"function\">\n")
for _,f in ipairs(m) do
fwrite("<dt>%s</dt>\n", f.name)
fwrite("<dd>\n%s\n", f.description)
if (#f.params > 0) then
fwrite("<h3>Parameters</h3>\n")
fwrite("<ul>\n")
for i,p in ipairs(f.params) do
fwrite("<li>%s: %s</li>\n", p, f.params[p])
end
fwrite("</ul>\n")
end
if (#f.returns > 0) then
fwrite("<h3>Return values</h3>\n")
fwrite("<ol>\n")
for i,r in ipairs(f.returns) do
fwrite("<li>%s: %s</li>\n", r, f.returns[r])
end
fwrite("</ol>\n")
end
fwrite("</dd>\n")
end
fwrite("</dl>\n")
end
fwrite("</body>")
fwrite("</html>")
| mit |
RwNigma/darkstar | scripts/zones/Tavnazian_Safehold/npcs/Quelveuiat.lua | 34 | 2668 | -----------------------------------
-- Area: Tavnazian Safehold
-- NPC: Quelveuiat
-- Standard Info NPC
-- @pos -3.177 -22.750 -25.970 26
-----------------------------------
package.loaded["scripts/zones/Tavnazian_Safehold/TextIDs"] = nil;
-----------------------------------
require("scripts/globals/quests");
require("scripts/globals/settings");
require("scripts/globals/keyitems");
require("scripts/zones/Tavnazian_Safehold/TextIDs");
-----------------------------------
-- onTrade Action
-----------------------------------
function onTrade(player,npc,trade)
local SealionCrestKey = trade:hasItemQty(1658,1);
local CoralCrestKey = trade:hasItemQty(1659,1);
local Count = trade:getItemCount();
if (player:getQuestStatus(OTHER_AREAS,A_HARD_DAY_S_KNIGHT) == QUEST_COMPLETED and player:hasKeyItem(TEMPLE_KNIGHT_KEY) == false) then
-- Trade Sealion and Coral Crest keys to obtain Temple Knight key (keyitem).
if (SealionCrestKey and CoralCrestKey and Count == 2) then
player:addKeyItem(TEMPLE_KNIGHT_KEY);
player:tradeComplete();
player:messageSpecial(KEYITEM_OBTAINED);
end
end
end;
-----------------------------------
-- onTrigger Action
-----------------------------------
function onTrigger(player,npc)
if (player:getQuestStatus(OTHER_AREAS,A_HARD_DAY_S_KNIGHT) == QUEST_AVAILABLE) then
player:startEvent(0x0077);
elseif (player:getQuestStatus(OTHER_AREAS,A_HARD_DAY_S_KNIGHT) == QUEST_ACCEPTED and player:getVar("SPLINTERSPINE_GRUKJUK") <= 1) then
player:startEvent(0x0078);
elseif (player:getVar("SPLINTERSPINE_GRUKJUK") == 2 and player:getQuestStatus(OTHER_AREAS,A_HARD_DAY_S_KNIGHT) == QUEST_ACCEPTED) then
player:startEvent(0x0079);
else
player:startEvent(0x007A);
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 == 0x0077 and option == 3) then
player:addQuest(OTHER_AREAS,A_HARD_DAY_S_KNIGHT);
elseif (csid == 0x0079) then
player:setVar("SPLINTERSPINE_GRUKJUK",0);
player:completeQuest(OTHER_AREAS,A_HARD_DAY_S_KNIGHT);
player:addGil(GIL_RATE*2100);
player:messageSpecial(GIL_OBTAINED,GIL_RATE*2100);
end
end;
| gpl-3.0 |
Kong/kong | kong/plugins/request-transformer/schema.lua | 1 | 3380 | local pl_template = require "pl.template"
local tx = require "pl.tablex"
local typedefs = require "kong.db.schema.typedefs"
local validate_header_name = require("kong.tools.utils").validate_header_name
local compile_opts = {
escape = "\xff", -- disable '#' as a valid template escape
}
-- entries must have colons to set the key and value apart
local function check_for_value(entry)
local name, value = entry:match("^([^:]+):*(.-)$")
if not name or not value or value == "" then
return false, "key '" ..name.. "' has no value"
end
local status, res, err = pcall(pl_template.compile, value, compile_opts)
if not status or err then
return false, "value '" .. value ..
"' is not in supported format, error:" ..
(status and res or err)
end
return true
end
local function validate_headers(pair, validate_value)
local name, value = pair:match("^([^:]+):*(.-)$")
if validate_header_name(name) == nil then
return nil, string.format("'%s' is not a valid header", tostring(name))
end
if validate_value then
if validate_header_name(value) == nil then
return nil, string.format("'%s' is not a valid header", tostring(value))
end
end
return true
end
local function validate_colon_headers(pair)
return validate_headers(pair, true)
end
local strings_array = {
type = "array",
default = {},
required = true,
elements = { type = "string" },
}
local headers_array = {
type = "array",
default = {},
required = true,
elements = { type = "string", custom_validator = validate_headers },
}
local strings_array_record = {
type = "record",
fields = {
{ body = strings_array },
{ headers = headers_array },
{ querystring = strings_array },
},
}
local colon_strings_array = {
type = "array",
default = {},
required = true,
elements = { type = "string", custom_validator = check_for_value }
}
local colon_header_value_array = {
type = "array",
default = {},
required = true,
elements = { type = "string", match = "^[^:]+:.*$", custom_validator = validate_headers },
}
local colon_strings_array_record = {
type = "record",
fields = {
{ body = colon_strings_array },
{ headers = colon_header_value_array },
{ querystring = colon_strings_array },
},
}
local colon_headers_array = {
type = "array",
default = {},
required = true,
elements = { type = "string", match = "^[^:]+:.*$", custom_validator = validate_colon_headers },
}
local colon_rename_strings_array_record = {
type = "record",
fields = {
{ body = colon_strings_array },
{ headers = colon_headers_array },
{ querystring = colon_strings_array },
},
}
local colon_strings_array_record_plus_uri = tx.deepcopy(colon_strings_array_record)
local uri = { uri = { type = "string" } }
table.insert(colon_strings_array_record_plus_uri.fields, uri)
return {
name = "request-transformer",
fields = {
{ protocols = typedefs.protocols },
{ config = {
type = "record",
fields = {
{ http_method = typedefs.http_method },
{ remove = strings_array_record },
{ rename = colon_rename_strings_array_record },
{ replace = colon_strings_array_record_plus_uri },
{ add = colon_strings_array_record },
{ append = colon_strings_array_record },
}
},
},
}
}
| apache-2.0 |
ffxijuggalo/darkstar | scripts/zones/West_Ronfaure/npcs/Zovriace.lua | 9 | 41586 | -----------------------------------
-- Area: West Ronfaure
-- NPC: Zovriace
-- Type: Patrol NPC
-- !pos -436.356 -15.851 -258.168 100
-----------------------------------
local ID = require("scripts/zones/West_Ronfaure/IDs")
require("scripts/globals/pathfind")
-----------------------------------
local path =
{
-439.970062, -16.752592, -255.100327,
-440.602631, -16.538126, -255.958786,
-441.127228, -16.394150, -256.900909,
-441.494019, -16.267317, -257.915710,
-441.581543, -16.133537, -258.985992,
-441.024231, -16.028330, -259.826294,
-439.954132, -16.028715, -259.822601,
-438.925629, -16.072157, -259.474915,
-437.941528, -16.180017, -259.014008,
-437.021820, -15.868464, -258.524048,
-436.108673, -15.583454, -258.000946,
-435.179413, -15.400028, -257.455811,
-432.864655, -15.075329, -256.065369,
-423.557495, -14.982476, -250.437790,
-422.761383, -15.055836, -249.708817,
-422.268677, -15.117037, -248.744232,
-421.972382, -15.198636, -247.701523,
-421.776733, -15.333975, -246.640106,
-421.618866, -15.467649, -245.572189,
-421.478943, -15.717875, -244.517334,
-421.351807, -15.921570, -243.463135,
-421.186218, -16.198463, -241.860138,
-421.114075, -16.145809, -240.774628,
-421.063721, -16.139482, -239.687912,
-420.994019, -16.130768, -237.785126,
-420.230377, -15.989685, -211.979935,
-420.197784, -15.922558, -210.893448,
-420.124512, -15.798100, -207.772995,
-420.100586, -15.813488, -206.552765,
-419.909180, -16.017889, -199.219910,
-420.047943, -16.120964, -198.143524,
-420.387573, -15.748003, -197.158432,
-420.822083, -15.460172, -196.220764,
-421.321320, -15.238870, -195.271896,
-421.853363, -15.129681, -194.327469,
-423.947327, -15.024358, -190.672211,
-427.640472, -14.942602, -184.327072,
-428.275848, -15.015442, -183.448257,
-428.993866, -15.115380, -182.637329,
-429.774628, -15.196917, -181.884567,
-430.584961, -15.269184, -181.162048,
-431.407013, -15.339080, -180.452606,
-432.945740, -15.590717, -179.147598,
-446.838165, -18.853514, -167.615036,
-447.872925, -18.977230, -166.740967,
-450.464325, -19.402002, -164.580673,
-451.186340, -19.500000, -163.781158,
-451.724823, -19.500000, -162.836929,
-452.156342, -19.526083, -161.839020,
-452.542633, -19.574369, -160.823151,
-452.902069, -19.619282, -159.797119,
-453.247406, -19.652224, -158.765945,
-454.379395, -19.973661, -155.298203,
-455.345062, -20.866318, -152.299789,
-455.671997, -20.945515, -151.285309,
-456.993286, -21.072395, -147.165604,
-457.321960, -21.268314, -146.147049,
-460.919006, -21.558647, -134.955734,
-461.252441, -21.516457, -133.920914,
-463.684235, -20.974045, -126.322334,
-463.735504, -21.005585, -125.238617,
-463.618225, -21.100723, -124.159538,
-463.476532, -21.130386, -123.083138,
-460.845245, -21.814005, -103.009911,
-460.340668, -21.860525, -102.053253,
-459.548370, -21.859089, -101.316696,
-458.651062, -21.799015, -100.705299,
-457.715729, -21.738424, -100.153778,
-456.764191, -21.662802, -99.631622,
-455.801666, -21.716837, -99.128433,
-452.543488, -21.461651, -97.451981,
-427.263428, -19.779127, -84.644547,
-426.292938, -19.805960, -84.153252,
-424.000397, -20.058718, -82.994804,
-423.030975, -19.983002, -82.507225,
-396.179047, -20.642097, -68.915520,
-395.230957, -20.758915, -68.394829,
-394.369598, -20.974821, -67.755898,
-393.589478, -21.246567, -67.048546,
-392.859406, -21.419449, -66.273178,
-392.153625, -21.557785, -65.456947,
-391.468964, -21.778866, -64.640053,
-390.559631, -22.323750, -63.552891,
-389.849030, -22.824114, -62.691097,
-387.739929, -24.336773, -60.088634,
-387.035553, -24.853951, -59.230145,
-386.339355, -25.370905, -58.366211,
-385.651886, -26.125864, -57.510376,
-385.033325, -27.045774, -56.701607,
-384.452972, -27.587692, -55.817024,
-383.951385, -27.987345, -54.938370,
-383.386536, -28.294943, -53.910427,
-382.906982, -28.606924, -52.984940,
-382.409454, -28.917976, -52.069004,
-381.867371, -29.025024, -51.137131,
-381.301788, -29.172449, -50.219383,
-380.727570, -29.320223, -49.307129,
-364.454529, -30.016165, -24.085087,
-354.090363, -29.671881, -8.006002,
-353.540497, -29.834528, -7.080005,
-353.008911, -30.037712, -6.150451,
-351.508148, -30.500000, -3.461302,
-344.298309, -31.130165, 9.622360,
-343.719788, -31.229996, 10.534849,
-343.014465, -31.336742, 11.354795,
-342.196075, -31.448938, 12.062510,
-341.337769, -31.562546, 12.721281,
-340.463776, -31.676613, 13.359138,
-339.578003, -31.747307, 13.983932,
-338.684845, -31.777473, 14.604170,
-331.282471, -31.493895, 19.661541,
-330.308228, -31.447271, 20.141212,
-329.288361, -31.455376, 20.518837,
-328.249207, -31.395697, 20.818035,
-327.199799, -31.337658, 21.087675,
-326.141876, -31.381889, 21.338877,
-325.082703, -31.432835, 21.581512,
-320.835022, -31.395533, 22.525442,
-319.773651, -31.337238, 22.757223,
-316.724976, -31.168060, 23.434225,
-315.697601, -31.067081, 23.774858,
-314.713531, -31.001366, 24.234629,
-313.761444, -30.953598, 24.758646,
-312.835083, -30.887995, 25.325043,
-311.918732, -30.789017, 25.902380,
-310.216614, -30.826614, 27.010038,
-307.517303, -31.226393, 28.788122,
-306.582703, -31.154129, 29.342878,
-305.625275, -31.055418, 29.852215,
-304.660309, -30.967735, 30.347439,
-303.691956, -30.867880, 30.831894,
-301.273224, -30.522186, 32.021267,
-300.325226, -30.253407, 32.488640,
-297.896606, -29.961315, 33.678493,
-296.921356, -29.980268, 34.155445,
-283.175232, -30.000000, 40.879360,
-282.197723, -30.000000, 41.357021,
-273.907654, -30.223761, 45.435520,
-273.112213, -30.613419, 46.087021,
-272.551117, -31.027349, 46.919304,
-272.154144, -31.419172, 47.850975,
-271.860565, -31.801704, 48.831139,
-271.583862, -32.090355, 49.799915,
-271.340332, -32.425247, 50.806000,
-270.992645, -32.844288, 52.328403,
-269.161621, -35.016342, 60.795799,
-268.899292, -35.537270, 62.046036,
-267.436157, -38.003387, 68.796013,
-267.218933, -38.403229, 69.785110,
-266.716248, -39.181328, 72.162575,
-266.646820, -39.236248, 73.245872,
-266.741486, -39.305218, 74.326553,
-266.943451, -39.503807, 75.379707,
-267.198029, -39.606842, 76.420052,
-267.467224, -39.573181, 77.473747,
-267.751343, -39.537670, 78.523438,
-269.489166, -39.688145, 84.654762,
-269.779968, -39.940563, 85.672394,
-270.407593, -40.357700, 87.859993,
-270.701263, -40.217247, 88.897224,
-271.803741, -39.582218, 92.765701,
-272.103394, -39.621971, 93.822968,
-274.938629, -40.094635, 103.757698,
-275.234436, -39.950058, 104.796463,
-278.316315, -39.956299, 115.598122,
-278.657959, -40.000000, 116.626968,
-279.067108, -40.000000, 117.634903,
-279.518555, -40.000000, 118.624847,
-279.993774, -40.000000, 119.603645,
-280.484222, -40.000000, 120.574821,
-280.980164, -40.000000, 121.543243,
-286.929169, -39.008667, 132.941757,
-287.430420, -38.897781, 133.901459,
-287.937683, -38.781601, 134.856888,
-288.510773, -38.692963, 135.778198,
-289.157349, -38.665531, 136.652649,
-289.833923, -38.639122, 137.504150,
-290.523529, -38.604607, 138.344910,
-291.396698, -38.552856, 139.386200,
-300.068176, -35.596138, 149.616638,
-300.450134, -35.417088, 150.612869,
-300.480957, -35.302635, 151.691971,
-300.363770, -35.374798, 152.765915,
-300.181000, -35.526699, 153.827637,
-299.967926, -35.682739, 154.883087,
-299.740814, -35.856140, 155.933807,
-299.166321, -36.110737, 158.434998,
-297.842926, -36.519508, 164.110306,
-297.711517, -36.728516, 165.169052,
-297.791962, -36.897087, 166.237534,
-298.034912, -37.036209, 167.288712,
-298.354279, -37.162457, 168.321182,
-298.708008, -37.283379, 169.343033,
-299.123047, -37.480621, 170.478378,
-299.870880, -38.047672, 172.461945,
-300.458160, -38.762894, 173.968826,
-301.121552, -39.588573, 175.707932,
-301.488495, -39.880459, 176.703125,
-301.741180, -40.187134, 177.714966,
-301.840820, -40.504196, 178.748749,
-301.855133, -40.822124, 179.788849,
-301.822845, -41.188747, 180.817581,
-301.758820, -41.552467, 181.840881,
-301.682739, -41.920956, 182.862518,
-301.407043, -42.825760, 186.114990,
-300.501160, -45.446545, 196.063461,
-300.327515, -45.781693, 197.086868,
-300.107330, -46.023857, 198.101761,
-299.892059, -46.020031, 199.202560,
-299.658722, -46.049198, 200.264832,
-299.083496, -45.989109, 202.775665,
-298.839966, -45.840462, 203.825668,
-298.599335, -45.612335, 204.856720,
-297.294495, -45.038647, 210.384552,
-296.802460, -45.031513, 211.348297,
-296.003754, -44.947575, 212.076996,
-295.089417, -44.939152, 212.665131,
-294.132080, -44.971771, 213.180725,
-293.159241, -45.004112, 213.666809,
-292.177643, -45.043068, 214.134933,
-290.945007, -45.035225, 214.709396,
-282.860168, -45.922268, 218.423615,
-281.928314, -46.162800, 218.882782,
-280.925964, -46.093803, 219.302551,
-279.942993, -46.035995, 219.765259,
-278.976990, -46.039272, 220.261993,
-278.019318, -46.126381, 220.774200,
-276.532257, -45.679039, 221.595612,
-273.266785, -45.098358, 223.469131,
-272.324432, -45.015408, 224.010422,
-268.550629, -45.024551, 226.176529,
-267.745361, -45.022247, 226.900223,
-267.117981, -44.979355, 227.787445,
-266.573853, -44.975834, 228.729248,
-266.066772, -44.982010, 229.691788,
-265.576538, -45.041542, 230.663071,
-265.079071, -45.163151, 231.627274,
-264.597351, -45.264587, 232.595947,
-264.152435, -45.446598, 233.563171,
-263.697998, -45.680012, 234.523819,
-262.016174, -46.281578, 238.029846,
-261.556702, -46.201237, 239.014328,
-256.600128, -45.025234, 249.377197,
-255.970734, -44.957794, 250.260529,
-255.212357, -44.939751, 251.038193,
-254.386093, -44.945457, 251.745514,
-253.526093, -44.969048, 252.411560,
-252.652176, -45.002594, 253.058823,
-251.770966, -45.036087, 253.696213,
-244.441742, -45.275829, 258.863953,
-243.505188, -45.542328, 259.357666,
-242.523361, -45.906620, 259.648193,
-241.460144, -46.028633, 259.823212,
-240.374603, -46.019741, 259.894318,
-239.287964, -46.013302, 259.945831,
-238.200699, -46.008728, 259.982391,
-235.359665, -46.299160, 260.041962,
-231.212814, -47.047096, 260.111084,
-228.414734, -47.613140, 260.165649,
-227.395874, -48.089172, 260.184479,
-225.697647, -48.950203, 260.216675,
-224.363464, -49.629337, 260.239838,
-223.352081, -49.953148, 260.253906,
-216.001205, -52.412048, 260.375458,
-214.947723, -52.636997, 260.390472,
-204.417313, -55.326168, 260.560699,
-203.368652, -55.655231, 260.576294,
-202.049591, -56.112896, 260.577698,
-200.935196, -56.080486, 260.591614,
-184.915848, -56.834442, 260.617188,
-183.857697, -57.100548, 260.594025,
-182.771301, -57.095242, 260.613068,
-181.551437, -57.195465, 260.611603,
-180.467743, -57.268650, 260.554718,
-179.388474, -57.235741, 260.443207,
-178.313416, -57.323948, 260.301849,
-177.240799, -57.410061, 260.141052,
-175.639709, -57.602425, 259.888031,
-153.454758, -59.971466, 256.230652,
-152.371017, -59.941368, 256.202332,
-151.338013, -59.899998, 256.526245,
-150.409531, -59.899998, 257.091797,
-149.546631, -59.905708, 257.754150,
-148.712616, -59.944000, 258.451752,
-147.891266, -59.982349, 259.164490,
-147.077164, -59.987167, 259.886108,
-145.559814, -59.996250, 261.249481,
-135.296967, -61.920395, 270.550049, -- report?
-136.090424, -61.731232, 269.830048,
-136.884094, -61.542065, 269.110352,
-150.086914, -59.899998, 257.147797,
-151.020218, -59.899998, 256.592834,
-152.073257, -59.902092, 256.345337,
-153.159882, -59.929256, 256.347260,
-154.243652, -59.956352, 256.436890,
-155.322754, -59.991856, 256.572998,
-156.398727, -59.956062, 256.729126,
-158.145386, -59.938908, 257.003632,
-178.976608, -57.275406, 260.436218,
-180.056641, -57.302162, 260.523682,
-181.140915, -57.218544, 260.571320,
-182.225555, -57.135334, 260.593964,
-183.310730, -57.070732, 260.604950,
-184.389069, -56.970604, 260.592346,
-185.446976, -56.699245, 260.612305,
-186.534317, -56.616566, 260.619019,
-188.029251, -56.562798, 260.618652,
-207.543884, -54.695351, 260.506195,
-208.593231, -54.421879, 260.490112,
-227.786392, -47.844944, 260.176392,
-228.828674, -47.528126, 260.161072,
-230.026764, -47.278732, 260.139496,
-234.035889, -46.541107, 260.063751,
-240.660934, -46.011520, 259.960083,
-241.744278, -46.169971, 259.869843,
-242.749298, -45.785637, 259.621307,
-243.688675, -45.496006, 259.184814,
-244.613403, -45.269833, 258.647064,
-245.518509, -45.137951, 258.052887,
-246.419617, -45.087288, 257.445129,
-247.315887, -45.036938, 256.830475,
-249.769028, -45.024799, 255.119431,
-254.651855, -44.940964, 251.663010,
-255.433929, -44.937099, 250.909637,
-256.076324, -44.971489, 250.033737,
-256.635040, -45.035885, 249.102524,
-257.142975, -45.097923, 248.142441,
-257.629761, -45.233803, 247.177734,
-258.461090, -45.483078, 245.483109,
-259.049194, -45.740898, 244.276123,
-259.516541, -45.851563, 243.307846,
-264.719360, -45.247227, 232.364548,
-265.227234, -45.105091, 231.261398,
-265.719788, -44.985176, 230.292435,
-266.195129, -44.977989, 229.313889,
-266.685333, -44.971275, 228.342972,
-267.309906, -44.990795, 227.454300,
-268.097290, -45.024536, 226.706238,
-268.976410, -45.019974, 226.065643,
-269.888763, -45.017735, 225.473099,
-270.818024, -45.019180, 224.907379,
-271.753998, -45.000942, 224.352997,
-273.165039, -45.084061, 223.535965,
-274.098724, -45.217224, 222.991837,
-275.034912, -45.352219, 222.454132,
-276.433075, -45.645039, 221.653473,
-278.282349, -46.227036, 220.580002,
-279.259583, -46.019772, 220.105209,
-280.239838, -46.051945, 219.636856,
-281.715057, -46.138523, 218.944061,
-295.072144, -44.942986, 212.826477,
-295.975891, -44.965645, 212.229233,
-296.626495, -44.995678, 211.363297,
-297.092560, -45.025742, 210.383209,
-297.438629, -45.079567, 209.353546,
-297.736084, -45.130760, 208.308319,
-298.005737, -45.248287, 207.260376,
-298.264038, -45.386070, 206.212494,
-299.041473, -45.962364, 202.959167,
-299.294495, -46.129169, 201.913116,
-299.533417, -46.064907, 200.852234,
-299.778412, -46.034283, 199.792679,
-300.021393, -46.009171, 198.732605,
-300.230682, -45.949970, 197.678162,
-300.387177, -45.645302, 196.654877,
-300.517700, -45.328785, 195.618057,
-300.631744, -45.131599, 194.554199,
-300.736755, -44.933083, 193.489655,
-301.916626, -41.039673, 180.393494,
-301.952759, -40.689056, 179.362061,
-301.844147, -40.380367, 178.326706,
-301.584625, -40.074371, 177.315918,
-301.265717, -39.777336, 176.319107,
-300.939575, -39.442776, 175.363297,
-300.565338, -38.942703, 174.325500,
-300.181183, -38.417553, 173.289810,
-299.740601, -37.873989, 172.134750,
-299.364197, -37.599380, 171.148911,
-298.786713, -37.338978, 169.644882,
-298.402985, -37.208858, 168.635559,
-298.027802, -37.092781, 167.620956,
-297.779541, -36.955162, 166.573044,
-297.768494, -36.779991, 165.501678,
-297.893860, -36.572292, 164.441559,
-298.075348, -36.378498, 163.386337,
-298.291718, -36.245903, 162.328415,
-298.523804, -36.191105, 161.267609,
-299.099976, -36.119068, 158.749771,
-300.622803, -35.272141, 152.185272,
-300.546265, -35.356747, 151.112457,
-300.139984, -35.533932, 150.124802,
-299.563080, -35.738934, 149.226395,
-298.926300, -35.974628, 148.366928,
-298.292847, -36.369488, 147.566315,
-297.652222, -36.771412, 146.784256,
-296.598267, -37.424564, 145.524170,
-289.386353, -38.662991, 137.017761,
-288.751190, -38.680820, 136.135315,
-288.184235, -38.716503, 135.207581,
-287.656708, -38.841850, 134.261246,
-286.957916, -39.001762, 132.948334,
-286.436218, -38.979378, 131.993698,
-285.933044, -39.086742, 131.035538,
-279.544037, -40.000000, 118.786339,
-279.095001, -40.000000, 117.795532,
-278.723389, -40.000000, 116.773209,
-278.390717, -40.000000, 115.739441,
-278.077759, -39.844975, 114.705635,
-277.060913, -39.500000, 111.198402,
-271.665955, -39.568001, 92.294022,
-271.258362, -39.819828, 90.879639,
-269.650452, -39.829777, 85.218178,
-269.097565, -39.500000, 83.293137,
-266.809784, -39.475517, 75.200165,
-266.649567, -39.287212, 74.141655,
-266.706604, -39.230602, 73.057381,
-266.841522, -39.182301, 71.979034,
-267.013214, -38.883488, 70.972496,
-267.203888, -38.458267, 69.986374,
-267.405945, -38.092369, 68.997025,
-267.967316, -37.205059, 66.336739,
-269.169342, -35.011940, 60.768829,
-269.416901, -34.755840, 59.608253,
-271.049866, -32.833099, 52.036350,
-271.266663, -32.500420, 51.020298,
-271.939880, -31.580200, 47.963612,
-272.323029, -31.133356, 47.024605,
-273.091705, -30.631182, 46.207066,
-273.918060, -30.234310, 45.609779,
-274.847778, -30.141161, 45.052742,
-275.801636, -30.049332, 44.537346,
-276.767395, -30.004099, 44.039276,
-277.740051, -30.000000, 43.551609,
-295.029419, -30.001234, 35.084103,
-296.004395, -30.028824, 34.606136,
-298.320343, -30.011620, 33.472553,
-299.292633, -30.127960, 32.998138,
-300.744598, -30.420561, 32.287434,
-301.822388, -30.660269, 31.766117,
-305.449860, -31.039577, 29.961134,
-306.393860, -31.150333, 29.427002,
-307.322937, -31.208359, 28.864517,
-308.242828, -31.225145, 28.287502,
-309.370667, -30.999538, 27.554298,
-313.548218, -30.951408, 24.807213,
-314.496948, -30.999880, 24.278208,
-315.499756, -31.051682, 23.858809,
-316.537872, -31.154470, 23.544914,
-317.590332, -31.206734, 23.277721,
-318.646790, -31.269846, 23.025274,
-319.705627, -31.330627, 22.782150,
-328.585144, -31.461010, 20.809793,
-329.604736, -31.452932, 20.447485,
-330.576935, -31.458323, 19.959888,
-331.516846, -31.525490, 19.415882,
-332.434601, -31.586788, 18.835255,
-333.342133, -31.637566, 18.237196,
-334.808746, -31.720680, 17.253775,
-341.755096, -31.512569, 12.505347,
-342.587311, -31.399881, 11.814846,
-343.284424, -31.293304, 10.987100,
-343.903748, -31.204266, 10.098687,
-344.476776, -31.068769, 9.182813,
-345.021790, -30.936897, 8.250527,
-345.557404, -30.848867, 7.308527,
-346.944550, -30.665789, 4.819434,
-352.769531, -30.134678, -5.750056,
-353.430542, -29.865831, -6.908241,
-353.990356, -29.703238, -7.826676,
-354.571625, -29.606535, -8.750077,
-359.278839, -30.020227, -16.060516,
-359.865417, -29.940750, -16.974663,
-366.939056, -29.873177, -27.931231,
-367.528503, -29.888115, -28.845236,
-376.512451, -29.969620, -42.758610,
-377.103638, -29.932671, -43.671219,
-381.560516, -29.108587, -50.606083,
-382.097595, -28.962421, -51.540813,
-382.600891, -28.786295, -52.479153,
-383.076721, -28.473091, -53.406521,
-383.741272, -28.044344, -54.676407,
-384.273438, -27.694052, -55.554253,
-384.877289, -27.241680, -56.411148,
-385.524475, -26.414268, -57.283955,
-386.158508, -25.591860, -58.105274,
-386.828674, -24.977655, -58.949734,
-390.529175, -22.315744, -63.529224,
-392.262146, -21.522633, -65.653603,
-392.948425, -21.380217, -66.485573,
-393.689911, -21.182203, -67.244202,
-394.540680, -20.930220, -67.872482,
-395.454437, -20.739042, -68.440071,
-396.398987, -20.635540, -68.968857,
-397.357697, -20.571712, -69.479454,
-398.320526, -20.508863, -69.982239,
-400.858337, -20.346436, -71.281647,
-416.078491, -20.016394, -78.992798,
-417.048981, -19.936098, -79.480896,
-427.943085, -19.760998, -84.990929,
-428.913177, -19.807173, -85.480782,
-432.057404, -20.048246, -87.078934,
-433.018707, -20.206867, -87.563354,
-434.463531, -20.382471, -88.293999,
-435.430756, -20.458065, -88.786209,
-452.483673, -21.459229, -97.418785,
-453.453613, -21.498474, -97.910263,
-455.629822, -21.682997, -99.016502,
-456.597382, -21.676950, -99.507576,
-459.140961, -21.836069, -100.792534,
-459.946869, -21.893318, -101.510696,
-460.448151, -21.846874, -102.472565,
-460.755463, -21.810520, -103.514992,
-460.974854, -21.743179, -104.577850,
-461.155731, -21.659788, -105.647171,
-461.317200, -21.591896, -106.720940,
-461.468292, -21.524906, -107.796364,
-463.602295, -21.103918, -124.129204,
-463.619171, -21.024265, -125.213806,
-463.478882, -21.006443, -126.292236,
-463.249878, -21.002714, -127.355629,
-462.966309, -21.089417, -128.399185,
-462.668304, -21.285374, -129.427078,
-462.235779, -21.446602, -130.840286,
-460.657928, -21.688395, -135.754669,
-460.330139, -21.662376, -136.789734,
-455.015533, -20.520708, -153.317886,
-454.692139, -20.245014, -154.319489,
-452.376251, -19.553642, -161.505966,
-451.983276, -19.504547, -162.518814,
-451.383820, -19.500000, -163.425491,
-450.662170, -19.500000, -164.235107,
-449.881348, -19.324495, -164.978180,
-449.075256, -19.183504, -165.695129,
-448.256256, -19.045288, -166.398026,
-447.224274, -18.874338, -167.267380,
-446.393372, -18.880678, -167.969147,
-444.853027, -18.565512, -169.265442,
-429.819672, -15.220426, -181.753754,
-429.047333, -15.136473, -182.514877,
-428.378082, -15.023755, -183.364578,
-427.766907, -14.929929, -184.258438,
-427.184479, -14.948370, -185.176834,
-426.620789, -14.981401, -186.106918,
-420.939972, -15.316271, -195.861465,
-420.463104, -15.644215, -196.799393,
-420.179413, -15.996948, -197.782822,
-420.054016, -16.013285, -198.776382,
-420.006409, -16.007343, -199.863220,
-419.994202, -16.007246, -200.951035,
-420.002808, -16.006878, -202.039001,
-420.028076, -16.012650, -203.534683,
-420.136383, -15.819376, -208.158340,
-420.158417, -15.863979, -209.517258,
-420.217560, -15.970049, -212.114258,
-420.270721, -15.849182, -213.198792,
-420.324890, -15.797634, -214.692932,
-420.826080, -15.902279, -232.085022,
-420.854614, -15.979057, -233.178070,
-421.049957, -16.137796, -239.834213,
-421.117493, -16.146238, -240.920044,
-421.206573, -16.172615, -242.004349,
-421.315979, -15.984070, -243.070419,
-421.494659, -15.643467, -244.787292,
-421.819092, -15.221020, -247.595215,
-422.154602, -15.128119, -248.622253,
-422.758545, -15.061894, -249.519104,
-423.569183, -14.987906, -250.238434,
-424.447510, -14.935026, -250.876724,
-425.353729, -14.944465, -251.478790,
-426.272919, -14.957020, -252.060471,
-427.197968, -14.990112, -252.632385,
-435.669800, -15.466051, -257.761230,
-436.582245, -15.703817, -258.315826,
-437.807831, -16.083422, -259.079224,
-438.774384, -16.063610, -259.543793,
-439.841156, -16.037457, -259.752838,
-440.927063, -16.028862, -259.821381,
-442.012054, -16.065359, -259.827911,
-443.029694, -15.716091, -259.796082,
-444.055817, -15.340240, -259.815460,
-445.097931, -15.219767, -260.104065,
-446.074341, -15.110579, -260.570770,
-447.027344, -15.057332, -261.092285,
-447.959381, -15.005149, -261.650909,
-448.870300, -15.018632, -262.244598,
-452.834351, -15.055134, -264.874695,
-453.655518, -15.037918, -265.585449,
-454.313416, -14.975594, -266.448151,
-454.843811, -14.943377, -267.396851,
-455.317291, -14.926654, -268.376190,
-455.755920, -14.934984, -269.371826,
-456.179169, -14.990575, -270.372711,
-458.718781, -15.924042, -276.598358,
-459.454010, -16.074858, -278.487640,
-459.765564, -16.035896, -279.529297,
-460.018890, -16.008865, -280.586884,
-460.219788, -16.034010, -281.655853,
-460.388611, -15.869349, -282.697662,
-460.631561, -15.373913, -284.238556,
-463.079895, -10.491953, -301.043823,
-463.087708, -10.158780, -302.077850,
-462.960846, -9.836479, -303.109039,
-462.774170, -9.560242, -304.125580,
-462.522583, -8.986555, -305.196259,
-462.273163, -8.643255, -306.190765,
-462.021210, -8.278727, -307.184570,
-460.034760, -6.387301, -314.867249,
-459.871155, -6.200213, -315.926605,
-459.784912, -6.106617, -317.006958,
-459.729767, -6.040372, -318.091217,
-459.694733, -6.044695, -319.178589,
-459.585297, -6.053058, -324.342834,
-459.546967, -5.772733, -326.638885,
-459.503937, -5.646238, -328.802887,
-459.475159, -5.742835, -330.568115,
-459.458099, -5.785998, -331.654663,
-459.434814, -5.762313, -332.741577,
-459.407196, -5.823767, -334.235260,
-459.388367, -5.885840, -335.321259,
-459.238617, -5.855601, -343.748810,
-459.212708, -5.653573, -345.233765,
-459.171204, -5.405949, -347.661652,
-459.148193, -5.488004, -349.155365,
-459.102081, -5.651767, -351.733948,
-459.078918, -5.694240, -352.820526,
-459.029205, -6.086042, -355.647919,
-459.029083, -6.127892, -356.731750,
-459.140869, -6.113956, -357.812897,
-459.383789, -6.083621, -358.872314,
-459.727936, -6.040620, -359.903625,
-460.125519, -6.022241, -360.915192,
-460.547241, -6.109803, -361.916656,
-460.983124, -5.974494, -362.906189,
-461.694427, -5.748822, -364.503021,
-464.664276, -4.937500, -371.008911,
-465.236359, -4.933529, -371.931122,
-466.029266, -4.964595, -372.673553,
-466.928986, -4.997910, -373.282715,
-467.884674, -5.034942, -373.801270,
-468.857971, -5.029415, -374.286438,
-469.843262, -5.023180, -374.747375,
-470.833405, -5.019099, -375.197601,
-472.694275, -5.035691, -376.029572,
-473.677887, -5.200471, -376.472137,
-474.661591, -5.361502, -376.908600,
-476.374115, -5.724977, -377.667419,
-477.943665, -6.254426, -378.389740,
-478.940887, -6.155789, -378.806549,
-479.933899, -6.100767, -379.246948,
-480.918152, -6.043252, -379.707092,
-481.900665, -6.081943, -380.169891,
-484.013855, -5.418111, -381.186493,
-491.435669, -5.052667, -384.848053,
-492.353546, -5.041574, -385.430573,
-493.202301, -5.007907, -386.109772,
-493.992279, -4.974132, -386.856659,
-494.756409, -4.940371, -387.630280,
-495.507080, -4.923118, -388.417175,
-496.431793, -4.977174, -389.412140,
-497.107117, -5.046514, -390.261566,
-497.657043, -5.110490, -391.197357,
-498.112122, -5.190608, -392.182343,
-498.507446, -5.332036, -393.186005,
-498.873962, -5.472911, -394.200806,
-499.234314, -5.613681, -395.218109,
-499.678253, -5.800858, -396.489166,
-500.778503, -6.103849, -399.830353,
-501.068237, -6.140066, -400.878174,
-501.285126, -6.187640, -401.943726,
-501.455048, -5.907662, -402.972321,
-501.603912, -5.583361, -404.001343,
-501.743408, -5.360402, -405.062927,
-502.090485, -4.776625, -407.835724,
-503.105774, -2.217786, -416.217438,
-503.239807, -1.832487, -417.352051,
-503.333099, -1.481157, -418.377258,
-503.423798, -1.100163, -419.395477,
-503.386627, -0.703467, -420.402710,
-503.246399, -0.351263, -421.441803,
-502.988159, -0.045092, -422.453247,
-502.687469, 0.254894, -423.455109,
-502.373627, 0.594657, -424.430695,
-502.022430, 1.109420, -425.470734,
-501.691040, 1.542306, -426.415924,
-499.392395, 3.206969, -433.018402,
-499.253448, 3.375491, -434.080170,
-499.522461, 3.599207, -435.105164,
-500.032349, 3.822114, -436.033020,
-500.653107, 3.809904, -436.925049,
-501.312653, 3.793942, -437.789276,
-501.987488, 3.745028, -438.639038,
-503.010254, 3.617167, -439.904755,
-504.546265, 3.195670, -441.791504,
-505.474762, 3.454881, -442.943634,
-506.260468, 3.535620, -443.878723,
-506.956055, 3.542965, -444.714844,
-508.938232, 3.486761, -447.139069,
-509.594696, 3.471608, -448.007050,
-510.234344, 3.489084, -448.886902,
-512.427246, 3.586239, -451.998352,
-513.936096, 3.984726, -454.195862,
-514.540894, 4.233383, -455.064941,
-515.166321, 4.378668, -455.945282,
-516.262939, 4.290412, -457.499878,
-516.891174, 4.174067, -458.381256,
-517.627136, 3.970321, -459.154846,
-518.497131, 3.965434, -459.776428,
-519.472900, 3.961867, -460.252655,
-520.468811, 3.907594, -460.686981,
-521.475464, 3.856341, -461.097015,
-522.467651, 3.899534, -461.479309,
-523.431274, 4.273953, -461.837158,
-532.930542, 4.970236, -465.372864,
-533.836426, 5.003310, -465.964172,
-534.517090, 5.036720, -466.809723,
-535.063843, 5.069100, -467.748749,
-535.532227, 5.071708, -468.730682,
-535.968689, 5.042767, -469.726746,
-536.385559, 4.985219, -470.730225,
-536.996216, 4.874025, -472.240662,
-538.487976, 4.135559, -475.968048,
-538.877197, 4.030794, -476.973175,
-539.262268, 3.887287, -477.981995,
-539.575439, 3.940336, -479.021515,
-539.779053, 3.965811, -480.089569,
-539.916809, 3.983058, -481.168549,
-540.027405, 3.990070, -482.250732,
-540.122314, 3.997955, -483.334686,
-540.210938, 3.984653, -484.419312,
-541.090576, 3.211054, -496.324768,
-541.168152, 3.029897, -497.395050,
-541.225708, 2.852559, -498.466858,
-541.208801, 2.688696, -499.542267,
-541.137390, 2.576481, -500.620575,
-541.029846, 2.491427, -501.699982,
-540.901306, 2.387329, -502.777466,
-540.700256, 2.348901, -504.390961,
-539.072510, 0.190201, -516.318054,
-538.841309, 0.175944, -517.380859,
-538.530579, 0.156524, -518.422974,
-538.178406, 0.134513, -519.452148,
-537.805481, 0.111208, -520.473999,
-537.424194, 0.087378, -521.492676,
-536.306885, 0.056635, -524.412842,
-533.919128, 0.072274, -530.589355,
-534.307983, 0.225401, -529.584229,
-534.697571, 0.361172, -528.577515,
-538.121399, 0.130942, -519.723328,
-538.474670, 0.153023, -518.694641,
-538.752563, 0.170393, -517.643005,
-538.969421, 0.183949, -516.577148,
-539.157410, 0.272568, -515.513428,
-539.318237, 0.485071, -514.458435,
-539.542297, 0.803161, -512.873474,
-539.692932, 0.970816, -511.811584,
-539.838379, 1.181126, -510.753571,
-540.765686, 2.421811, -503.992981,
-540.907532, 2.391479, -502.915649,
-541.162781, 2.543372, -500.897217,
-541.213013, 2.639980, -499.816193,
-541.198853, 2.814182, -498.741730,
-541.153137, 2.989250, -497.668915,
-541.090637, 3.167528, -496.597382,
-540.901733, 3.472016, -493.766296,
-539.946655, 3.986804, -480.899536,
-539.758118, 3.963221, -479.829315,
-539.464539, 3.926524, -478.782715,
-539.127625, 3.884508, -477.750854,
-538.753662, 4.055820, -476.738281,
-538.086609, 4.375992, -474.991974,
-535.247925, 5.074961, -467.828430,
-534.701660, 5.041934, -466.858551,
-533.907593, 5.008235, -466.119568,
-532.972717, 4.975322, -465.566498,
-531.983582, 4.943339, -465.114624,
-530.979858, 4.951505, -464.695160,
-529.968079, 4.959478, -464.295441,
-528.951843, 4.983376, -463.907593,
-522.430969, 3.916511, -461.465240,
-521.404968, 3.857628, -461.086182,
-520.377686, 3.902210, -460.729462,
-519.369934, 3.953047, -460.322479,
-518.443848, 3.963709, -459.761841,
-517.644409, 3.968113, -459.040253,
-516.927307, 4.138369, -458.245422,
-516.257751, 4.275104, -457.397705,
-515.619324, 4.360233, -456.520050,
-514.989380, 4.372784, -455.633331,
-514.354065, 4.148522, -454.766449,
-513.569702, 3.888090, -453.690735,
-512.848206, 3.701035, -452.650909,
-512.268372, 3.550035, -451.781738,
-511.656403, 3.532558, -450.883881,
-510.565186, 3.495838, -449.323639,
-509.924683, 3.478686, -448.444824,
-509.263702, 3.481614, -447.580719,
-508.588806, 3.498191, -446.727631,
-507.732697, 3.521606, -445.671478,
-504.967285, 3.235765, -442.320770,
-504.184204, 3.426662, -441.405670,
-503.524536, 3.552731, -440.548615,
-502.838013, 3.638559, -439.709167,
-499.995270, 3.863406, -436.248932,
-499.458771, 3.631288, -435.332092,
-499.354584, 3.427225, -434.275543,
-499.518890, 3.263798, -433.213623,
-499.786255, 3.119409, -432.168945,
-500.093414, 2.942964, -431.138855,
-500.416901, 2.698143, -430.129211,
-500.756897, 2.452024, -429.125366,
-501.102753, 2.205250, -428.123657,
-501.993927, 1.130284, -425.598083,
-502.375153, 0.625838, -424.550262,
-502.760925, 0.259216, -423.439453,
-503.125061, -0.073914, -422.319733,
-503.344879, -0.434069, -421.301147,
-503.392548, -0.782053, -420.267029,
-503.345978, -1.156086, -419.237427,
-503.275909, -1.517113, -418.212494,
-503.200043, -1.875748, -417.190155,
-503.092529, -2.185827, -416.171051,
-501.571167, -5.735084, -403.501678,
-501.418823, -6.069547, -402.475281,
-501.176941, -6.153698, -401.405243,
-500.898254, -6.118875, -400.354431,
-500.586060, -6.079853, -399.313019,
-500.255157, -6.038494, -398.277283,
-499.919769, -5.917615, -397.250214,
-498.133850, -5.162109, -391.881653,
-497.607086, -5.099213, -390.933563,
-496.951874, -5.030679, -390.068451,
-496.247040, -4.960183, -389.242767,
-495.526642, -4.922899, -388.429321,
-494.798859, -4.939609, -387.620911,
-494.057587, -4.973323, -386.825287,
-493.242004, -5.007064, -386.107086,
-492.357513, -5.040519, -385.475281,
-491.422150, -5.050906, -384.920258,
-490.463867, -5.046978, -384.405090,
-489.496246, -5.027953, -383.907104,
-488.524017, -5.008810, -383.419098,
-483.903564, -5.444798, -381.144897,
-482.970856, -5.764278, -380.673676,
-482.046753, -6.081060, -380.195770,
-481.059265, -6.036974, -379.756531,
-480.068268, -6.092669, -379.310974,
-478.083740, -6.252785, -378.424103,
-475.939850, -5.600721, -377.478241,
-474.095123, -5.269806, -376.659973,
-472.988983, -5.088950, -376.167572,
-471.997314, -4.996942, -375.725739,
-467.519684, -5.021126, -373.745483,
-466.568787, -4.988472, -373.221497,
-465.785889, -4.954824, -372.473022,
-465.155731, -4.938012, -371.586975,
-464.613434, -4.943035, -370.644104,
-464.112732, -4.970317, -369.678741,
-463.636993, -5.030797, -368.702332,
-463.174835, -5.119479, -367.720856,
-462.721741, -5.261708, -366.742218,
-461.430298, -5.878856, -363.953918,
-460.990692, -5.964869, -362.965485,
-459.656555, -6.049467, -359.997162,
-459.353271, -6.087378, -358.954742,
-459.191864, -6.107553, -357.879517,
-459.106384, -6.118238, -356.795227,
-459.081055, -6.089601, -355.710297,
-459.074738, -5.935709, -354.633362,
-459.104004, -5.658697, -351.932465,
-459.120667, -5.591868, -350.846558,
-459.187042, -5.479144, -346.507324,
-459.430115, -5.749809, -332.941071,
-459.453735, -5.802073, -331.854553,
-459.471832, -5.754164, -330.767517,
-459.490845, -5.694329, -329.681580,
-459.512299, -5.627197, -328.459930,
-459.529968, -5.682715, -327.376678,
-459.596893, -6.022334, -323.863861,
-459.627655, -6.068361, -321.961487,
-459.653656, -6.049818, -320.465668,
-459.672607, -6.047450, -319.377808,
-459.690857, -6.045168, -318.289795,
-459.733826, -6.098748, -317.204376,
-459.866302, -6.163945, -316.126587,
-460.061859, -6.354894, -315.070129,
-460.284729, -6.588387, -314.031128,
-460.533112, -6.826213, -312.999054,
-460.823303, -7.095395, -311.840057,
-462.704620, -9.301330, -304.645416,
-462.954193, -9.692020, -303.546783,
-463.049988, -10.017150, -302.513519,
-463.025604, -10.351537, -301.479034,
-462.936340, -10.689318, -300.448883,
-462.818665, -11.044333, -299.424500,
-462.686890, -11.409551, -298.408417,
-462.388000, -12.191285, -296.252502,
-460.616119, -15.430405, -284.034149,
-460.460663, -15.766811, -283.004272,
-460.297577, -16.098799, -281.981476,
-460.138611, -16.023895, -280.905792,
-459.880035, -16.021536, -279.850311,
-459.524323, -16.066000, -278.793884,
-459.151947, -16.112444, -277.774414,
-458.760895, -15.948345, -276.768036,
-457.728149, -15.418857, -274.162994,
-457.121918, -15.183194, -272.663147,
-455.141998, -14.929026, -267.753723,
-454.605865, -14.961267, -266.809937,
-453.910492, -14.994783, -265.975586,
-453.106659, -15.028536, -265.243866,
-452.248810, -15.071724, -264.575989,
-451.363373, -15.070765, -263.944366,
-450.467194, -15.049448, -263.327393,
-449.339539, -15.027678, -262.566895,
-446.158661, -15.106158, -260.478607,
-445.146484, -15.217936, -260.096680,
-444.094391, -15.313764, -259.845978,
-443.059662, -15.693615, -259.832489,
-442.038452, -16.061672, -259.905914,
-440.926056, -16.011379, -259.961243,
-439.853027, -16.029181, -259.818878,
-438.834473, -16.076151, -259.442963,
-437.860443, -16.135080, -258.975220,
-436.944824, -15.842243, -258.482483,
-436.029755, -15.561083, -257.958588,
-435.103333, -15.389626, -257.408356,
-433.018707, -15.096863, -256.158447,
-423.253204, -15.007891, -250.244461,
-422.581299, -15.076889, -249.399033,
-422.162994, -15.134439, -248.398422,
-421.907043, -15.243899, -247.346481,
-421.727417, -15.378567, -246.282013,
-421.576630, -15.511925, -245.212921,
-421.436920, -15.814054, -244.166107,
-421.312561, -15.977121, -243.104950,
-421.161774, -16.151787, -241.633881,
-421.101837, -16.144278, -240.547592,
-421.054230, -16.138294, -239.460739,
-420.986694, -16.129854, -237.557938,
-420.237152, -15.986206, -212.018356,
-420.191437, -15.916931, -210.797974,
-420.120667, -15.789013, -207.812439,
-420.097992, -15.820995, -206.456985,
-419.913025, -16.017410, -199.259720,
-420.074188, -16.138962, -198.186157,
-420.394592, -15.806675, -197.200790,
-420.823639, -15.475427, -196.257751,
-421.315735, -15.246454, -195.308350,
-421.840698, -15.131503, -194.360291,
-422.374817, -15.078588, -193.413864,
-424.067291, -15.028349, -190.467560,
-427.695129, -14.944219, -184.241776,
-428.330750, -15.027770, -183.363968,
-429.060547, -15.124342, -182.563538,
-429.847046, -15.204210, -181.816025,
-430.657654, -15.276329, -181.094086,
-431.483185, -15.340816, -180.388275,
-432.919403, -15.584278, -179.168777,
-446.700073, -18.848972, -167.730667,
-447.838928, -18.971676, -166.769211,
-450.328156, -19.379137, -164.696960,
-451.060272, -19.534018, -163.909332,
-451.625610, -19.500000, -162.980560,
-452.083923, -19.517031, -161.994354,
-452.476959, -19.566160, -160.981140,
-452.841187, -19.611700, -159.956909,
-453.191650, -19.646599, -158.927551,
-454.367828, -19.964460, -155.331253,
-455.293671, -20.791029, -152.456436,
-455.619934, -20.976021, -151.448273,
-460.864044, -21.582912, -135.124496,
-461.198395, -21.523344, -134.089920,
-463.464020, -20.982677, -127.008972,
-463.628113, -20.996647, -125.935585,
-463.609283, -21.038952, -124.848961,
-463.521912, -21.146475, -123.767731,
-463.400543, -21.146563, -122.686722,
-463.201691, -21.188892, -121.067558,
-463.072876, -21.257940, -119.990120,
-462.932098, -21.293131, -118.911903,
-460.858124, -21.810720, -103.154648,
-460.394226, -21.855116, -102.181808,
-459.633484, -21.864172, -101.409859,
-458.751892, -21.805742, -100.775322,
-457.821533, -21.747103, -100.215164,
-456.871063, -21.669014, -99.690086,
-455.908997, -21.711084, -99.185425,
-452.652191, -21.466049, -97.507286,
-427.503632, -19.772459, -84.766029,
-426.533905, -19.798971, -84.273788,
-424.118073, -20.060156, -83.055641,
-423.148651, -19.991360, -82.567337
}
function onSpawn(npc)
npc:initNpcAi()
npc:setPos(dsp.path.first(path))
onPath(npc)
end
function onPath(npc)
if npc:atPoint(dsp.path.get(path, 288)) then
GetNPCByID(npc:getID() + 4):showText(npc, ID.text.ZOVRIACE_REPORT)
-- small delay after path finish
npc:wait(8000)
end
dsp.path.patrol(npc, path)
end
function onTrade(player, npc, trade)
end
function onTrigger(player, npc)
player:showText(npc, ID.text.ZOVRIACE_DIALOG)
npc:wait()
end
function onEventUpdate(player, csid, option)
end
function onEventFinish(player, csid, option)
end
| gpl-3.0 |
Deadwing888/darkstar | scripts/zones/Promyvion-Dem/Zone.lua | 13 | 7696 | -----------------------------------
--
-- Zone: Promyvion-Dem (18)
--
-----------------------------------
package.loaded["scripts/zones/Promyvion-Dem/TextIDs"] = nil;
-----------------------------------
require("scripts/globals/settings");
require("scripts/globals/status");
require("scripts/globals/missions");
require("scripts/zones/Promyvion-Dem/TextIDs");
-----------------------------------
-- onInitialize
-----------------------------------
function onInitialize(zone)
--
zone:registerRegion(11,157,-4,-82,161,4,-77); -- Level 1 Return
zone:registerRegion(12,117,-4,-283,122,4,-277); -- Level 1 MR
--
zone:registerRegion(21,-383,-4,-2,-278,4,2); -- Level Two Return
zone:registerRegion(22,-82,-4,76,-77,4,80); -- Level Two MR1
zone:registerRegion(23,-361,-4,36,-356,4,42); -- Level Two MR2
zone:registerRegion(24,-83,-4,-83,-77,4,-76); -- Level Two MR3
zone:registerRegion(25,-282,-4,-202,-277,4,-196); -- Level Two MR4
--
zone:registerRegion(31,-160,-4,437,-157,4,441); -- Level Three West Return
zone:registerRegion(32,-42,-4,317,-37,4,322); -- Level Three West MR1
zone:registerRegion(33,-322,-4,156,-316,4,162); -- Level Three West MR2
zone:registerRegion(34,-122,-4,157,-118,4,163); -- Level Three West MR3
--
zone:registerRegion(35,-2,-4,-322,2,4,-317); -- Level Three East Return
zone:registerRegion(36,37,-4,-203,43,4,-198); -- Level Three East MR1
zone:registerRegion(37,-122,-4,-242,-116,4,-237); -- Level Three East MR2
zone:registerRegion(38,-122,-4,-402,-116,4,-396); -- Level Three East MR3
--
zone:registerRegion(41,357,-4,237,361,4,242); -- Level Four Return
end;
-----------------------------------
-- onZoneIn
-----------------------------------
function onZoneIn(player,prevZone)
local cs = -1;
if (player:getXPos() == 0 and player:getYPos() == 0 and player:getZPos() == 0) then
player:setPos(185.891, 0, -52.331, 128, 18); -- {R}
end
if (player:getCurrentMission(COP) == BELOW_THE_ARKS and player:getVar("PromathiaStatus") == 2) then
player:completeMission(COP,BELOW_THE_ARKS);
player:addMission(COP,THE_MOTHERCRYSTALS); -- start mission 1.3
player:setVar("PromathiaStatus",0);
elseif (player:getCurrentMission(COP) == THE_MOTHERCRYSTALS) then
if (player:hasKeyItem(LIGHT_OF_HOLLA) and player:hasKeyItem(LIGHT_OF_MEA)) then
if (player:getVar("cslastpromy") == 1) then
player:setVar("cslastpromy",0)
cs = 0x0034;
end
elseif (player:hasKeyItem(LIGHT_OF_HOLLA) or player:hasKeyItem(LIGHT_OF_MEA)) then
if (player:getVar("cs2ndpromy") == 1) then
player:setVar("cs2ndpromy",0)
cs = 0x0033;
end
end
end
if (player:getVar("FirstPromyvionDem") == 1) then
cs = 0x0032;
elseif (ENABLE_COP_ZONE_CAP == 1) then
player:addStatusEffect(EFFECT_LEVEL_RESTRICTION,30,0,0);-- ZONE LEVEL RESTRICTION
end
return cs;
end;
-----------------------------------
-- onRegionEnter
-----------------------------------
function onRegionEnter(player,region)
-- regionID =region:GetRegionID();
-- printf("regionID: %u",regionID);
if (player:getAnimation()==0) then
switch (region:GetRegionID()): caseof
{
[11] = function (x)
player:startEvent(0x002E);
end,
[12] = function (x)
if (GetNPCByID(16851268):getAnimation() == 8) then
player:startEvent(30);
end
end,
[21] = function (x)
player:startEvent(41);
end,
[22] = function (x)
if (GetNPCByID(16851273):getAnimation() == 8) then
if (player:getVar("MemoryReceptacle") == 2) then
player:startEvent(35);
else
player:startEvent(34);
end
end
end,
[23] = function (x)
if (GetNPCByID(16851275):getAnimation() == 8) then
if (player:getVar("MemoryReceptacle") == 2) then
player:startEvent(35);
else
player:startEvent(34);
end
end
end,
[24] = function (x)
if (GetNPCByID(16851272):getAnimation() == 8) then
if (player:getVar("MemoryReceptacle") == 2) then
player:startEvent(35);
else
player:startEvent(34);
end
end
end,
[25] = function (x)
if (GetNPCByID(16851274):getAnimation() == 8) then
if (player:getVar("MemoryReceptacle") == 2) then
player:startEvent(35);
else
player:startEvent(34);
end
end
end,
[31] = function (x)
player:startEvent(30);
end,
[32] = function (x)
if (GetNPCByID(16851277):getAnimation() == 8) then
player:startEvent(32);
end
end,
[33] = function (x)
if (GetNPCByID(16851276):getAnimation() == 8) then
player:startEvent(32);
end
end,
[34] = function (x)
if (GetNPCByID(16851278):getAnimation() == 8) then
player:startEvent(32);
end
end,
[35] = function (x)
player:startEvent(30);
end,
[36] = function (x)
if (GetNPCByID(16851269):getAnimation() == 8) then
player:startEvent(32);
end
end,
[37] = function (x)
if (GetNPCByID(16851270):getAnimation() == 8) then
player:startEvent(32);
end
end,
[38] = function (x)
if (GetNPCByID(16851271):getAnimation() == 8) then
player:startEvent(32);
end
end,
[41] = function (x)
if (player:getVar("MemoryReceptacle") == 2) then
player:startEvent(31);
else
player:startEvent(34);
end
end,
}
end
end;
-----------------------------------
-- onRegionLeave
-----------------------------------
function onRegionLeave(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);
if (csid == 0x002e and option == 1) then
player:setPos(-226.193, -46.459, -280.046, 127, 14); -- To Hall of Transference {R}
elseif (csid == 0x0032) then
player:setVar("FirstPromyvionDem",0);
if (ENABLE_COP_ZONE_CAP == 1) then
player:addStatusEffect(EFFECT_LEVEL_RESTRICTION,30,0,0); -- ZONE LEVEL RESTRICTION
end
end
if (option==1) then
player:setVar("MemoryReceptacle",0);
end
end; | gpl-3.0 |
destdev/ygopro-scripts | c28053763.lua | 1 | 2444 | --ドラゴノイド・ジェネレーター
function c28053763.initial_effect(c)
--Activate
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_ACTIVATE)
e1:SetCode(EVENT_FREE_CHAIN)
e1:SetCost(c28053763.cost)
c:RegisterEffect(e1)
--Special Summon
local e2=Effect.CreateEffect(c)
e2:SetCategory(CATEGORY_SPECIAL_SUMMON+CATEGORY_TOKEN)
e2:SetType(EFFECT_TYPE_IGNITION)
e2:SetRange(LOCATION_SZONE)
e2:SetCountLimit(2,28053763)
e2:SetTarget(c28053763.tktg)
e2:SetOperation(c28053763.tkop)
c:RegisterEffect(e2)
end
function c28053763.cost(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.CheckLPCost(tp,1000) end
Duel.PayLPCost(tp,1000)
end
function c28053763.tktg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0
and Duel.IsPlayerCanSpecialSummonMonster(tp,28053764,0,0x4011,300,300,1,RACE_MACHINE,ATTRIBUTE_EARTH,POS_FACEUP_ATTACK) end
Duel.SetOperationInfo(0,CATEGORY_TOKEN,nil,1,0,0)
Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,0,0)
end
function c28053763.tkop(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
if not c:IsRelateToEffect(e) then return end
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_FIELD)
e1:SetCode(EFFECT_CANNOT_SPECIAL_SUMMON)
e1:SetProperty(EFFECT_FLAG_PLAYER_TARGET)
e1:SetTargetRange(1,0)
e1:SetTarget(aux.TargetBoolFunction(Card.IsLocation,LOCATION_EXTRA))
e1:SetReset(RESET_PHASE+PHASE_END)
Duel.RegisterEffect(e1,tp)
if Duel.GetLocationCount(tp,LOCATION_MZONE)<=0
or not Duel.IsPlayerCanSpecialSummonMonster(tp,28053764,0,0x4011,300,300,1,RACE_MACHINE,ATTRIBUTE_EARTH,POS_FACEUP_ATTACK) then return end
local token=Duel.CreateToken(tp,28053764)
Duel.SpecialSummon(token,0,tp,tp,false,false,POS_FACEUP_ATTACK)
local e2=Effect.CreateEffect(c)
e2:SetCategory(CATEGORY_SPECIAL_SUMMON)
e2:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS)
e2:SetCode(EVENT_PHASE+PHASE_END)
e2:SetCountLimit(1)
e2:SetOperation(c28053763.tkop2)
e2:SetReset(RESET_PHASE+PHASE_END)
Duel.RegisterEffect(e2,tp)
end
function c28053763.tkop2(e,tp,eg,ep,ev,re,r,rp)
if Duel.GetLocationCount(1-tp,LOCATION_MZONE)<=0 then return end
if not Duel.IsPlayerCanSpecialSummonMonster(1-tp,28053764,0,0x4011,300,300,1,RACE_MACHINE,ATTRIBUTE_EARTH,POS_FACEUP_ATTACK) then return end
Duel.Hint(HINT_CARD,PLAYER_ALL,28053763)
local token=Duel.CreateToken(1-tp,28053764)
Duel.SpecialSummon(token,0,1-tp,1-tp,false,false,POS_FACEUP_ATTACK)
end
| gpl-2.0 |
streamdataio/kong | spec/plugins/response-transformer/access_spec.lua | 3 | 3154 | local spec_helper = require "spec.spec_helpers"
local http_client = require "kong.tools.http_client"
local cjson = require "cjson"
local STUB_GET_URL = spec_helper.PROXY_URL.."/get"
local STUB_HEADERS_URL = spec_helper.PROXY_URL.."/response-headers"
describe("Response Transformer Plugin #proxy", function()
setup(function()
spec_helper.prepare_db()
spec_helper.insert_fixtures {
api = {
{ name = "tests response-transformer", inbound_dns = "response.com", upstream_url = "http://httpbin.org" },
{ name = "tests response-transformer 2", inbound_dns = "response2.com", upstream_url = "http://httpbin.org" },
},
plugin = {
{
name = "response-transformer",
config = {
add = {
headers = {"x-added:true", "x-added2:true" },
json = {"newjsonparam:newvalue"}
},
remove = {
headers = { "x-to-remove" },
json = { "origin" }
}
},
__api = 1
},
{
name = "response-transformer",
config = {
add = {
headers = {"Cache-Control:max-age=86400"}
}
},
__api = 2
}
}
}
spec_helper.start_kong()
end)
teardown(function()
spec_helper.stop_kong()
end)
describe("Test adding parameters", function()
it("should add new headers", function()
local _, status, headers = http_client.get(STUB_GET_URL, {}, {host = "response.com"})
assert.are.equal(200, status)
assert.are.equal("true", headers["x-added"])
assert.are.equal("true", headers["x-added2"])
end)
it("should add new parameters on GET", function()
local response, status = http_client.get("http://127.0.0.1:8100/get", {}, {host = "response.com"})
assert.are.equal(200, status)
local body = cjson.decode(response)
assert.are.equal("newvalue", body["newjsonparam"])
end)
it("should add new parameters on POST", function()
local response, status = http_client.post("http://127.0.0.1:8100/post", {}, {host = "response.com"})
assert.are.equal(200, status)
local body = cjson.decode(response)
assert.are.equal("newvalue", body["newjsonparam"])
end)
it("should add new headers", function()
local _, status, headers = http_client.get(STUB_GET_URL, {}, {host = "response2.com"})
assert.are.equal(200, status)
assert.are.equal("max-age=86400", headers["cache-control"])
end)
end)
describe("Test removing parameters", function()
it("should remove a header", function()
local _, status, headers = http_client.get(STUB_HEADERS_URL, { ["x-to-remove"] = "true"}, {host = "response.com"})
assert.are.equal(200, status)
assert.falsy(headers["x-to-remove"])
end)
it("should remove a parameter on GET", function()
local response, status = http_client.get("http://127.0.0.1:8100/get", {}, {host = "response.com"})
assert.are.equal(200, status)
local body = cjson.decode(response)
assert.falsy(body.origin)
end)
end)
end)
| apache-2.0 |
RwNigma/darkstar | scripts/zones/Port_Windurst/npcs/HomePoint#2.lua | 17 | 1253 | -----------------------------------
-- Area: Port Windurst
-- NPC: HomePoint#2
-- @pos -207 -8.159 210 240
-----------------------------------
package.loaded["scripts/zones/Port_Windurst/TextIDs"] = nil;
require("scripts/globals/settings");
require("scripts/zones/Port_Windurst/TextIDs");
require("scripts/globals/homepoint");
-----------------------------------
-- onTrade Action
-----------------------------------
function onTrade(player,npc,trade)
end;
-----------------------------------
-- onTrigger Action
-----------------------------------
function onTrigger(player,npc)
homepointMenu( player, 0x21fd, 23);
end;
-----------------------------------
-- onEventUpdate
-----------------------------------
function onEventUpdate(player,csid,option)
--printf("CSID: %u",csid);
--printf("RESULT: %u",option);
end;
-----------------------------------
-- onEventFinish
-----------------------------------
function onEventFinish(player,csid,option)
--printf("CSID: %u",csid);
--printf("RESULT: %u",option);
if (csid == 0x21fd) then
if (option == 1) then
player:setHomePoint();
player:messageSpecial(HOMEPOINT_SET);
else
hpTeleport( player, option);
end
end
end; | gpl-3.0 |
jcosborn/qhmc | lua/Init.lua | 1 | 2685 | -- this file is loaded at startup by default
function printfAll(...)
io.write(string.format(...))
end
function eprintfAll(...)
io.stderr:write(string.format(...))
end
if qopqdp and qopqdp.master then
function printf(...)
if(qopqdp.master()) then
printfAll(...)
end
end
function eprintf(...)
if(qopqdp.master()) then
eprintfAll(...)
end
end
else
printf = printfAll
end
do
local spaces = ""
local function printline(event, ln)
if(event == "call") then
spaces = spaces .. " "
elseif(event == "return") then
spaces = string.sub(spaces, 1, -3)
else
if ln==nil then ln = "" end
print(spaces .. (debug.getinfo(2,"n").name or "main") .. " : " .. ln)
end
end
function trace(on)
if(on) then
debug.sethook(printline, "crl")
else
debug.sethook(nil, "crl")
end
end
end
function tableCopy(t)
local r = {}
for k,v in pairs(t) do r[k]=v end
return r
end
function tableCopyTo(r, t)
for k,v in pairs(t) do r[k]=v end
end
function abort(...)
printf(...)
printf(debug.traceback())
end
do
local function simple(t)
for k,v in pairs(t) do
if type(v) == "table" then return false end
end
return true
end
local function numeric(t)
for k,v in pairs(t) do
if type(k) ~= "number" then return false end
if k ~= math.floor(k) then return false end
if k<1 then return false end
end
return true
end
local function sortkeys(a, b)
local ta,tb = type(a),type(b)
if ta==tb then return a<b end
return ta>tb
end
local function myprintr(x, indent, seen)
if type(x) == "table" then
if seen[x] then printf("<loop>"); return end
seen[x] = true
printf("{")
if simple(x) and numeric(x) then
local n = table.maxn(x)
printf(" ")
for i=1,n do
myprintr(x[i], indent, tableCopy(seen))
if i<n then printf(", ")
else printf(" ") end
end
else
printf("\n")
local keys = {}
for k in pairs(x) do keys[#keys+1] = k end
table.sort(keys, sortkeys)
for _,k in ipairs(keys) do
local v = x[k]
printf(" %s%s = ", indent, tostring(k))
myprintr(v, indent.." ", tableCopy(seen))
printf("\n")
end
if(indent~="") then printf("%s", indent) end
end
printf("}")
else
local s = tostring(x)
if x==nil then s = "nil" end
printf("%s", s)
end
end
function myprint(...)
local t = {...}
local n = table.maxn(t)
for i=1,n do
myprintr(t[i], "", {})
end
end
end
Class = require 'pl.class'
| gpl-3.0 |
Deadwing888/darkstar | scripts/globals/items/dragon_steak.lua | 18 | 1866 | -----------------------------------------
-- ID: 4350
-- Item: dragon_steak
-- Food Effect: 180Min, All Races
-----------------------------------------
-- Health 25
-- Strength 7
-- Intelligence -3
-- Health Regen While Healing 2
-- Attack % 20
-- Attack Cap 150
-- Ranged ATT % 20
-- Ranged ATT Cap 150
-- Demon Killer 5
-----------------------------------------
require("scripts/globals/status");
-----------------------------------------
-- OnItemCheck
-----------------------------------------
function onItemCheck(target)
local result = 0;
if (target:hasStatusEffect(EFFECT_FOOD) == true or target:hasStatusEffect(EFFECT_FIELD_SUPPORT_FOOD) == true) then
result = 246;
end
return result;
end;
-----------------------------------------
-- OnItemUse
-----------------------------------------
function onItemUse(target)
target:addStatusEffect(EFFECT_FOOD,0,0,10800,4350);
end;
-----------------------------------------
-- onEffectGain Action
-----------------------------------------
function onEffectGain(target,effect)
target:addMod(MOD_HP, 25);
target:addMod(MOD_STR, 7);
target:addMod(MOD_INT, -3);
target:addMod(MOD_HPHEAL, 2);
target:addMod(MOD_FOOD_ATTP, 20);
target:addMod(MOD_FOOD_ATT_CAP, 150);
target:addMod(MOD_FOOD_RATTP, 20);
target:addMod(MOD_FOOD_RATT_CAP, 150);
target:addMod(MOD_DEMON_KILLER, 5);
end;
-----------------------------------------
-- onEffectLose Action
-----------------------------------------
function onEffectLose(target,effect)
target:delMod(MOD_HP, 25);
target:delMod(MOD_STR, 7);
target:delMod(MOD_INT, -3);
target:delMod(MOD_HPHEAL, 2);
target:delMod(MOD_FOOD_ATTP, 20);
target:delMod(MOD_FOOD_ATT_CAP, 150);
target:delMod(MOD_FOOD_RATTP, 20);
target:delMod(MOD_FOOD_RATT_CAP, 150);
target:delMod(MOD_DEMON_KILLER, 5);
end;
| gpl-3.0 |
RwNigma/darkstar | scripts/zones/Mount_Kamihr/Zone.lua | 34 | 1279 | -----------------------------------
--
-- Zone: Mount Kamihr
--
-----------------------------------
package.loaded["scripts/zones/Mount_Kamihr/TextIDs"] = nil;
-----------------------------------
require("scripts/globals/settings");
require("scripts/zones/Mount_Kamihr/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(x, y, z, r);
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 |
RwNigma/darkstar | scripts/zones/Lower_Delkfutts_Tower/npcs/_540.lua | 17 | 2177 | -----------------------------------
-- Area: Lower Delkfutt's Tower
-- NPC: Cermet Door
-- Cermet Door for Windy Ambassador
-- Windurst Mission 3.3 "A New Journey"
-- @pos 636 16 59 184
-----------------------------------
package.loaded["scripts/zones/Lower_Delkfutts_Tower/TextIDs"] = nil;
-----------------------------------
require("scripts/globals/settings");
require("scripts/globals/keyitems");
require("scripts/globals/missions");
require("scripts/zones/Lower_Delkfutts_Tower/TextIDs");
-----------------------------------
-- onTrade Action
-----------------------------------
function onTrade(player,npc,trade)
if (player:getCurrentMission(WINDURST) == A_NEW_JOURNEY and player:getVar("MissionStatus") == 2) then
if (trade:hasItemQty(549,1) and trade:getItemCount() == 1) then -- Trade Delkfutt Key
player:startEvent(0x0002);
end
end
end;
-----------------------------------
-- onTrigger Action
-----------------------------------
function onTrigger(player,npc)
local currentMission = player:getCurrentMission(WINDURST);
if (currentMission == A_NEW_JOURNEY and player:getVar("MissionStatus") == 2 and player:hasKeyItem(DELKFUTT_KEY) == false) then
player:messageSpecial(THE_DOOR_IS_FIRMLY_SHUT_OPEN_KEY);
elseif (currentMission == A_NEW_JOURNEY and player:getVar("MissionStatus") == 2 and player:hasKeyItem(DELKFUTT_KEY)) then
player:startEvent(0x0002);
else
player:messageSpecial(DOOR_FIRMLY_SHUT);
end
return 1;
end;
-----------------------------------
-- onEventUpdate
-----------------------------------
function onEventUpdate(player,csid,option)
--printf("CSID: %u",csid);
--printf("RESULT: %u",option);
end;
-----------------------------------
-- onEventFinish
-----------------------------------
function onEventFinish(player,csid,option)
--print("CSID:",csid);
--print("RESULT:",option);
if (csid == 0x0002) then
if (player:hasKeyItem(DELKFUTT_KEY) == false) then
player:tradeComplete();
player:addKeyItem(DELKFUTT_KEY);
player:messageSpecial(KEYITEM_OBTAINED,DELKFUTT_KEY);
end
player:setVar("MissionStatus",3);
end
end; | gpl-3.0 |
ffxijuggalo/darkstar | scripts/zones/Upper_Jeuno/npcs/Theraisie.lua | 12 | 1397 | -----------------------------------
-- Area: Upper Jeuno
-- NPC: Theraisie
-- Standard Merchant NPC
-----------------------------------
local ID = require("scripts/zones/Upper_Jeuno/IDs")
require("scripts/globals/shop")
function onTrade(player,npc,trade)
end
function onTrigger(player,npc)
local stock =
{
21444, 200, -- Livid Broth
21445, 344, -- Lyrical Broth
21446, 519, -- Airy Broth
21447, 1016, -- Crumbly Soil
17922, 1484, -- Blackwater Broth
21448, 1747, -- Pale Sap
21498, 1747, -- Crackling Broth
17920, 2195, -- Meaty Broth
21497, 2371, -- Rapid Broth
21499, 2425, -- Creepy Broth
17921, 2853, -- Muddy Broth
21449, 3004, -- Dire Broth
17016, 100, -- Pet Food Alpha
17017, 200, -- Pet Food Beta
17018, 350, -- Pet Food Gamma
17019, 500, -- Pet Food Delta
17020, 750, -- Pet Food Epsilon
17021, 1000, -- Pet Food Zeta
17022, 1500, -- Pet Food Eta
17023, 2000, -- Pet Food Theta
19251, 300, -- Pet Roborant
19252, 250, -- Pet Poultice
}
player:showText(npc, ID.text.MP_SHOP_DIALOG)
dsp.shop.general(player, stock)
end
function onEventUpdate(player,csid,option)
end
function onEventFinish(player,csid,option)
end | gpl-3.0 |
ffxijuggalo/darkstar | scripts/globals/shop.lua | 7 | 24263 | -----------------------------------
--
-- Functions for Shop system
--
-----------------------------------
require("scripts/globals/conquest")
require("scripts/globals/settings")
require("scripts/globals/crafting")
-----------------------------------
dsp = dsp or {}
dsp.shop =
{
--[[ *******************************************************************************
send general shop dialog to player
stock cuts off after 16 items. if you add more, extras will not display
stock is of form {itemId1, price1, itemId2, price2, ...}
log is a log ID from scripts/globals/log_ids.lua
******************************************************************************* --]]
general = function(player, stock, log)
local priceMultiplier = 1
if log then
priceMultiplier = (1 + (0.20 * (9 - player:getFameLevel(log)) / 8)) * SHOP_PRICE
else
log = -1
end
player:createShop(#stock / 2, log)
for i = 1, #stock, 2 do
player:addShopItem(stock[i], stock[i+1] * priceMultiplier)
end
player:sendMenu(2)
end,
--[[ *******************************************************************************
send general guild shop dialog to player (Added on June 2014 QoL)
stock is of form {itemId1, price1, guildID, guildRank, ...}
log is default set to -1 as it's needed as part of createShop()
******************************************************************************* --]]
generalGuild = function(player, stock, guildRank)
local log = -1
player:createShop(#stock / 3, log)
for i = 1, #stock, 3 do
if guildRank >= stock[i+2] then
player:addShopItem(stock[i], stock[i+1])
end
end
player:sendMenu(2)
end,
--[[ *******************************************************************************
send nation shop dialog to player
stock cuts off after 16 items. if you add more, extras will not display
stock is of form {itemId1, price1, place1, itemId2, price2, place2, ...}
where place is what place the nation must be in for item to be stocked
nation is a dsp.nation ID from scripts/globals/zone.lua
******************************************************************************* --]]
nation = function(player, stock, nation)
local rank = getNationRank(nation)
local newStock = {}
for i = 1, #stock, 3 do
if
(stock[i+2] == 1 and player:getNation() == nation and rank == 1) or
(stock[i+2] == 2 and rank <= 2) or
(stock[i+2] == 3)
then
table.insert(newStock, stock[i])
table.insert(newStock, stock[i+1])
end
end
dsp.shop.general(player, newStock, nation)
end,
--[[ *******************************************************************************
send outpost shop dialog to player
******************************************************************************* --]]
outpost = function(player)
local stock =
{
4148, 316, -- Antidote
4151, 800, -- Echo Drops
4128, 4832, -- Ether
4150, 2595, -- Eye Drops
4112, 910, -- Potion
}
dsp.shop.general(player, stock)
end,
--[[ *******************************************************************************
send celebratory chest shop dialog to player
******************************************************************************* --]]
celebratory = function(player)
local stock =
{
4167, 30, -- Cracker
4168, 30, -- Twinkle Shower
4215, 60, -- Popstar
4216, 60, -- Brilliant Snow
4256, 30, -- Ouka Ranman
4169, 30, -- Little Comet
5769, 650, -- Popper
4170, 1000, -- Wedding Bell
5424, 6000, -- Serene Serinette
5425, 6000, -- Joyous Serinette
4441, 1116, -- Grape Juice
4238, 3000, -- Inferno Crystal
4240, 3000, -- Cyclone Crystal
4241, 3000, -- Terra Crystal
}
dsp.shop.general(player, stock)
end,
--[[ *******************************************************************************
stock for guild vendors that are open 24/8
******************************************************************************* --]]
generalGuildStock =
{
[guild.cooking] =
{
936, 16, dsp.craftRank.AMATEUR, -- Rock Salt
4509, 12, dsp.craftRank.AMATEUR, -- Distilled Water
4362, 100, dsp.craftRank.AMATEUR, -- Lizard Egg
4392, 32, dsp.craftRank.AMATEUR, -- Saruta Orange
4431, 76, dsp.craftRank.AMATEUR, -- San d'Orian Grapes
9193, 2500, dsp.craftRank.AMATEUR, -- Miso
9194, 2500, dsp.craftRank.AMATEUR, -- Soy Sauce
9195, 2500, dsp.craftRank.AMATEUR, -- Dried Bonito
610, 60, dsp.craftRank.RECRUIT, -- San d'Orian Flour
627, 40, dsp.craftRank.RECRUIT, -- Maple Sugar
4363, 44, dsp.craftRank.RECRUIT, -- Faerie Apple
4378, 60, dsp.craftRank.RECRUIT, -- Selbina Milk
4370, 200, dsp.craftRank.RECRUIT, -- Honey
4432, 60, dsp.craftRank.INITIATE, -- Kazham Pineapple
4366, 24, dsp.craftRank.INITIATE, -- La Theine Cabbage
611, 40, dsp.craftRank.INITIATE, -- Rye Flour
4412, 325, dsp.craftRank.NOVICE, -- Thundermelon
4491, 200, dsp.craftRank.NOVICE, -- Watermelon
615, 60, dsp.craftRank.NOVICE, -- Selbina Butter
612, 60, dsp.craftRank.APPRENTICE, -- Kazham Peppers
1111, 900, dsp.craftRank.APPRENTICE, -- Gelatin
1776, 3000, dsp.craftRank.JOURNEYMAN, -- Spaghetti
5164, 2595, dsp.craftRank.JOURNEYMAN, -- Ground Wasabi
616, 1600, dsp.craftRank.CRAFTSMAN, -- Pie Dough
2561, 3000, dsp.craftRank.CRAFTSMAN, -- Pizza Dough
8800, 600, dsp.craftRank.CRAFTSMAN, -- Azuki Bean
8903, 300, dsp.craftRank.AMATEUR, -- Cooking Kit 5
8904, 400, dsp.craftRank.AMATEUR, -- Cooking Kit 10
8905, 650, dsp.craftRank.AMATEUR, -- Cooking Kit 15
8906, 1050, dsp.craftRank.AMATEUR, -- Cooking Kit 20
8907, 1600, dsp.craftRank.AMATEUR, -- Cooking Kit 25
8908, 2300, dsp.craftRank.AMATEUR, -- Cooking Kit 30
8909, 3150, dsp.craftRank.AMATEUR, -- Cooking Kit 35
8910, 4150, dsp.craftRank.AMATEUR, -- Cooking Kit 40
8911, 5300, dsp.craftRank.AMATEUR, -- Cooking Kit 45
8912, 7600, dsp.craftRank.AMATEUR -- Cooking Kit 50
},
[guild.clothcraft] =
{
2128, 75, dsp.craftRank.AMATEUR, -- Spindle
2145, 75, dsp.craftRank.AMATEUR, -- Zephyr Thread
833, 20, dsp.craftRank.AMATEUR, -- Moko Grass
834, 500, dsp.craftRank.RECRUIT, -- Saruta Cotton
1845, 200, dsp.craftRank.RECRUIT, -- Red Moko Grass
819, 150, dsp.craftRank.INITIATE, -- Linen Thread
820, 2800, dsp.craftRank.NOVICE, -- Wool Thread
2295, 800, dsp.craftRank.APPRENTICE, -- Mohbwa Grass
816, 1500, dsp.craftRank.APPRENTICE, -- Silk Thread
2315, 1400, dsp.craftRank.JOURNEYMAN, -- Karakul Wool
823, 14500, dsp.craftRank.CRAFTSMAN, -- Gold Thread
8847, 300, dsp.craftRank.AMATEUR, -- Clothcraft kit 5
8848, 400, dsp.craftRank.AMATEUR, -- Clothcraft Kit 10
8849, 650, dsp.craftRank.AMATEUR, -- Clothcraft Kit 15
8850, 1050, dsp.craftRank.AMATEUR, -- Clothcraft Kit 20
8851, 1600, dsp.craftRank.AMATEUR, -- Clothcraft Kit 25
8852, 2300, dsp.craftRank.AMATEUR, -- Clothcraft Kit 30
8853, 3150, dsp.craftRank.AMATEUR, -- Clothcraft Kit 35
8854, 4150, dsp.craftRank.AMATEUR, -- Clothcraft Kit 40
8855, 5300, dsp.craftRank.AMATEUR, -- Clothcraft Kit 45
8856, 7600, dsp.craftRank.AMATEUR, -- Clothcraft Kit 50
9251, 1126125, dsp.craftRank.AMATEUR -- Khoma Thread
},
[guild.goldsmithing] =
{
2144, 75, dsp.craftRank.AMATEUR, -- Workshop Anvil
2143, 75, dsp.craftRank.AMATEUR, -- Mandrel
642, 200, dsp.craftRank.AMATEUR, -- Zinc Ore
640, 12, dsp.craftRank.AMATEUR, -- Copper Ore
1231, 40, dsp.craftRank.RECRUIT, -- Brass Nugget
661, 300, dsp.craftRank.RECRUIT, -- Brass Sheet
736, 450, dsp.craftRank.RECRUIT, -- Silver Ore
1233, 200, dsp.craftRank.INITIATE, -- Silver Nugget
806, 1863, dsp.craftRank.INITIATE, -- Tourmaline
807, 1863, dsp.craftRank.INITIATE, -- Sardonyx
809, 1863, dsp.craftRank.INITIATE, -- Clear Topaz
800, 1863, dsp.craftRank.INITIATE, -- Amethyst
795, 1863, dsp.craftRank.INITIATE, -- Lapis Lazuli
814, 1863, dsp.craftRank.INITIATE, -- Amber
799, 1863, dsp.craftRank.INITIATE, -- Onyx
796, 1863, dsp.craftRank.INITIATE, -- Light Opal
760, 23000, dsp.craftRank.NOVICE, -- Silver Chain
644, 2000, dsp.craftRank.NOVICE, -- Mythril Ore
737, 3000, dsp.craftRank.APPRENTICE, -- Gold Ore
663, 12000, dsp.craftRank.APPRENTICE, -- Mythril Sheet
788, 8000, dsp.craftRank.APPRENTICE, -- Peridot
790, 8000, dsp.craftRank.APPRENTICE, -- Garnet
808, 8000, dsp.craftRank.APPRENTICE, -- Goshenite
811, 8000, dsp.craftRank.APPRENTICE, -- Ametrine
798, 8000, dsp.craftRank.APPRENTICE, -- Turquoise
815, 8000, dsp.craftRank.APPRENTICE, -- Sphene
793, 8000, dsp.craftRank.APPRENTICE, -- Black Pearl
792, 8000, dsp.craftRank.APPRENTICE, -- Pearl
678, 5000, dsp.craftRank.APPRENTICE, -- Aluminum Ore
752, 32000, dsp.craftRank.JOURNEYMAN, -- Gold Sheet
761, 58000, dsp.craftRank.JOURNEYMAN, -- Gold Chain
738, 5000, dsp.craftRank.CRAFTSMAN, -- Platinum Ore
8833, 300, dsp.craftRank.AMATEUR, -- Goldsmithing Kit 5
8834, 400, dsp.craftRank.AMATEUR, -- Goldsmithing Kit 10
8835, 650, dsp.craftRank.AMATEUR, -- Goldsmithing Kit 15
8836, 1050, dsp.craftRank.AMATEUR, -- Goldsmithing Kit 20
8837, 1600, dsp.craftRank.AMATEUR, -- Goldsmithing Kit 25
8838, 2300, dsp.craftRank.AMATEUR, -- Goldsmithing Kit 30
8839, 3150, dsp.craftRank.AMATEUR, -- Goldsmithing Kit 35
8840, 4150, dsp.craftRank.AMATEUR, -- Goldsmithing Kit 40
8841, 5300, dsp.craftRank.AMATEUR, -- Goldsmithing Kit 45
8842, 7600, dsp.craftRank.AMATEUR, -- Goldsmithing Kit 50
9249, 1126125, dsp.craftRank.AMATEUR -- Ruthenium Ore
},
[guild.woodworking] =
{
1657, 100, dsp.craftRank.AMATEUR, -- Bundling Twine
688, 25, dsp.craftRank.AMATEUR, -- Arrowwood Log
689, 50, dsp.craftRank.AMATEUR, -- Lauan Log
691, 70, dsp.craftRank.AMATEUR, -- Maple Log
697, 800, dsp.craftRank.RECRUIT, -- Holly Log
695, 1600, dsp.craftRank.RECRUIT, -- Willow Log
693, 1300, dsp.craftRank.RECRUIT, -- Walnut Log
696, 500, dsp.craftRank.INITIATE, -- Yew Log
690, 3800, dsp.craftRank.INITIATE, -- Elm Log
694, 3400, dsp.craftRank.INITIATE, -- Chestnut Log
727, 2000, dsp.craftRank.NOVICE, -- Dogwood Log
699, 4000, dsp.craftRank.NOVICE, -- Oak Log
701, 4500, dsp.craftRank.APPRENTICE, -- Rosewood Log
700, 4500, dsp.craftRank.JOURNEYMAN, -- Mahogany Log
702, 5000, dsp.craftRank.CRAFTSMAN, -- Ebony Log
2761, 5500, dsp.craftRank.CRAFTSMAN, -- Feyweald Log
8805, 300, dsp.craftRank.AMATEUR, -- Smithing Kit 5
8806, 400, dsp.craftRank.AMATEUR, -- Smithing Kit 10
8807, 650, dsp.craftRank.AMATEUR, -- Smithing Kit 15
8808, 1050, dsp.craftRank.AMATEUR, -- Smithing Kit 20
8809, 1600, dsp.craftRank.AMATEUR, -- Smithing Kit 25
8810, 2300, dsp.craftRank.AMATEUR, -- Smithing Kit 30
8811, 3150, dsp.craftRank.AMATEUR, -- Smithing Kit 35
8812, 4150, dsp.craftRank.AMATEUR, -- Smithing Kit 40
8813, 5300, dsp.craftRank.AMATEUR, -- Smithing Kit 45
8814, 7600, dsp.craftRank.AMATEUR, -- Smithing Kit 50
9245, 1126125, dsp.craftRank.AMATEUR -- Cypress Log
},
[guild.alchemy] =
{
2131, 75, dsp.craftRank.AMATEUR, -- Triturator
912, 40, dsp.craftRank.AMATEUR, -- Beehive Chip
914, 1700, dsp.craftRank.AMATEUR, -- Mercury
937, 300, dsp.craftRank.RECRUIT, -- Animal Glue
943, 320, dsp.craftRank.RECRUIT, -- Poison Dust
637, 1500, dsp.craftRank.INITIATE, -- Slime Oil
928, 515, dsp.craftRank.INITIATE, -- Bomb Ash
921, 200, dsp.craftRank.INITIATE, -- Ahriman Tears
933, 1200, dsp.craftRank.NOVICE, -- Glass Fiber
947, 5000, dsp.craftRank.NOVICE, -- Firesand
4171, 700, dsp.craftRank.APPRENTICE, -- Vitriol
1886, 4000, dsp.craftRank.APPRENTICE, -- Sieglinde Putty
923, 1800, dsp.craftRank.APPRENTICE, -- Dryad Root
932, 1900, dsp.craftRank.JOURNEYMAN, -- Carbon Fiber
939, 2100, dsp.craftRank.JOURNEYMAN, -- Hecteyes Eye
915, 3600, dsp.craftRank.JOURNEYMAN, -- Toad Oil
931, 5000, dsp.craftRank.CRAFTSMAN, -- Cermet Chunk
944, 1035, dsp.craftRank.CRAFTSMAN, -- Venom Dust
8889, 300, dsp.craftRank.AMATEUR, -- Alchemy Kit 5
8890, 400, dsp.craftRank.AMATEUR, -- Alchemy Kit 10
8891, 650, dsp.craftRank.AMATEUR, -- Alchemy Kit 15
8892, 1050, dsp.craftRank.AMATEUR, -- Alchemy Kit 20
8893, 1600, dsp.craftRank.AMATEUR, -- Alchemy Kit 25
8894, 2300, dsp.craftRank.AMATEUR, -- Alchemy Kit 30
8895, 3150, dsp.craftRank.AMATEUR, -- Alchemy Kit 35
8896, 4150, dsp.craftRank.AMATEUR, -- Alchemy Kit 40
8897, 5300, dsp.craftRank.AMATEUR, -- Alchemy Kit 45
8898, 7600, dsp.craftRank.AMATEUR, -- Alchemy Kit 50
9257, 1126125, dsp.craftRank.AMATEUR -- Azure Leaf
},
[guild.bonecraft] =
{
2130, 75, dsp.craftRank.AMATEUR, -- Shagreen File
880, 150, dsp.craftRank.AMATEUR, -- Bone Chip
864, 96, dsp.craftRank.AMATEUR, -- Fish Scales
898, 1500, dsp.craftRank.RECRUIT, -- Chicken Bone [Recruit]
893, 1400, dsp.craftRank.RECRUIT, -- Giant Femur [Recruit]
889, 500, dsp.craftRank.INITIATE, -- Beetle Shell [Initiate]
894, 1000, dsp.craftRank.INITIATE, -- Beetle Jaw [Initiate]
895, 1800, dsp.craftRank.NOVICE, -- Ram Horn [Novice]
884, 2000, dsp.craftRank.NOVICE, -- Black Tiger Fang [Novice]
881, 2500, dsp.craftRank.APPRENTICE, -- Crab Shell [Apprentice]
885, 6000, dsp.craftRank.JOURNEYMAN, -- Turtle Shell [Journeyman]
897, 2400, dsp.craftRank.JOURNEYMAN, -- Scorpion Claw [Journeyman]
1622, 4000, dsp.craftRank.JOURNEYMAN, -- Bugard Tusk [Journeyman]
896, 3000, dsp.craftRank.CRAFTSMAN, -- Scorpion Shell [Craftsman]
2147, 4500, dsp.craftRank.CRAFTSMAN, -- Marid Tusk [Craftsman]
8875, 300, dsp.craftRank.AMATEUR, -- Bonecraft Kit 5
8876, 400, dsp.craftRank.AMATEUR, -- Bonecraft Kit 10
8877, 650, dsp.craftRank.AMATEUR, -- Bonecraft Kit 15
8878, 1050, dsp.craftRank.AMATEUR, -- Bonecraft Kit 20
8879, 1600, dsp.craftRank.AMATEUR, -- Bonecraft Kit 25
8880, 2300, dsp.craftRank.AMATEUR, -- Bonecraft Kit 30
8881, 3150, dsp.craftRank.AMATEUR, -- Bonecraft Kit 35
8882, 4150, dsp.craftRank.AMATEUR, -- Bonecraft Kit 40
8883, 5300, dsp.craftRank.AMATEUR, -- Bonecraft Kit 45
8884, 7600, dsp.craftRank.AMATEUR, -- Bonecraft Kit 50
9255, 1126125, dsp.craftRank.AMATEUR -- Cyan Coral
},
[guild.leathercraft] =
{
2129, 75, dsp.craftRank.AMATEUR, -- Tanning Vat
505, 100, dsp.craftRank.AMATEUR, -- Sheepskin
856, 80, dsp.craftRank.AMATEUR, -- Rabbit Hide
852, 600, dsp.craftRank.RECRUIT, -- Lizard Skin
878, 600, dsp.craftRank.RECRUIT, -- Karakul Skin
858, 600, dsp.craftRank.RECRUIT, -- Wolf Hide
857, 2400, dsp.craftRank.INITIATE, -- Dhalmel Hide
1640, 2500, dsp.craftRank.INITIATE, -- Bugard Skin
859, 1500, dsp.craftRank.NOVICE, -- Ram Skin
1628, 16000, dsp.craftRank.APPRENTICE, -- Buffalo Hide
853, 3000, dsp.craftRank.JOURNEYMAN, -- Raptor Skin
2123, 2500, dsp.craftRank.JOURNEYMAN, -- Catoblepas Hide
2518, 3000, dsp.craftRank.CRAFTSMAN, -- Smilodon Hide
854, 3000, dsp.craftRank.CRAFTSMAN, -- Cockatrice Skin
8861, 300, dsp.craftRank.AMATEUR, -- Leathercraft Kit 5
8862, 400, dsp.craftRank.AMATEUR, -- Leathercraft Kit 10
8863, 650, dsp.craftRank.AMATEUR, -- Leathercraft Kit 15
8864, 1050, dsp.craftRank.AMATEUR, -- Leathercraft Kit 20
8865, 1600, dsp.craftRank.AMATEUR, -- Leathercraft Kit 25
8866, 2300, dsp.craftRank.AMATEUR, -- Leathercraft Kit 30
8867, 3150, dsp.craftRank.AMATEUR, -- Leathercraft Kit 35
8868, 4150, dsp.craftRank.AMATEUR, -- Leathercraft Kit 40
8869, 5300, dsp.craftRank.AMATEUR, -- Leathercraft Kit 45
8870, 7600, dsp.craftRank.AMATEUR, -- Leathercraft Kit 50
9253, 1126125, dsp.craftRank.AMATEUR -- Synthetic Faulpie Leather
},
[guild.smithing] =
{
2144, 75, dsp.craftRank.AMATEUR, -- Workshop Anvil
2143, 75, dsp.craftRank.AMATEUR, -- Mandrel
640, 12, dsp.craftRank.AMATEUR, -- Copper Ore
1232, 70, dsp.craftRank.AMATEUR, -- Bronze Nugget
641, 60, dsp.craftRank.RECRUIT, -- Tin Ore
660, 120, dsp.craftRank.RECRUIT, -- Bronze Sheet
643, 900, dsp.craftRank.RECRUIT, -- Iron Ore
1650, 800, dsp.craftRank.INITIATE, -- Kopparnickel Ore
1234, 500, dsp.craftRank.INITIATE, -- Iron Nugget
662, 6000, dsp.craftRank.INITIATE, -- Iron Sheet
666, 10000, dsp.craftRank.NOVICE, -- Steel Sheet
652, 6000, dsp.craftRank.APPRENTICE, -- Steel Ingot
657, 12000, dsp.craftRank.APPRENTICE, -- Tama-Hagane
1228, 2700, dsp.craftRank.JOURNEYMAN, -- Darksteel Nugget
645, 7000, dsp.craftRank.JOURNEYMAN, -- Darksteel Ore
1235, 800, dsp.craftRank.JOURNEYMAN, -- Steel Nugget
664, 28000, dsp.craftRank.JOURNEYMAN, -- Darksteel Sheet
2763, 5000, dsp.craftRank.CRAFTSMAN, -- Swamp Ore
8819, 300, dsp.craftRank.AMATEUR, -- Smithing Kit 5
8820, 400, dsp.craftRank.AMATEUR, -- Smithing Kit 10
8821, 650, dsp.craftRank.AMATEUR, -- Smithing Kit 15
8822, 1050, dsp.craftRank.AMATEUR, -- Smithing Kit 20
8823, 1600, dsp.craftRank.AMATEUR, -- Smithing Kit 25
8824, 2300, dsp.craftRank.AMATEUR, -- Smithing Kit 30
8825, 3150, dsp.craftRank.AMATEUR, -- Smithing Kit 35
8826, 4150, dsp.craftRank.AMATEUR, -- Smithing Kit 40
8827, 5300, dsp.craftRank.AMATEUR, -- Smithing Kit 45
8828, 7600, dsp.craftRank.AMATEUR, -- Smithing Kit 50
9247, 1126125, dsp.craftRank.AMATEUR -- Niobium Ore
}
}
} | gpl-3.0 |
RwNigma/darkstar | scripts/globals/items/bowl_of_sprightly_soup.lua | 36 | 1326 | -----------------------------------------
-- ID: 5930
-- Item: Bowl of Sprightly Soup
-- Food Effect: 3 Hrs, All Races
-----------------------------------------
-- MP 30
-- Mind 4
-- HP Recovered While Healing 4
-- Enmity -4
-----------------------------------------
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,10800,5930);
end;
-----------------------------------------
-- onEffectGain Action
-----------------------------------------
function onEffectGain(target,effect)
target:addMod(MOD_MP, 30);
target:addMod(MOD_MND, 4);
target:addMod(MOD_HPHEAL, 4);
target:addMod(MOD_ENMITY, -4);
end;
-----------------------------------------
-- onEffectLose Action
-----------------------------------------
function onEffectLose(target,effect)
target:delMod(MOD_MP, 30);
target:delMod(MOD_MND, 4);
target:delMod(MOD_HPHEAL, 4);
target:delMod(MOD_ENMITY, -4);
end;
| gpl-3.0 |
MonkeyFirst/urho3d-staticmodel-instances | Sources/bin/Data/LuaScripts/Utilities/Touch.lua | 32 | 2209 | -- Mobile framework for Android/iOS
-- Gamepad from Ninja Snow War
-- Touches patterns:
-- - 1 finger touch = pick object through raycast
-- - 1 or 2 fingers drag = rotate camera
-- - 2 fingers sliding in opposite direction (up/down) = zoom in/out
-- Setup: Call the update function 'UpdateTouches()' from HandleUpdate or equivalent update handler function
local GYROSCOPE_THRESHOLD = 0.1
CAMERA_MIN_DIST = 1.0
CAMERA_MAX_DIST = 20.0
local zoom = false
useGyroscope = false
cameraDistance = 5.0
function UpdateTouches(controls) -- Called from HandleUpdate
zoom = false -- reset bool
-- Zoom in/out
if input.numTouches == 2 then
local touch1 = input:GetTouch(0)
local touch2 = input:GetTouch(1)
-- Check for zoom pattern (touches moving in opposite directions and on empty space)
if not touch1.touchedElement and not touch2.touchedElement and ((touch1.delta.y > 0 and touch2.delta.y < 0) or (touch1.delta.y < 0 and touch2.delta.y > 0)) then zoom = true else zoom = false end
-- Check for zoom direction (in/out)
if zoom then
if Abs(touch1.position.y - touch2.position.y) > Abs(touch1.lastPosition.y - touch2.lastPosition.y) then sens = -1 else sens = 1 end
cameraDistance = cameraDistance + Abs(touch1.delta.y - touch2.delta.y) * sens * TOUCH_SENSITIVITY / 50
cameraDistance = Clamp(cameraDistance, CAMERA_MIN_DIST, CAMERA_MAX_DIST) -- Restrict zoom range to [1;20]
end
end
-- Gyroscope (emulated by SDL through a virtual joystick)
if useGyroscope and input.numJoysticks > 0 then -- numJoysticks = 1 on iOS & Android
local joystick = input:GetJoystickByIndex(0) -- JoystickState
if joystick.numAxes >= 2 then
if joystick:GetAxisPosition(0) < -GYROSCOPE_THRESHOLD then controls:Set(CTRL_LEFT, true) end
if joystick:GetAxisPosition(0) > GYROSCOPE_THRESHOLD then controls:Set(CTRL_RIGHT, true) end
if joystick:GetAxisPosition(1) < -GYROSCOPE_THRESHOLD then controls:Set(CTRL_FORWARD, true) end
if joystick:GetAxisPosition(1) > GYROSCOPE_THRESHOLD then controls:Set(CTRL_BACK, true) end
end
end
end
| mit |
ffxijuggalo/darkstar | scripts/globals/items/plate_of_felicifruit_gelatin.lua | 11 | 1086 | -----------------------------------------
-- ID: 5978
-- Item: Plate of Felicifruit Gelatin
-- Food Effect: 180 Min, All Races
-----------------------------------------
-- MP % 5 Cap 100
-- Intelligence +7
-- MP Healing +3
-----------------------------------------
require("scripts/globals/status")
require("scripts/globals/msg")
-----------------------------------------
function onItemCheck(target)
local result = 0
if target:hasStatusEffect(dsp.effect.FOOD) or target:hasStatusEffect(dsp.effect.FIELD_SUPPORT_FOOD) then
result = dsp.msg.basic.IS_FULL
end
return result
end
function onItemUse(target)
target:addStatusEffect(dsp.effect.FOOD,0,0,10800,5978)
end
function onEffectGain(target, effect)
target:addMod(dsp.mod.FOOD_MPP, 5)
target:addMod(dsp.mod.FOOD_MP_CAP, 100)
target:addMod(dsp.mod.INT, 7)
target:addMod(dsp.mod.MPHEAL, 3)
end
function onEffectLose(target, effect)
target:delMod(dsp.mod.FOOD_MPP, 5)
target:delMod(dsp.mod.FOOD_MP_CAP, 100)
target:delMod(dsp.mod.INT, 7)
target:delMod(dsp.mod.MPHEAL, 3)
end
| gpl-3.0 |
destdev/ygopro-scripts | c43455065.lua | 3 | 2816 | --魔力の泉
function c43455065.initial_effect(c)
--Activate
local e1=Effect.CreateEffect(c)
e1:SetCategory(CATEGORY_DRAW)
e1:SetType(EFFECT_TYPE_ACTIVATE)
e1:SetCode(EVENT_FREE_CHAIN)
e1:SetProperty(EFFECT_FLAG_PLAYER_TARGET)
e1:SetCountLimit(1,43455065+EFFECT_COUNT_CODE_OATH)
e1:SetTarget(c43455065.target)
e1:SetOperation(c43455065.activate)
c:RegisterEffect(e1)
end
function c43455065.filter(c)
return c:IsFaceup() and c:IsType(TYPE_SPELL+TYPE_TRAP)
end
function c43455065.target(e,tp,eg,ep,ev,re,r,rp,chk)
local ct=Duel.GetMatchingGroupCount(c43455065.filter,tp,0,LOCATION_ONFIELD,nil)
if chk==0 then return ct>0 and Duel.IsPlayerCanDraw(tp,ct) end
Duel.SetTargetPlayer(tp)
Duel.SetTargetParam(ct)
Duel.SetOperationInfo(0,CATEGORY_DRAW,nil,0,tp,ct)
end
function c43455065.activate(e,tp,eg,ep,ev,re,r,rp)
local p=Duel.GetChainInfo(0,CHAININFO_TARGET_PLAYER)
local ct=Duel.GetMatchingGroupCount(c43455065.filter,tp,0,LOCATION_ONFIELD,nil)
if Duel.Draw(p,ct,REASON_EFFECT)~=0 then
ct=Duel.GetMatchingGroupCount(c43455065.filter,tp,LOCATION_ONFIELD,0,nil)
if ct>0 then
Duel.BreakEffect()
Duel.DiscardHand(tp,nil,ct,ct,REASON_EFFECT+REASON_DISCARD)
end
end
local rct=1
if Duel.GetTurnPlayer()~=tp then rct=2 end
local c=e:GetHandler()
--indestructable
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_FIELD)
e1:SetCode(EFFECT_INDESTRUCTABLE_EFFECT)
e1:SetTargetRange(0,LOCATION_ONFIELD)
e1:SetProperty(EFFECT_FLAG_SET_AVAILABLE)
e1:SetTarget(c43455065.indtg)
e1:SetValue(1)
e1:SetReset(RESET_PHASE+PHASE_END+RESET_OPPO_TURN,rct)
Duel.RegisterEffect(e1,tp)
local e2=e1:Clone()
e2:SetCode(EFFECT_INDESTRUCTABLE_BATTLE)
e2:SetTargetRange(0,LOCATION_MZONE)
Duel.RegisterEffect(e2,tp)
--cannot inactivate/disable
local e2=Effect.CreateEffect(c)
e2:SetType(EFFECT_TYPE_FIELD)
e2:SetCode(EFFECT_CANNOT_INACTIVATE)
e2:SetValue(c43455065.efilter)
e2:SetReset(RESET_PHASE+PHASE_END+RESET_OPPO_TURN,rct)
Duel.RegisterEffect(e2,tp)
local e3=Effect.CreateEffect(c)
e3:SetType(EFFECT_TYPE_FIELD)
e3:SetCode(EFFECT_CANNOT_DISEFFECT)
e3:SetValue(c43455065.efilter)
e3:SetReset(RESET_PHASE+PHASE_END+RESET_OPPO_TURN,rct)
Duel.RegisterEffect(e3,tp)
--cannot disable
local e4=Effect.CreateEffect(c)
e4:SetType(EFFECT_TYPE_FIELD)
e4:SetCode(EFFECT_CANNOT_DISABLE)
e4:SetTargetRange(0,LOCATION_ONFIELD)
e4:SetProperty(EFFECT_FLAG_SET_AVAILABLE)
e4:SetTarget(c43455065.indtg)
e4:SetReset(RESET_PHASE+PHASE_END+RESET_OPPO_TURN,rct)
Duel.RegisterEffect(e4,tp)
end
function c43455065.indtg(e,c)
return c:IsType(TYPE_SPELL+TYPE_TRAP)
end
function c43455065.efilter(e,ct)
local te,tp=Duel.GetChainInfo(ct,CHAININFO_TRIGGERING_EFFECT,CHAININFO_TRIGGERING_PLAYER)
local tc=te:GetHandler()
return tp~=e:GetHandlerPlayer() and tc:IsType(TYPE_SPELL+TYPE_TRAP)
end
| gpl-2.0 |
lyntel/OpenRA | mods/cnc/maps/nod02b/nod02b.lua | 12 | 6483 | NodUnits = { "bggy", "e1", "e1", "e1", "e1", "e1", "bggy", "e1", "e1", "e1", "bggy" }
NodBaseBuildings = { "hand", "fact", "nuke" }
Grd2ActorTriggerActivator = { Refinery, Yard }
Atk4ActorTriggerActivator = { Guard1 }
Atk3ActorTriggerActivator = { Guard4 }
Atk6ActorTriggerActivator = { Guard2, Guard3 }
HuntActorTriggerActivator = { Refinery, Yard, Barracks, Plant, Silo1, Silo2 }
Atk8TriggerFunctionTime = DateTime.Minutes(1) + DateTime.Seconds(25)
Atk7TriggerFunctionTime = DateTime.Minutes(1) + DateTime.Seconds(20)
Gdi1Waypoints = { waypoint0, waypoint1, waypoint2, waypoint3 }
Gdi3Waypoints = { waypoint0, waypoint1, waypoint4, waypoint5, waypoint6, waypoint7, waypoint9 }
UnitToRebuild = 'e1'
GDIStartUnits = 0
Grd2TriggerFunction = function()
if not Grd2TriggerSwitch then
Grd2TriggerSwitch = true
MyActors = getActors(GDI, { ['e1'] = 5 })
Utils.Do(MyActors, function(actor)
Gdi5Movement(actor)
end)
end
end
Atk8TriggerFunction = function()
MyActors = getActors(GDI, { ['e1'] = 2 })
Utils.Do(MyActors, function(actor)
Gdi1Movement(actor)
end)
end
Atk7TriggerFunction = function()
MyActors = getActors(GDI, { ['e1'] = 3 })
Utils.Do(MyActors, function(actor)
Gdi3Movement(actor)
end)
end
Atk4TriggerFunction = function()
MyActors = getActors(GDI, { ['e1'] = 3 })
Utils.Do(MyActors, function(actor)
Gdi3Movement(actor)
end)
end
Atk3TriggerFunction = function()
MyActors = getActors(GDI, { ['e1'] = 2 })
Utils.Do(MyActors, function(actor)
Gdi1Movement(actor)
end)
end
Atk6TriggerFunction = function()
MyActors = getActors(GDI, { ['e1'] = 2 })
Utils.Do(MyActors, function(actor)
Gdi1Movement(actor)
end)
end
Atk5TriggerFunction = function()
if not Atk5TriggerSwitch then
Atk5TriggerSwitch = true
MyActors = getActors(GDI, { ['e1'] = 3 })
Utils.Do(MyActors, function(actor)
Gdi3Movement(actor)
end)
end
end
HuntTriggerFunction = function()
local list = GDI.GetGroundAttackers()
Utils.Do(list, function(unit)
IdleHunt(unit)
end)
end
Gdi5Movement = function(unit)
IdleHunt(unit)
end
Gdi1Movement = function(unit)
Utils.Do(Gdi1Waypoints, function(waypoint)
unit.AttackMove(waypoint.Location)
end)
IdleHunt(unit)
end
Gdi3Movement = function(unit)
Utils.Do(Gdi3Waypoints, function(waypoint)
unit.AttackMove(waypoint.Location)
end)
IdleHunt(unit)
end
WorldLoaded = function()
GDI = Player.GetPlayer("GDI")
Nod = Player.GetPlayer("Nod")
Trigger.OnObjectiveAdded(Nod, function(p, id)
Media.DisplayMessage(p.GetObjectiveDescription(id), "New " .. string.lower(p.GetObjectiveType(id)) .. " objective")
end)
Trigger.OnObjectiveCompleted(Nod, function(p, id)
Media.DisplayMessage(p.GetObjectiveDescription(id), "Objective completed")
end)
Trigger.OnObjectiveFailed(Nod, function(p, id)
Media.DisplayMessage(p.GetObjectiveDescription(id), "Objective failed")
end)
Trigger.OnPlayerWon(Nod, function()
Media.PlaySpeechNotification(Nod, "Win")
end)
Trigger.OnPlayerLost(Nod, function()
Media.PlaySpeechNotification(Nod, "Lose")
end)
GDIObjective = GDI.AddPrimaryObjective("Kill all enemies.")
NodObjective1 = Nod.AddPrimaryObjective("Build a base.")
NodObjective2 = Nod.AddPrimaryObjective("Destroy all GDI units.")
OnAnyDamaged(Grd2ActorTriggerActivator, Grd2TriggerFunction)
Trigger.AfterDelay(Atk8TriggerFunctionTime, Atk8TriggerFunction)
Trigger.AfterDelay(Atk7TriggerFunctionTime, Atk7TriggerFunction)
Trigger.OnAllRemovedFromWorld(Atk4ActorTriggerActivator, Atk4TriggerFunction)
Trigger.OnAllRemovedFromWorld(Atk3ActorTriggerActivator, Atk3TriggerFunction)
Trigger.OnDamaged(Harvester, Atk5TriggerFunction)
Trigger.OnAllRemovedFromWorld(HuntActorTriggerActivator, HuntTriggerFunction)
Trigger.AfterDelay(0, getStartUnits)
Harvester.FindResources()
InsertNodUnits()
end
Tick = function()
if Nod.HasNoRequiredUnits() then
if DateTime.GameTime > 2 then
GDI.MarkCompletedObjective(GDIObjective)
end
end
if GDI.HasNoRequiredUnits() then
Nod.MarkCompletedObjective(NodObjective2)
end
if DateTime.GameTime % DateTime.Seconds(1) == 0 and not Nod.IsObjectiveCompleted(NodObjective1) and CheckForBase(Nod, NodBaseBuildings) then
Nod.MarkCompletedObjective(NodObjective1)
end
if DateTime.GameTime % DateTime.Seconds(3) == 0 and Barracks.IsInWorld and Barracks.Owner == gdi then
checkProduction(GDI)
end
end
CheckForBase = function(player, buildings)
local checked = { }
local baseBuildings = Map.ActorsInBox(Map.TopLeft, Map.BottomRight, function(actor)
if actor.Owner ~= Nod or Utils.Any(checked, function(bldng) return bldng.Type == actor.Type end) then
return false
end
local found = false
for i = 1, #buildings, 1 do
if actor.Type == buildings[i] then
found = true
checked[#checked + 1] = actor
end
end
return found
end)
return #baseBuildings >= 3
end
OnAnyDamaged = function(actors, func)
Utils.Do(actors, function(actor)
Trigger.OnDamaged(actor, func)
end)
end
getActors = function(owner, units)
local maxUnits = 0
local actors = { }
for type, count in pairs(units) do
local globalActors = Map.ActorsInBox(Map.TopLeft, Map.BottomRight, function(actor)
return actor.Owner == owner and actor.Type == type and not actor.IsDead
end)
if #globalActors < count then
maxUnits = #globalActors
else
maxUnits = count
end
for i = 1, maxUnits, 1 do
actors[#actors + 1] = globalActors[i]
end
end
return actors
end
checkProduction = function(player)
local Units = Map.ActorsInBox(Map.TopLeft, Map.BottomRight, function(actor)
return actor.Owner == player and actor.Type == UnitToRebuild
end)
if #Units < GDIStartUnits then
local unitsToProduce = GDIStartUnits - #Units
if Barracks.IsInWorld and unitsToProduce > 0 then
local UnitsType = { }
for i = 1, unitsToProduce, 1 do
UnitsType[i] = UnitToRebuild
end
Barracks.Build(UnitsType)
end
end
end
getStartUnits = function()
local Units = Map.ActorsInBox(Map.TopLeft, Map.BottomRight, function(actor)
return actor.Owner == GDI
end)
Utils.Do(Units, function(unit)
if unit.Type == UnitToRebuild then
GDIStartUnits = GDIStartUnits + 1
end
end)
end
InsertNodUnits = function()
Media.PlaySpeechNotification(Nod, "Reinforce")
Reinforcements.Reinforce(Nod, NodUnits, { UnitsEntry.Location, UnitsRally.Location }, 15)
Reinforcements.Reinforce(Nod, { "mcv" }, { McvEntry.Location, McvRally.Location })
end
IdleHunt = function(unit)
if not unit.IsDead then
Trigger.OnIdle(unit, unit.Hunt)
end
end
| gpl-3.0 |
ffxijuggalo/darkstar | scripts/zones/Arrapago_Reef/Zone.lua | 9 | 3774 | -----------------------------------
--
-- Zone: Arrapago_Reef (54)
--
-----------------------------------
local ID = require("scripts/zones/Arrapago_Reef/IDs")
require("scripts/globals/keyitems")
require("scripts/globals/missions")
require("scripts/globals/npc_util")
require("scripts/globals/settings")
require("scripts/globals/quests")
require("scripts/globals/zone")
-----------------------------------
function onInitialize(zone)
zone:registerRegion(1,-462,-4,-420,-455,-1,-392) -- approach the Cutter
end
function onZoneIn(player,prevZone)
local cs = -1
if player:getXPos() == 0 and player:getYPos() == 0 and player:getZPos() == 0 then
player:setPos(-456, -3, -405, 64)
end
if prevZone == dsp.zone.THE_ASHU_TALIF then
if player:getCurrentMission(TOAU) == dsp.mission.id.toau.THE_BLACK_COFFIN and player:getCharVar("AhtUrganStatus") == 2 then
player:setPos(-456, -3, -405, 64)
cs = 9
elseif player:getCharVar("AgainstAllOdds") == 3 then
cs = 238
end
elseif prevZone == dsp.zone.CAEDARVA_MIRE then
if player:getCurrentMission(TOAU) == dsp.mission.id.toau.PREVALENCE_OF_PIRATES and player:getCharVar("AhtUrganStatus") == 0 then
cs = 13
end
elseif prevZone == dsp.zone.ILRUSI_ATOLL then
player:setPos(26, -7, 606, 222)
end
return cs
end
function afterZoneIn(player)
player:entityVisualPacket("1pb1")
player:entityVisualPacket("2pb1")
end
function onRegionEnter(player,region)
if (player:getCurrentMission(TOAU) == dsp.mission.id.toau.THE_BLACK_COFFIN and player:hasKeyItem(dsp.ki.EPHRAMADIAN_GOLD_COIN) and player:getCharVar("AhtUrganStatus") == 0) then
player:startEvent(8)
elseif (player:getCurrentMission(TOAU) == dsp.mission.id.toau.PREVALENCE_OF_PIRATES and player:getCharVar("AhtUrganStatus") == 1) then
player:startEvent(14)
elseif (player:getCurrentMission(TOAU) == dsp.mission.id.toau.TESTING_THE_WATERS and player:hasKeyItem(dsp.ki.EPHRAMADIAN_GOLD_COIN)) then
player:startEvent(15)
elseif (player:getQuestStatus(AHT_URHGAN,dsp.quest.id.ahtUrhgan.AGAINST_ALL_ODDS) == QUEST_ACCEPTED and player:getCharVar("AgainstAllOdds") == 1) then
player:startEvent(237)
end
end
function onEventUpdate(player,csid,option)
end
function onEventFinish(player,csid,option)
if (csid == 8) then
player:setCharVar("AhtUrganStatus",1)
player:startEvent(34,1,1,1,1,1,1,1,1)
elseif (csid == 9) then
player:setCharVar("AhtUrganStatus",3)
player:setPos(0,0,0,0,53)
elseif (csid == 13) then
player:setCharVar("AhtUrganStatus",1)
elseif (csid == 14) then
player:completeMission(TOAU,dsp.mission.id.toau.PREVALENCE_OF_PIRATES)
player:setCharVar("AhtUrganStatus",0)
player:addKeyItem(dsp.ki.PERIQIA_ASSAULT_AREA_ENTRY_PERMIT)
player:messageSpecial(ID.text.KEYITEM_OBTAINED,dsp.ki.PERIQIA_ASSAULT_AREA_ENTRY_PERMIT)
player:addMission(TOAU,dsp.mission.id.toau.SHADES_OF_VENGEANCE)
elseif (csid == 15) then
player:setCharVar("AhtUrganStatus",1)
player:setPos(0,0,0,0,57)
elseif (csid == 34 and player:getCharVar("AhtUrganStatus") == 1) then
player:startEvent(35)
elseif (csid == 90) then -- enter instance: the ashu talif
player:setPos(0,0,0,0,60)
elseif (csid == 108) then -- enter instance: illrusi atoll
player:setPos(0,0,0,0,55)
elseif (csid == 237) then
player:startEvent(240)
elseif csid == 238 then
npcUtil.completeQuest(player, AHT_URHGAN, dsp.quest.id.ahtUrhgan.AGAINST_ALL_ODDS, { item=15266, var="AgainstAllOdds"})
elseif (csid == 240) then
player:setCharVar("AgainstAllOdds",2)
end
end | gpl-3.0 |
Enhex/Urho3D-CEF3 | Bin_Debug/Data/LuaScripts/16_Chat.lua | 2 | 7338 | -- Chat example
-- This sample demonstrates:
-- - Starting up a network server or connecting to it
-- - Implementing simple chat functionality with network messages
require "LuaScripts/Utilities/Sample"
-- Identifier for the chat network messages
local MSG_CHAT = 32
-- UDP port we will use
local CHAT_SERVER_PORT = 2345
local chatHistory = {}
local chatHistoryText = nil
local buttonContainer = nil
local textEdit = nil
local sendButton = nil
local connectButton = nil
local disconnectButton = nil
local startServerButton = nil
function Start()
-- Execute the common startup for samples
SampleStart()
-- Enable OS cursor
input.mouseVisible = true
-- Create the user interface
CreateUI()
-- Subscribe to UI and network events
SubscribeToEvents()
end
function CreateUI()
SetLogoVisible(false) -- We need the full rendering window
local uiStyle = cache:GetResource("XMLFile", "UI/DefaultStyle.xml")
-- Set style to the UI root so that elements will inherit it
ui.root.defaultStyle = uiStyle
local font = cache:GetResource("Font", "Fonts/Anonymous Pro.ttf")
chatHistoryText = ui.root:CreateChild("Text")
chatHistoryText:SetFont(font, 12)
buttonContainer = ui.root:CreateChild("UIElement")
buttonContainer:SetFixedSize(graphics.width, 20)
buttonContainer:SetPosition(0, graphics.height - 20)
buttonContainer.layoutMode = LM_HORIZONTAL
textEdit = buttonContainer:CreateChild("LineEdit")
textEdit:SetStyleAuto()
sendButton = CreateButton("Send", 70)
connectButton = CreateButton("Connect", 90)
disconnectButton = CreateButton("Disconnect", 100)
startServerButton = CreateButton("Start Server", 110)
UpdateButtons()
local size = (graphics.height - 20) / chatHistoryText.rowHeight
for i = 1, size do
table.insert(chatHistory, "")
end
-- No viewports or scene is defined. However, the default zone's fog color controls the fill color
renderer.defaultZone.fogColor = Color(0.0, 0.0, 0.1)
end
function SubscribeToEvents()
-- Subscribe to UI element events
SubscribeToEvent(textEdit, "TextFinished", "HandleSend")
SubscribeToEvent(sendButton, "Released", "HandleSend")
SubscribeToEvent(connectButton, "Released", "HandleConnect")
SubscribeToEvent(disconnectButton, "Released", "HandleDisconnect")
SubscribeToEvent(startServerButton, "Released", "HandleStartServer")
-- Subscribe to log messages so that we can pipe them to the chat window
SubscribeToEvent("LogMessage", "HandleLogMessage")
-- Subscribe to network events
SubscribeToEvent("NetworkMessage", "HandleNetworkMessage")
SubscribeToEvent("ServerConnected", "HandleConnectionStatus")
SubscribeToEvent("ServerDisconnected", "HandleConnectionStatus")
SubscribeToEvent("ConnectFailed", "HandleConnectionStatus")
end
function CreateButton(text, width)
local font = cache:GetResource("Font", "Fonts/Anonymous Pro.ttf")
local button = buttonContainer:CreateChild("Button")
button:SetStyleAuto()
button:SetFixedWidth(width)
local buttonText = button:CreateChild("Text")
buttonText:SetFont(font, 12)
buttonText:SetAlignment(HA_CENTER, VA_CENTER)
buttonText.text = text
return button
end
function ShowChatText(row)
table.remove(chatHistory, 1)
table.insert(chatHistory, row)
-- Concatenate all the rows in history
local allRows = ""
for i, r in ipairs(chatHistory) do
allRows = allRows .. r .. "\n"
end
chatHistoryText.text = allRows
end
function UpdateButtons()
local serverConnection = network.serverConnection
local serverRunning = network.serverRunning
-- Show and hide buttons so that eg. Connect and Disconnect are never shown at the same time
sendButton.visible = serverConnection ~= nil
connectButton.visible = (serverConnection == nil) and (not serverRunning)
disconnectButton.visible = (serverConnection ~= nil) or serverRunning
startServerButton.visible = (serverConnection == nil) and (not serverRunning)
end
function HandleLogMessage(eventType, eventData)
ShowChatText(eventData:GetString("Message"))
end
function HandleSend(eventType, eventData)
local text = textEdit.text
if text == "" then
return -- Do not send an empty message
end
local serverConnection = network.serverConnection
if serverConnection ~= nil then
-- A VectorBuffer object is convenient for constructing a message to send
local msg = VectorBuffer()
msg:WriteString(text)
-- Send the chat message as in-order and reliable
serverConnection:SendMessage(MSG_CHAT, true, true, msg)
-- Empty the text edit after sending
textEdit.text = ""
end
end
function HandleConnect(eventType, eventData)
local address = textEdit.text
if address == "" then
address = "localhost" -- Use localhost to connect if nothing else specified
end
-- Empty the text edit after reading the address to connect to
textEdit.text = ""
-- Connect to server, do not specify a client scene as we are not using scene replication, just messages.
-- At connect time we could also send identity parameters (such as username) in a VariantMap, but in this
-- case we skip it for simplicity
network:Connect(address, CHAT_SERVER_PORT, nil)
UpdateButtons()
end
function HandleDisconnect(eventType, eventData)
local serverConnection = network.serverConnection
-- If we were connected to server, disconnect
if serverConnection ~= nil then
serverConnection:Disconnect()
-- Or if we were running a server, stop it
else
if network.serverRunning then
network:StopServer()
end
end
UpdateButtons()
end
function HandleStartServer(eventType, eventData)
network:StartServer(CHAT_SERVER_PORT)
UpdateButtons()
end
function HandleNetworkMessage(eventType, eventData)
local msgID = eventData:GetInt("MessageID")
if msgID == MSG_CHAT then
local msg = eventData:GetBuffer("Data")
local text = msg:ReadString()
-- If we are the server, prepend the sender's IP address and port and echo to everyone
-- If we are a client, just display the message
if network.serverRunning then
local sender = eventData:GetPtr("Connection", "Connection")
text = sender:ToString() .. " " .. text
local sendMsg = VectorBuffer()
sendMsg:WriteString(text)
-- Broadcast as in-order and reliable
network:BroadcastMessage(MSG_CHAT, true, true, sendMsg)
end
ShowChatText(text)
end
end
function HandleConnectionStatus(eventType, eventData)
UpdateButtons()
end
-- Create XML patch instructions for screen joystick layout specific to this sample app
function GetScreenJoystickPatchString()
return
"<patch>" ..
" <add sel=\"/element/element[./attribute[@name='Name' and @value='Button2']]\">" ..
" <attribute name=\"Is Visible\" value=\"false\" />" ..
" </add>" ..
" <add sel=\"/element/element[./attribute[@name='Name' and @value='Hat0']]\">" ..
" <attribute name=\"Is Visible\" value=\"false\" />" ..
" </add>" ..
"</patch>"
end
| mit |
kidaa/luakit | lib/lousy/uri.lua | 7 | 3484 | ------------------------------------------------------
-- URI parsing functions --
-- © 2011 Mason Larobina <mason.larobina@gmail.com> --
------------------------------------------------------
-- Get lua environment
local table = table
local string = string
local ipairs = ipairs
local pairs = pairs
local tostring = tostring
local type = type
local setmetatable = setmetatable
local getmetatable = getmetatable
local assert = assert
local rawset = rawset
-- Get luakit environment
local util = require "lousy.util"
local capi = { soup = soup }
local uri_encode = luakit.uri_encode
local uri_decode = luakit.uri_decode
module "lousy.uri"
local opts_metatable = {
__tostring = function (opts)
local ret, done = {}, {}
-- Get opt order from metatable
local mt = getmetatable(opts)
-- Add original args first in order
if mt and mt.order then
for _, k in ipairs(mt.order) do
local v = opts[k]
if v and v ~= "" then
table.insert(ret, uri_encode(k) .. "=" .. uri_encode(v))
done[k] = true
end
end
end
-- Add new args
for k, v in pairs(opts) do
if not done[k] and v ~= "" then
table.insert(ret, uri_encode(k) .. "=" .. uri_encode(v))
end
end
-- Join query opts
return table.concat(ret, "&")
end,
__add = function (op1, op2)
assert(type(op1) == "table" and type(op2) == "table",
"non-table operands")
local ret = util.table.copy(op1)
for k, v in pairs(op2) do
ret[k] = v
end
return ret
end,
}
--- Parse uri query
--@param query the query component of a uri
--@return table of options
function parse_query(query)
local opts, order = {}, {}
string.gsub(query or "", "&*([^&=]+)=([^&]+)", function (k, v)
opts[k] = uri_decode(v)
table.insert(order, k)
end)
-- Put order table in opts metatable
local mt = util.table.clone(opts_metatable)
mt.order = order
return setmetatable(opts, mt)
end
-- Allowed URI table properties
local uri_allowed = { scheme = true, user = true, password = true,
host = true, path = true, query = true, fragment = true, opts = true }
-- URI table metatable
local uri_metatable = {
__tostring = function (uri)
local t = util.table.clone(uri)
t.query = tostring(t.opts)
return capi.soup.uri_tostring(t)
end,
__add = function (op1, op2)
assert(type(op1) == "table" and type(op2) == "table",
"non-table operands")
local ret = util.table.copy(op1)
for k, v in pairs(op2) do
assert(uri_allowed[k], "invalid property: " .. k)
if k == "query" and type(v) == "string" then
uri.opts = parse_query(v)
else
uri[k] = v
end
end
return ret
end,
}
-- Parse uri string and return uri table
function parse(uri)
-- Get uri table
local uri = capi.soup.parse_uri(uri)
if not uri then return end
-- Parse uri.query and set uri.opts
uri.opts = parse_query(uri.query)
uri.query = nil
return setmetatable(uri, uri_metatable)
end
-- Duplicate uri object
function copy(uri)
assert(type(uri) == "table", "not a table")
return parse(tostring(uri))
end
-- vim: et:sw=4:ts=8:sts=4:tw=80
| gpl-3.0 |
madmaxoft/ZeroBranePackage | remoteedit.lua | 2 | 3152 | local id = ID("remoteedit.openremotefile")
local lastfile = ""
local editors = {}
local function reportErr(err) return(err:gsub('.-:%d+:%s*','')) end
local mobdebug = require("mobdebug")
local copas = require("copas")
return {
name = "Remote edit",
description = "Allows to edit files remotely while debugging is in progress.",
author = "Paul Kulchenko",
version = 0.13,
dependencies = "1.40",
onRegister = function(self)
local menu = ide:GetMenuBar():GetMenu(ide:GetMenuBar():FindMenu(TR("&File")))
menu:Insert(2, id, "Open Remotely...")
ide:GetMainFrame():Connect(id, wx.wxEVT_COMMAND_MENU_SELECTED,
function()
local file = wx.wxGetTextFromUser("Enter name (with path) of the remote file",
"Open remote file", lastfile)
if file and #file > 0 then
self:loadFile(file)
lastfile = file
end
end)
ide:GetMainFrame():Connect(id, wx.wxEVT_UPDATE_UI,
function (event)
local debugger = ide:GetDebugger()
event:Enable(debugger:IsConnected() and not debugger:IsRunning())
end)
end,
onUnRegister = function(self)
ide:RemoveMenuItem(id)
end,
onEditorClose = function(self, editor)
editors[editor] = nil
end,
onEditorPreSave = function(self, editor)
local remote = editors[editor]
if remote and ide:GetDocument(editor):IsModified() then
self:saveFile(remote, editor)
return false
end
end,
loadFile = function(self, remote)
local debugger = ide:GetDebugger()
if not debugger:IsConnected() or debugger:IsRunning() then return end
local code = ([[(function() local f, err = io.open(%s); if not f then error(err) end; local c = f:read('*a'); f:close(); return c end)()]])
:format(mobdebug.line(remote))
copas.addthread(function()
local debugger = ide:GetDebugger()
local res, _, err = debugger:evaluate(code)
if err then
ide:Print(("Failed to load file '%s': %s."):format(remote, reportErr(err)))
return
end
local ok, content = LoadSafe("return "..res)
if ok then
ide:Print(("Loaded file '%s'."):format(remote))
self.onIdleOnce = function()
local editor = NewFile("remote: "..remote)
editor:SetText(content)
editor:SetSavePoint()
editors[editor] = remote
end
else
ide:Print(("Failed to load file '%s': %s."):format(remote, content))
end
end)
end,
saveFile = function(self, remote, editor)
local debugger = ide:GetDebugger()
if not debugger:IsConnected() or debugger:IsRunning() then return end
local content = editor:GetText()
local code = ([[local f, err = io.open(%s, 'w'); if not f then error(err) end; f:write(%s); f:close()]])
:format(mobdebug.line(remote), mobdebug.line(content))
copas.addthread(function()
local err = select(3, debugger:execute(code))
if not err then
editor:SetSavePoint()
ide:Print(("Saved file '%s'."):format(remote))
else
ide:Print(("Failed to save file '%s': %s."):format(remote, reportErr(err)))
end
end)
end,
}
| mit |
fkooman/luci | applications/luci-app-privoxy/luasrc/controller/privoxy.lua | 33 | 4608 | -- Copyright 2014 Christian Schoenebeck <christian dot schoenebeck at gmail dot com>
-- Licensed under the Apache License, Version 2.0
module("luci.controller.privoxy", package.seeall)
local NX = require "nixio"
local NXFS = require "nixio.fs"
local HTTP = require "luci.http"
local UCI = require "luci.model.uci"
local UTIL = require "luci.util"
local SYS = require "luci.sys"
PRIVOXY_MIN = "3.0.22-0" -- minimum version of service required
function index()
entry( {"admin", "services", "privoxy"}, cbi("privoxy"), _("Privoxy WEB proxy"), 59)
entry( {"admin", "services", "privoxy", "logview"}, call("logread") ).leaf = true
entry( {"admin", "services", "privoxy", "startstop"}, call("startstop") ).leaf = true
entry( {"admin", "services", "privoxy", "status"}, call("get_pid") ).leaf = true
end
-- called by XHR.get from detail_logview.htm
function logread()
-- read application settings
local uci = UCI.cursor()
local logdir = uci:get("privoxy", "privoxy", "logdir") or "/var/log"
local logfile = uci:get("privoxy", "privoxy", "logfile") or "privoxy.log"
uci:unload("privoxy")
local lfile=logdir .. "/" .. logfile
local ldata=NXFS.readfile(lfile)
if not ldata or #ldata == 0 then
ldata="_nodata_"
end
HTTP.write(ldata)
end
-- called by XHR.get from detail_startstop.htm
function startstop()
local pid = get_pid(true)
if pid > 0 then
SYS.call("/etc/init.d/privoxy stop")
NX.nanosleep(1) -- sleep a second
if NX.kill(pid, 0) then -- still running
NX.kill(pid, 9) -- send SIGKILL
end
pid = 0
else
SYS.call("/etc/init.d/privoxy start")
NX.nanosleep(1) -- sleep a second
pid = tonumber(NXFS.readfile("/var/run/privoxy.pid") or 0 )
if pid > 0 and not NX.kill(pid, 0) then
pid = 0 -- process did not start
end
end
HTTP.write(tostring(pid)) -- HTTP needs string not number
end
-- called by XHR.poll from detail_startstop.htm
-- and from lua (with parameter "true")
function get_pid(from_lua)
local pid = tonumber(NXFS.readfile("/var/run/privoxy.pid") or 0 )
if pid > 0 and not NX.kill(pid, 0) then
pid = 0
end
if from_lua then
return pid
else
HTTP.write(tostring(pid)) -- HTTP needs string not number
end
end
-- compare versions using "<=" "<" ">" ">=" "=" "<<" ">>"
function ipkg_ver_compare(ver1, comp, ver2)
if not ver1 or not ver2
or not comp or not (#comp > 0) then return nil end
-- correct compare string
if comp == "<>" or comp == "><" or comp == "!=" or comp == "~=" then comp = "~="
elseif comp == "<=" or comp == "<" or comp == "=<" then comp = "<="
elseif comp == ">=" or comp == ">" or comp == "=>" then comp = ">="
elseif comp == "=" or comp == "==" then comp = "=="
elseif comp == "<<" then comp = "<"
elseif comp == ">>" then comp = ">"
else return nil end
local av1 = UTIL.split(ver1, "[%.%-]", nil, true)
local av2 = UTIL.split(ver2, "[%.%-]", nil, true)
for i = 1, math.max(table.getn(av1),table.getn(av2)), 1 do
local s1 = av1[i] or ""
local s2 = av2[i] or ""
-- first "not equal" found return true
if comp == "~=" and (s1 ~= s2) then return true end
-- first "lower" found return true
if (comp == "<" or comp == "<=") and (s1 < s2) then return true end
-- first "greater" found return true
if (comp == ">" or comp == ">=") and (s1 > s2) then return true end
-- not equal then return false
if (s1 ~= s2) then return false end
end
-- all equal and not compare greater or lower then true
return not (comp == "<" or comp == ">")
end
-- read version information for given package if installed
function ipkg_ver_installed(pkg)
local version = nil
local control = io.open("/usr/lib/opkg/info/%s.control" % pkg, "r")
if control then
local ln
repeat
ln = control:read("*l")
if ln and ln:match("^Version: ") then
version = ln:gsub("^Version: ", "")
break
end
until not ln
control:close()
end
return version
end
-- replacement of build-in Flag.parse of cbi.lua
-- modified to mark section as changed if value changes
-- current parse did not do this, but it is done AbstaractValue.parse()
function flag_parse(self, section)
local fexists = self.map:formvalue(
luci.cbi.FEXIST_PREFIX .. self.config .. "." .. section .. "." .. self.option)
if fexists then
local fvalue = self:formvalue(section) and self.enabled or self.disabled
local cvalue = self:cfgvalue(section)
if fvalue ~= self.default or (not self.optional and not self.rmempty) then
self:write(section, fvalue)
else
self:remove(section)
end
if (fvalue ~= cvalue) then self.section.changed = true end
else
self:remove(section)
self.section.changed = true
end
end
| apache-2.0 |
DeepMark/deepmark | torch/audio/Dataset.lua | 1 | 3240 | ------------------------------------------------------------------------
--[[ Dataset ]] --
-- Creates a dataset of random numbers based on the Baidu chosen
-- distribution of dataset for the benchmark.
------------------------------------------------------------------------
require 'nn'
local Dataset = torch.class('nn.DeepSpeechDataset')
Dataset.uttLengths = { 100, 200, 300, 400, 500, 600, 700, 800, 900, 1000, 1100, 1200, 1300, 1400, 1500 }
Dataset.counts = { 3, 10, 11, 13, 14, 13, 9, 8, 5, 4, 3, 2, 2, 2, 1 }
Dataset.label_lengths = { 7, 17, 35, 48, 62, 78, 93, 107, 120, 134, 148, 163, 178, 193, 209 }
Dataset.freqBins = 161
Dataset.scaleFactor = 10 * 128
Dataset.chars = 29
Dataset.extra = 1000
function Dataset:__init(minibatchSize)
self.minibatchSize = minibatchSize
self.current = 1
self.uttCounts = {}
for index, value in ipairs(Dataset.counts) do
table.insert(self.uttCounts, value * Dataset.scaleFactor)
end
-- Swapped the freqBins around compared to ref for multiGPU support.
self.randomness = torch.randn(minibatchSize * (Dataset.uttLengths[#Dataset.uttLengths] + self.extra), Dataset.freqBins)
local size = 0
local duration = 0
for x =1, #Dataset.counts do
size = size + Dataset.counts[x] * Dataset.scaleFactor -- get total count to track progress
duration = duration + (Dataset.counts[x] * Dataset.scaleFactor * Dataset.uttLengths[x]) / 100 -- get total duration of dataset (each second is 100 timesteps)
end
self.size = size
self.duration = duration
end
function Dataset:next()
if self.current > #self.uttCounts then
return nil
else
local inc
local miniBatchSize
if (self.uttCounts[self.current] > self.minibatchSize) then
miniBatchSize = self.minibatchSize
self.uttCounts[self.current] = self.uttCounts[self.current] - self.minibatchSize
inc = 0
else
miniBatchSize = self.uttCounts[self.current]
self.uttCounts[self.current] = 0
inc = 1
end
local uttLength = self.uttLengths[self.current]
local labelLength = self.label_lengths[self.current]
local startIndex = math.random(1, Dataset.extra + self.minibatchSize * (Dataset.uttLengths[#Dataset.uttLengths] - self.uttLengths[self.current]))
local endIndex = startIndex + uttLength * miniBatchSize
self.current = self.current + inc
local label = torch.Tensor(labelLength)
for x = 1, labelLength do
label[x] = math.random(Dataset.chars)
end
local input = self.randomness[{{ startIndex, endIndex - 1 }, {} }]
return uttLength, input, label
end
end
-- Converts the iterator information into the format required for Torch benchmark
function Dataset:nextTorchSet()
local uttLength, input, label = self:next()
if (uttLength ~= nil) then
-- Define length and label for each sample in minibatch.
uttLength = torch.Tensor(self.minibatchSize):fill(uttLength)
label = label:view(1, -1):expand(self.minibatchSize, label:size(1))
return uttLength, input, torch.totable(label)
else
return nil
end
end
return Dataset
| apache-2.0 |
andrew-d/luabuild | modules/luasocket/src/socket.lua | 3 | 4875 | -----------------------------------------------------------------------------
-- LuaSocket helper module
-- Author: Diego Nehab
-----------------------------------------------------------------------------
-----------------------------------------------------------------------------
-- Declare module and import dependencies
-----------------------------------------------------------------------------
local base = _G
local string = require("string")
local math = require("math")
local socket = require("socket.core")
-----------------------------------------------------------------------------
-- Exported auxiliar functions
-----------------------------------------------------------------------------
function socket.connect4(address, port, laddress, lport)
return socket.connect(address, port, laddress, lport, "inet")
end
function socket.connect6(address, port, laddress, lport)
return socket.connect(address, port, laddress, lport, "inet6")
end
function socket.bind(host, port, backlog)
if socket._BROKEN_XP and (host == "localhost" or host == "*") then
sock, err = socket.tcp()
if not sock then return nil, err end
sock:setoption("reuseaddr",true)
res, err = sock:bind(host,port)
if not res then return nil, err end
res, err = sock:listen(backlog)
if not res then sock:close(); return nil,err end
return sock
end
if host == "*" then host = "0.0.0.0" end
local addrinfo, err = socket.dns.getaddrinfo(host);
if not addrinfo then return nil, err end
local sock, res
err = "no info on address"
for i, alt in base.ipairs(addrinfo) do
if alt.family == "inet" then
sock, err = socket.tcp()
else
sock, err = socket.tcp6()
end
if not sock then return nil, err end
sock:setoption("reuseaddr", true)
res, err = sock:bind(alt.addr, port)
if not res then
sock:close()
else
res, err = sock:listen(backlog)
if not res then
sock:close()
else
return sock
end
end
end
return nil, err
end
socket.try = socket.newtry()
function socket.choose(table)
return function(name, opt1, opt2)
if base.type(name) ~= "string" then
name, opt1, opt2 = "default", name, opt1
end
local f = table[name or "nil"]
if not f then base.error("unknown key (".. base.tostring(name) ..")", 3)
else return f(opt1, opt2) end
end
end
-----------------------------------------------------------------------------
-- Socket sources and sinks, conforming to LTN12
-----------------------------------------------------------------------------
-- create namespaces inside LuaSocket namespace
local sourcet = {}
local sinkt = {}
socket.sourct = sourcet
socket.sinkt = sinkt
socket.BLOCKSIZE = 2048
sinkt["close-when-done"] = function(sock)
return base.setmetatable({
getfd = function() return sock:getfd() end,
dirty = function() return sock:dirty() end
}, {
__call = function(self, chunk, err)
if not chunk then
sock:close()
return 1
else return sock:send(chunk) end
end
})
end
sinkt["keep-open"] = function(sock)
return base.setmetatable({
getfd = function() return sock:getfd() end,
dirty = function() return sock:dirty() end
}, {
__call = function(self, chunk, err)
if chunk then return sock:send(chunk)
else return 1 end
end
})
end
sinkt["default"] = sinkt["keep-open"]
sink = socket.choose(sinkt)
sourcet["by-length"] = function(sock, length)
return base.setmetatable({
getfd = function() return sock:getfd() end,
dirty = function() return sock:dirty() end
}, {
__call = function()
if length <= 0 then return nil end
local size = math.min(socket.BLOCKSIZE, length)
local chunk, err = sock:receive(size)
if err then return nil, err end
length = length - string.len(chunk)
return chunk
end
})
end
sourcet["until-closed"] = function(sock)
local done
return base.setmetatable({
getfd = function() return sock:getfd() end,
dirty = function() return sock:dirty() end
}, {
__call = function()
if done then return nil end
local chunk, err, partial = sock:receive(socket.BLOCKSIZE)
if not err then return chunk
elseif err == "closed" then
sock:close()
done = 1
return partial
else return nil, err end
end
})
end
sourcet["default"] = sourcet["until-closed"]
source = socket.choose(sourcet)
return socket
| mit |
LuaDist/lrexlib-tre | mkrockspecs.lua | 5 | 1276 | -- Generate the rockspecs
require "std"
if select ("#", ...) < 2 then
io.stderr:write "Usage: mkrockspecs VERSION MD5SUM\n"
os.exit ()
end
version = select (1, ...)
md5sum = select (2, ...)
function format (x, indent)
indent = indent or ""
if type (x) == "table" then
local s = "{\n"
for i, v in pairs (x) do
if type (i) ~= "number" then
s = s..indent..i.." = "..format (v, indent.." ")..",\n"
end
end
for i, v in ipairs (x) do
s = s..indent..format (v, indent.." ")..",\n"
end
return s..indent:sub(1, -3).."}"
elseif type (x) == "string" then
return string.format ("%q", x)
else
return tostring (x)
end
end
for f, spec in pairs (loadfile ("rockspecs.lua") ()) do
if f ~= "default" then
local specfile = "lrexlib-"..f:lower ().."-"..version.."-1.rockspec"
h = io.open (specfile, "w")
assert (h)
flavour = f -- a global, visible in loadfile
local specs = loadfile ("rockspecs.lua") () -- reload to get current flavour interpolated
local spec = table.merge (specs.default, specs[f])
local s = ""
for i, v in pairs (spec) do
s = s..i.." = "..format (v, " ").."\n"
end
h:write (s)
h:close ()
os.execute ("luarocks lint " .. specfile)
end
end
| mit |
nmav/luci | applications/luci-app-simple-adblock/luasrc/model/cbi/simple-adblock.lua | 2 | 12088 | -- Copyright 2016-2018 Stan Grishin <stangri@melmac.net>
-- Licensed to the public under the Apache License 2.0.
local readmeURL = "https://github.com/openwrt/packages/tree/master/net/simple-adblock/files/README.md"
-- local readmeURL = "https://github.com/stangri/openwrt_packages/tree/master/simple-adblock/files/README.md"
local packageName = "simple-adblock"
local uci = require "luci.model.uci".cursor()
local util = require "luci.util"
local sys = require "luci.sys"
local jsonc = require "luci.jsonc"
local fs = require "nixio.fs"
local http = require "luci.http"
local dispatcher = require "luci.dispatcher"
local enabledFlag = uci:get(packageName, "config", "enabled")
local command, outputFile, outputCache, outputGzip
local targetDNS = uci:get(packageName, "config", "dns")
local checkDnsmasq = sys.call("which dnsmasq >/dev/null 2>&1") == 0 and true
local checkUnbound = sys.call("which unbound >/dev/null 2>&1") == 0 and true
local checkDnsmasqIpset = sys.call("dnsmasq -v 2>/dev/null | grep -q 'no-ipset' || ! dnsmasq -v 2>/dev/null | grep -q -w 'ipset'") ~= 0
and sys.call("ipset help hash:net >/dev/null 2>&1") and true
if not targetDNS or targetDNS == "" then
targetDNS = "dnsmasq.servers"
end
if targetDNS ~= "dnsmasq.addnhosts" and targetDNS ~= "dnsmasq.conf" and
targetDNS ~= "dnsmasq.ipset" and targetDNS ~= "dnsmasq.servers" and
targetDNS ~= "unbound.adb_list" then
targetDNS = "dnsmasq.servers"
end
if targetDNS == "dnsmasq.addnhosts" then
outputFile="/var/run/" .. packageName .. ".addnhosts"
outputCache="/var/run/" .. packageName .. ".addnhosts.cache"
outputGzip="/etc/" .. packageName .. ".addnhosts.gz"
elseif targetDNS == "dnsmasq.conf" then
outputFile="/var/dnsmasq.d/" .. packageName .. ""
outputCache="/var/run/" .. packageName .. ".dnsmasq.cache"
outputGzip="/etc/" .. packageName .. ".dnsmasq.gz"
elseif targetDNS == "dnsmasq.servers" then
outputFile="/var/run/" .. packageName .. ".servers"
outputCache="/var/run/" .. packageName .. ".servers.cache"
outputGzip="/etc/" .. packageName .. ".servers.gz"
elseif targetDNS == "unbound.adb_list" then
outputFile="/var/lib/unbound/adb_list." .. packageName .. ""
outputCache="/var/run/" .. packageName .. ".unbound.cache"
outputGzip="/etc/" .. packageName .. ".unbound.gz"
end
m = Map("simple-adblock", translate("Simple AdBlock Settings"))
m.apply_on_parse = true
m.on_after_apply = function(self)
sys.call("/etc/init.d/simple-adblock restart")
end
local tmpfs
if fs.access("/var/run/" .. packageName .. ".json") then
tmpfs = jsonc.parse(util.trim(sys.exec("cat /var/run/" .. packageName .. ".json")))
end
local tmpfsVersion, tmpfsStatus, tmpfsMessage, tmpfsError, tmpfsStats = "", "Stopped"
if tmpfs and tmpfs['data'] then
if tmpfs['data']['status'] and tmpfs['data']['status'] ~= "" then
tmpfsStatus = tmpfs['data']['status']
end
if tmpfs['data']['message'] and tmpfs['data']['message'] ~= "" then
tmpfsMessage = tmpfs['data']['message']
end
if tmpfs['data']['error'] and tmpfs['data']['error'] ~= "" then
tmpfsError = tmpfs['data']['error']
end
if tmpfs['data']['stats'] and tmpfs['data']['stats'] ~= "" then
tmpfsStats = tmpfs['data']['stats']
end
if tmpfs['data']['version'] and tmpfs['data']['version'] ~= "" then
tmpfsVersion = " (" .. packageName .. " " .. tmpfs['data']['version'] .. ")"
end
end
h = m:section(NamedSection, "config", "simple-adblock", translate("Service Status") .. tmpfsVersion)
if tmpfsStatus and tmpfsStatus:match("ing") then
ss = h:option(DummyValue, "_dummy", translate("Service Status"))
ss.template = "simple-adblock/status"
ss.value = tmpfsStatus .. '...'
if tmpfsMessage then
sm = h:option(DummyValue, "_dummy", translate("Task"))
sm.template = "simple-adblock/status"
sm.value = tmpfsMessage
end
else
en = h:option(Button, "__toggle")
if enabledFlag ~= "1" or tmpfsStatus:match("Stopped") then
en.title = translate("Service is disabled/stopped")
en.inputtitle = translate("Enable/Start")
en.inputstyle = "apply important"
if fs.access(outputCache) then
sm = h:option(DummyValue, "_dummy", translate("Info"))
sm.template = "simple-adblock/status"
sm.value = "Cache file containing " .. util.trim(sys.exec("wc -l < " .. outputCache)) .. " domains found."
elseif fs.access(outputGzip) then
sm = h:option(DummyValue, "_dummy", translate("Info"))
sm.template = "simple-adblock/status"
sm.value = "Compressed cache file found."
end
else
en.title = translate("Service is enabled/started")
en.inputtitle = translate("Stop/Disable")
en.inputstyle = "reset important"
ss = h:option(DummyValue, "_dummy", translate("Service Status"))
ss.template = "simple-adblock/status"
ss.value = tmpfsStatus
if tmpfsMessage then
ms = h:option(DummyValue, "_dummy", translate("Message"))
ms.template = "simple-adblock/status"
ms.value = tmpfsMessage
end
if tmpfsError then
es = h:option(DummyValue, "_dummy", translate("Collected Errors"))
es.template = "simple-adblock/status"
es.value = tmpfsError
reload = h:option(Button, "__reload")
reload.title = translate("Service started with error")
reload.inputtitle = translate("Reload")
reload.inputstyle = "apply important"
function reload.write()
sys.exec("/etc/init.d/simple-adblock reload")
http.redirect(dispatcher.build_url("admin/services/" .. packageName))
end
end
end
function en.write()
if tmpfsStatus and tmpfsStatus:match("Stopped") then
enabledFlag = "1"
else
enabledFlag = enabledFlag == "1" and "0" or "1"
end
uci:set(packageName, "config", "enabled", enabledFlag)
uci:save(packageName)
uci:commit(packageName)
if enabledFlag == "0" then
luci.sys.init.stop(packageName)
else
luci.sys.init.enable(packageName)
luci.sys.init.start(packageName)
end
luci.http.redirect(luci.dispatcher.build_url("admin/services/" .. packageName))
end
end
s = m:section(NamedSection, "config", "simple-adblock", translate("Configuration"))
-- General options
s:tab("basic", translate("Basic Configuration"))
o2 = s:taboption("basic", ListValue, "verbosity", translate("Output Verbosity Setting"),translate("Controls system log and console output verbosity."))
o2:value("0", translate("Suppress output"))
o2:value("1", translate("Some output"))
o2:value("2", translate("Verbose output"))
o2.default = 2
o3 = s:taboption("basic", ListValue, "force_dns", translate("Force Router DNS"), translate("Forces Router DNS use on local devices, also known as DNS Hijacking."))
o3:value("0", translate("Let local devices use their own DNS servers if set"))
o3:value("1", translate("Force Router DNS server to all local devices"))
o3.default = 1
local sysfs_path = "/sys/class/leds/"
local leds = {}
if nixio.fs.access(sysfs_path) then
leds = nixio.util.consume((nixio.fs.dir(sysfs_path)))
end
if #leds ~= 0 then
o4 = s:taboption("basic", Value, "led", translate("LED to indicate status"), translate("Pick the LED not already used in")
.. [[ <a href="]] .. luci.dispatcher.build_url("admin/system/leds") .. [[">]]
.. translate("System LED Configuration") .. [[</a>]] .. ".")
o4.rmempty = false
o4:value("", translate("none"))
for k, v in ipairs(leds) do
o4:value(v)
end
end
s:tab("advanced", translate("Advanced Configuration"))
local dns_descr = translate("Pick the DNS resolution option to create the adblock list for, see the") .. " "
.. [[<a href="]] .. readmeURL .. [[#dns-resolution-option" target="_blank">]]
.. translate("README") .. [[</a>]] .. " " .. translate("for details.")
if not checkDnsmasq then
dns_descr = dns_descr .. "<br />" .. translate("Please note that") .. " <i>dnsmasq.addnhosts</i> " .. translate("is not supported on this system.")
dns_descr = dns_descr .. "<br />" .. translate("Please note that") .. " <i>dnsmasq.conf</i> " .. translate("is not supported on this system.")
dns_descr = dns_descr .. "<br />" .. translate("Please note that") .. " <i>dnsmasq.ipset</i> " .. translate("is not supported on this system.")
dns_descr = dns_descr .. "<br />" .. translate("Please note that") .. " <i>dnsmasq.servers</i> " .. translate("is not supported on this system.")
elseif not checkDnsmasqIpset then
dns_descr = dns_descr .. "<br />" .. translate("Please note that") .. " <i>dnsmasq.ipset</i> " .. translate("is not supported on this system.")
end
if not checkUnbound then
dns_descr = dns_descr .. "<br />" .. translate("Please note that") .. " <i>unbound.adb_list</i> " .. translate("is not supported on this system.")
end
dns = s:taboption("advanced", ListValue, "dns", translate("DNS Service"), dns_descr)
if checkDnsmasq then
dns:value("dnsmasq.addnhosts", translate("DNSMASQ Additional Hosts"))
dns:value("dnsmasq.conf", translate("DNSMASQ Config"))
if checkDnsmasqIpset then
dns:value("dnsmasq.ipset", translate("DNSMASQ IP Set"))
end
dns:value("dnsmasq.servers", translate("DNSMASQ Servers File"))
end
if checkUnbound then
dns:value("unbound.adb_list", translate("Unbound AdBlock List"))
end
dns.default = "dnsmasq.servers"
ipv6 = s:taboption("advanced", ListValue, "ipv6_enabled", translate("IPv6 Support"), translate("Add IPv6 entries to block-list."))
ipv6:value("", translate("Do not add IPv6 entries"))
ipv6:value("1", translate("Add IPv6 entries"))
ipv6:depends({dns="dnsmasq.addnhosts"})
ipv6.default = ""
ipv6.rmempty = true
o5 = s:taboption("advanced", Value, "boot_delay", translate("Delay (in seconds) for on-boot start"), translate("Run service after set delay on boot."))
o5.default = 120
o5.datatype = "range(1,600)"
o6 = s:taboption("advanced", Value, "download_timeout", translate("Download time-out (in seconds)"), translate("Stop the download if it is stalled for set number of seconds."))
o6.default = 10
o6.datatype = "range(1,60)"
o7 = s:taboption("advanced", Value, "curl_retry", translate("Curl download retry"), translate("If curl is installed and detected, it would retry download this many times on timeout/fail."))
o7.default = 3
o7.datatype = "range(0,30)"
o8 = s:taboption("advanced", ListValue, "parallel_downloads", translate("Simultaneous processing"), translate("Launch all lists downloads and processing simultaneously, reducing service start time."))
o8:value("0", translate("Do not use simultaneous processing"))
o8:value("1", translate("Use simultaneous processing"))
o8.default = 1
o10 = s:taboption("advanced", ListValue, "compressed_cache", translate("Store compressed cache file on router"), translate("Attempt to create a compressed cache of block-list in the persistent memory."))
o10:value("0", translate("Do not store compressed cache"))
o10:value("1", translate("Store compressed cache"))
o10.default = "0"
o11 = s:taboption("advanced", ListValue, "debug", translate("Enable Debugging"), translate("Enables debug output to /tmp/simple-adblock.log."))
o11:value("0", translate("Disable Debugging"))
o11:value("1", translate("Enable Debugging"))
o11.default = "0"
s2 = m:section(NamedSection, "config", "simple-adblock", translate("Whitelist and Blocklist Management"))
-- Whitelisted Domains
d1 = s2:option(DynamicList, "whitelist_domain", translate("Whitelisted Domains"), translate("Individual domains to be whitelisted."))
d1.addremove = false
d1.optional = false
-- Blacklisted Domains
d3 = s2:option(DynamicList, "blacklist_domain", translate("Blacklisted Domains"), translate("Individual domains to be blacklisted."))
d3.addremove = false
d3.optional = false
-- Whitelisted Domains URLs
d2 = s2:option(DynamicList, "whitelist_domains_url", translate("Whitelisted Domain URLs"), translate("URLs to lists of domains to be whitelisted."))
d2.addremove = false
d2.optional = false
-- Blacklisted Domains URLs
d4 = s2:option(DynamicList, "blacklist_domains_url", translate("Blacklisted Domain URLs"), translate("URLs to lists of domains to be blacklisted."))
d4.addremove = false
d4.optional = false
-- Blacklisted Hosts URLs
d5 = s2:option(DynamicList, "blacklist_hosts_url", translate("Blacklisted Hosts URLs"), translate("URLs to lists of hosts to be blacklisted."))
d5.addremove = false
d5.optional = false
return m
| apache-2.0 |
kikito/ld-29 | lib/middleclass.lua | 63 | 6117 | local middleclass = {
_VERSION = 'middleclass v3.0.1',
_DESCRIPTION = 'Object Orientation for Lua',
_URL = 'https://github.com/kikito/middleclass',
_LICENSE = [[
MIT LICENSE
Copyright (c) 2011 Enrique García Cota
Permission is hereby granted, free of charge, to any person obtaining a
copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:
The above copyright notice and this permission notice shall be included
in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
]]
}
local function _setClassDictionariesMetatables(aClass)
local dict = aClass.__instanceDict
dict.__index = dict
local super = aClass.super
if super then
local superStatic = super.static
setmetatable(dict, super.__instanceDict)
setmetatable(aClass.static, { __index = function(_,k) return dict[k] or superStatic[k] end })
else
setmetatable(aClass.static, { __index = function(_,k) return dict[k] end })
end
end
local function _setClassMetatable(aClass)
setmetatable(aClass, {
__tostring = function() return "class " .. aClass.name end,
__index = aClass.static,
__newindex = aClass.__instanceDict,
__call = function(self, ...) return self:new(...) end
})
end
local function _createClass(name, super)
local aClass = { name = name, super = super, static = {}, __mixins = {}, __instanceDict={} }
aClass.subclasses = setmetatable({}, {__mode = "k"})
_setClassDictionariesMetatables(aClass)
_setClassMetatable(aClass)
return aClass
end
local function _createLookupMetamethod(aClass, name)
return function(...)
local method = aClass.super[name]
assert( type(method)=='function', tostring(aClass) .. " doesn't implement metamethod '" .. name .. "'" )
return method(...)
end
end
local function _setClassMetamethods(aClass)
for _,m in ipairs(aClass.__metamethods) do
aClass[m]= _createLookupMetamethod(aClass, m)
end
end
local function _setDefaultInitializeMethod(aClass, super)
aClass.initialize = function(instance, ...)
return super.initialize(instance, ...)
end
end
local function _includeMixin(aClass, mixin)
assert(type(mixin)=='table', "mixin must be a table")
for name,method in pairs(mixin) do
if name ~= "included" and name ~= "static" then aClass[name] = method end
end
if mixin.static then
for name,method in pairs(mixin.static) do
aClass.static[name] = method
end
end
if type(mixin.included)=="function" then mixin:included(aClass) end
aClass.__mixins[mixin] = true
end
local Object = _createClass("Object", nil)
Object.static.__metamethods = { '__add', '__call', '__concat', '__div', '__ipairs', '__le',
'__len', '__lt', '__mod', '__mul', '__pairs', '__pow', '__sub',
'__tostring', '__unm'}
function Object.static:allocate()
assert(type(self) == 'table', "Make sure that you are using 'Class:allocate' instead of 'Class.allocate'")
return setmetatable({ class = self }, self.__instanceDict)
end
function Object.static:new(...)
local instance = self:allocate()
instance:initialize(...)
return instance
end
function Object.static:subclass(name)
assert(type(self) == 'table', "Make sure that you are using 'Class:subclass' instead of 'Class.subclass'")
assert(type(name) == "string", "You must provide a name(string) for your class")
local subclass = _createClass(name, self)
_setClassMetamethods(subclass)
_setDefaultInitializeMethod(subclass, self)
self.subclasses[subclass] = true
self:subclassed(subclass)
return subclass
end
function Object.static:subclassed(other) end
function Object.static:isSubclassOf(other)
return type(other) == 'table' and
type(self) == 'table' and
type(self.super) == 'table' and
( self.super == other or
type(self.super.isSubclassOf) == 'function' and
self.super:isSubclassOf(other)
)
end
function Object.static:include( ... )
assert(type(self) == 'table', "Make sure you that you are using 'Class:include' instead of 'Class.include'")
for _,mixin in ipairs({...}) do _includeMixin(self, mixin) end
return self
end
function Object.static:includes(mixin)
return type(mixin) == 'table' and
type(self) == 'table' and
type(self.__mixins) == 'table' and
( self.__mixins[mixin] or
type(self.super) == 'table' and
type(self.super.includes) == 'function' and
self.super:includes(mixin)
)
end
function Object:initialize() end
function Object:__tostring() return "instance of " .. tostring(self.class) end
function Object:isInstanceOf(aClass)
return type(self) == 'table' and
type(self.class) == 'table' and
type(aClass) == 'table' and
( aClass == self.class or
type(aClass.isSubclassOf) == 'function' and
self.class:isSubclassOf(aClass)
)
end
function middleclass.class(name, super, ...)
super = super or Object
return super:subclass(name, ...)
end
middleclass.Object = Object
setmetatable(middleclass, { __call = function(_, ...) return middleclass.class(...) end })
return middleclass
| mit |
MegaThorx/open_reallife | open_reallife/client/login.lua | 2 | 2836 | Login = {}
Login.Display = function(...)
Login.ShowWindow(...)
end
addEvent("onClientDisplayLogin", true)
addEventHandler("onClientDisplayLogin", root, Login.Display)
Login.DisplayRegister = function(...)
Login.ShowWindowRegister(...)
end
addEvent("onClientDisplayRegister", true)
addEventHandler("onClientDisplayRegister", root, Login.DisplayRegister)
Login.Hide = function()
Login.HideWindow()
end
Login.ShowWindow = function(username)
executeBrowserJavascript(GUI.browser, '$("#login").css("visibility", "visible");')
executeBrowserJavascript(GUI.browser, '$("#login").contents().get(0).location.href = "http://mta/open_reallife/files/html/login.html"')
if(username)then
setTimer(function()
executeBrowserJavascript(GUI.browser, '$("#login").contents().find("#username").val("'..username..'")')
end, 100, 1)
end
Cursor.Show()
HUD.Hide()
end
Login.ShowWindowRegister = function(username, email)
executeBrowserJavascript(GUI.browser, '$("#login").css("visibility", "visible");')
executeBrowserJavascript(GUI.browser, '$("#login").contents().get(0).location.href = "http://mta/open_reallife/files/html/register.html"')
if(username)then
setTimer(function()
executeBrowserJavascript(GUI.browser, '$("#login").contents().find("#username").val("'..username..'")')
end, 100, 1)
end
if(email)then
setTimer(function()
executeBrowserJavascript(GUI.browser, '$("#login").contents().find("#email").val("'..email..'")')
end, 100, 1)
end
Cursor.Show()
HUD.Hide()
end
Login.HideWindow = function()
executeBrowserJavascript(GUI.browser, '$("#login").css("visibility", "hidden");')
Cursor.Hide()
HUD.Show()
end
addEvent("onClientHideLogin", true)
addEventHandler("onClientHideLogin", root, Login.HideWindow)
Login.OnSubmit = function(_, post)
local username = HTML.Decode(post["username"])
local password = HTML.Decode(post["password"])
local autologin = HTML.Decode(post["remember_me"])
if(username == "" or password == "")then
-- TODO add errors
else
Login.HideWindow()
triggerServerEvent("onTryLogin", localPlayer, username, password, autologin)
end
end
GUI.AddAjaxGetHandler("login", Login.OnSubmit)
Login.OnRegister = function(_, post)
local username = HTML.Decode(post["username"])
local email = HTML.Decode(post["email"])
local password = HTML.Decode(post["password"])
local password2 = HTML.Decode(post["password_confirmation"])
local toc = HTML.Decode(post["t_and_c"])
if(username == "" or email == "" or password == "" or password2 == "" or not toc)then
-- TODO add errors
Login.ShowWindowRegister(username, email)
else
Login.HideWindow()
triggerServerEvent("onTryRegister", localPlayer, username, email, password, password2)
end
end
GUI.AddAjaxGetHandler("register", Login.OnRegister)
| mit |
FaceDeer/crafting | furnace.lua | 1 | 14494 | local MP = minetest.get_modpath(minetest.get_current_modname())
local S, NS = dofile(MP.."/intllib.lua")
local recipes = simplecrafting_lib.get_crafting_info("furnace").recipes
local show_guides = crafting.config.show_guides
local clear_default_crafting = crafting.config.clear_default_crafting
local max_heat = ItemStack({name="simplecrafting_lib:heat",count=9999})
local function is_ingredient(item)
local outputs = simplecrafting_lib.get_craftable_recipes("furnace", {ItemStack(item), max_heat})
if #outputs > 0 then
return outputs
end
return nil
end
local function get_recipe_name(item_stack)
local item = item_stack:get_name()
local craftable_recipes = simplecrafting_lib.get_craftable_recipes("furnace", {item_stack, max_heat})
if craftable_recipes then
for item_name, _ in pairs(craftable_recipes[1].input) do
-- there should only be one item other than heat
if item_name ~= "simplecrafting_lib:heat" then
return item_name
end
end
end
return nil
end
local function sort_input(meta)
local inv = meta:get_inventory()
if inv:is_empty("input") then
return
end
local item = inv:get_stack("input",1)
local fuel = inv:get_stack("input",2)
local item_recipes
local item_fuel
if not item:is_empty() then
item_recipes = is_ingredient(item:get_name())
item_fuel = simplecrafting_lib.is_fuel("fuel", item:get_name())
end
local fuel_recipes
local fuel_fuel
if not fuel:is_empty() then
fuel_recipes = is_ingredient(fuel:get_name())
fuel_fuel = simplecrafting_lib.is_fuel("fuel", fuel:get_name())
end
-- Assume one is a correct fuel
if fuel_fuel then
return false
elseif item_fuel then
inv:set_list("input",{fuel,item})
return true
end
-- Assume one is an ingredient
if item_recipes then
return false
elseif fuel_recipes then
inv:set_list("input",{fuel,item})
return true
end
-- If both wrong, don't do anything
return false
end
local function is_recipe(item,fuel)
local item_recipes = is_ingredient(item)
local fuel_def = simplecrafting_lib.is_fuel("fuel", fuel)
if not item_recipes or not fuel_def then
return nil, nil
end
return item_recipes[1], fuel_def
end
local function swap_furnace(pos)
local node = minetest.get_node(pos)
if node.name == "crafting:furnace" then
node.name = "crafting:furnace_active"
elseif node.name == "crafting:furnace_active" then
node.name = "crafting:furnace"
end
minetest.swap_node(pos,node)
end
local function set_infotext(state)
state.infotext = S("Fuel time: @1 | Item time: @2", state.burntime, state.itemtime)
end
local function get_furnace_state(pos)
local meta = minetest.get_meta(pos)
local inv = meta:get_inventory()
return {
inv = inv,
meta = meta,
burntime = meta:get_float("burntime"),
itemtime = meta:get_float("itemtime"),
item = inv:get_stack("input",1),
fuel = inv:get_stack("input",2),
old_fuel = meta:get_string("fuel"),
old_item = meta:get_string("item"),
infotext = meta:get_string("infotext"),
}
end
local function set_furnace_state(pos,state)
local meta = minetest.get_meta(pos)
local inv = meta:get_inventory()
meta:set_float("burntime",state.burntime)
meta:set_float("itemtime",state.itemtime)
inv:set_stack("input",1,state.item)
inv:set_stack("input",2,state.fuel)
meta:set_string("fuel",state.old_fuel)
meta:set_string("item",state.old_item)
meta:set_string("infotext",state.infotext)
end
local function burn_fuel(state)
local fuel_def = simplecrafting_lib.is_fuel("fuel", state.fuel:get_name())
-- check if all the returns can fit into output
if fuel_def.returns then
local old_out = state.inv:get_list("output")
for item, count in pairs(fuel_def.returns) do
local leftovers = state.inv:add_item("output",ItemStack({name=item, count=count}))
if leftovers:get_count() > 0 then
-- can't fit, roll back output inventory and exit
state.inv:set_list("output", old_out)
return false
end
end
end
state.old_fuel = state.fuel:get_name()
state.burntime = fuel_def.output:get_count()
state.fuel:set_count(state.fuel:get_count() - 1)
return true
end
local function set_ingredient(state,item,recipe)
state.old_item = item:get_name()
state.itemtime = recipe.input["simplecrafting_lib:heat"]
end
local function clear_item(state)
state.old_item = ""
state.itemtime = math.huge
end
local function set_timer(pos,itemtime,burntime)
minetest.get_node_timer(pos):start(math.min(itemtime,burntime))
end
local function enough_items(item_stack,recipe)
if item_stack:is_empty() then
return false
end
local recipe_name = get_recipe_name(item_stack)
return item_stack:get_count() >= recipe.input[get_recipe_name(item_stack)]
end
local function room_for_out(recipe,inv)
if not inv:room_for_item("output", recipe.output) then
return false
end
return true
end
local function try_start(pos)
local state = get_furnace_state(pos)
local recipe,fuel_def = is_recipe(state.item:get_name(),state.fuel:get_name())
if not recipe
or not enough_items(state.item,recipe)
or not room_for_out(recipe,state.inv) then
return
end
set_ingredient(state,state.item,recipe)
if not burn_fuel(state) then
return
end
set_timer(pos,recipe.input["simplecrafting_lib:heat"],fuel_def.output:get_count())
swap_furnace(pos)
set_infotext(state)
set_furnace_state(pos,state)
end
local function get_formspec()
local formspec = {
"size[8,9]",
default.gui_bg,
default.gui_bg_img,
default.gui_slots,
"list[context;input;2,1;1,1;]",
"list[context;input;2,3;1,1;1]",
"list[context;output;4,1.5;2,2;]",
"list[current_player;main;0,5;8,1;0]",
"list[current_player;main;0,6.2;8,3;8]",
"listring[context;output]",
"listring[current_player;main]",
"listring[context;input]",
"listring[current_player;main]",
}
if show_guides then
table.insert(formspec, "button[7,4;1,0.75;show_guide;Show\nGuide]")
end
return table.concat(formspec)
end
minetest.register_node("crafting:furnace",{
description = S("Furnace"),
drawtype = "normal",
tiles = {
"default_furnace_top.png", "default_furnace_bottom.png",
"default_furnace_side.png", "default_furnace_side.png",
"default_furnace_side.png", "default_furnace_front.png"
},
sounds = default.node_sound_stone_defaults(),
paramtype2 = "facedir",
is_ground_content = false,
groups = {oddly_breakable_by_hand = 1,cracky=3},
on_construct = function(pos)
local meta = minetest.get_meta(pos)
local inv = meta:get_inventory()
inv:set_size("input", 2)
inv:set_size("output", 2*2)
meta:set_string("formspec", get_formspec())
end,
on_metadata_inventory_move = function(pos,flist,fi,tlist,ti,no,player)
local meta = minetest.get_meta(pos)
if tlist == "input" then
sort_input(meta)
end
try_start(pos)
end,
on_metadata_inventory_take = function(pos,lname,i,stack,player)
try_start(pos)
end,
on_metadata_inventory_put = function(pos,lname,i,stack,player)
local meta = minetest.get_meta(pos)
if lname == "input" then
sort_input(meta)
end
meta:set_string("formspec", get_formspec()) -- since the formspec can theoretically change, refresh it every once in a while
try_start(pos)
end,
can_dig = function(pos,player)
local meta = minetest.get_meta(pos)
local inv = meta:get_inventory()
return inv:is_empty("output") and inv:is_empty("input")
end,
on_receive_fields = function(pos, formname, fields, sender)
if fields.show_guide and show_guides then
simplecrafting_lib.show_crafting_guide("furnace", sender)
end
end,
})
local function on_timeout(state)
local recipe,fuel_def = is_recipe(state.item:get_name(),state.old_fuel)
if state.item:get_name() ~= state.old_item then
if recipe then
set_ingredient(state,state.item,recipe)
return true
else
clear_item(state)
return false
end
end
-- Triggered if active furnace placed
if not recipe then
clear_item(state)
return false
end
if not room_for_out(recipe,state.inv)
or not enough_items(state.item,recipe) then
clear_item(state)
return false
end
state.inv:add_item("output",recipe.output)
state.item:set_count(state.item:get_count() - recipe.input[get_recipe_name(state.item)])
if not room_for_out(recipe,state.inv)
or not enough_items(state.item,recipe) then
clear_item(state)
return false
else
set_ingredient(state,state.item,recipe)
return true
end
end
local function on_burnout(state)
local recipe,fuel_def = is_recipe(state.item:get_name(),state.fuel:get_name())
if not recipe then
clear_item(state)
state.burntime = 0
return false
end
if not room_for_out(recipe,state.inv)
or not enough_items(state.item,recipe) then
clear_item(state)
state.burntime = 0
return false
end
return burn_fuel(state)
end
local function try_change(pos)
local state = get_furnace_state(pos)
local recipe,fuel_def = is_recipe(state.item:get_name(),state.fuel:get_name())
local timer = minetest.get_node_timer(pos)
if state.item:get_name() ~= state.old_item and recipe then
-- Check if remains of old fuel can be used
local old_recipe = is_recipe(state.item:get_name(),state.old_fuel)
if old_recipe == recipe then
set_ingredient(state,state.item,recipe)
state.burntime = state.burntime - timer:get_elapsed()
timer:start(math.min(state.burntime,recipe.input["simplecrafting_lib:heat"]))
set_infotext(state)
set_furnace_state(pos,state)
return
else
if not burn_fuel(state) then
return
end
set_ingredient(state,state.item,recipe)
timer:start(math.min(recipe.input["simplecrafting_lib:heat"],fuel_def.output:get_count()))
set_infotext(state)
set_furnace_state(pos,state)
return
end
end
if state.fuel:get_name() ~= state.old_fuel then
local old_recipe = is_recipe(state.item:get_name(),state.old_fuel)
if recipe and recipe ~= old_recipe then
if not burn_fuel(state) then
return
end
set_ingredient(state,state.item,recipe)
timer:start(math.min(recipe.input["simplecrafting_lib:heat"],fuel_def.output:get_count()))
set_infotext(state)
set_furnace_state(pos,state)
return
end
end
end
local function furnace_timer(pos,elapsed,state)
state = state or get_furnace_state(pos)
local timer = minetest.get_node_timer(pos)
local time_taken = math.min(state.burntime,state.itemtime)
local create_timer = true
local remaining = elapsed
if remaining >= time_taken then
remaining = elapsed - time_taken
state.itemtime = state.itemtime - time_taken
state.burntime = state.burntime - time_taken
create_timer = state.burntime > 0
if state.itemtime <= 0 then
on_timeout(state)
end
if state.burntime <= 0 then
create_timer = on_burnout(state)
end
end
if create_timer then
local time = math.min(state.burntime,state.itemtime)
if remaining > time then
return furnace_timer(pos,remaining,state)
else
timer:set(time,remaining)
end
else
swap_furnace(pos)
end
set_infotext(state)
set_furnace_state(pos,state)
return false
end
minetest.register_node("crafting:furnace_active",{
description = S("Furnace"),
drawtype = "normal",
tiles = {
"default_furnace_top.png", "default_furnace_bottom.png",
"default_furnace_side.png", "default_furnace_side.png",
"default_furnace_side.png",
{
image = "default_furnace_front_active.png",
backface_culling = false,
animation = {
type = "vertical_frames",
aspect_w = 16,
aspect_h = 16,
length = 1.5
},
},
},
sounds = default.node_sound_stone_defaults(),
paramtype2 = "facedir",
drop = "crafting:furnace",
groups = {oddly_breakable_by_hand = 1,cracky=3,not_in_creative_inventory=1},
is_ground_content = false,
on_metadata_inventory_move = function(pos,flist,fi,tlist,ti,no,player)
local meta = minetest.get_meta(pos)
if tlist == "input" then
sort_input(meta)
end
try_change(pos)
end,
on_metadata_inventory_take = function(pos,lname,i,stack,player)
try_change(pos)
end,
on_metadata_inventory_put = function(pos,lname,i,stack,player)
local meta = minetest.get_meta(pos)
if lname == "input" then
sort_input(meta)
end
try_change(pos)
end,
can_dig = function(pos,player)
local meta = minetest.get_meta(pos)
local inv = meta:get_inventory()
return inv:is_empty("output") and inv:is_empty("input")
end,
on_receive_fields = function(pos, formname, fields, sender)
if fields.show_guide and show_guides then
simplecrafting_lib.show_crafting_guide("furnace", sender)
end
end,
on_timer = furnace_timer,
})
-------------------------------------------------------------------------
-- Crafting
local furnace_recipe = {
output = "crafting:furnace",
recipe = {
{"default:stone","default:stone","default:stone"},
{"default:stone","default:coal_lump","default:stone"},
{"default:stone","default:stone","default:stone"},
},
}
if clear_default_crafting then
-- If we've cleared native crafting, there's no point to the default furnace.
-- replace it with the crafting: mod furnace.
minetest.register_alias_force("default:furnace", "crafting:furnace")
minetest.register_alias_force("default:furnace_active", "crafting:furnace_active")
else
-- If we haven't cleared native crafting, leave the existing furnace alone and add the crafting: mod one separately
minetest.register_craft(furnace_recipe)
end
-------------------------------------------------------------------------
-- Guide
if show_guides then
minetest.register_craftitem("crafting:furnace_guide", {
description = S("Crafting Guide (Furnace)"),
inventory_image = "crafting_guide_cover.png^[colorize:#88000088^crafting_guide_contents.png",
wield_image = "crafting_guide_cover.png^[colorize:#88000088^crafting_guide_contents.png",
stack_max = 1,
groups = {book = 1},
on_use = function(itemstack, user)
simplecrafting_lib.show_crafting_guide("furnace", user)
end,
})
if minetest.get_modpath("default") then
minetest.register_craft({
output = "crafting:furnace_guide",
type = "shapeless",
recipe = {"crafting:furnace", "default:book"},
replacements = {{"crafting:furnace", "crafting:furnace"}}
})
end
end
----------------------------------------------------------------------------
-- Hopper compatibility
if minetest.get_modpath("hopper") and hopper ~= nil and hopper.add_container ~= nil then
hopper:add_container({
{"top", "crafting:furnace", "output"},
{"bottom", "crafting:furnace", "input"},
{"side", "crafting:furnace", "input"},
{"top", "crafting:furnace_active", "output"},
{"bottom", "crafting:furnace_active", "input"},
{"side", "crafting:furnace_active", "input"},
})
end | mit |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.