Skip to content

Instantly share code, notes, and snippets.

@Rumrusher
Forked from warmist/spellbook.lua
Last active December 15, 2015 08:59
Show Gist options
  • Select an option

  • Save Rumrusher/5234890 to your computer and use it in GitHub Desktop.

Select an option

Save Rumrusher/5234890 to your computer and use it in GitHub Desktop.
My spellbook spells.
--show a list of 'spells'
local dlg=require("gui.dialogs")
function doNothing()
print("doing nothing real good but here have a site")
require("plugins.dfusion.adv_tools").addSite(nil,nil,nil,nil,nil,nil,df.global.world.units.active[0].civ_id)
end
function SummonSelf()
for k,v in pairs(df.global.world.nemesis.all) do
if v.flags.ACTIVE_ADVENTURER then
df.global.world.world_data.travel[0].members:insert("#",{new=true,nemesis_id=v.id})
end
end
end
function getCompanions()
local ret={}
local adv=df.global.world.units.active[0]
for k,v in pairs(df.global.world.nemesis.all) do
if v.relations.group_leader_id==adv.id or v.relations.following==adv.id then
table.insert(ret,v)
end
end
return ret
end
function SummonCompanions()
local Adv
for k,v in pairs(df.global.world.nemesis.all) do
if v.flags.ACTIVE_ADVENTURER then
Adv=v
break
end
end
for k,v in pairs(df.global.world.nemesis.all) do
if v.relations.group_leader_id==adv.id or v.relations.following==adv.id then
df.global.world.world_data.travel[0].members:insert("#",{new=true,nemesis_id=v.id})
end
end
end
function SummonCiv()
local Adv
for k,v in pairs(df.global.world.nemesis.all) do
if v.flags.ACTIVE_ADVENTURER then
local Adv=v
break
end
end
for k,v in pairs(df.global.world.nemesis.all) do
if v.figure.civ_id==Adv.figure.civ_id or v.relations.group_leader_id==Adv.id then
df.global.world.world_data.travel[0].members:insert("#",{new=true,nemesis_id=v.id})
end
end
end
function sparWildlife()
for k,v in pairs(df.global.world.units.active) do
if v.civ_id==-1 then
v.flags2.sparring=true
end
end
end
function Warmlor()
dofile("hack/scripts/test2.lua") --warmlor Anga the big book of scripts and spells
end
function Waypoints()
dofile("hack/scripts/portal.lua")
end
function greetAndStuff()
dlg.showMessage("Greetings", "Season's greatings and lols")
end
listofspells={
{text="nothing", spell=doNothing,icon='*'},
{text="hello world", spell=greetAndStuff,key="CUSTOM_C"},
{text="Summon doppleganger", spell=SummonSelf,key="CUSTOM_D"},
{text="Summon Friends", spell=SummonCompanions,key="CUSTOM_D"},
{text="Summon Random", spell=SummonRandom,key="CUSTOM_D"},
{text="Summon Civ", spell=SummonCiv,key="CUSTOM_D"},
{text="Train with Wildlife", spell=sparWildlife,key="CUSTOM_F"},
{text="Tap into Warmlor Anga", spell=Warmlor,key="CUSTOM_W"},
{text="sync in the teleporter", spell=Waypoints,key="CUSTOM_P"},
}
dlg.showListPrompt("Spelz","Choze spel",nil, listofspells,function(index,choice) choice.spell() end)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment