 |
Magic-League.com Forums of Magic-League: Free Online Magic: the Gathering Play with Apprentice and Magic Workstation; casual or tournament play.
|
|
|
| Author |
Message |
coppro
Joined: 21 Aug 2005 Posts: 17
|
Posted: Thu Jan 18, 2007 6:51 pm Post subject: |
|
|
Ah, now I remember. It's called MakeAppr. And C is pretty similar to Java.
As for the gatherer, why not use the Text Spoiler output? It's in the following format:
| Code: | CardName: "Ach! Hans, Run!"
Cost: 2RRGG
Type: Enchantment
Pow/Tgh: /
Rules Text: At the beginning of your upkeep, you may say "Ach! Hans, run! It's the . . ." and name a creature card. If you do, search your library for the named card, put it into play, then shuffle your library. That creature has haste. Remove it from the game at end of turn.
Set/Rarity: Unhinged Rare |
Here's the relative section of the MakeAppr sources:
| Code: | int getint(HANDLE fileFp) { char strBuffer[5]; long t; int r; ReadFile(fileFp,strBuffer,1,&t,NULL); r=strBuffer[0]; if (r<0) { r+=256; } return r; }
void get100(HANDLE fileFp) { char strBuffer[200]; long t; ReadFile(fileFp,strBuffer,100,&t,NULL); }
void gval(HANDLE fileFp, char *gvalgl) { int gvaltmp; char gvalstr[8192]; long t; gvaltmp=getint(fileFp)+getint(fileFp)*256; ReadFile(fileFp,gvalstr,gvaltmp,&t,NULL); gvalstr[gvaltmp]=0; strcpy(gvalgl,gvalstr); }
int LoadList() {
HANDLE fp2;
int tmp;
int offs;
int cur=0;
int total;
fp2=CreateFile(szFileData,GENERIC_READ,0,0,OPEN_EXISTING,FILE_ATTRIBUTE_NORMAL,NULL);
if (fp2==INVALID_HANDLE_VALUE) { return FALSE; }
offs=getint(fp2)+getint(fp2)*256+getint(fp2)*65536;
for (tmp=4;tmp<offs-99;tmp+=100) { get100(fp2); } for (tmp--;tmp<offs;tmp++) { getint(fp2); }
total=getint(fp2)+getint(fp2)*256+getint(fp2)*65536;
SetFilePointer(fp2,0,NULL,FILE_BEGIN);
getint(fp2);getint(fp2);getint(fp2);getint(fp2);
while (cur<total) {
gval(fp2,str); strcpy(Cards[cur].CardType,str);
gval(fp2,str); strcpy(Cards[cur].CC,str);
gval(fp2,str); strcpy(Cards[cur].PT,str);
gval(fp2,str); strcpy(Cards[cur].Text,str);
gval(fp2,str); strcpy(Cards[cur].Comment,str);
cur++;
}
SetFilePointer(fp2,0,NULL,FILE_BEGIN);
for (tmp=0;tmp<offs-99;tmp+=100) { get100(fp2); }
for (tmp--;tmp<offs+3;tmp++) { getint(fp2); }
cur=0;
while (cur<total) {
gval(fp2,str); strcpy(Cards[cur].CardName,str);
getint(fp2);getint(fp2);getint(fp2);getint(fp2);
Cards[cur].color=getint(fp2);
gval(fp2,str); strcpy(Cards[cur].Edition,str);
getint(fp2);getint(fp2);
Cards[cur].act=1;
cur++;
}
cur=total;
CloseHandle(fp2);
for (cur=0;cur<total;cur++) { SendMessage(lst_cards,LB_SETITEMDATA,SendMessage(lst_cards,LB_ADDSTRING,0,(LPARAM)Cards[cur].CardName),cur); }
numcards=cur;
return TRUE;
} |
There's a number of API specific functions in there, but I'm hoping this is enough to work off of. |
|
| Back to top |
|
 |
PatrickGA
Joined: 17 Jan 2007 Posts: 11
|
Posted: Fri Jan 19, 2007 8:22 am Post subject: |
|
|
| Spyx wrote: |
That's how it's supposed to be. At least in mws when you go T2 -> forest you get 12 forests with different art. |
The art is the only thing different about them and, if you choose "Summary" in the gatherer database, you'll see art is stored by card and by set, not just by card. You have to click their little set icons to call up the different artwork.
This makes me assume that "summary" output is at least filtering the query, but if anything I think it should be the other way around. No matter what the artwork is, the card is the same. Plaintext can't possibly depict the difference.
@coppro: Thanks a lot. I already built a small XML card list to use as dummy data, but once the project side of it is out of the way, should I choose to make a release version (that is, should I become certain Wizards will not be suing my pants off), that'll surely come in handy.
As for C being similar to Java; It isn't even on our curriculum, although the instructor said we might have a short module on it at the end of the year just for the sake of knowing we can use it. He did tell us Java and C were very similar, but I'll stick to learning Java for now.
I still feel like I can't do squat with it, honestly, but the other students tell me it isn't so different from VB (Which I do have experience with and, frankly, I could program Apprentice with my eyes closed using). Either way, I'm working on it. It's all about syntax. |
|
| Back to top |
|
 |
nico Administrator
Joined: 28 Oct 2003 Posts: 823
|
Posted: Fri Jan 19, 2007 3:52 pm Post subject: |
|
|
Well, if you have some problems with fear of wizards sueing when you are using for the use of apprentice (or somesuch) then you may want to look at other things, like scrollrack. Open source program to play online, or mindless automaton, from the same person, but compatible to apprentice when it comes to communicating.
There also has been a development of apprentice 2, wich in fact only has the name in common, and the fact that the one programming it was part of the team that developped apprentice. Alas, development on this has stopped and there will never be a completed apprentice 2.
So, all in all, there are some possibilities to look at, pick one and have a go at it.
Greetz Nico |
|
| Back to top |
|
 |
PatrickGA
Joined: 17 Jan 2007 Posts: 11
|
Posted: Sat Feb 03, 2007 7:13 am Post subject: |
|
|
Just a small progress report in case anyone is interested.
I'm seriously considering making a release version now, I'm really enjoying building this program. The only problem is that the online play won't be available for quite some time... it started with JXTA (Juxtapose) programming being the main project, and I was hoping to be able to use the Apprentice source, but that's apparently out of the question with Wizards owning the rights to the source. As a result I pretty much threw a week and a half to the four winds trying to make a program filled with deprecated methods work... So I'm running on a very shortened timespan for my project (it's to be presented on monday).
As a result, I have a chunk of the program itself working, but online connection isn't available yet -- which causes more problems in a sense, because I can't test any code I'd use to read opponent status.
Anywho, I'm just curious if anyone would actually be interested in a release version if I were to fix JXTA or manage to find some other way to play more than two players across the net?
It's still lacking a sound name (It has a lame tentative name, "TCG Dueling Grounds", but that's just so my main window doesn't have an empty name field when I present it as a school project), and I admit I'm still a little green with Java (The 3 weeks I had to code this were also the only 3 weeks I've ever done Java, heh) so the code is a little messy as it stands. If I were to make a release version, though, I'd definitely clean the code up first.
As for features, I'm including a bunch of things I think Apprentice should have originally had and a few of my own little quirks, and I'm making sure everything I build is reusable. The data-side stuff is all XML format, so literally anyone who has done first grade English could grab it and read it like a book.
If you're interested in screenshots or more information, or if you have any suggestions about features you'd like to see implemented, PM me. |
|
| Back to top |
|
 |
|
Powered by phpBB © 2001, 2005 phpBB Group
|