Started migration to init/plugin scheme (init files for noninteractive parts). Also added WINDOWS/LINUX flags
parent
150e06f115
commit
1a99121ead
@ -0,0 +1,89 @@
|
|||||||
|
adv_tools=adv_tools or {}
|
||||||
|
adv_tools.menu=adv_tools.menu or MakeMenu()
|
||||||
|
function adv_tools.ressurect()
|
||||||
|
myoff=offsets.getEx("AdvCreatureVec")
|
||||||
|
vector=engine.peek(myoff,ptr_vector)
|
||||||
|
indx=GetCreatureAtPos(getxyz())
|
||||||
|
if indx<0 then indx=0 end
|
||||||
|
--print(string.format("%x",vector:getval(indx)))
|
||||||
|
v2=engine.peek(vector:getval(indx),ptr_Creature.hurt1)
|
||||||
|
for i=0,v2:size()-1 do
|
||||||
|
v2:setval(i,0)
|
||||||
|
end
|
||||||
|
v2=engine.peek(vector:getval(indx),ptr_Creature.hurt2)
|
||||||
|
v2.type=DWORD
|
||||||
|
for i=0,v2:size()-1 do
|
||||||
|
v2:setval(i,0)
|
||||||
|
end
|
||||||
|
engine.poke(vector:getval(indx),ptr_Creature.bloodlvl,60000) --give blood
|
||||||
|
engine.poke(vector:getval(indx),ptr_Creature.bleedlvl,0) --stop some bleeding...
|
||||||
|
local flg=engine.peek(vector:getval(indx),ptr_Creature.flags)
|
||||||
|
flg:set(1,false) --ALIVE
|
||||||
|
flg:set(39,false) -- leave body yet again
|
||||||
|
flg:set(37,false) -- something todo with wounds- lets you walk again.
|
||||||
|
flg:set(58,true) -- makes them able to breathe
|
||||||
|
flg:set(61,true) -- gives them sight
|
||||||
|
engine.poke(vector:getval(indx),ptr_Creature.flags,flg)
|
||||||
|
end
|
||||||
|
|
||||||
|
function adv_tools.wagonmode() --by rumrusher
|
||||||
|
--first three lines same as before (because we will need an offset of creature at location x,y,z)
|
||||||
|
myoff=offsets.getEx("AdvCreatureVec")
|
||||||
|
vector=engine.peek(myoff,ptr_vector)
|
||||||
|
indx=GetCreatureAtPos(getxyz())
|
||||||
|
--indx=0
|
||||||
|
--print(string.format("%x",vector:getval(indx)))
|
||||||
|
flg=engine.peek(vector:getval(indx),ptr_Creature.flags) --get flags
|
||||||
|
flg:set(1,false)
|
||||||
|
flg:set(74,false)
|
||||||
|
engine.poke(vector:getval(indx),ptr_Creature.flags,flg)
|
||||||
|
print("To stay normal press y, else hit Enter turn Wagon mode on.")
|
||||||
|
r=io.stdin:read() -- repeat for it too work... also creature will be dead.
|
||||||
|
if r== "y" then
|
||||||
|
flg=engine.peek(vector:getval(indx),ptr_Creature.flags)
|
||||||
|
flg:set(1,false)
|
||||||
|
engine.poke(vector:getval(indx),ptr_Creature.flags,flg)
|
||||||
|
else
|
||||||
|
flg=engine.peek(vector:getval(indx),ptr_Creature.flags)
|
||||||
|
flg:set(1,false)
|
||||||
|
flg:flip(74)
|
||||||
|
engine.poke(vector:getval(indx),ptr_Creature.flags,flg)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
function selectall()
|
||||||
|
local retvec={} --return vector (or a list)
|
||||||
|
myoff=offsets.getEx("AdvCreatureVec")
|
||||||
|
vector=engine.peek(myoff,ptr_vector) --standart start
|
||||||
|
for i=0,vector:size()-1 do --check all creatures
|
||||||
|
local off
|
||||||
|
off=vector:getval(i)
|
||||||
|
local flags=engine.peek(off,ptr_Creature.flags)
|
||||||
|
if flags:get(1)==true then --if dead ...
|
||||||
|
table.insert(retvec,off)--... add it to return vector
|
||||||
|
end
|
||||||
|
end
|
||||||
|
return retvec --return the "return vector" :)
|
||||||
|
end
|
||||||
|
function adv_tools.hostilate()
|
||||||
|
vector=engine.peek(offsets.getEx("AdvCreatureVec"),ptr_vector)
|
||||||
|
id=GetCreatureAtPos(getxyz())
|
||||||
|
print(string.format("Vec:%d cr:%d",vector:size(),id))
|
||||||
|
off=vector:getval(id)
|
||||||
|
crciv=engine.peek(vector:getval(id),ptr_Creature.civ)
|
||||||
|
curciv=engine.peek(vector:getval(0),ptr_Creature.civ)
|
||||||
|
|
||||||
|
if curciv==crciv then
|
||||||
|
print("Friendly-making enemy")
|
||||||
|
engine.poke(off,ptr_Creature.civ,-1)
|
||||||
|
flg=engine.peek(off,ptr_Creature.flags)
|
||||||
|
flg:set(17,true)
|
||||||
|
engine.poke(off,ptr_Creature.flags,flg)
|
||||||
|
else
|
||||||
|
print("Enemy- making friendly")
|
||||||
|
engine.poke(off,ptr_Creature.civ,curciv)
|
||||||
|
flg=engine.peek(off,ptr_Creature.flags)
|
||||||
|
flg:set(17,false)
|
||||||
|
flg:set(19,false)
|
||||||
|
engine.poke(off,ptr_Creature.flags,flg)
|
||||||
|
end
|
||||||
|
end
|
@ -1,89 +0,0 @@
|
|||||||
adv_tools=adv_tools or {}
|
|
||||||
adv_tools.menu=adv_tools.menu or MakeMenu()
|
|
||||||
function adv_tools.ressurect()
|
|
||||||
myoff=offsets.getEx("AdvCreatureVec")
|
|
||||||
vector=engine.peek(myoff,ptr_vector)
|
|
||||||
indx=GetCreatureAtPos(getxyz())
|
|
||||||
if indx<0 then indx=0 end
|
|
||||||
--print(string.format("%x",vector:getval(indx)))
|
|
||||||
v2=engine.peek(vector:getval(indx),ptr_Creature.hurt1)
|
|
||||||
for i=0,v2:size()-1 do
|
|
||||||
v2:setval(i,0)
|
|
||||||
end
|
|
||||||
v2=engine.peek(vector:getval(indx),ptr_Creature.hurt2)
|
|
||||||
v2.type=DWORD
|
|
||||||
for i=0,v2:size()-1 do
|
|
||||||
v2:setval(i,0)
|
|
||||||
end
|
|
||||||
engine.poke(vector:getval(indx),ptr_Creature.bloodlvl,60000) --give blood
|
|
||||||
engine.poke(vector:getval(indx),ptr_Creature.bleedlvl,0) --stop some bleeding...
|
|
||||||
local flg=engine.peek(vector:getval(indx),ptr_Creature.flags)
|
|
||||||
flg:set(1,false) --ALIVE
|
|
||||||
flg:set(39,false) -- leave body yet again
|
|
||||||
flg:set(37,false) -- something todo with wounds- lets you walk again.
|
|
||||||
flg:set(58,true) -- makes them able to breathe
|
|
||||||
flg:set(61,true) -- gives them sight
|
|
||||||
engine.poke(vector:getval(indx),ptr_Creature.flags,flg)
|
|
||||||
end
|
|
||||||
|
|
||||||
function adv_tools.wagonmode() --by rumrusher
|
|
||||||
--first three lines same as before (because we will need an offset of creature at location x,y,z)
|
|
||||||
myoff=offsets.getEx("AdvCreatureVec")
|
|
||||||
vector=engine.peek(myoff,ptr_vector)
|
|
||||||
indx=GetCreatureAtPos(getxyz())
|
|
||||||
--indx=0
|
|
||||||
--print(string.format("%x",vector:getval(indx)))
|
|
||||||
flg=engine.peek(vector:getval(indx),ptr_Creature.flags) --get flags
|
|
||||||
flg:set(1,false)
|
|
||||||
flg:set(74,false)
|
|
||||||
engine.poke(vector:getval(indx),ptr_Creature.flags,flg)
|
|
||||||
print("To stay normal press y, else hit Enter turn Wagon mode on.")
|
|
||||||
r=io.stdin:read() -- repeat for it too work... also creature will be dead.
|
|
||||||
if r== "y" then
|
|
||||||
flg=engine.peek(vector:getval(indx),ptr_Creature.flags)
|
|
||||||
flg:set(1,false)
|
|
||||||
engine.poke(vector:getval(indx),ptr_Creature.flags,flg)
|
|
||||||
else
|
|
||||||
flg=engine.peek(vector:getval(indx),ptr_Creature.flags)
|
|
||||||
flg:set(1,false)
|
|
||||||
flg:flip(74)
|
|
||||||
engine.poke(vector:getval(indx),ptr_Creature.flags,flg)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
function selectall()
|
|
||||||
local retvec={} --return vector (or a list)
|
|
||||||
myoff=offsets.getEx("AdvCreatureVec")
|
|
||||||
vector=engine.peek(myoff,ptr_vector) --standart start
|
|
||||||
for i=0,vector:size()-1 do --check all creatures
|
|
||||||
local off
|
|
||||||
off=vector:getval(i)
|
|
||||||
local flags=engine.peek(off,ptr_Creature.flags)
|
|
||||||
if flags:get(1)==true then --if dead ...
|
|
||||||
table.insert(retvec,off)--... add it to return vector
|
|
||||||
end
|
|
||||||
end
|
|
||||||
return retvec --return the "return vector" :)
|
|
||||||
end
|
|
||||||
function adv_tools.hostilate()
|
|
||||||
vector=engine.peek(offsets.getEx("AdvCreatureVec"),ptr_vector)
|
|
||||||
id=GetCreatureAtPos(getxyz())
|
|
||||||
print(string.format("Vec:%d cr:%d",vector:size(),id))
|
|
||||||
off=vector:getval(id)
|
|
||||||
crciv=engine.peek(vector:getval(id),ptr_Creature.civ)
|
|
||||||
curciv=engine.peek(vector:getval(0),ptr_Creature.civ)
|
|
||||||
|
|
||||||
if curciv==crciv then
|
|
||||||
print("Friendly-making enemy")
|
|
||||||
engine.poke(off,ptr_Creature.civ,-1)
|
|
||||||
flg=engine.peek(off,ptr_Creature.flags)
|
|
||||||
flg:set(17,true)
|
|
||||||
engine.poke(off,ptr_Creature.flags,flg)
|
|
||||||
else
|
|
||||||
print("Enemy- making friendly")
|
|
||||||
engine.poke(off,ptr_Creature.civ,curciv)
|
|
||||||
flg=engine.peek(off,ptr_Creature.flags)
|
|
||||||
flg:set(17,false)
|
|
||||||
flg:set(19,false)
|
|
||||||
engine.poke(off,ptr_Creature.flags,flg)
|
|
||||||
end
|
|
||||||
end
|
|
@ -0,0 +1,45 @@
|
|||||||
|
function analyzeF(off)
|
||||||
|
pos=offsets.find(off,0x39,ANYBYTE,0x8c,00,00,00)
|
||||||
|
print(string.format("Compare at:%x",pos))
|
||||||
|
if pos ==0 then
|
||||||
|
return 0
|
||||||
|
end
|
||||||
|
if(pos-off>0x100) then
|
||||||
|
print(string.format("Distance to cmp:%x",pos-off))
|
||||||
|
pos =offsets.find(off,CALL)
|
||||||
|
print(string.format("Distance to call:%x",pos-off))
|
||||||
|
return 0
|
||||||
|
--return analyzeF(pos)
|
||||||
|
else
|
||||||
|
return pos
|
||||||
|
end
|
||||||
|
end
|
||||||
|
function minEx(...)
|
||||||
|
local imin=arg[1]
|
||||||
|
for _,v in ipairs(arg) do
|
||||||
|
if imin> v and v~=0 then
|
||||||
|
imin=v
|
||||||
|
end
|
||||||
|
end
|
||||||
|
return imin
|
||||||
|
end
|
||||||
|
function signDword(dw)
|
||||||
|
if(dw>0xFFFFFFFF) then
|
||||||
|
return dw-0xFFFFFFFF
|
||||||
|
end
|
||||||
|
return dw
|
||||||
|
end
|
||||||
|
--[[
|
||||||
|
Warning: not all mov's are acounted for. Found one: mov EAX,WORD PTR[EBP+1EF4] WTF??
|
||||||
|
Two more compares are missing. There are calls instead (same function)
|
||||||
|
]]--
|
||||||
|
|
||||||
|
friendship_in={}
|
||||||
|
dofile("dfusion/friendship/install.lua")
|
||||||
|
dofile("dfusion/friendship/patch.lua")
|
||||||
|
|
||||||
|
function friendship(names)
|
||||||
|
friendship_in.install(names)
|
||||||
|
friendship_in.patch()
|
||||||
|
end
|
||||||
|
|
@ -1,65 +1,19 @@
|
|||||||
--if(mypos~=0) then
|
|
||||||
--print("plugin already active")
|
|
||||||
--maybe set options for reinit?
|
|
||||||
--return
|
|
||||||
--end
|
|
||||||
|
|
||||||
function analyzeF(off)
|
|
||||||
pos=offsets.find(off,0x39,ANYBYTE,0x8c,00,00,00)
|
|
||||||
print(string.format("Compare at:%x",pos))
|
|
||||||
if pos ==0 then
|
|
||||||
return 0
|
|
||||||
end
|
|
||||||
if(pos-off>0x100) then
|
|
||||||
print(string.format("Distance to cmp:%x",pos-off))
|
|
||||||
pos =offsets.find(off,CALL)
|
|
||||||
print(string.format("Distance to call:%x",pos-off))
|
|
||||||
return 0
|
|
||||||
--return analyzeF(pos)
|
|
||||||
else
|
|
||||||
return pos
|
|
||||||
end
|
|
||||||
end
|
|
||||||
function minEx(...)
|
|
||||||
local imin=arg[1]
|
|
||||||
for _,v in ipairs(arg) do
|
|
||||||
if imin> v and v~=0 then
|
|
||||||
imin=v
|
|
||||||
end
|
|
||||||
end
|
|
||||||
return imin
|
|
||||||
end
|
|
||||||
function signDword(dw)
|
|
||||||
if(dw>0xFFFFFFFF) then
|
|
||||||
return dw-0xFFFFFFFF
|
|
||||||
end
|
|
||||||
return dw
|
|
||||||
end
|
|
||||||
--[[
|
|
||||||
Warning: not all mov's are acounted for. Found one: mov EAX,WORD PTR[EBP+1EF4] WTF??
|
|
||||||
Two more compares are missing. There are calls instead (same function)
|
|
||||||
]]--
|
|
||||||
if not(FILE) then
|
if not(FILE) then
|
||||||
--print("race num:"..engine.peekw(offsets.getEx("CurrentRace")))
|
--sanity test
|
||||||
--print(string.format("%x vs %x",offsets.getEx("CurrentRace"),VersionInfo.getGroup("Creatures"):getAddress("current_race")))
|
--print("race num:"..engine.peekw(offsets.getEx("CurrentRace")))
|
||||||
add_race=VersionInfo.getGroup("Creatures"):getAddress("current_race")
|
--print(string.format("%x vs %x",offsets.getEx("CurrentRace"),VersionInfo.getGroup("Creatures"):getAddress("current_race")))
|
||||||
print("Race num:"..engine.peekw(add_race))
|
add_race=VersionInfo.getGroup("Creatures"):getAddress("current_race")
|
||||||
print("Your current race is:"..GetRaceToken(engine.peekw(add_race)))
|
print("Race num:"..engine.peekw(add_race))
|
||||||
print("If this is wrong please type 'q'")
|
print("Your current race is:"..GetRaceToken(engine.peekw(add_race)))
|
||||||
if(io.stdin:read()=='q') then
|
print("If this is wrong please type 'q'")
|
||||||
return
|
if(io.stdin:read()=='q') then
|
||||||
end
|
return
|
||||||
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
friendship_in={}
|
|
||||||
dofile("dfusion/friendship/install.lua")
|
|
||||||
dofile("dfusion/friendship/patch.lua")
|
|
||||||
if not(FILE) then
|
if not(FILE) then
|
||||||
names=ParseNames("dfusion/friendship/races.txt")--io.open("plugins/friendship/races.txt"):lines()
|
names=ParseNames("dfusion/friendship/races.txt")--io.open("plugins/friendship/races.txt"):lines()
|
||||||
friendship_in.install(names)
|
friendship_in.install(names)
|
||||||
friendship_in.patch()
|
friendship_in.patch()
|
||||||
end
|
end
|
||||||
function friendship(names)
|
|
||||||
friendship_in.install(names)
|
|
||||||
friendship_in.patch()
|
|
||||||
end
|
|
||||||
|
|
Loading…
Reference in New Issue