NPCリスト
NPCのリストを取得して、コンソールに一覧を出すプログラム例
string SP = " ";
Namebuff namebuff = new Namebuff();
float X, Y, Z, Rot;
int NPCMAP = 0x3e5f48;
for (int i = 0; i < 768; i++)
{
int NPCaddr = 0;
ReadProcessMemory(handle,BASE + NPCMAP+i*4, &NPCaddr,4, null);
if (NPCaddr == 0) continue;
ReadProcessMemory(handle, NPCaddr+0x7c, &namebuff, 20, null);
byte[] NpcNameBuff = new byte[20];
for (int j = 0; j < 20; j++)
{
NpcNameBuff[j] = namebuff.name[j];
if (namebuff.name[j] == 0) break;
}
string NpcName = Encoding.Default.GetString(NpcNameBuff).Replace("\0", "");
if (NpcName.Length == 0) continue;
//if (NpcName == "") return;
ReadProcessMemory(handle, NPCaddr + 0x24, &X, 4, null);
ReadProcessMemory(handle, NPCaddr + 0x28, &Z, 4, null);
ReadProcessMemory(handle, NPCaddr + 0x2c, &Y, 4, null);
ReadProcessMemory(handle, NPCaddr + 0x38, &Rot, 4, null);
Byte HPP = 0;
ReadProcessMemory(handle, NPCaddr + 0xd0, &HPP, 1, null);
if (HPP == 0) continue;
ushort shuzoku = 0;
ReadProcessMemory(handle, NPCaddr + 0xe0, &shuzoku, 2, null);
if (shuzoku <= 0x0100) continue;
Console.WriteLine(i.ToString("x") + SP +"("+HPP+"-"+shuzoku.ToString("x4")+")"+ NPCaddr.ToString("x") +SP+ X.ToString() + SP + Y.ToString() + SP + NpcName);
}
構造体↓
unsafe struct Namebuff
{
internal fixed byte name[20];
}
NPCリストのメモリマップはおおむねこんな感じ。まだ詳しくはわかってない。
- +0x24周りはふつうにXYZと方角
- +7c以下は名前(これはメモリダンプすれば一目瞭然)
- +c0には、なぜかHPPのMAX(だから、つねに0x64)
- +d0には、現在のHPP(byteだが、shortでも可)
- +edには、NPCのカテゴリー?
街のNPCは0x100以下(モーグリ=0x54等)
モンスは、0x100以上みたいで、サルタ倉庫と、ボヤで照合してみたら
→どちらのウサギも0x10d
→どちらのマンドラも0x012c
なので、モンスの「種族」ごとにざっくりと入っているようだ
モンスは、0x100以上みたいで、サルタ倉庫と、ボヤで照合してみたら
→どちらのウサギも0x10d
→どちらのマンドラも0x012c
なので、モンスの「種族」ごとにざっくりと入っているようだ
MAP表示
ウィンダス森の区限定のMAP表示プログラム
ねこまの.ini の処理方法のコード例です。
ねこまの.ini の処理方法のコード例です。
//あらかじめ、Bitmap _bmp = new Bitmap(@"C:\--pathname--\map\f1.gif");
//本当は、エリアコードはもちろんのこと、どのボックスに入るか要判定
int MYPOS = 0x8f2258;
float X, Y, Z, Rot;
ReadProcessMemory(handle, BASE + MYPOS + 4, &X, 4, null);
ReadProcessMemory(handle, BASE + MYPOS + 8, &Z, 4, null);
ReadProcessMemory(handle, BASE + MYPOS + 12, &Y, 4, null);
ReadProcessMemory(handle, BASE + MYPOS + 16, &Rot, 4, null);
// f1_jname=ウィンダス 森の区
// f1_0=0.4,129,-0.4,145,-10000,-10000,-10000,10000,10000,10000
// thanks to ねこま!
int a = ( (int)(0.4 * X) + 129 ) * 2; //ねこまはもともとは256*256だったので
int b = ( -(int)(0.4 * Y) + 145) * 2; //その名残り。知ってた?w
Graphics g = pictureBox1.CreateGraphics();
Rectangle rect = new Rectangle(0, 0, 200, 200);
g.DrawImage(_bmp, rect, a - 50, b - 50, 100, 100, GraphicsUnit.Pixel);//地図表示
Pen redpen = new Pen(Color.Red, 2);
g.DrawEllipse(redpen, 100, 100, 25, 25);//自分円
g.Dispose();