EOSERV Forum > Lounge > PubExplore
Topic is locked.
Page: << 1 2 >>
PubExplore
Author Message
Post #89527 PubExplore

Ok, so i decided Id try and make a better PubEditor called PubExplore. Ive set up a few things, and was wondering how i would begin to read the Pub files. Ive opened it in notepad and i am wondering how xD. Anyone know anything about it?

---
Andrewbob - I would be on the fucking copter of rofls

Programmer, Web Developer, and Graphics Designer
13 years, 41 weeks ago
Post #89536 Re: PubExplore

What language?

13 years, 41 weeks ago
Post #89537 Re: PubExplore

Visual Basic, im going to try it in that because of how simple VB is. If not, ill prolly go to C#

---
Andrewbob - I would be on the fucking copter of rofls

Programmer, Web Developer, and Graphics Designer
13 years, 41 weeks ago
Post #89539 Re: PubExplore

If you make it C++ I can help you out alot I'm very well with WINAPI.

13 years, 41 weeks ago
Post #89540 Re: PubExplore

Lol, im not good at all in C++. Ive been meaning to learn it but i procrastinate alot :P

---
Andrewbob - I would be on the fucking copter of rofls

Programmer, Web Developer, and Graphics Designer
13 years, 41 weeks ago
Post #89577 Re: PubExplore

Pub file readers are pretty easy to make if you know what you're doing. I made one in C# (twice -.-) and one in PHP just from looking at the eoserv source code. If you use eodata.cpp/hpp as a reference then its easy enough to port it to another language.

I've never worked with editing though, only opening. Good luck!

---
class EOSERV {
Programmer | Oldbie
Open source EO Client: https://github.com/ethanmoffat/EndlessClient
};
13 years, 41 weeks ago
Post #89579 Re: PubExplore

Haha, thanks for the advice. Ima get on that tomorow. I cant sleep right now so i started adding stuff into my site XD What i intended on doing is also loading the GFX drop views and etc. I got them loading thanks tolookingatthesourceofDesmond's Map editor. 


Edit: OK im building the EIFReader class and i ran into the problem of Ord() whats the visual basic equivilant of this? And this:

        $this->data = array(0 => new EIF_Data); 

Derp, i feel stupid now lol. data(0) = new EIFData 

I have the datastructure of EIFData and i am confused on the array part.


Also :

return isset($types[$type])?$types[$type]:'';

Whats that question mark supposed to be?

and what is this Number() function? I cant find it anywere on google and its not a custom function.

        $len = Number(ord($len[0]), ord($len[1]));


These problems have been fixed.

---
Andrewbob - I would be on the fucking copter of rofls

Programmer, Web Developer, and Graphics Designer
13 years, 41 weeks ago
Post #89633 Re: PubExplore

Number is a function that is in Packet.cpp/.hpp. It is a function that turns the byte numbers stored in the pub file and makes them into the correct values. It uses some constants which I believe are also defined in Packet.hpp.

The question mark is an operator (I can never remember its name). You can use it for assigning a variable in place of an if statement, its a shorthand notation.

Say you have an int x that is assigned an arbitrary value and you want to assign int y based on the value of x.

int y = x > 5 ? 2 : 7;

This is equivalent to:

int y;

if(x > 5)
  y = 2;
else
  y = 7;

Much simpler with the shorthand!

---
class EOSERV {
Programmer | Oldbie
Open source EO Client: https://github.com/ethanmoffat/EndlessClient
};
13 years, 41 weeks ago
Post #89718 Re: PubExplore

Sweet, now all i need is the number function. 

I found this in packet.cpp : 

unsigned int PacketProcessor::Number(unsigned char b1, unsigned char b2, unsigned char b3, unsigned char b4)

{

if (b1 == 0 || b1 == 254) b1 = 1;

if (b2 == 0 || b2 == 254) b2 = 1;

if (b3 == 0 || b3 == 254) b3 = 1;

if (b4 == 0 || b4 == 254) b4 = 1;


--b1;

--b2;

--b3;

--b4;


return (b4*PacketProcessor::MAX3 + b3*PacketProcessor::MAX2 + b2*PacketProcessor::MAX1 + b1);

}


