/* PNJ Server Plugin - DMS - junary 2008 - by Bastien BOURINEAU */ typeof sClass = S;; /******************************************************************************* *******************************************************************************/ /******************************************************************************* Registering downloadable files: - avatars & textures & anim *******************************************************************************/ /***************************************** Fonction qui renvoie l'indice du dernier % dans la chaine s *****************************************/ fun search_last_percent(s)= let strlen s -> l in let 1 -> i in (while i i in substr filename i+1 1000 else filename -> filetex in ( set l = filetex::l; ); let if (nth_char filenamebis 0)=='% then let search_last_percent filenamebis -> i in substr filenamebis i+1 1000 else filenamebis -> filetexbis in ( set l = filetexbis::l; ); let if posbis == nil then substr newMapo pos+1 (strlen mapo)-(pos+1) else substr newMapobis posbis+1 (strlen mapo)-(posbis+1) -> nextfile in registerTextures nextfile l /* 1 = strlen "\n" */ ); l;; fun registerfile(file)= _RSunregister this file; _RSregisterfiles this file::nil RSfile+RScontrol; 0;; fun registerListInit(l)= if l == nil then 0 else ( registerfile hd l; registerListInit tl l );; // for Debug fun _fooSListEx(l)= let sizelist l -> size in let 0 -> i in while i < size do ( _fooS strcat ">>>>>>>>>>>>>>>> list : " nth_list l i; set i = i + 1; ); 0;; /******************************************************************************* cbGetServerParams() ui -> UserI : user instance cli -> Client : client action -> S : action param -> S : parameters <- I : not used *******************************************************************************/ fun cbGetServerParams(ui, cli, action, param, s) = UsendMessage ui cli "setServerParams" s; 0;; fun UpLoad(cli,name,contenu)= _RSunregister this name; _storepack contenu name; _RSregister this name RSfile|RScontrol name; 0;; fun getFilesList(data)= let sizelist data -> size in let nil -> ndata in let 0 -> i in ( while i < size do ( let nth_list data i -> elem in set ndata = (hd elem)::ndata; set i = i + 1; ); ndata; );; fun cbNewOb(o)= let UgetParams ObUi o -> l in let getInfo l "m3dpath" -> m3dpath in let strextr getInfo l "anims" -> lanims in let strextr getInfo l "sounds" -> lsounds in let registerTextures _getpack _checkpack m3dpath nil -> ltexturepath in let getFilesList lsounds -> dlsounds in let getFilesList lanims -> dlanims in let listcat (listcat (listcat dlanims m3dpath::nil) ltexturepath) dlsounds -> resregister in let zip linebuild resregister -> s in ( _DMScbUpload this @UpLoad; registerListInit resregister; UcbMessage (ObUi o) ["getServerParams" mkfun5 @cbGetServerParams s]:: nil; ); 0;; /* IniPlug */ fun IniPlug(file)= set sClass = getInfo strextr _getpack _checkpack file "name"; PlugRegister sClass @cbNewOb nil; 0;;