barko / atdjs Goto Github PK
View Code? Open in Web Editor NEWatd code generator for OCaml/js_of_ocaml
License: BSD 3-Clause "New" or "Revised" License
atd code generator for OCaml/js_of_ocaml
License: BSD 3-Clause "New" or "Revised" License
Hi, here my (huge) .atd file
type notification =
{
add : info list;
del : info list;
update : info list;
}
type position = (int*int)
type info = {
events : eventJeu list;
inventaire : objetJeu list;
detection : itemJeu list;
chat : chatLigne list;
fichePerso : fichePersoItem list;
actionJoueur : actionJoueurType ;
}
type nainInfo = {
idnainInfo: string;
nomen: string;
guilde: string;
niveau: string;
tag : string;
xp : string;
(Etc...)
}
(*TODO TODO : voir si la date ne doit pas être en float pour prendre en compte les ms sur les arbitrages*)
type itemJeu = [Nain of nainLight | Objet of objetJeu ]
type eventJeu = (nainLight * nainLight * objetJeu * objetJeu * typeEvenement * int (int pour la date)) (* C'est à qu'il faut le remplacer par une liste d'Events possibles )
type nainLight = { idnain : string; }
type chatLigne = (nainLight * heureDate * string)
type heureDate = int
type fichePersoItem = string (Inconnu total, à déterminer)
type objetJeu = { idobj : string }(TODO plus le reste qui viendra plus tard)
type actionJoueurType = [
| DeplacementGauche of nainLight(=>)
| DeplacementDroite of nainLight(=>)
| DeplacementHaut of nainLight(=>)
| DeplacementBas of nainLight(=>)
| DeplacementBasGauche of nainLight(=>)
| DeplacementBasDroite of nainLight(=>)
| DeplacementHautGauche of nainLight(=>)
| DeplacementHautDroite of nainLight(=>)
| AttaqueEvt of ( nainLight * nainLight * objetJeu * position )(=>)
| JeSuisAttaqueEvt of ( nainLight * nainLight * objetJeu * position )(=>)
| RamasseObjetEvt of ( nainLight * objetJeu )(=>)
| PoserObjetEvt of ( nainLight * objetJeu )(=>)
| UtiliserObjetEvt of ( nainLight * objetJeu )(=>)
| PrendDrapeauEvt of nainLight(=>)
| PoseDrapeauEvt of nainLight(=>*)
| VideEvt
]
type typeEvenement = [
| AttaqueEvent of ( nainLight * nainLight * objetJeu * position ) (TODO plus le reste qui viendra plus tard)
| PriseObjetEvent of ( nainLight * objetJeu )
| PoseObjetEvent of ( nainLight * objetJeu )
]
type dialogueClientServeur = [ EvenementFromClient of (demandeClient * idClient) | RefreshFromServeurToClient of (notification * idClient)]
type demandeClient = [ ActionJoueur of actionJoueurType | DemandeInfo of typeInfo]
type typeInfo = [ ClassementGuilde of int(Guilde)) | Evenements of heureDate (TODO gérer comme ds Nainwak le filtrage --> on le mettra sur le client)
| MondeCourant of infoMonde ]
type infoMonde = {
nomMonde : string;
liste_Objets : (int * int * objetJeu ) list;
liste_Champion : (int * int * nainLight) list;
liste_Events : eventJeu list; (Du plus récent au plus ancien)
}
type idClient = int
type success = { success : bool ; msgs : string list}
(=>)
type etatSpaceChampion = [
| HiberneDepuis of int (* Les dates = nombre de seconde depuis 2000*)
| Vivant
| CompteSupprimeLe of int
]
type typeObjet = [
| Arme
| Rune
| Special
| Bouffe
] (TODO : on pourrait mettre les caractéristiques ici)
type objetBackup = {
au_sol : bool ;
possede_par : string;
nom : string;
description : string;
coutUtilisation : int;
typeObjet : typeObjet; (* A voir : est-ce que c'est là qu'on stokera diverses infos spécifiques ? _)
utilisable_le : int; (_date en seconde à partir de laquelle l'objet devient utilisable*)
position : position;
force : int;
portee : int;
utilisee_le : int;
temp_blocage : int
}
type hashIDObjet = (string * objetBackup) list
type spaceChampionBackup = {
etatChampion : etatSpaceChampion;
pa : int;
pv : int;
xp : int;
attaque : int;
regeneration : int;
celerite : int; (Nombre de pa par déplacement ?)
coutDeplacement : int;
position : position;
direction : int; ([1;4]U[6;9])
inventaire : hashIDObjet; (_let prem : Hashtbl.create 127 in Hashtbl.add prem "IDObj0" (None : objetSpaceChampion option); prem(_Liste d'objets*) *)
mondeCourant : monde;
myShoulder : spaceChampionBackup;
myObject1 : objetBackup;
myObject2 : objetBackup
}
type monde = {
damier : (spaceChampionBackup list * objetBackup list) list;
listeChampion : spaceChampionBackup;
listeObjets : spaceChampionBackup;
}
The file produced give me the following error :
ocamlc.opt -verbose -c -I /opt/local/lib/ocaml/site-lib/lwt -I /opt/local/lib/ocaml/site-lib/js_of_ocaml -I /opt/local/lib/ocaml/site-lib/jsonoj spacechampion.ml
File "spacechampion.ml", line 753, characters 27-31:
Error: This expression has type info but an expression was expected of type
spaceChampionBackup
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.