displayGuilds = displayTitles...
Posted: Mon Dec 12, 2011 4:41 pm
Ok, so I wrote this a while back and forgot about it. I dunno if you can find a use for it but it's changed now. This function used to display the guildnames of players and NPCs around. Now it displays the titles of players.
I'm sure the new offset for guilds isn't too far off.
Code: Select all
local guild_ptr_offset = 0x298;
local function roundIt(_number)
if _number > (math.floor(_number) + 0.5) then
return math.ceil(_number);
else
return math.floor(_number);
end
end
local function fixString(_string,_length)
_string = _string:sub(1,_length);
xTra = _length-_string:len();
if xTra > 0 then
for i=1,xTra do
_string = _string .. " ";
end
end
return _string;
end
function displayGuilds()
local objectList = CObjectList();
objectList:update();
local objSize = objectList:size();
cprintf(cli.yellow,"X\tZ\tY\tNPC Name Guild Name Id Address\n")
cprintf(cli.yellow,"-\t-\t-\t-------- ---------- -- -------\n")
local lncolor,obj;
for i = 0,objSize do
obj = objectList:getObject(i);
obj.GuildName = memoryReadString(getProc(),memoryReadInt(getProc(), obj.Address + guild_ptr_offset))
if obj.Guildobj.GuildName ~= "" then
if (i == 0) or ((i / 2) == (math.floor(i/2))) then
_lncolor = cli.lightgray;
else
_lncolor = cli.white;
end
cprintf(_lncolor,"%d",roundIt(obj.X));
cprintf(_lncolor,"\t%d",roundIt(obj.Z));
cprintf(_lncolor,"\t%d",roundIt(obj.Y));
cprintf(_lncolor,"\t%s",fixString(obj.Name,24));
cprintf(_lncolor," %s",fixString(obj.GuildName,15));
cprintf(_lncolor," %s",fixString(tostring(obj.Id),7));
cprintf(_lncolor,"%x\n",obj.Address);
end
end
end