Register for your free account! | Forgot your password?

You last visited: Today at 04:41

  • Please register to post and access all features, it's quick, easy and FREE!

Advertisement



WQ bot for PWI

Discussion on WQ bot for PWI within the PW Hacks, Bots, Cheats, Exploits forum part of the Perfect World category.

Reply
 
Old 11/14/2012, 19:07   #346
 
elite*gold: 0
Join Date: Oct 2010
Posts: 555
Received Thanks: 163
seems that they changed at PWI now the WQ. They have new NPCs and I can not find the WQ in the Quest list anymore Instead of this is now the WQ item in the quest item listed and there is written whats the next NPC.

NPC 31 .... at 629, 243
NPC 32 .... landing possible at 648, 111
NPC 33 .... landing possible at 670, 175
NPC 34 .... landing possible at 115, 257
NPC 35 .... landing possible at 147, 247
NPC 36 .... landing possible at 172, 261
NPC 37 .... landing possible at 234, 231

From NPC 32 to 34 it is currently not possible to fly via auto pilot as the direct line go over the corner with no land.

lvl 70+ get 226 000 exp
lvl 90+ get 678 000 exp. the random reward like 5 rep, 10 k coins, 1 mirage seems to be the same
martmor is offline  
Old 11/14/2012, 23:40   #347
 
elite*gold: 0
Join Date: Apr 2010
Posts: 99
Received Thanks: 136
Here are my offsets. Can't get the bot to work. The "reset after flying up" doesn't work anymore. No clue why, maybe one of the offsets is wrong or they changed the fly function. Someone knows?
Attached Files
File Type: txt WQing.txt (613 Bytes, 79 views)
msxgames is offline  
Thanks
4 Users
Old 11/15/2012, 00:29   #348
 
elite*gold: 0
Join Date: Oct 2010
Posts: 555
Received Thanks: 163
Thank you very much for the offsets. It work good. Not perfect, but good.

now are some NPCs missing at the Bot . They added 7 NPCs and every char must fly to 4 of the 7 additional NPCs.

I wrote already the addresses. But the reward is more as the double then before.

So PW changed something at the WQ
martmor is offline  
Thanks
1 User
Old 11/16/2012, 17:25   #349
 
elite*gold: 0
Join Date: Oct 2010
Posts: 555
Received Thanks: 163
I have here some questions...

I try to add the new NPCs to the WQ.

But I have problems with the Coordinates.

As example:

NPC 32

Emerald Moon at World: 648 111 (22) PW Database ID: 26161

Interest07 wrote already the coordinates to his database that he uploaded (thank you very much)

There is written:

26161 world 2484.93 217.74 -4391.85

But these coordinates are completly different to others at the source code. Example:
PWDAtabase ID: 6639
World: 431 737 (22) Merchant Chen
from interest07 download file:
6639 world 310.56 221.01 1869.16

in the source:
xCoord8359 := 1134178481
yCoord8359 := 1130168939
zCoord8359 := 1156163994

Why is this difference?
martmor is offline  
Thanks
1 User
Old 11/16/2012, 18:19   #350
 
AlainProvist's Avatar
 