Would this happen to be it?

Also i ran into another problem.

        for ($i = 0; $i < $len; ++$i)

What would the equivelant VB.NET to this?

---
Andrewbob - I would be on the fucking copter of rofls

Programmer, Web Developer, and Graphics Designer
13 years, 41 weeks ago
Post #89756 Re: PubExplore
Yes that's to convert it to a number.

The other question I believe is:

FOR i=0 TO 10
NEXT i
---
I am an alien and not crazy!
13 years, 41 weeks ago
Post #89757 Re: PubExplore
Desmond Taylor posted: (23rd Jul 2011 10:04 pm)

Yes that's to convert it to a number.

The other question I believe is:

FOR i=0 TO 10
NEXT i
Well i know the format im just wondering how to do it with the other 2 parameters.

Ive almost got the class worked out i just need this and to convert the number function to VB, then the next classes should be alot easier.

---
Andrewbob - I would be on the fucking copter of rofls

Programmer, Web Developer, and Graphics Designer
13 years, 41 weeks ago
Post #89759 Re: PubExplore

I'm not that good with VB anymore but for the second part it's definatly like this.

DIM len = 10

FOR i=0 TO len
   Do Stuff
NEXT i

---
I am an alien and not crazy!
13 years, 41 weeks ago
Post #89764 Re: PubExplore

Hmm. Ive read a few things on for loops and this is what describes it.

for (expr1; expr2; expr3)    statement


Edit: This helped me s little bit more.

for ( initialize a counter; conditional statement; increment a counter){

do this code;

}


For i=0 To Len

If i < Len then

' Now i just need to know what ++$1 is.

End If

Next


Edit2: Does this look about right? It works fine.

    Shared Function Number(b1, b2, Optional b3 = 0, Optional b4 = 0)

        If b1 = 0 Or b1 = 254 Then

            b1 = 1

        End If

        If b2 = 0 Or b2 = 254 Then

            b2 = 1

        End If

        If b3 = 0 Or b3 = 254 Then

            b3 = 1

        End If

        If b4 = 0 Or b4 = 254 Then

            b4 = 1

        End If

        Return (b4 * 253 + b3 * 64009 + b2 * 16194277 + b1)

    End Function

---
Andrewbob - I would be on the fucking copter of rofls

Programmer, Web Developer, and Graphics Designer
13 years, 41 weeks ago
Post #89791 Re: PubExplore

b2, b3, b4 all have default parameters of 254. I don't know anything about vb but I'm guessing declaring those parameters optional and setting them to 254 is the equivalent.

You also have to decrement each parameter. (--b1; --b2; --b3; --b4;)

And your constants in the return statement are backwards. MAX3 is the largest and MAX1 is the smallest.

---
class EOSERV {
Programmer | Oldbie
Open source EO Client: https://github.com/ethanmoffat/EndlessClient
};
13 years, 41 weeks ago
Post #89792 Re: PubExplore

Lol this part is confusing me very much :P 

[Solved problems removed]

Edit : Ok i succesfully recieved the names of thoose ids. 1,2,3,4 so on. im guessing i did something right.


Edit2 : Yes! I got it now :D Its read every single name perfectly and im pretty sure it works with the other things. Now i just gotta add the rest of the algorithm data and EIFReader class is finished :D Thanks guys for your help!


Edit3: Came across an error >:O On the id search (Just to test if stuff was coming out right) it keeps showing letters for ids and etc. Check this video and see if youll beable to notice the problem : Here

Fixed that. Now the tons shows up as a huge number. Why? Anyone know? It only shows up on the ones with :

OData.Number(Asc(FileData.Substring(FI, 1)), Asc(FileData.Substring(FI + 1, 1)))

Also, it only counts items up to 315?  

---
Andrewbob - I would be on the fucking copter of rofls

Programmer, Web Developer, and Graphics Designer
13 years, 41 weeks ago
Page: << 1 2 >>
Topic is locked.
EOSERV Forum > Lounge > PubExplore