elite*gold: 0
Join Date: Aug 2012
Posts: 381
Received Thanks: 562
The source code use unsigned integer values as floating point coordinates (the ones from Interest07's database). All your have to do is getting the hexadecimal conversion of the floating point value in the database, ans then convert the hex value to decimal and your have the value to put in the source code.

If you ask yourself why the floating point values from Interest07's DB is not the X Y (alt) you can get in game, I fear I have no clue right now. But anyway what I told you above should be sufficient to upgrade the source with new npcs .


edit : useful link for hex2float float2hex conversion :
AlainProvist is offline  
Thanks
1 User
Old 11/16/2012, 20:20   #351
 
elite*gold: 0
Join Date: Oct 2010
Posts: 555
Received Thanks: 163
Hi, thank you for your fast response. Yes I read something about floating points the last days here in the forum from Interest07 but searched not enough for it as it seems.

Your answer was very helpful. Thank you very much. I hope I have soon time to try it. Thank you and nice weekend

Edit:

OK, I had now time to test it and I think I got it now xD

Interest07 Database:

12974 world 1332.28 219.61 956.61

(Example for everybody who want to know it too and is as me old man a little bit slow in programming) The 1332.28 you convert here: from float Value to Hex Value and then here from Hex Value to Dec Value.

And this is what Interest07 used at his bot.

The question that I have now is, how did Interest07 got the coordinates like:

1332.28 219.61 956.61

Interest07 wrote here:

Quote:
The id listed here in indeed a 'typeId' of sorts (although every NPC is a seperate 'type'). It is located in memory right next to the unique id (0x8010XXXX) you are referring to.
But I think I do not understand this. How to get these coordinates?
martmor is offline  
Old 11/17/2012, 19:10   #352
 
AlainProvist's Avatar
 
elite*gold: 0
Join Date: Aug 2012
Posts: 381
Received Thanks: 562
From what I can deduce of the 2 examples of npc coord you gave it seems that :

X value is X coordinate in the game
Y value is the altitude in the game
Z value is the Y coordinate in the game

There is a 10x factor between the DB value and the in game coord and a position offset that seems to be 400, 550 (0) in the game ref.
This point has the coord 0,0,0 in the DB.

So basically if you want to convert a game coord to the DB value used in the programm, you will have to do :
Xdb = (Xgame - 400)*10
Ydb = ALTgame*10
Zdb = (Ygame - 550)*10

This formula works with the 2 coords' npcs you gave previously and it should work with all coordinates.

I hope this will help you.

In another hand I saw the flyup function doesn't work anymore (seemed buggy anyway). I will try to fix.
Do not hesitate to post here your advancements .


edit : I made the formula from observations of the values but I suppose Interest07 just picked the values from the memory.
AlainProvist is offline  
Thanks
1 User
Old 11/18/2012, 13:01   #353
 
elite*gold: 0
Join Date: Oct 2010
Posts: 555
Received Thanks: 163
Dear AlainProvist

Thank you very much for your helpful response.

I tried now the first time since the update the "old" WQ Bot 2.9 (thank you very much) with the new offsets from MSXGames (thank you very much).

As you wrote correct, there is since the last expansion a problem that the bot fly up at the begin. With this problem the bot worked at the one char till NPC 20 or 22. Then he stucked the first time.

But I try now to get the new coordinates for the 7 added NPCs to the WQ and write them here. Next week I try to add them into the source code of WQ Bot.


NPC 31 .... at 628, 242 (25)
PWDatabase 24963 Laid-back Old Man

24963 world 2280 250 -3080

Hex: 0x450e8000 - 0x437a0000 - 0xc5408000

That are the following coordinates for the Bot:

Dec: 1158578176 - 1132068864 - 3309338624

NPC 32 .... landing possible at 648, 111 (21) Emerald Moon PWDB ID: 26161

2480 210 -3890

0x451b0000 - 0x45034000 - 0xc5732000

1159397376 - 1157840896 - 3312656384

NPC 33 .... landing possible at 670, 175 (24) Guard Autumnland 24982

2700 240 -3750

0x4528c000 - 0x43700000 - 0xc56a6000

1160298496 - 1131413504 - 3312082944

NPC 34 .... landing possible at 115, 257 (20) Valiant Avatar 29056

-2850 200 -2930

0xc5322000 - 0x43480000 - 0xc5372000

3308396544 - 1128792064 - 3308724224

NPC 35 .... landing possible at 147, 247 (13) Merchant Fritz ID: 29101

-2530 130 -3030

0xc51e2000 - 0x43020000 - 0xc53d6000

3307085824 - 1124204544 - 3309133824

NPC 36 .... landing possible at 172, 261 (21) Feong Yong 29011

-2280 210 -2890

0xc50e8000 - 0x43520000 - 0xc534a000

3306061824 - 1129447424 - 3308560384

NPC 37 .... landing possible at 234, 231 (22) Ancestral Guardian Shawn 30033

-1660 220 -3190

0xc4cf8000 - 0x435c0000 - 0xc5476000

3301933056 - 1130102784 - 3309789184

OK, that are all coordinates

But to change the source code that the bot works well, I think I am to much noob. There is the problem that he do not fly up and then must be added another "else if" into the bot. An Elseif that if the WQ go from point 32 to 34 that he fly over an other point (example) 481, 207 (22 if bot must land) (no mobs and NPC can attack there) on the map as there is no direct fly between these two points possible.


Edit / Update:

Hello

I changed now the source code. At first: I did not tried it until now I have problems to compile it lol. he write an mistake in line 41 but there I did not changed anything. Question: which compiler is the best for ahk source code? VS 2008 and AutoIT Debugger seems that they not work


Code:
; <COMPILER: v1.0.90.0>
#Persistent
#SingleInstance
DetectHiddenWindows, On
SetKeyDelay,,50



IniRead, logActivities		, WQing.ini, main,logActivities

IniRead, realBaseAddress		, WQing.ini, offsets,realBaseAddress
IniRead, baseOffset			, WQing.ini, offsets,baseOffset
IniRead, playerOffSet			, WQing.ini, offsets,playerOffSet
IniRead, playerNameOffset		, WQing.ini, offsets,playerNameOffset
IniRead, nameLengthOffset		, WQing.ini, offsets,nameLengthOffset
IniRead, playerTargetIdOffset		, WQing.ini, offsets,playerTargetIdOffset
IniRead, playerActionStructOffset	, WQing.ini, offsets,playerActionStructOffset
IniRead, playerCounterOffset		, WQing.ini, offsets,playerCounterOffset
IniRead, playerIntervalOffset		, WQing.ini, offsets,playerIntervalOffset
IniRead, playerFlyMountOffset		, WQing.ini, offsets,playerFlyMountOffset
IniRead, playerFlySpdOffset		, WQing.ini, offsets,playerFlySpdOffset
IniRead, playerTransportModeOffset	, WQing.ini, offsets,playerTransportModeOffset
IniRead, playerXposOffset		, WQing.ini, offsets,playerXposOffset
IniRead, playerYposOffset		, WQing.ini, offsets,playerYposOffset
IniRead, playerZposOffset		, WQing.ini, offsets,playerZposOffset
IniRead, SendPacketAddress		, WQing.ini, offsets,SendPacketAddress
IniRead, questFunctionAddress		, WQing.ini, offsets,questFunctionAddress
IniRead, questFunctionOffset		, WQing.ini, offsets,questFunctionOffset
IniRead, npcIdOffset			, WQing.ini, offsets,npcIdOffset
IniRead, sortedNpcListOffset		, WQing.ini, offsets,sortedNpcListOffset
IniRead, baseListsOffset		, WQing.ini, offsets,baseListsOffset
IniRead, npcListOffset			, WQing.ini, offsets,npcListOffset





npcId8348	:=	4436
npcId8349	:=	2288
npcId8350	:=	3125
npcId8351	:=	6623
npcId8352	:=	3417
npcId8353	:=	3273
npcId8354	:=	3820
npcId8355	:=	9305
npcId8356	:=	3721
npcId8357	:=	3852
npcId8358	:=	2584
npcId8359	:=	6639
npcId8360	:=	3732
npcId8361	:=	4066
npcId8362	:=	4164
npcId8363	:=	3958
npcId8364	:=	3948
npcId8365	:=	3963
npcId8366	:=	3950
npcId8367	:=	7198
npcId8368	:=	7476
npcId8369	:=	7189
npcId8370	:=	7156
npcId8371	:=	7193
npcId8372	:=	9294
npcId8373	:=	7146
npcId8374	:=	7126
npcId8375	:=	7155
npcId8376	:=	7149
npcId8377	:=	7367
npcId8378	:=	14090
npcId8379	:=	14090
npcId8380	:=	14090
npcId8381	:=	14090
npcId8382	:=	14090
npcId8383	:=	14090
npcId8384	:=	14090
npcId8385	:=	14090
npcId8386	:=	14090
npcId8387	:=	14090
npcId8388	:=	14090
npcId8389	:=	14090
npcId8390	:=	14090
npcId8391	:=	14090
npcId8392	:=	14090
npcId8393	:=	14090
npcId8394	:=	14090
npcId8395	:=	14090
npcId8396	:=	2222
npcId8397	:=	14090
npcId8398	:=	12974
npcId8399	:=	24963 ; NPC31
npcId8400	:=	26161 ; NPC32
npcId8401	:=	24982 ; NPC33
npcId8402	:=	29056 ; NPC34
npcId8403	:=	29101 ; NPC35
npcId8404	:=	29011 ; NPC36
npcId8405	:=	30033 ; NPC37



xCoord8348	:=	1150922672
xCoord8349	:=	3302385319
xCoord8350	:=	1148557837
xCoord8351	:=	3303292969
xCoord8352	:=	1142127397
xCoord8353	:=	1156113401
xCoord8354	:=	1156110694
xCoord8355	:=	1155705131
xCoord8356	:=	1158297134
xCoord8357	:=	1159710894
xCoord8358	:=	1160108504
xCoord8359	:=	1134178481
xCoord8360	:=	3285809922
xCoord8361	:=	3290771596
xCoord8362	:=	3308040683
xCoord8363	:=	3307254531
xCoord8364	:=	3297816607
xCoord8365	:=	1135247292
xCoord8366	:=	1143076818
xCoord8367	:=	1160136679
xCoord8368	:=	1160190578
xCoord8369	:=	1152945684
xCoord8370	:=	1153034387
xCoord8371	:=	1152265176
xCoord8372	:=	1159054997
xCoord8373	:=	1159086744
xCoord8374	:=	1159662514
xCoord8375	:=	1160067557
xCoord8376	:=	1159191720
xCoord8377	:=	3305664239
xCoord8378	:=	1151616945
xCoord8379	:=	1151616945
xCoord8380	:=	1151616945
xCoord8381	:=	1151616945
xCoord8382	:=	1151616945
xCoord8383	:=	1151616945
xCoord8384	:=	1151616945
xCoord8385	:=	1151616945
xCoord8386	:=	1151616945
xCoord8387	:=	1151616945
xCoord8388	:=	1151616945
xCoord8389	:=	1151616945
xCoord8390	:=	1151616945
xCoord8391	:=	1151616945
xCoord8392	:=	1151616945
xCoord8393	:=	1151616945
xCoord8394	:=	1151616945
xCoord8395	:=	1151616945
xCoord8396	:=	1154882031
xCoord8397	:=	1151616945
xCoord8398	:=	1151749044
xCoord8399	:=	1158578176 
xCoord8400	:=	1159397376 
xCoord8401	:=	1160298496 
xCoord8402	:=	3308396544 
xCoord8403	:=	3307085824 
xCoord8404	:=	3306061824 
xCoord8405	:=	3301933056 

yCoord8348	:=	1130077739
yCoord8349	:=	1130079036
yCoord8350	:=	1130021976
yCoord8351	:=	1141044657
yCoord8352	:=	1130042464
yCoord8353	:=	1131590663
yCoord8354	:=	1131336105
yCoord8355	:=	1130076569
yCoord8356	:=	1130234513
yCoord8357	:=	1130031613
yCoord8358	:=	1132208056
yCoord8359	:=	1130168939
yCoord8360	:=	1134634916
yCoord8361	:=	1130096160
yCoord8362	:=	1141030586
yCoord8363	:=	1140993714
yCoord8364	:=	1141067583
yCoord8365	:=	1130090536
yCoord8366	:=	1132295168
yCoord8367	:=	1130628796
yCoord8368	:=	1130627738
yCoord8369	:=	1130689735
yCoord8370	:=	1130518019
yCoord8371	:=	1130027594
yCoord8372	:=	1130154748
yCoord8373	:=	1130073206
yCoord8374	:=	1130614368
yCoord8375	:=	1130092715
yCoord8376	:=	1130117314
yCoord8377	:=	1130496656
yCoord8378	:=	1130077739
yCoord8379	:=	1130077739
yCoord8380	:=	1130077739
yCoord8381	:=	1130077739
yCoord8382	:=	1130077739
yCoord8383	:=	1130077739
yCoord8384	:=	1130077739
yCoord8385	:=	1130077739
yCoord8386	:=	1130077739
yCoord8387	:=	1130077739
yCoord8388	:=	1130077739
yCoord8389	:=	1130077739
yCoord8390	:=	1130077739
yCoord8391	:=	1130077739
yCoord8392	:=	1130077739
yCoord8393	:=	1130077739
yCoord8394	:=	1130077739
yCoord8395	:=	1130077739
yCoord8396	:=	1130136969
yCoord8397	:=	1130077739
yCoord8398	:=	1130077739
yCoord8399	:=	1132068864 
yCoord8400	:=	1157840896 
yCoord8401	:=	1131413504 
yCoord8402	:=	1128792064 
yCoord8403	:=	1124204544 
yCoord8404	:=	1129447424 
yCoord8405	:=	1130102784 

zCoord8348	:=	1148590119
zCoord8349	:=	1115520494
zCoord8350	:=	1166235043
zCoord8351	:=	3298807030
zCoord8352	:=	1138268421
zCoord8353	:=	1125415571
zCoord8354	:=	1126821456
zCoord8355	:=	1151963447
zCoord8356	:=	1155092500
zCoord8357	:=	1161783713
zCoord8358	:=	1166197254
zCoord8359	:=	1156163994
zCoord8360	:=	1158984367
zCoord8361	:=	1160585847
zCoord8362	:=	1137289047
zCoord8363	:=	1147499808
zCoord8364	:=	1126624420
zCoord8365	:=	3294985570
zCoord8366	:=	3305352074
zCoord8367	:=	3303123588
zCoord8368	:=	3302758014
zCoord8369	:=	3302842554
zCoord8370	:=	3302573762
zCoord8371	:=	3299372414
zCoord8372	:=	3292082340
zCoord8373	:=	1125247490
zCoord8374	:=	1058505046
zCoord8375	:=	1142385946
zCoord8376	:=	1143040737
zCoord8377	:=	1162223519
zCoord8378	:=	1147533066
zCoord8379	:=	1147533066
zCoord8380	:=	1147533066
zCoord8381	:=	1147533066
zCoord8382	:=	1147533066
zCoord8383	:=	1147533066
zCoord8384	:=	1147533066
zCoord8385	:=	1147533066
zCoord8386	:=	1147533066
zCoord8387	:=	1147533066
zCoord8388	:=	1147533066
zCoord8389	:=	1147533066
zCoord8390	:=	1147533066
zCoord8391	:=	1147533066
zCoord8392	:=	1147533066
zCoord8393	:=	1147533066
zCoord8394	:=	1147533066
zCoord8395	:=	1147533066
zCoord8396	:=	1148540945
zCoord8397	:=	1147533066
zCoord8398	:=	1148064643
zCoord8399	:=	3309338624
zCoord8400	:=	3312656384
zCoord8401	:=	3312082944
zCoord8402	:=	3308724224
zCoord8403	:=	3309133824
zCoord8404	:=	3308560384
zCoord8405	:=	3309789184


ActiveList =
InActiveList =
ActiveNitems := 0
InActiveNitems := 0

createGui()

	settimer, mainloop, 500

return


GuiClose:
ExitApp

showStats:
Gui Submit, nohide

selectedPlayer := Active

loop %nPWs%
{
	tempId := PWlist%A_Index%
	if(playername%tempid% = selectedPlayer)
	{
		tempPlayer := tempid

		break
	}
}
StringSplit, statusParam, PWstatus%tempPlayer%, `,
questInfo := getQuestInfo(nextQuest%tempPlayer%)
currentStatus := statusParam1 . " [" . questInfo . "]"
GuiControl,, StatusText, %currentStatus%

return

Button>>:
gui submit, nohide
item = %InActive%
if(item <> "")
{
	removeItem("inactive", item)
	addItem("active", item)
	loop %nPWs%
	{
		tempId := PWlist%A_Index%
		if(playername%tempid% = item)
		{
			tempPlayer := tempid
			logthis("selected player: " . tempPlayer, "main")

			break
		}
	}
	PWstatus%tempPlayer% := "Idle"
}
return

Button<<:
gui submit, nohide
item = %Active%
if(item <> "")
{
	removeItem("active", item)
	addItem("inactive", item)
	loop %nPWs%
	{
		tempId := PWlist%A_Index%
		if(playername%tempid% = item)
		{
			tempPlayer := tempid
			logthis("selected player: " . tempPlayer, "main")

			break
		}
	}
	PWstatus%tempPlayer% := "Idle"
}
return

addItem(listBox, item)
{
	%listBox%List := %listBox%List . "`n" . item
	Sort, %listBox%List, U D`n
	if errorlevel = 0
		%listBox%Nitems := %listBox%Nitems + 1
	theList := %listBox%List
	GuiControl,, %listBox%, %theList%

}

removeItem(listBox, item)
{
	StringReplace, theList, %listBox%List, `n%item%
	%listBox%List := theList
	GuiControl,, %listBox%, %theList%
	%listBox%Nitems := %listBox%Nitems - 1
	if(%listBox%Nitems < 1)
	{
		createGui()

	}
}

createGui()
{
	global

	Gui, Destroy
	Gui +Delimiter`n
	Gui, Add, ListBox, vInActive x16 y44 w100 h147 %InActiveList%
	Gui, Add, Button, x126 y84 w50 h30 , >>
	Gui, Add, Button, x126 y124 w50 h30 , <<
	Gui, Add, ListBox, vActive gShowStats x186 y44 w110 h147 %ActiveList%
	Gui, Add, Text, x16 y14 w100 h20 , Inactive
	Gui, Add, Text, x186 y14 w110 h20 , Doing WQ
	Gui, Add, Text, vStatusText x316 y44 w130 h150 , Stats
	Gui, Show, x131 y91 h215 w464, Auto WQ
}


mainLoop:




WinGet, winList ,List
PWlist =
nPWs = 0
loop %winList%
{

	windId := winList%A_Index%

	WinGet, processName ,processName , ahk_id %windId%
	if(processName = "elementclient.exe")
	{

		Winget, pId, PID, ahk_id %windId%

		theId = ahk_pid %pid%
		playerName := getPlayerName(theId)
		if(playerName <> "")
		{
			playerName%pId% = %playername%
			playername = %pId%
			nPWs := nPWs + 1
			PWlist%nPWs% = %playerName%
			PWidList%playerName% = %theId%
		}
	}
}





addNewPlayers()

removeNonPresentPlayers()

StringSplit, activeArray, ActiveList, `n

loop %activeArray0%
{
	if(A_index > 1)
	{
		index := A_index
		playerName := activeArray%index%
		tolog = updating status: %playername%
		logThis(toLog, "main")
		loop %nPWs%
		{
			pwId := PWlist%A_Index%
			if(playername%pwid% = playername)
			{
				playername := pwid
				break
			}
		}
		updateStatus(playerName)
		Gui Submit, nohide
		selectedPlayer := Active
		loop %nPWs%
		{
			pwId := PWlist%A_Index%
			if(playername%pwid% = selectedPlayer)
			{
				selectedPlayer := pwid
				break
			}
		}
		StringSplit, statusParam, PWstatus%selectedPlayer%, `,

		questInfo := getQuestInfo(nextQuest%selectedPlayer%)
		currentStatus := statusParam1 . " [" . questInfo . "]"
		GuiControl,, StatusText, %currentStatus%



	}
}


return

getQuestInfo(questId)
{

	local returnValue := ""
	if(questId = 8348)
	{
	returnValue = Volume 1
	}
	else if(questId = 8349)
	{
	returnValue = Volume 2
	}
	else if(questId = 8350)
	{
	returnValue = Volume 3
	}
	else if(questId = 8351)
	{
	returnValue = Volume 4
	}
	else if(questId = 8352)
	{
	returnValue = Volume 5
	}
	else if(questId = 8353)
	{
	returnValue = Volume 6
	}
	else if(questId = 8354)
	{
	returnValue = Volume 7
	}
	else if(questId = 8355)
	{
	returnValue = Volume 8
	}
	else if(questId = 8356)
	{
	returnValue = Volume 9
	}
	else if(questId = 8357)
	{
	returnValue = Volume 10
	}
	else if(questId = 8358)
	{
	returnValue = Volume 11
	}
	else if(questId = 8359)
	{
	returnValue = Volume 12
	}
	else if(questId = 8360)
	{
	returnValue = Volume 13
	}
	else if(questId = 8361)
	{
	returnValue = Volume 14
	}
	else if(questId = 8362)
	{
	returnValue = Volume 15
	}
	else if(questId = 8363)
	{
	returnValue = Volume 16
	}
	else if(questId = 8364)
	{
	returnValue = Volume 17
	}
	else if(questId = 8365)
	{
	returnValue = Volume 18
	}
	else if(questId = 8366)
	{
	returnValue = Volume 19
	}
	else if(questId = 8367)
	{
	returnValue = Volume 20
	}
	else if(questId = 8368)
	{
	returnValue = Volume 21
	}
	else if(questId = 8369)
	{
	returnValue = Volume 22
	}
	else if(questId = 8370)
	{
	returnValue = Volume 23
	}
	else if(questId = 8371)
	{
	returnValue = Volume 24
	}
	else if(questId = 8372)
	{
	returnValue = Volume 25
	}
	else if(questId = 8373)
	{
	returnValue = Volume 26
	}
	else if(questId = 8374)
	{
	returnValue = Volume 27
	}
	else if(questId = 8375)
	{
	returnValue = Volume 28
	}
	else if(questId = 8376)
	{
	returnValue = Volume 29
	}
	else if(questId = 8377)
	{
	returnValue = Volume 30
	}
	else if(questId = 8378)
	{
	returnValue = No Bonus
	}
	else if(questId = 8379)
	{
	returnValue = Exp Bonus
	}
	else if(questId = 8380)
	{
	returnValue = SP Bonus
	}
	else if(questId = 8381)
	{
	returnValue = Reputation
	}
	else if(questId = 8382)
	{
	returnValue = Gold Bonus
	}
	else if(questId = 8383)
	{
	returnValue = Mirage
	}
	else if(questId = 8384)
	{
	returnValue = No Bonus
	}
	else if(questId = 8385)
	{
	returnValue = Exp Bonus
	}
	else if(questId = 8386)
	{
	returnValue = SP Bonus
	}
	else if(questId = 8387)
	{
	returnValue = Reputation
	}
	else if(questId = 8388)
	{
	returnValue = Gold Bonus
	}
	else if(questId = 8389)
	{
	returnValue = Mirage
	}
	else if(questId = 8390)
	{
	returnValue = No Bonus
	}
	else if(questId = 8391)
	{
	returnValue = Exp Bonus
	}
	else if(questId = 8392)
	{
	returnValue = SP Bonus
	}
	else if(questId = 8393)
	{
	returnValue = Reputation
	}
	else if(questId = 8394)
	{
	returnValue = Gold Bonus
	}
	else if(questId = 8395)
	{
	returnValue = Mirage
	}
	else if(questId = 8396)
	{
	returnValue = Elder
	}
	else if(questId = 8397)
	{
	returnValue = Armerigo
	}
	else if(questId = 8398)
	{
	returnValue = Penney
	}
	else if(questId = 8399)
	{
	returnValue = Volume 31
	}
	else if(questId = 8400)
	{
	returnValue = Volume 32
	}
	else if(questId = 8401)
	{
	returnValue = Volume 33
	}
	else if(questId = 8402)
	{
	returnValue = Volume 34
	}
	else if(questId = 8403)
	{
	returnValue = Volume 35
	}
	else if(questId = 8404)
	{
	returnValue = Volume 36
	}
	else if(questId = 8405)
	{
	returnValue = Volume 37
	}
	return returnValue
}



getPlayerName(theId)
{
	global

	local baseAddress := ReadMemory(realBaseAddress, theId)
	local structurePointer := ReadMemory(baseAddress + baseOffset, theId)
	local playerPointer := ReadMemory(structurePointer + playerOffset, theId)
	local playerNamePointer := ReadMemory(playerPointer + playerNameOffset, theId)

	local playerNameLength := ReadMemory(playerNamePointer + nameLengthOffset, theId)

	local playerName := ""
	local tempOffset := 0xFFFFFFFD

	loop %playerNameLength%
	{
		tempOffset := tempOffset + 0x2
		local character := ReadMemory(playerNamePointer + tempOffset,theId, 2)

		SetFormat, IntegerFast, hex
		character += 0
		character .= ""
		SetFormat, IntegerFast, d

		playerName := playerName Hex2txt(character)
	}

	return playerName
}

getNextQuest(theId)
{
	global

	local returnValue := 0
	local questId := 8348
	loop 58 ; old 51 added 7x loop
	{
		value := checkQuestPresent(questId, theId)
		if(value = 0)
		{
			returnValue := questId
			break
		}
		questId := questId + 1
	}

	return returnValue
}

npcIsClose(questId, theId)
{

	global

	local baseAddress := ReadMemory(realBaseAddress, theId)
	local structurePointer := ReadMemory(baseAddress + baseOffset, theId)
	local playerPointer := ReadMemory(structurePointer + playerOffset, theId)

	SetFormat, IntegerFast, hex

	local xCoord := ReadMemory(playerPointer + playerXposOffset, theId)
	local yCoord := ReadMemory(playerPointer + playerYposOffset, theId)
	local zCoord := ReadMemory(playerPointer + playerZposOffset, theId)

	local npcX := xCoord%questId%
	local npcY := yCoord%questId%
	local npcZ := zCoord%questId%

	SetFormat, IntegerFast, d

	local dX := hextofloat(xcoord) - hextofloat(npcx)
	local dY := hextofloat(ycoord) - hextofloat(npcy)
	local dZ := hextofloat(zcoord) - hextofloat(npcz)

	distance := sqrt(dX * dX + dY * dY + dZ * dZ)


	if(distance < 5)
	{
		return 1
	}
	else
	{
		return 0
	}

}

handleNpc(questId, theId)
{
	global

	SetFormat, IntegerFast, hex



	npcTypeId := npcId%questId%



	local baseAddress := ReadMemory(realBaseAddress, theId)
	local structurePointer := ReadMemory(baseAddress + baseOffset, theId)
	local baseListsPointer := ReadMemory(structurePointer + baseListsOffset, theId)
	local npcListPointer := ReadMemory(baseListsPointer + npcListOffset, theId)
	local sortedNpcList := ReadMemory(npcListPointer + sortedNpcListOffset, theId)
	local npcCount  := ReadMemory(npcListPointer + 0x14, theId)

	local i := 0x0

	loop %npcCount%
	{
		local npcPointer := ReadMemory(sortedNpcList + i,theId)
		local npcType := ReadMemory(npcPointer + npcIdOffset + 0x4,theId)
		local npcId := ReadMemory(npcPointer + npcIdOffset,theId)
		if(npcType = npcTypeId)
		{
			break
		}


		i := i + 0x4
	}


	revHex(revNpcId, npcId)
	packet := ""
	packet = %packet%0200%revNpcId%
	packetSize := 0x6
	packetSizeStr := "06"
	sendPacket(packet, packetSizeStr, packetsize, theId)

	local baseAddress := ReadMemory(realBaseAddress, theId)
	local structurePointer := ReadMemory(baseAddress + baseOffset, theId)
	local playerPointer := ReadMemory(structurePointer + playerOffset, theId)


	loop
	{
		local targetId := ReadMemory(playerPointer + playerTargetIdOffset, theId)
		if(targetId = npcId)
		{
			break
		}
		sleep 100
	}



	packet := ""
	packet = %packet%2300%revNpcId%
	packetSize := 0x6
	packetSizeStr := "06"
	sendPacket(packet, packetSizeStr, packetsize, theId)

	sleep 100



	revHex(revQuestId, questId)
	packet := ""
	packet = %packet%2500070000000C000000%revQuestId%0000000000000000
	packetSize := 0x16
	packetSizeStr := "16"
	sendPacket(packet, packetSizeStr, packetsize, theId)

	sleep 3000

}

getMoveMethod(questId, theId)
{
	global

	local x := xCoord%questId%
	local y := yCoord%questId%
	local z := zCoord%questId%
	local baseAddress := ReadMemory(realBaseAddress, theId)
	local structurePointer := ReadMemory(baseAddress + baseOffset, theId)
	local playerPointer := ReadMemory(structurePointer + playerOffset, theId)

	SetFormat, IntegerFast, hex

	local xCoord := ReadMemory(playerPointer + playerXposOffset, theId)
	local yCoord := ReadMemory(playerPointer + playerYposOffset, theId)
	local zCoord := ReadMemory(playerPointer + playerZposOffset, theId)


	SetFormat, IntegerFast, d

	local dX := hextofloat(xcoord) - hextofloat(x)
	local dY := hextofloat(ycoord) - hextofloat(y)
	local dZ := hextofloat(zcoord) - hextofloat(z)

	local distance := sqrt(dX * dX + dZ * dZ)
	local returnValue =
	if(distance < 5)
	{
		returnValue = Falling
	}
	else
	{
		local height := 77.0

		local nTimesUp := 20

		returnValue = FlyUp@%nTimesUp%@SetFlyTo@%x%@%y%@%z%@%height%@Flying@Falling
	}

	return returnValue




}


flymodeActive(theId)
{
	global

	local baseAddress := ReadMemory(realBaseAddress, theId)
	local structurePointer := ReadMemory(baseAddress + baseOffset, theId)
	local playerPointer := ReadMemory(structurePointer + playerOffset, theId)
	local transportMode := ReadMemory(playerPointer + playerTransportModeOffset, theId)

	if(transportMode = 2)
	{
		return 1
	}
	else
	{
		return 0
	}
}


toggleFlying(theId)
{
	global
	local baseAddress := ReadMemory(realBaseAddress, theId)
	local structurePointer := ReadMemory(baseAddress + baseOffset, theId)
	local playerPointer := ReadMemory(structurePointer + playerOffset, theId)
	local flyMountId := ReadMemory(playerPointer + playerFlyMountOffset, theId)

	revHex(revFlyMountId, flyMountId)
	packet := ""
	packet = 280001010C00%revFlyMountId%
	packetSize := 0xA
	packetSizeStr := "0A"
	sendPacket(packet, packetSizeStr, packetsize, theId)
	sleep 2000
}





setFlyTo(theId, xCoord, yCoord, zCoord, height)
{
	global
	local baseAddress := ReadMemory(realBaseAddress, theId)
	local structurePointer := ReadMemory(baseAddress + baseOffset, theId)
	local playerPointer := ReadMemory(structurePointer + playerOffset, theId)
	local actionStruct := ReadMemory(playerPointer + playerActionStructOffset, theId)

	MoveTo(Xcoord, Ycoord, Zcoord, 0, theId, actionStruct, height)
}


getCurrentCoords(theId)
{
	global
	local baseAddress := ReadMemory(realBaseAddress, theId)
	local structurePointer := ReadMemory(baseAddress + baseOffset, theId)
	local playerPointer := ReadMemory(structurePointer + playerOffset, theId)

	local xCoord := ReadMemory(playerPointer + playerXposOffset, theId)
	local yCoord := ReadMemory(playerPointer + playerYposOffset, theId)
	local zCoord := ReadMemory(playerPointer + playerZposOffset, theId)

	local returnValue = %xCoord%@%yCoord%@%zCoord%

	return returnValue

}

isIdle(theId)
{
	global
	local baseAddress := ReadMemory(realBaseAddress, theId)
	local structurePointer := ReadMemory(baseAddress + baseOffset, theId)
	local playerPointer := ReadMemory(structurePointer + playerOffset, theId)
	local actionStruct := ReadMemory(playerPointer + playerActionStructOffset, theId)
	local moving := ReadMemory(actionstruct+0x18,theId)

	if(moving = 0)
	{
		return 1
	}
	else
	{
		return 0
	}




}



updateStatus(name)
{
	global
	nextQuest := nextQuest%Name%
	clientId := PWidList%Name%
	StringSplit, statusParam, PWstatus%Name%, `,
	currentStatus := statusParam1
		tolog = updating status: status: %currentStatus%, quest: %nextQuest%
		logThis(toLog, name)
	if(currentStatus = "Idle")
	{
		tolog = currentStatus is Idle
		logThis(toLog, name)

		nextQuest := getNextQuest(clientId)
		nextQuest%Name% := nextQuest
		if(nextQuest = 0)
		{

			tolog = No new quest found, staying Idle
			logThis(toLog, Name)
		}
		else
		{
			if(NpcIsClose(nextQuest, clientId) = 1)
			{
				tolog = Npc is close for quest: %nextQuest%
				logThis(toLog, Name)
				handleNpc(nextQuest, clientId)
				tolog = Handled npc for quest %nextQuest%
				logThis(toLog, Name)

			}
			else
			{
				moveMethod := getMoveMethod(nextQuest, clientId)
				PWstatus%Name% = Moving,%moveMethod%
				tolog = Npc is not close: status: Moving,%moveMethod%
				logThis(toLog, Name)
			}
		}
	}
	else if(currentStatus = "Moving")
	{

		moveMethod := statusParam2
		tolog = Moving: %moveMethod%
		logThis(toLog, Name)

		stringsplit, moving, moveMethod, @
		if(moving1 = "FlyUp")
		{


			if(flyModeActive(clientId) = 1)
			{
				tolog = Flymode is active, so Flying Up
				logThis(toLog, Name)
				flyUp(clientId, moving2)
				tolog = Done flying up
				logThis(toLog, Name)

				nParams := moving0 - 2
				newMoveMethod := ""
				testValues := moving0 . moving1 . moving2 . moving3 . moving4 . moving5 . moving6
								logThis(testValues, Name)
				loop %nParams%
				{
					paramIndex := A_Index + 2
					testValues := paramindex . newmovemethod . moving%paramindex%
					logThis(testValues, Name)
					newMoveMethod := newMoveMethod . moving%paramIndex%
					if(A_Index < nParams)
					{
						newMoveMethod := newMoveMethod . "@"
					}
				}
				PWstatus%Name% = Moving,%newMoveMethod%
				tolog = new status: Moving,%newMoveMethod%
				logThis(toLog, Name)
			}
			else
			{
				tolog = Flymode not active, toggling flymode
				logThis(toLog, Name)
				toggleFlying(clientId)
				tolog = Toggled flymode
				logThis(toLog, Name)
			}
		}
		else if(moving1 = "SetFlyTo")
		{
			tolog = Setting FlyTo: %moving2%, %moving3%, %moving4%, %moving5%
			logThis(toLog, Name)
			setFlyTo(clientId, moving2, moving3, moving4, moving5)
			currentCoords := getCurrentCoords(clientId)

			tolog = Set fly to, current coords: %currentCoords%
			logThis(toLog, Name)


			nParams := moving0 - 5
			newMoveMethod := ""
			loop %nParams%
			{
				paramIndex := A_Index + 5
				newMoveMethod := newMoveMethod . moving%paramIndex%
				if(A_Index < nParams)
				{
					newMoveMethod := newMoveMethod . "@"
				}
			}
			PWstatus%Name% = Moving,%newMoveMethod%,%currentCoords%
			tolog = new status: Moving,%newMoveMethod%,%currentCoords%
			logThis(toLog, Name)
		}
		else if(moving1 = "Flying")
		{
			currentCoords := getCurrentCoords(clientId)

			if (isIdle(clientId) = 1)
			{


				tolog = Done flying
				logThis(toLog, Name)

				nParams := moving0 - 1
				newMoveMethod := ""
				loop %nParams%
				{
					paramIndex := A_Index + 1
					newMoveMethod := newMoveMethod . moving%paramIndex%
					if(A_Index < nParams)
					{
						newMoveMethod := newMoveMethod . "@"
					}
				}
				MoveMethod := newMoveMethod

			}

			PWstatus%Name% = Moving,%MoveMethod%,%currentCoords%
			tolog = flying, new status: Moving,%MoveMethod%,%currentCoords%
			logThis(toLog, Name)

		}
		else if(moving1 = "Falling")
		{
			tolog = Falling now
			logThis(toLog, Name)
			if(flymodeActive(clientId) = 1)
			{
				tolog = Currently flying, toggling flymode
				logThis(toLog, Name)
				toggleFlying(clientId)
				tolog = Toggled flymode
				logThis(toLog, Name)
			}
			else
			{
				tolog = Currently not flying
				logThis(toLog, Name)

				currentCoords := getCurrentCoords(clientId)
				if (isIdle(clientId) = 1)
				{
					if(NpcIsClose(nextQuest, clientId) = 0)
					{
						tolog = Npc not close, toggling flymode
						logThis(toLog, Name)
						toggleFlying(clientId)
						tolog = Toggled flymode
						logThis(toLog, Name)
					}
					else
					{

						tolog = Stopped falling
						logThis(toLog, Name)

						nParams := moving0 - 1
						newMoveMethod := ""
						loop %nParams%
						{
							paramIndex := A_Index + 1
							newMoveMethod := newMoveMethod . moving%paramIndex%
							if(A_Index < nParams)
							{
								newMoveMethod := newMoveMethod . "@"
							}
						}
						PWstatus%Name% = Idle
					}
				}

				tolog := PWstatus%Name%
				logThis("status: " . toLog, Name)








			}
		}

	}
}


addNewPlayers()
{
	global

	loop %nPWs%
	{
		playerId := PWlist%A_Index%
		playername := playername%playerid%
		if(playerNameInLists(playerName) = 0)
		{
			addItem("inactive", playername)
			loop %nPWs%
			{
				tempId := PWlist%A_Index%
				if(playername%tempid% = playername)
				{
					tempPlayer := tempid
					logthis("selected player: " . tempPlayer, "main")

					break
				}
			}
			PWstatus%tempPlayer% := "Idle"

		}
	}
}

removeNonPresentPlayers()
{
	global

	StringSplit, activeArray, ActiveList, `n

	loop %ActiveNitems%
	{
		index := A_Index + 1
		playerInList := activeArray%index%
		playerPresent := 0
		loop %nPWs%
		{
			playerid := PWlist%A_Index%
			playername := playername%playerid%
			if(playerInList = playerName)
			{
				playerPresent = 1
				break
			}
		}
		if (playerPresent = 0)
		{
			removeItem("active", playerInList)
		}
	}
	StringSplit, inactiveArray, inActiveList, `n

	loop %InActiveNitems%
	{
		index := A_Index + 1
		playerInList := inactiveArray%index%
		playerPresent := 0
		loop %nPWs%
		{
			playerid := PWlist%A_Index%
			playername := playername%playerid%
			if(playerInList = playerName)
			{
				playerPresent = 1
				break
			}
		}
		if (playerPresent = 0)
		{
			removeItem("inactive", playerInList)
		}
	}


}


playerNameInLists(playerName)
{

	global

	StringSplit, activeArray, ActiveList, `n
	playerPresent := 0
	loop %ActiveNitems%
	{
		index := A_Index + 1
		playerInList := activeArray%index%
		if(playerInList = playerName)
		{
			playerPresent := 1
			break
		}
	}
	if(playerPresent = 0)
	{
		StringSplit, inactiveArray, inActiveList, `n

		loop %InActiveNitems%
		{
			index := A_Index + 1
			playerInList := inactiveArray%index%

			if(playerInList = playerName)
			{
				playerPresent := 1
				break
			}
		}
	}

	return playerPresent
}


checkQuestPresent(questId, client)
{
	global


	winget, pid, PID, %client%


	If ProcessHandle%PID% =
	{
		ProcessHandle%PID% 	:= 	DllCall("OpenProcess", "int", 2035711, "char", 1, "UInt", PID, "UInt")
		logThis("ProcessHandle: " . ProcessHandle%PID%, "main")
	}

	functionSize := 100


	If returnAddress%PID% =
	{
		returnAddress%PID% 	:=   	DllCall("VirtualAllocEx", "Uint", ProcessHandle%PID%, "Uint", 0, "Uint", 0x4, "Uint", 0x1000, "Uint", 0x40)
		logThis("returnAddress: " . returnAddress%PID%, "main")
	}
	If functionAddress%PID% =
	{
		functionAddress%PID% :=   	DllCall("VirtualAllocEx", "Uint", ProcessHandle%PID%, "Uint", 0, "Uint", functionSize, "Uint", 0x1000, "Uint", 0x40)
		logThis("functionAddress: " . functionAddress%PID%, "main")
	}


	revHex(revReturnAddress, returnAddress%PID%)
	revHex(revQuestId, questId)
	revHex(revQuestFunctionAddress, questFunctionAddress)
	revHex(revBaseAddress, realBaseAddress)
	revHex(revQuestFunctionOffset, questFunctionOffset)
	revHex(revPlayerOffSet, playerOffSet, 2)
















	func =
	func = %func%60
	func = %func%B8%revQuestFunctionAddress%
	func = %func%8B0D%revBaseAddress%
	func = %func%8B491C
	func = %func%8B49%revPlayerOffSet%
	func = %func%8B89%revQuestFunctionOffset%
	func = %func%68%revQuestId%
	func = %func%FFD0
	func = %func%A3%revReturnAddress%
	func = %func%61
	func = %func%C3


	MCode(checkQuestFunction, func)


	DllCall("WriteProcessMemory", "UInt", ProcessHandle%PID%, "UInt", functionAddress%PID%, "Uint", &checkQuestFunction, "Uint", functionSize, "Uint *", 0)




	SetFormat, IntegerFast, d

	hThrd := DllCall("CreateRemoteThread", "Uint", ProcessHandle%PID%, "Uint", 0, "Uint", 0, "Uint", functionAddress%PID%, "Uint", 0, "Uint", 0, "Uint", 0)
	loop
	{
		result := DllCall( "WaitForSingleObject", UInt,hThrd, UInt,50 )
		if(result <> 258)
		{
			break
		}
		sleep 50
		if(A_Index > 100)
		{
			break
		}
	}


	local returnValue := readMemory(returnAddress%PID%, client)

	DllCall( "CloseHandle", UInt,hThrd )







	return returnValue

}


sendPacket(packet, packetSizeStr, packetsize, client)
{
	global

	MCode(processedPacket, packet)


	winget, pid, PID, %client%


	If ProcessHandle%PID% =
	{
		ProcessHandle%PID% 	:= 	DllCall("OpenProcess", "int", 2035711, "char", 1, "UInt", PID, "UInt")
		logThis("ProcessHandle: " . ProcessHandle%PID%, "main")
	}


	If packetAddress%PID% =
	{
		packetAddress%PID% 	:=   	DllCall("VirtualAllocEx", "Uint", ProcessHandle%PID%, "Uint", 0, "Uint", packetSize, "Uint", 0x1000, "Uint", 0x40)
		logThis("packetAddress: " . packetAddress%PID%, "main")
	}
	If functionAddress_%PID% =
	{
		functionAddress_%PID% :=   	DllCall("VirtualAllocEx", "Uint", ProcessHandle%PID%, "Uint", 0, "Uint", 0x1B, "Uint", 0x1000, "Uint", 0x40)
		logThis("functionAddress: " . functionAddress_%PID%, "main")
	}

	revHex(packetAddressRev, packetAddress%PID%)
	revHex(revSendPacketAddress, SendPacketAddress)
	revHex(revBaseAddress, realBaseAddress)


	func =
	func = %func%60
	func = %func%B8%revSendPacketAddress%
	func = %func%8B0D%revBaseAddress%
	func = %func%8B4920
	func = %func%BF%packetAddressRev%
	func = %func%6A%packetSizeStr%
	func = %func%57
	func = %func%FFD0
	func = %func%61
	func = %func%C3
	MCode(sendFunction, func)


	DllCall("WriteProcessMemory", "UInt", ProcessHandle%PID%, "UInt", packetAddress%PID%, "Uint", &processedPacket, "Uint", packetSize, "Uint *", 0)
	DllCall("WriteProcessMemory", "UInt", ProcessHandle%PID%, "UInt", functionAddress_%PID%, "Uint", &sendFunction, "Uint", 0x1B, "Uint *", 0)

	hThrd := DllCall("CreateRemoteThread", "Uint", ProcessHandle%PID%, "Uint", 0, "Uint", 0, "Uint", functionAddress_%PID%, "Uint", 0, "Uint", 0, "Uint", 0)
	loop
	{
		result := DllCall( "WaitForSingleObject", UInt,hThrd, UInt,50 )
		if(result <> 258)
		{
			break
		}
		sleep 50
		if(A_Index > 100)
		{
			break
		}
	}

	DllCall( "CloseHandle", UInt,hThrd )





}


MCode(ByRef code, hex) {
   VarSetCapacity(code,StrLen(hex)//2)
   Loop % StrLen(hex)//2
      NumPut("0x" . SubStr(hex,2*A_Index-1,2), code, A_Index-1, "Char")
}

revHex(byref CodeRev, Code, requestedLength=8)
{


	SetFormat, IntegerFast, hex
	Code += 0
	Code .= ""
	SetFormat, IntegerFast, d
	CodeRev =
	temp2 := substr(Code, 3)
	temp2 := "00000000" . temp2

	temp := strlen(temp2)-requestedLength + 1
	temp2 := substr(temp2, temp)

	i := requestedLength - 1
	looplength := requestedLength // 2
	loop %loopLength%
	{

		CodeRev := CodeRev . substr(temp2, i, 2)
		i := i - 2
	}
}



MoveTo(X, Y, Z, moveType, client, actionStruct, height=-1.0)
{
	actionList := ReadMemory(actionStruct+0x30,client)
	MoveAction := ReadMemory(actionList+0x4,client)

	writeMemory(0, MoveAction+0x8, client)
	writeMemory(1, MoveAction+0x14, client)
	writeMemory(X, MoveAction + 0x20, client)
	writeMemory(Y, MoveAction + 0x24, client)
	writeMemory(Z, MoveAction + 0x28, client)
	writeMemory(FloatToHex(height), MoveAction + 0x68, client)
	if(height >= 0.0)
	{
		writeMemory(26625, MoveAction + 0x64, client)
		writeMemory(256, MoveAction + 0x6C, client)
	}
	else
	{
		writeMemory(26624, MoveAction + 0x64, client)
		writeMemory(65536, MoveAction + 0x6C, client)
	}
	writeMemory(moveType, MoveAction + 0x2C, client)
	writeMemory(MoveAction, actionstruct+0xC, client)
	writeMemory(1, actionstruct+0x18, client)
	writeMemory(moveAction, actionstruct+0x14, client)
}



flyUp(client, times)
{

	global

	local loopn := times - 1
	local time := 0.5
	local baseAddress := ReadMemory(realBaseAddress,client)
	local pointer1 := ReadMemory(baseAddress+baseOffset,client)
	local player := ReadMemory(pointer1+playerOffset,client)

	SetFormat, IntegerFast, hex

	local yCoord := readmemory(player+playerYposOffset, client, 4)
	local yCoordFloat := hextofloat(yCoord)

	if(yCoordFloat < 700)
	{

		loop %times%
		{
			sleep 500
			local packet := "0700"
			local counter := readmemory(player+playerCounterOffset, client, 2)
			local interval := readmemory(player+playerIntervalOffset, client, 2)
			local xCoord := readmemory(player+playerXposOffset, client, 4)
			local zCoord := readmemory(player+playerZposOffset, client, 4)
			local speed := readmemory(player+playerFlySpdOffset, client, 4)
			local moveType := 0x61

			local speedFloat := hextofloat(speed)

			local yCoordFloat := yCoordFloat + speedFloat * time
			local sendSpeedFloat := speedFloat * 256 + 0.5
			local sendSpeedHex := floor(sendSpeedFloat)
			local sendYcoordHex := floattohex(yCoordFloat)
			revHex(value, xCoord)
			packet := packet . value
			revHex(value, sendYcoordHex)
			packet := packet . value
			revHex(value, zCoord)
			packet := packet . value
			revHex(value, sendSpeedHex, 4)
			packet := packet . value
			packet := packet . "00"
			revHex(value, moveType, 2)
			packet := packet . value
			revHex(value, counter, 4)
			packet := packet . value
			packet := packet . "F401"

			writeMemory(counter + 1,player+playerCounterOffset, client, 2)
			writeMemory(sendYcoordHex,player+playerYposOffset, client)
			sendPacket(packet, "16", 0x16, client)

		}


		local packet := "0700"
		local counter := readmemory(player+playerCounterOffset, client, 2)
		local speedFloat := hextofloat(speed)

		local yCoordFloat := yCoordFloat + speedFloat * time
		local sendSpeedFloat := speedFloat * 256 + 0.5
		local sendSpeedHex := floor(sendSpeedFloat)
		local sendYcoordHex := floattohex(yCoordFloat)
		revHex(value, xCoord)
		packet := packet . value
		revHex(value, sendYcoordHex)
		packet := packet . value
		revHex(value, zCoord)
		packet := packet . value
		revHex(value, sendSpeedHex, 4)
		packet := packet . value
		packet := packet . "00"
		revHex(value, moveType, 2)
		packet := packet . value
		revHex(value, counter, 4)
		packet := packet . value
		packet := packet . "0000"

		writeMemory(counter + 1,player+playerCounterOffset, client, 2)
		writeMemory(sendYcoordHex,player+playerYposOffset, client)
		sendPacket(packet, "16", 0x16, client)


		sleep 2000
	}
		SetFormat, IntegerFast, d
}

logThis(toLog, playerName)
{
	global

	if(logActivities=1)
	{

	FileAppend,
	(
		`n%toLog%
	), %playerName%.txt
	}

}





String2Hex(x)
{
   format = %A_FormatInteger%
   SetFormat Integer, H
   hex = X
   Loop Parse, x
   {
      y := ASC(A_LoopField)
      StringTrimLeft y, y, 2
      hex = %hex%%y%
   }
   SetFormat Integer, %format%
   Return hex
}

Hex2String(x)
{
   Loop % StrLen(x)//2
   {
      StringMid hex, x, 2*A_Index, 2
      string := string . Chr("0x" hex)
   }
   Return string
}




Hash16(x)
{
   hash = 5381
   StringLen Len, x
   Loop %Len%
   {
      Transform y, ASC, %x%
      hash := 33*hash + y
      hash := hash >> 16 ^ hash & 0xFFFF
      StringTrimLeft x, x, 1
   }
   Return hash
}

ReadMemory2(MADDRESS=0,PROGRAM="", size=4, retType="UInt*")
{
	winget, pid, PID, %PROGRAM%
	tooltip, %PROGRAM% | %pid%
	sleep 1000
	ProcessHandle := DllCall("OpenProcess", "int", 2035711, "char", 0, "UInt", PID, "UInt")
	DllCall("ReadProcessMemory","UInt",ProcessHandle,"UInt",MADDRESS,retType,MVALUE,"UInt",size,"UInt *",0)
	DllCall("CloseHandle", "int", ProcessHandle)
	return MVALUE
}

ReadMemory(MADDRESS=0,PROGRAM="", size=4, retType="UInt*")
{
   Static OLDPROC, ProcessHandle
   VarSetCapacity(MVALUE,size,0)
   If PROGRAM != %OLDPROC%
   {
      WinGet, pid, pid, % OLDPROC := PROGRAM
      ProcessHandle := ( ProcessHandle ? 0*(closed:=DllCall("CloseHandle"
      ,"UInt",ProcessHandle)) : 0 )+(pid ? DllCall("OpenProcess"
      ,"Int",16,"Int",0,"UInt",pid) : 0)
   }
   If (ProcessHandle) && DllCall("ReadProcessMemory","UInt",ProcessHandle,"UInt",MADDRESS,retType,MVALUE,"UInt",size,"UInt *",0)
   	return MVALUE
   return !ProcessHandle ? "Handle Closed: " closed : "Fail"
}

WriteMemory(WVALUE,MADDRESS,PROGRAM, size=4)
{
	winget, pid, PID, %PROGRAM%

	ProcessHandle := DllCall("OpenProcess", "int", 2035711, "char", 0, "UInt", PID, "UInt")
	DllCall("WriteProcessMemory", "UInt", ProcessHandle, "UInt", MADDRESS, "Uint*", WVALUE, "Uint", size, "Uint *", 0)

	DllCall("CloseHandle", "int", ProcessHandle)
	return
}




dec2hex(n) {

	SetFormat, IntegerFast, hex
	n += 0
	n .= ""
	SetFormat, IntegerFast, d







}

hex2dec(n) {
   x := ((substr(n,1,2)!="0x") ? "0x" : "") n
   if ! StrLen(x+0)
      return n
   oIF := A_FormatInteger
   SetFormat,Integer, d
   x += 0
   SetFormat,Integer, % oIF
   return x
}


HexToFloat(d) {
      Return (1-2*(d>>31)) * (2**((d>>23 & 255)-127)) * (1+(d & 8388607)/8388608)
}

Txt2Hex(Txt) {
format := A_FormatInteger
StringSplit, TxtArray, Txt
loop, %TxtArray0%
   {
   CurrentTxt := TxtArray%A_Index%
   blah := Asc(CurrentTxt)
   SetFormat, Integer, Hex
   Hex := Asc(CurrentTxt)
   SetFormat, Integer, Decimal
   StringReplace, Hex, Hex, 0x,,All
   If StrLen(Hex) = 1
      {
      Hex := Hex . "0"
      }
   Hex%A_Index% := Hex
   }
Hex=
Loop, %TxtArray0%
   {
   Hex := Hex . Hex%A_Index%
   }
SetFormat, Integer, %Format%
return %Hex%
}

Hex2Txt(Hex) {
format := A_FormatInteger
go=1
Txt=
HexLen := StrLen(Hex)
Loop, %HexLen%
   {
   If go=1
   {
   go=0
   HexSet := "0x" . SubStr(Hex, A_Index, 2)
   SetFormat, Integer, Decimal
   HexSet += 0
   Txt := Txt . Chr(HexSet)
   }
   else
   {
   go=1
   }
   }
SetFormat, Integer, %Format%
return %Txt%
}

HexToDouble(x) {
   Return (2*(x>0)-1) * (2**((x>>52 & 0x7FF)-1075)) * (0x10000000000000 | x & 0xFFFFFFFFFFFFF)
}

FloatToHex(f) {
   form := A_FormatInteger
   SetFormat Integer, HEX
   v := DllCall("MulDiv", Float,f, Int,1, Int,1, UInt)
   SetFormat Integer, %form%
   Return v
}
I added the 7 new NPC coordinates and I added 7 additional loops. (thats all that I made)

There are known Bugs:

Since the last expansion do not work the fly up. (not sure if it is as of a wrong offset or if the old code do not work at the expansion). Here is the source code from the fly up:

Code:
flyUp(client, times)
{

	global

	local loopn := times - 1
	local time := 0.5
	local baseAddress := ReadMemory(realBaseAddress,client)
	local pointer1 := ReadMemory(baseAddress+baseOffset,client)
	local player := ReadMemory(pointer1+playerOffset,client)

	SetFormat, IntegerFast, hex

	local yCoord := readmemory(player+playerYposOffset, client, 4)
	local yCoordFloat := hextofloat(yCoord)

	if(yCoordFloat < 700)
	{

		loop %times%
		{
			sleep 500
			local packet := "0700"
			local counter := readmemory(player+playerCounterOffset, client, 2)
			local interval := readmemory(player+playerIntervalOffset, client, 2)
			local xCoord := readmemory(player+playerXposOffset, client, 4)
			local zCoord := readmemory(player+playerZposOffset, client, 4)
			local speed := readmemory(player+playerFlySpdOffset, client, 4)
			local moveType := 0x61

			local speedFloat := hextofloat(speed)

			local yCoordFloat := yCoordFloat + speedFloat * time
			local sendSpeedFloat := speedFloat * 256 + 0.5
			local sendSpeedHex := floor(sendSpeedFloat)
			local sendYcoordHex := floattohex(yCoordFloat)
			revHex(value, xCoord)
			packet := packet . value
			revHex(value, sendYcoordHex)
			packet := packet . value
			revHex(value, zCoord)
			packet := packet . value
			revHex(value, sendSpeedHex, 4)
			packet := packet . value
			packet := packet . "00"
			revHex(value, moveType, 2)
			packet := packet . value
			revHex(value, counter, 4)
			packet := packet . value
			packet := packet . "F401"

			writeMemory(counter + 1,player+playerCounterOffset, client, 2)
			writeMemory(sendYcoordHex,player+playerYposOffset, client)
			sendPacket(packet, "16", 0x16, client)

		}


		local packet := "0700"
		local counter := readmemory(player+playerCounterOffset, client, 2)
		local speedFloat := hextofloat(speed)

		local yCoordFloat := yCoordFloat + speedFloat * time
		local sendSpeedFloat := speedFloat * 256 + 0.5
		local sendSpeedHex := floor(sendSpeedFloat)
		local sendYcoordHex := floattohex(yCoordFloat)
		revHex(value, xCoord)
		packet := packet . value
		revHex(value, sendYcoordHex)
		packet := packet . value
		revHex(value, zCoord)
		packet := packet . value
		revHex(value, sendSpeedHex, 4)
		packet := packet . value
		packet := packet . "00"
		revHex(value, moveType, 2)
		packet := packet . value
		revHex(value, counter, 4)
		packet := packet . value
		packet := packet . "0000"

		writeMemory(counter + 1,player+playerCounterOffset, client, 2)
		writeMemory(sendYcoordHex,player+playerYposOffset, client)
		sendPacket(packet, "16", 0x16, client)


		sleep 2000
	}
		SetFormat, IntegerFast, d
}
The second known Bug is, that if you must fly from NPC 32 to NPC 34 the bot stops at 40% as there is no map (the corner between tideborn and earthguard) Until now I do not have any Idea how to slove this problem. (I know that I can give the program an additional point to fly to this. But I do not know how to make it.

So again. This Bot have Beta status. I never tried it until now. And as fly up do not work maybe you get stuck arround NPC 21 or so and maybe later too. Or maybe the bot do not work.
martmor is offline  
Old 11/18/2012, 22:20   #354
 
AlainProvist's Avatar
 
elite*gold: 0
Join Date: Aug 2012
Posts: 381
Received Thanks: 562
i tried to fix the flyup function but I can't find what has changed with the last expansion... I fear it is related to the way the server update the player position. From what I understood from the code we send some positions for a laps of time to the server depending our flight speed and then we send a invalid packet that is supposed the update the client with the last known position. But in fact this last position is our original position before we used the function to fly up. So either the offset to send position packets is not the good one, or the invalid packet doesn't work anymore to update the client (I saw that any action you do after using the flyup function is unable to be performed).

Anyways, since the function is broken and because I'm not confident with packet send, I created a new flyup function that use some call to the flyTo function in order to fly up in an ascendant spire around the ground position. This works like a charm and could even fix some fly up problems when a tree is above the npc.

I have to do some tests to be sure it works with all npcs and I will add the new npcs in the same time. For the one that can't be reached directly cause of the bounds of the map, I will add an extra way point to avoid the bounds.

edit : ****... I just realized that the 7 new npcs don't appear in the quest list at all...what is a big deal since the loop that allow to fly to the next npc check the npc id from the quests and compare it to the list in the programm... this will need to get it from else where.
AlainProvist is offline  
Thanks
1 User
Old 11/19/2012, 08:38   #355
 
elite*gold: 0
Join Date: Mar 2009
Posts: 112
Received Thanks: 123
Quote:
Originally Posted by AlainProvist View Post
****... I just realized that the 7 new npcs don't appear in the quest list at all...what is a big deal since the loop that allow to fly to the next npc check the npc id from the quests and compare it to the list in the programm... this will need to get it from else where.
Quest item inventory, there is an item there related to WQ quest, that updates for every completed step. Id of that item uniquely corresponds to a specific quest id and can thus be used for a lookup in a custom maintained quest list. It works for all quests in WQ chain.
Shareen is offline  
Thanks
1 User
Old 11/19/2012, 18:58   #356
 
AlainProvist's Avatar
 
elite*gold: 0
Join Date: Aug 2012
Posts: 381
Received Thanks: 562
It would be the best way to make it work but I have neither the offset for the quest item inventory nor the ids of the objects to get in.

I'll make a brainless code that fly to each npcs and check if the quest is available or not the time to find how to make the quest item inventory work.
AlainProvist is offline  
Thanks
1 User
Old 11/20/2012, 17:05   #357
 
elite*gold: 0
Join Date: Oct 2010
Posts: 555
Received Thanks: 163
Quote:
I'll make a brainless code that fly to each npcs and check if the quest is available or not the time to find how to make the quest item inventory work.
That will be very good, Thank you very much. I think that this is good.

Then it is not needed to set an point between station 32 and 34. As direct fly from 33 to 34 work
martmor is offline  
Old 11/20/2012, 22:42   #358
 
AlainProvist's Avatar
 
elite*gold: 0
Join Date: Aug 2012
Posts: 381
Received Thanks: 562
Quests ids are not good... it is not 8399 and so on but a probably higher value. Without it I can't validate the quest at each npc. If anyone that have knoweldge in Cheat Engine could get the id from the sendpacket adress when giving back the quest at npc31 or get it by any other way, I would be able to finish my fix.
AlainProvist is offline  
Thanks
1 User
Old 11/20/2012, 23:28   #359
 
elite*gold: 0
Join Date: Mar 2009
Posts: 112
Received Thanks: 123
Quote:
Originally Posted by AlainProvist View Post
It would be the best way to make it work but I have neither the offset for the quest item inventory nor the ids of the objects to get in.
Offsets for quest item inventory:
base + [$1C + [$34 + [$D8C + [$0C + [(inventoryIndex*4) + [<itemStruct>]]]]]]

where:
- base is what WQ.ahk refers to as realBase
- inventoryIndex is numerical value ranging from 0 to 31 (number of quest inventory slots, you'll want to scan inventory at start to locate WQ item slot index)
- itemStruct is a structure of items contained in quest inventory, with itemId located at offset $08

From the early days, I have this list that is however not modified to account for the latest patch, so you can do some work as well

itemId is in decimal notation, questId is in hexadecimal notation

Npc names in list are not the ones used on current PWI version, these are from way back from PW-MYEN days, but you should be able to link these with questIds in npcIds from WQ.ahk.


itemIdquestIdNpcNameDescription
14031$0000209CTailor Ellenvolume 01
14032$0000209DMosarvolume 02
14033$0000209EOld Huntervolume 03
14034$0000209FMerchandizer Rexvoulme 04
14035$000020A0Tea Picker LadyVolume 05
14036$000020A1NorwoodVolume 06
14037$000020A2XarlesVolume 07
14038$000020A3TristramVolume 08
14039$000020A4XenonVolume 09
14040$000020A5Ryu RikuVolume 10
14041$000020A6City of Misfortune castellanVolume 11
14042$000020A7Merchandizer NicholasVolume 12
14043$000020A8Clan of Haste HermitVolume 13
14044$000020A9Camp of Sumor ElderVolume 14
14045$000020AABlacksmith HaywardVolume 15
14046$000020ABGuard HilarioVolume 16
14047$000020ACZoltanVolume 17
14048$000020ADHongVolume 18
14049$000020AEWalworthVolume 19
14050$000020AFScholarVolume 20
14051$000020B0Pharmacist LukeVolume 21
14052$000020B1TenauriVolume 22
14053$000020B2Hell EmissaryVolume 23
14054$000020B3ChaunceyVolume 24
14055$000020B4GammerVolume 25
14056$000020B5CounterjumperVolume 26
14057$000020B6CuthbertVolume 27
14058$000020B7IlarioVolume 28
14059$000020B8OutlanderVolume 29
14060$000020B9Merchandizer SeanVolume 30
14061$000020CBArmerigoPW History- FoxDirect Preface (ending item)
14062$000020CBArmerigoend item
14063$000020CBArmerigoend item
14064$000020CBArmerigoend item
14065$000020CBArmerigoend item
14066$000020CEPenneyPre volume 1
14067$000020CDArmerigoStart of WQ
14125$000020CBArmerigonone
Shareen is offline  
Thanks
2 Users
Old 11/21/2012, 01:03   #360
 
AlainProvist's Avatar
 
elite*gold: 0
Join Date: Aug 2012
Posts: 381
Received Thanks: 562
You rox ^^ thanks a lot for these offsets : finally got my item ids.
PHP Code:
getItemQuestInv(theIdslotIndex)
{
    global
    
    ;
base + [$1C + [$34 + [$D8C + [$0C + [(inventoryIndex*4) + [<itemStruct>]]]]]]
    
    
local baseAddress := ReadMemory(realBaseAddresstheId)
    
local structurePointer := ReadMemory(baseAddress baseOffsettheId) ;+0x1C
    local playerPointer 
:= ReadMemory(structurePointer playerOffsettheId) ;+0x34
    local inventoryPointer 
:= ReadMemory(playerPointer 0xD8CtheId) ;+0xD8C
    local inventoryBase 
:= ReadMemory(inventoryPointer 0xCtheId) ;+0xC
    local itemSlot 
:= ReadMemory(inventoryBase + (slotIndex*4), theId)
    
local id := ReadMemory(itemSlot 0x08theId)
    
    
tolog inventoryBase : %inventoryBase% , itemSlot%slotIndex% : %itemSlot% , id : %id%
        
logThis(toLog"debug")
    
    return 
id

I got id = 37013 for vol.31 what is exactly the id of this item in pwdatabase.

Just need the quest ids to take the quest to the npc and all will be fixed soon


Edit : ROFL pwdatabase is just amazing : it store the id of the quests too in the adress bar. Just have to pick up the ids ^^. I'll post the final code soon : be ready !

Edit 2 : Still filling the exact coords for new npcs and trying to deal with covered npcs... not an easy task in fact.
AlainProvist is offline  
Thanks
1 User
Reply




All times are GMT +1. The time now is 04:42.


Powered by vBulletin®
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
SEO by vBSEO ©2011, Crawlability, Inc.
This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

Support | Contact Us | FAQ | Advertising | Privacy Policy | Terms of Service | Abuse
Copyright ©2025 elitepvpers All Rights Reserved.