ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/deliantra/html5client/main.js
(Generate patch)

Comparing deliantra/html5client/main.js (file contents):
Revision 1.2 by sf-demisephi, Sun Nov 4 09:30:25 2012 UTC vs.
Revision 1.3 by sf-demisephi, Sun Nov 4 16:53:24 2012 UTC

47 47
48var skipKeyTest = false; 48var skipKeyTest = false;
49var keys = { 49var keys = {
50 shift: 0, 50 shift: 0,
51 alt: 0, 51 alt: 0,
52 ctrl: 0 52 ctrl: 0,
53 states : []
53}; 54};
54 55
55var versionInfo = { 56var versionInfo = {
56 perlver: "5.014002", 57 perlver: "5.014002",
57 clientver: "3.0Af0000000", 58 clientver: "3.0Af0000000",
61 modulever: "1.31", 62 modulever: "1.31",
62 osver: "linux", 63 osver: "linux",
63 protver: 1 64 protver: 1
64}; 65};
65var expTableFacenum = -1; 66var expTableFacenum = -1;
67
68var isRunning = false;
69var isFiring = false;
70mapsize = {width: 0,height:0};
66 71
67function appendToBody(e){ 72function appendToBody(e){
68 document.getElementsByTagName("body")[0].appendChild(e); 73 document.getElementsByTagName("body")[0].appendChild(e);
69} 74}
70 75
113var xPlayerWindow = null; 118var xPlayerWindow = null;
114var pattern = null; 119var pattern = null;
115var patternImage = null; 120var patternImage = null;
116var isMainCalled = false; 121var isMainCalled = false;
117var xInfoWindow = null; 122var xInfoWindow = null;
123var xBarsWindow = null;
118 124
119var wsUri = "ws://testserver.deliantra.net:13327/ws"; 125var wsUri = "ws://testserver.deliantra.net:13327/ws";
120//var wsUri = "ws://slashflash.pl:13327/deliantra"; 126//var wsUri = "ws://slashflash.pl:13327/deliantra";
121//var wsUri = "ws://localhost:13327/deliantra"; 127//var wsUri = "ws://localhost:13327/deliantra";
122 128
156 button.addEventListener("click",function (e){ 162 button.addEventListener("click",function (e){
157 div.parent.style.display="none"; 163 div.parent.style.display="none";
158 xMapWindow.contents.appendChild(canvas); 164 xMapWindow.contents.appendChild(canvas);
159 xMapWindow.show(true); 165 xMapWindow.show(true);
160 xFloorWindow.show(true); 166 xFloorWindow.show(true);
167 xBarsWindow.show(true);
161 ctx.fillStyle = "#000"; 168 ctx.fillStyle = "#000";
162 169
163 ctx.font = "10px Courier New,MonoSpace"; 170 ctx.font = "10px Courier New,MonoSpace";
164 Messages.push(new Message(100,"'engine' started")); 171 Messages.push(new Message(100,"'engine' started"));
165 setInterval(draw,1000/5); 172 setInterval(draw,1000/5);
181 login.value = password.value = "null"; 188 login.value = password.value = "null";
182 div.parent.style.display="none"; 189 div.parent.style.display="none";
183 xMapWindow.contents.appendChild(canvas); 190 xMapWindow.contents.appendChild(canvas);
184 xMapWindow.show(true); 191 xMapWindow.show(true);
185 xFloorWindow.show(true); 192 xFloorWindow.show(true);
193 xBarsWindow.show(true);
186 ctx.fillStyle = "#000"; 194 ctx.fillStyle = "#000";
187 ctx.font = "10px Courier New,MonoSpace"; 195 ctx.font = "10px Courier New,MonoSpace";
188 Messages.push(new Message(100,"'engine' started")); 196 Messages.push(new Message(100,"'engine' started"));
189 setInterval(draw,1000/5); 197 setInterval(draw,1000/5);
190 198
203 login.value = password.value = "NULL"; 211 login.value = password.value = "NULL";
204 div.parent.style.display="none"; 212 div.parent.style.display="none";
205 xMapWindow.contents.appendChild(canvas); 213 xMapWindow.contents.appendChild(canvas);
206 xMapWindow.show(true); 214 xMapWindow.show(true);
207 xFloorWindow.show(true); 215 xFloorWindow.show(true);
216 xBarsWindow.show(true);
208 ctx.fillStyle = "#000"; 217 ctx.fillStyle = "#000";
209 ctx.font = "10px Courier New,MonoSpace"; 218 ctx.font = "10px Courier New,MonoSpace";
210 Messages.push(new Message(100,"'engine' started")); 219 Messages.push(new Message(100,"'engine' started"));
211 setInterval(draw,1000/5); 220 setInterval(draw,1000/5);
212 websocket = new WebSocket(wsUri); 221 websocket = new WebSocket(wsUri);
224 login.value = password.value = "VOID"; 233 login.value = password.value = "VOID";
225 div.parent.style.display="none"; 234 div.parent.style.display="none";
226 xMapWindow.contents.appendChild(canvas); 235 xMapWindow.contents.appendChild(canvas);
227 xMapWindow.show(true); 236 xMapWindow.show(true);
228 xFloorWindow.show(true); 237 xFloorWindow.show(true);
238 xBarsWindow.show(true);
229 ctx.fillStyle = "#000"; 239 ctx.fillStyle = "#000";
230 ctx.font = "10px Courier New,MonoSpace"; 240 ctx.font = "10px Courier New,MonoSpace";
231 Messages.push(new Message(100,"'engine' started")); 241 Messages.push(new Message(100,"'engine' started"));
232 setInterval(draw,1000/5); 242 setInterval(draw,1000/5);
233 websocket = new WebSocket(wsUri); 243 websocket = new WebSocket(wsUri);
239 return div.parent; 249 return div.parent;
240 250
241 251
242} 252}
243 253
254function draw(){
255 xBarsWindow.ctx.fillStyle = "#000";
256 xBarsWindow.ctx.fillRect(0,0,xBarsWindow.sw,xBarsWindow.sh);
257
258
259 if ( typeof (myStats[CS_STAT_MAXHP]) == typeof(1)){
260 xBarsWindow.ctx.save();
261
262 xBarsWindow.ctx.fillStyle = "#F00";
263 xBarsWindow.ctx.globalAlpha = 0.5;
264 xBarsWindow.ctx.fillRect(10,10,20,xBarsWindow.sh);
265 xBarsWindow.ctx.fillRect(10,10+xBarsWindow.sh-(myStats[CS_STAT_HP]/myStats[CS_STAT_MAXHP])*xBarsWindow.sh,20,(myStats[CS_STAT_HP]/myStats[CS_STAT_MAXHP])*xBarsWindow.sh);
266 xBarsWindow.ctx.restore();
267 }
268
269 if ( typeof (myStats[CS_STAT_MAXSP]) == typeof(1)){
270 xBarsWindow.ctx.save();
271
272 xBarsWindow.ctx.fillStyle = "#00F";
273 xBarsWindow.ctx.globalAlpha = 0.5;
274 xBarsWindow.ctx.fillRect(50,10,20,xBarsWindow.sh);
275 xBarsWindow.ctx.fillRect(50,10+xBarsWindow.sh-(myStats[CS_STAT_SP]/myStats[CS_STAT_MAXSP])*xBarsWindow.sh,20,(myStats[CS_STAT_SP]/myStats[CS_STAT_MAXSP])*xBarsWindow.sh);
276 xBarsWindow.ctx.restore();
277 }
278 if ( typeof (myStats[CS_STAT_MAXGRACE]) == typeof(1)){
279 xBarsWindow.ctx.save();
280 xBarsWindow.ctx.fillStyle = "#0FF";
281 xBarsWindow.ctx.globalAlpha = 0.5;
282 xBarsWindow.ctx.fillRect(90,10,20,xBarsWindow.sh);
283 xBarsWindow.ctx.fillRect(90,10+xBarsWindow.sh-(myStats[CS_STAT_GRACE]/myStats[CS_STAT_MAXGRACE])*xBarsWindow.sh,20,(myStats[CS_STAT_GRACE]/myStats[CS_STAT_MAXGRACE])*xBarsWindow.sh);
284 xBarsWindow.ctx.restore();
285 }
286
287 if ( typeof (myStats[CS_STAT_FOOD]) == typeof(1)){
288 xBarsWindow.ctx.save();
289 xBarsWindow.ctx.fillStyle = "#ff0";
290 xBarsWindow.ctx.globalAlpha = 0.5;
291 xBarsWindow.ctx.fillRect(130,10,20,xBarsWindow.sh);
292 xBarsWindow.ctx.fillRect(130,10+xBarsWindow.sh-(myStats[CS_STAT_FOOD]/999)*xBarsWindow.sh,20,(myStats[CS_STAT_FOOD]/999)*xBarsWindow.sh);
293 xBarsWindow.ctx.restore();
294 }
295}
296
244function main (){ 297function main (){
298
299 for (var i = 0;i<255;++i){
300 keys.states[i]=0;
301 };
302
245 if (isMainCalled==true){ 303 if (isMainCalled==true){
246 isMainCalled = true; 304 isMainCalled = true;
247 return; 305 return;
248 } 306 }
249 307
302 xPlayerWindow.contents.appendChild(div); 360 xPlayerWindow.contents.appendChild(div);
303 361
304 div = document.createElement("div"); 362 div = document.createElement("div");
305 div.className = "skills_widnow_content"; 363 div.className = "skills_widnow_content";
306 xPlayerWindow.contents.appendChild(div); 364 xPlayerWindow.contents.appendChild(div);
365
366 div = document.createElement("div");
367 div.className = "statistics_widnow_content";
368 xPlayerWindow.contents.appendChild(div);
369
307 hideAllPlayerTabs(); 370 hideAllPlayerTabs();
308 371
309 xPlayerWindow.show(false); 372 xPlayerWindow.show(false);
310 ctx = canvas.getContext('2d'); 373 ctx = canvas.getContext('2d');
311 374
316 window.addEventListener("mouseup",onMouseUp); 379 window.addEventListener("mouseup",onMouseUp);
317 380
318 //document.getElementsByTagName("body")[0].addEventListener("contextmenu",onClick); 381 //document.getElementsByTagName("body")[0].addEventListener("contextmenu",onClick);
319 //document.addEventListener("contextmenu",onClick); 382 //document.addEventListener("contextmenu",onClick);
320 383
321 output = document.createElement("textarea"); 384 output = $_("textarea");
322 385
323 output.style.opacity ="0.3"; 386 output.style.opacity ="0.3";
324 output.style.filter ="filter:alpha(opacity=30);"; 387 output.style.filter ="filter:alpha(opacity=30);";
325 388
326 output.style.width = "99%" 389 output.style.width = "99%"
327 output.style.height = "70%"; 390 output.style.height = "70%";
328 logWindow.contents.appendChild(output); 391 logWindow.contents.appendChild(output);
329 392
393 xBarsWindow = createWindow("bars",250,300,sw - 280,sh-320);
394 var barsCanvas = $_("canvas");
395 barsCanvas.width = xBarsWindow.sw = xBarsWindow.width() - 20;
396 barsCanvas.height =xBarsWindow.sh = xBarsWindow.height() - 20;
397 xBarsWindow.contents.appendChild(barsCanvas);
398 xBarsWindow.ctx = barsCanvas.getContext("2d");
399 xBarsWindow.ctx.fillStyle = "#000";
400 xBarsWindow.ctx.fillRect(0,0,xBarsWindow.sw,xBarsWindow.sh);
401 xBarsWindow.show(false);
330 xInfoWindow = createWindow("info",300,200,-400,-300); 402 xInfoWindow = createWindow("info",300,200,-400,-300);
331 xInfoWindow.show(false); 403 xInfoWindow.show(false);
332 404
333 } 405 }
334}; 406};
335 407
336var currentWindow=null; 408var currentWindow=null;
337var currentWindowOffset = {x:0,y:0}; 409var currentWindowOffset = {x:0,y:0};
338var currentWindowResize = false; 410var currentWindowResize = false;
339 411
340function showPlayerTab (){ 412function showPlayerTab (e,tn){
413
414 xPlayerWindow.show(true);
341 var tabName = (this.value).split(" ")[0].toLowerCase(); 415 var tabName = tn ? tn : (this.value).split(" ")[0].toLowerCase();
342 416
343 var div; 417 var div;
344 418
345 switch (tabName){ 419 switch (tabName){
346 case "inventory": 420 case "inventory":
361 case "skills": 435 case "skills":
362 hideAllPlayerTabs(); 436 hideAllPlayerTabs();
363 var content = xPlayerWindow.getElementsByClassName("skills_widnow_content")[0]; 437 var content = xPlayerWindow.getElementsByClassName("skills_widnow_content")[0];
364 content.style.display = "block"; 438 content.style.display = "block";
365 updateSkillList(); 439 updateSkillList();
440 break;;
441 case "statistics":
442 hideAllPlayerTabs();
443 var content = xPlayerWindow.getElementsByClassName("statistics_widnow_content")[0];
444 content.style.display = "block";
445 updateStatsList();
446 break;;
366 default: 447 default:
448
367 break; 449 break;
368 } 450 }
369} 451}
370var playerTabs = ["player_widnow_content","floor_widnow_content","spellbook_widnow_content","skills_widnow_content"]; 452var playerTabs = ["player_widnow_content","floor_widnow_content","spellbook_widnow_content","skills_widnow_content","statistics_widnow_content"];
371 453
372function hideAllPlayerTabs (){ 454function hideAllPlayerTabs (){
373 for (var i = 0;i<playerTabs.length;++i){ 455 for (var i = 0;i<playerTabs.length;++i){
374 xPlayerWindow.getElementsByClassName(playerTabs[i])[0].style.display="none"; 456 xPlayerWindow.getElementsByClassName(playerTabs[i])[0].style.display="none";
375 } 457 }
376} 458}
377 459
460function updateStatsList(){
461 var content = xPlayerWindow.getElementsByClassName("statistics_widnow_content")[0];
462 var div;
463 content.innerHTML = "";
464 var tableLeft;
465 var tableRight;
466 var tr;
467 var td;
468
469 content.appendChild(div=$_("div"));
470 div.innerHTML = "Primary/Secondary statistics.";
471 content.appendChild($_("hr"));
472 content.appendChild(tableLeft = $_("table"));
473 tableLeft.style.width="45%";
474 tableLeft.style.float = "left";
475 content.appendChild(tableRight = $_("table"));
476 tableRight.style.width="45%";
477 tableRight.style.float = "right";
478 content.appendChild(div=$_("br"));
479 content.appendChild(div=$_("br"));
480 content.appendChild(div=$_("div"));
481 div.innerHTML = "Resistances.";
482 div.style.clear = "both";
483 content.appendChild($_("hr"));
484
485 var j=0;
486
487 var basicStats = [CS_STAT_STR,CS_STAT_INT,CS_STAT_WIS,CS_STAT_DEX,CS_STAT_CON,CS_STAT_CHA,CS_STAT_WC,CS_STAT_AC,CS_STAT_DAM,/*CS_STAT_ARMOUR,*/CS_STAT_SPEED,CS_STAT_WEAP_SP];
488 var basicStatsNames = ['CS_STAT_STR','CS_STAT_INT','CS_STAT_WIS','CS_STAT_DEX','CS_STAT_CON','CS_STAT_CHA','CS_STAT_WC','CS_STAT_AC','CS_STAT_DAM',/*'CS_STAT_ARMOUR',*/'CS_STAT_SPEED','CS_STAT_WEAP_SP'];
489
490
491 for (i=0;i<basicStats.length;++i){
492
493 var table = i<6 ? tableLeft : tableRight;
494
495 table.appendChild(tr = $_("tr"));
496 tr.index = i;
497
498
499 tr.appendChild(td=$_("td"));
500 td.innerHTML = basicStatsNames[i];
501
502
503 tr.appendChild(td=$_("td"));
504 td.innerHTML = myStats[basicStats[i]];
505
506 };
507 var resNames = ['CS_STAT_RES_PHYS','CS_STAT_RES_MAG','CS_STAT_RES_FIRE','CS_STAT_RES_ELEC','CS_STAT_RES_COLD','CS_STAT_RES_CONF','CS_STAT_RES_ACID',
508 'CS_STAT_RES_DRAIN','CS_STAT_RES_GHOSTHIT','CS_STAT_RES_POISON','CS_STAT_RES_SLOW','CS_STAT_RES_PARA','CS_STAT_TURN_UNDEAD','CS_STAT_RES_FEAR',
509 'CS_STAT_RES_DEPLETE', 'CS_STAT_RES_DEATH', 'CS_STAT_RES_HOLYWORD','CS_STAT_RES_BLIND'];
510
511 content.appendChild(tableLeft = $_("table"));
512 tableLeft.style.width="45%";
513 tableLeft.style.float = "left";
514 content.appendChild(tableRight = $_("table"));
515 tableRight.style.width="45%";
516 tableRight.style.float = "right";
517
518 for (i=CS_STAT_RESIST_START;i<CS_STAT_RESIST_END;++i){
519 var table = i%2==0 ? tableLeft : tableRight;
520
521 table.appendChild(tr = $_("tr"));
522 tr.index = i;
523
524
525 tr.appendChild(td=$_("td"));
526 td.innerHTML = resNames[i-CS_STAT_RESIST_START];
527
528
529 tr.appendChild(td=$_("td"));
530 td.innerHTML = myStats[i];
531
532 }
533
534
535
536
537}
538
539/*
540
541
542 CS_STAT_SKILLINFO = 140,
543 CS_NUM_SKILLS = 50,
544 SF_FIREON = 0x01,
545 SF_RUNON = 0x02,
546 NDI_BLACK = 0,
547 NDI_WHITE = 1,
548 NDI_NAVY = 2,
549 NDI_RED = 3,
550 NDI_ORANGE = 4,
551 NDI_BLUE = 5,
552 NDI_DK_ORANGE = 6,
553 NDI_GREEN = 7,
554 NDI_LT_GREEN = 8,
555 NDI_GREY = 9,
556 NDI_BROWN = 10,
557 NDI_GOLD = 11,
558 NDI_TAN = 12,
559 NDI_MAX_COLOR = 12,
560 NDI_COLOR_MASK = 0x1f,
561 NDI_REPLY = 0x20,
562 NDI_NOCRATE = 0x40,
563 NDI_CLEAR = 0x80,
564 a_none = 0,
565 a_readied = 1,
566 a_wielded = 2,
567 a_worn = 3,
568 a_active = 4,
569 a_applied = 5,
570 F_APPLIED = 0x000F,
571 F_LOCATION = 0x00F0,
572 F_UNPAID = 0x0200,
573 F_MAGIC = 0x0400,
574 F_CURSED = 0x0800,
575 F_DAMNED = 0x1000,
576 F_OPEN = 0x2000,
577 F_NOPICK = 0x4000,
578 F_LOCKED = 0x8000,
579 CF_FACE_NONE = 0,
580 CF_FACE_BITMAP = 1,
581 CF_FACE_XPM = 2,
582 CF_FACE_PNG = 3,
583 CF_FACE_CACHE = 0x10,
584 FACE_FLOOR = 0x80,
585 FACE_COLOR_MASK = 0xf,
586 UPD_LOCATION = 0x01,
587 UPD_FLAGS = 0x02,
588 UPD_WEIGHT = 0x04,
589 UPD_FACE = 0x08,
590 UPD_NAME = 0x10,
591 UPD_ANIM = 0x20,
592 UPD_ANIMSPEED = 0x40,
593 UPD_NROF = 0x80,
594 UPD_SP_MANA = 0x01,
595 UPD_SP_GRACE = 0x02,
596 UPD_SP_LEVEL = 0x04,
597 SOUND_NORMAL = 0,
598 SOUND_SPELL = 1,
599
600 PICKUP_NOTHING = 0x00000000,
601
602 PICKUP_DEBUG = 0x10000000,
603 PICKUP_INHIBIT = 0x20000000,
604 PICKUP_STOP = 0x40000000,
605 PICKUP_NEWMODE = 0x80000000,
606
607 PICKUP_RATIO = 0x0000000F,
608
609 PICKUP_FOOD = 0x00000010,
610 PICKUP_DRINK = 0x00000020,
611 PICKUP_VALUABLES = 0x00000040,
612 PICKUP_BOW = 0x00000080,
613
614 PICKUP_ARROW = 0x00000100,
615 PICKUP_HELMET = 0x00000200,
616 PICKUP_SHIELD = 0x00000400,
617 PICKUP_ARMOUR = 0x00000800,
618
619 PICKUP_BOOTS = 0x00001000,
620 PICKUP_GLOVES = 0x00002000,
621 PICKUP_CLOAK = 0x00004000,
622 PICKUP_KEY = 0x00008000,
623
624 PICKUP_MISSILEWEAPON = 0x00010000,
625 PICKUP_ALLWEAPON = 0x00020000,
626 PICKUP_MAGICAL = 0x00040000,
627 PICKUP_POTION = 0x00080000,
628
629 PICKUP_SPELLBOOK = 0x00100000,
630 PICKUP_SKILLSCROLL = 0x00200000,
631 PICKUP_READABLES = 0x00400000,
632 PICKUP_MAGIC_DEVICE = 0x00800000,
633
634 PICKUP_NOT_CURSED = 0x01000000,
635
636 PICKUP_JEWELS = 0x02000000,
637 PICKUP_FLESH = 0x04000000;
638 */
378 639
379function updateItemsList(){ 640function updateItemsList(){
380 var content = xPlayerWindow.getElementsByClassName("player_widnow_content")[0]; 641 var content = xPlayerWindow.getElementsByClassName("player_widnow_content")[0];
381 642
382 643
383 content.innerHTML = ""; 644 content.innerHTML = "";
384 myItems.each(function (item,i,p){ 645 myItems.each(function (item,i,p){
385 if (isNaN(item.nr_of)) 646 if (isNaN(item.nr_of))
386 return; 647 return;
387 content.appendChild(div = document.createElement("div")); 648 content.appendChild(div = $_("div"));
388 var img = tilesInfo.getImgByFaceNum(item.face); 649 var img = tilesInfo.getImgByFaceNum(item.face);
389 if (img){ 650 if (img){
390 div.innerHTML="<div><input type='hidden' value='"+item.itemId+"'/> <img src='"+img.src+"' alt='' style='width:32px;'/>"+(item.nr_of>1?item.namepl:item.name)+(item.nr_of>1?item.nr_of:"")+"</div>" 651 div.innerHTML="<div><input type='hidden' value='"+item.itemId+"'/> <img src='"+img.src+"' alt='' style='width:32px;'/>"+(item.nr_of>1?item.namepl:item.name)+(item.nr_of>1?item.nr_of:"")+"</div>"
391 }else{ 652 }else{
392 div.innerHTML="<div><input type='hidden' value='"+item.itemId+"'/>"+(item.nr_of>1?item.namepl:item.name)+"</div>" 653 div.innerHTML="<div><input type='hidden' value='"+item.itemId+"'/>"+(item.nr_of>1?item.namepl:item.name)+"</div>"
403 664
404 content.innerHTML = ""; 665 content.innerHTML = "";
405 floorItems.each(function (item,i,p){ 666 floorItems.each(function (item,i,p){
406 if (isNaN(item.nr_of)) 667 if (isNaN(item.nr_of))
407 return; 668 return;
408 content.appendChild(div = document.createElement("div")); 669 content.appendChild(div = $_("div"));
409 var img = tilesInfo.getImgByFaceNum(item.face); 670 var img = tilesInfo.getImgByFaceNum(item.face);
410 if (img){ 671 if (img){
411 div.innerHTML="<div><input type='hidden' value='"+item.itemId+"'/> <img src='"+img.src+"' alt='' style='width:32px;'/>"+(item.nr_of>1?item.namepl:item.name)+(item.nr_of>1?item.nr_of:"")+"</div>" 672 div.innerHTML="<div><input type='hidden' value='"+item.itemId+"'/> <img src='"+img.src+"' alt='' style='width:32px;'/>"+(item.nr_of>1?item.namepl:item.name)+(item.nr_of>1?item.nr_of:"")+"</div>"
412 }else{ 673 }else{
413 div.innerHTML="<div><input type='hidden' value='"+item.itemId+"'/>"+(item.nr_of>1?item.namepl:item.name)+"</div>" 674 div.innerHTML="<div><input type='hidden' value='"+item.itemId+"'/>"+(item.nr_of>1?item.namepl:item.name)+"</div>"
477 xInfoWindow.show(false); 738 xInfoWindow.show(false);
478} 739}
479 740
480function createWindow(title,width,height,x,y){ 741function createWindow(title,width,height,x,y){
481 var windowTemplate = document.getElementById("window_template_container").innerHTML; 742 var windowTemplate = document.getElementById("window_template_container").innerHTML;
482 var div = document.createElement("div"); 743 var div = $_("div");
483 div.innerHTML = windowTemplate; 744 div.innerHTML = windowTemplate;
484 745
485 var xwindow = div.getElementsByClassName("window")[0]; 746 var xwindow = div.getElementsByClassName("window")[0];
486 xwindow.style.left = x+"px"; 747 xwindow.style.left = x+"px";
487 xwindow.style.top = y+"px"; 748 xwindow.style.top = y+"px";
561 822
562 } 823 }
563 return false; 824 return false;
564} 825}
565 826
566function draw(){
567 827
568}
569 828
570function drawStar(ctx,r,x,y){ 829function drawStar(ctx,r,x,y){
571 ctx.save(); 830 ctx.save();
572 if ( typeof (x) !="undefined" && typeof(y)!="undefined"){ 831 if ( typeof (x) !="undefined" && typeof(y)!="undefined"){
573 ctx.translate ( x , y); 832 ctx.translate ( x , y);
759 } 1018 }
760 return false; 1019 return false;
761} 1020}
762 1021
763 1022
764var isRunning = false; 1023function onKeyDown (keyCode){
765var isFiring = false; 1024 switch(keyCode){
766mapsize = {width: 0,height:0}; 1025 case 38:
1026 if (keys.ctrl&&!isRunning){
1027 isRunning = true;
1028 doSend("command run 1");
1029 //doSend("command north")
1030 }
1031 else
1032 if (!isFiring&&keys.shift){
1033 doSend("command fire");
1034 isFiring = true;
1035 }else
1036 doSend("command north");
1037 break;
1038 case 40:
1039 if (keys.ctrl&&!isRunning){
1040 isRunning = true;
1041 doSend("command run 5" );
1042 //doSend("command souh")
1043 }
1044 else
1045 if (!isFiring&&keys.shift){
1046 doSend("command fire");
1047 isFiring = true;
1048 }else
1049 doSend("command south");
1050 break;
1051 case 37:
1052 if (keys.ctrl&&!isRunning){
1053 isRunning = true;
1054 doSend("command run 7" );
1055 // doSend("command west")
1056 }
1057 else
1058 if (!isFiring&&keys.shift){
1059 doSend("command fire");
1060 isFiring = true;
1061 }else
1062 doSend("command west");
1063 break;
1064 case 39:
1065 if (keys.ctrl&&!isRunning){
1066 isRunning = true;
1067 doSend("command run 3" );
1068 //doSend("command west")
1069 }else
1070 if (!isFiring&&keys.shift){
1071 doSend("command fire");
1072 isFiring = true;
1073 }else
1074 doSend("command east");
1075 break;
1076 case 49:
1077 case 9:
1078 xPlayerWindow.show(!xPlayerWindow.visible() );
1079 break;
1080 /*case 49:
1081 skipKeyTest = true;
1082 document.getElementsByTagName("body")[0].appendChild(createCommandWindow());
1083 break;*/
767 1084
1085 case 32:
1086 doSend("command apply");
1087 break;
1088 case 188:
1089 doSend("command get");
1090 break;
1091 case 16:
1092 keys.shift = 1;
1093 break;
1094 case 18:
1095 keys.alt = 1;
1096 break;
1097 case 17:
1098 keys.ctrl = 1;
1099 break;
1100 case 113:
1101 showPlayerTab({},"statistics");
1102 break;
1103 case 114:
1104 showPlayerTab({},"skills");
1105 break;
1106
1107 case 115:
1108 showPlayerTab({},"spellbook");
1109 break;
1110
1111 case 116:
1112 showPlayerTab({},"inventory");
1113 break;
1114 default:
1115 //messageBox(e.keyCode);
1116 break;
1117 }
1118}
1119
1120function onKeyUp(keyCode){
1121 switch(keyCode){
1122 case 38:
1123 if (isRunning&&!keys.ctrl){
1124 doSend("command run_stop");
1125 isRunning = false;
1126 }
1127 if (isFiring&&!keys.shift){
1128 doSend("command fire_stop");
1129 isFiring = false;
1130 }
1131 break;
1132 case 40:
1133 if (isFiring&&!keys.shift){
1134 doSend("command fire_stop");
1135 isFiring = false;
1136 }
1137 if (isRunning&&!keys.ctrl){
1138 doSend("command run_stop");
1139 isRunning = false;
1140 }
1141 break;
1142 case 37:
1143 if (isFiring&&!keys.shift){
1144 doSend("command fire_stop");
1145 isFiring = false;
1146 }
1147 if (isRunning&&!keys.ctrl){
1148 doSend("command run_stop");
1149 isRunning = false;
1150 }
1151 break;
1152 case 39:
1153 if (isFiring&&!keys.shift){
1154 doSend("command fire_stop");
1155 isFiring = false;
1156 }
1157 if (isRunning&&!keys.ctrl){
1158 doSend("command run_stop");
1159 isRunning = false;
1160 }
1161 break;
1162 case 49:
1163 break;
1164 case 16:
1165 keys.shift = 0;
1166 break;
1167 case 18:
1168 keys.alt = 0;
1169 break;
1170 case 17:
1171 keys.ctrl = 0;
1172 if (isRunning&&!keys.ctrl){
1173 doSend("command run_stop");
1174 isRunning = false;
1175 }
1176 break;
1177 default:
1178 //messageBox(e.keyCode);
1179 break;
1180 }
1181
1182}
768function feed_version (data,dataAsArray){ 1183function feed_version (data,dataAsArray){
769 var smapsize = Math.floor(xMapWindow.width()/64); 1184 var smapsize = Math.floor(xMapWindow.width()/64);
770 mapsize.width = mapsize.height = parseInt(smapsize); 1185 mapsize.width = mapsize.height = parseInt(smapsize);
771 smapsize = smapsize +"x" + smapsize; 1186 smapsize = smapsize +"x" + smapsize;
772 map_clear(); 1187 map_clear();
773 doSend('setup tileset 1 excmd 1 smoothing 1 mapinfocmd 1 facecache 1 newmapcmd 1 extmap 1 fxix 3 darkness 1 extcmd 2 msg 2 frag 0 map1acmd 1 spellmon 1 itemcmd 2 exp64 1 widget 1 lzf 0 mapsize ' + smapsize); 1188 doSend('setup tileset 1 excmd 1 smoothing 1 mapinfocmd 1 facecache 1 newmapcmd 1 extmap 1 fxix 3 darkness 1 extcmd 2 msg 2 frag 0 map1acmd 1 spellmon 1 itemcmd 2 exp64 1 widget 1 lzf 0 mapsize ' + smapsize);
774 1189
775
776
777
778
779 window.addEventListener("keydown",function (e){ 1190 window.addEventListener("keydown",function (e){
780 if (skipKeyTest){ 1191 if (skipKeyTest){
781 return; 1192 return;
782 } 1193 }
783 switch(e.keyCode){
784 case 38:
785 //if (keys.ctrl&&!isRunning){
786 // isRunning = true;
787 // doSend("command run north");
788 //doSend("command north")
789 //}
790 //else
791 if (!isFiring&&keys.shift){
792 doSend("command fire");
793 isFiring = true;
794 }
795 doSend("command north");
796 break;
797 case 40:
798 //if (keys.ctrl&&!isRunning){
799 // isRunning = true;
800 // doSend("command run south");
801 // //doSend("command souh")
802 //}
803 //else
804 if (!isFiring&&keys.shift){
805 doSend("command fire");
806 isFiring = true;
807 }
808 doSend("command south");
809 break;
810 case 37:
811 //if (keys.ctrl&&!isRunning){
812 // isRunning = true;
813 // doSend("command run west" );
814 //doSend("command west")
815 //}
816 //else
817 if (!isFiring&&keys.shift){
818 doSend("command fire");
819 isFiring = true;
820 }
821 doSend("command west");
822 break;
823 case 39:
824 if (!isFiring&&keys.shift){
825 doSend("command fire");
826 isFiring = true;
827 }
828 doSend("command east");
829 break;
830 case 49:
831 case 9:
832 xPlayerWindow.show(!xPlayerWindow.visible() );
833 break;
834 /*case 49:
835 skipKeyTest = true;
836 document.getElementsByTagName("body")[0].appendChild(createCommandWindow());
837 break;*/
838 1194
839 case 32: 1195 if (keys.states [e.keyCode]==0){
840 doSend("command apply"); 1196 onKeyDown(e.keyCode);
841 break;
842 case 188:
843 doSend("command get");
844 break;
845 case 16:
846 keys.shift = 1;
847 break;
848 case 18:
849 keys.alt = 1;
850 break;
851 case 17:
852 keys.ctrl = 1;
853 break;
854 default:
855 //messageBox(e.keyCode);
856 break;
857 } 1197 }
1198
1199 keys.states [e.keyCode] = 1;
1200
858 try { 1201 try {
859 e.preventDefault(); 1202 e.preventDefault();
860 }catch (e){ 1203 }catch (e){
861 1204
862 } 1205 }
863 return false; 1206 return false;
864 }); 1207 });
865 window.addEventListener("keyup",function (e){ 1208 window.addEventListener("keyup",function (e){
866 if (skipKeyTest){ 1209 if (skipKeyTest){
867 return; 1210 return;
868 } 1211 }
869 switch(e.keyCode){ 1212 if (keys.states [e.keyCode]==1){
870 case 38: 1213 onKeyUp(e.keyCode);
871 //if (isRunning)
872 //doSend("command run_stop");
873 if (isFiring&&!keys.shift){
874 doSend("command fire_stop");
875 isFiring = false;
876 }
877 break;
878 case 40:
879 if (isFiring&&!keys.shift){
880 doSend("command fire_stop");
881 isFiring = false;
882 }
883 //if (isRunning)
884 //doSend("command run_stop");
885 break;
886 case 37:
887 if (isFiring&&!keys.shift){
888 doSend("command fire_stop");
889 isFiring = false;
890 }
891 //if (isRunning)
892 //doSend("command run_stop");
893 break;
894 case 39:
895 if (isFiring&&!keys.shift){
896 doSend("command fire_stop");
897 isFiring = false;
898 }
899 //if (isRunning)
900 //doSend("command run_stop");
901 break;
902 case 49:
903 break;
904 case 16:
905 keys.shift = 0;
906 break;
907 case 18:
908 keys.alt = 0;
909 break;
910 case 17:
911 keys.ctrl = 0;
912 break;
913 default:
914 //messageBox(e.keyCode);
915 break;
916 } 1214 }
1215 keys.states [e.keyCode] = 0;
917 try { 1216 try {
918 e.preventDefault(); 1217 e.preventDefault();
919 }catch (e){ 1218 }catch (e){
920 1219
921 } 1220 }
1051 while (i<x){ 1350 while (i<x){
1052 mapCell=mapCell.nextCell; 1351 mapCell=mapCell.nextCell;
1053 ++i; 1352 ++i;
1054 } 1353 }
1055 return mapCell.data; 1354 return mapCell.data;
1355}
1356
1357function map_get_cell_ex (x,y){
1358 var i = 0;
1359 var mapRow = Map.firstRow;
1360 while (i<y){
1361 mapRow = mapRow.nextRow;
1362 ++i;
1363 }
1364 i = 0;
1365 var mapCell = mapRow.firstCell;
1366 while (i<x){
1367 mapCell=mapCell.nextCell;
1368 ++i;
1369 }
1370 return mapCell;
1371
1056} 1372}
1057 1373
1058function scroll_map (dx,dy){ 1374function scroll_map (dx,dy){
1059 var x,y; 1375 var x,y;
1060 var tmpDx = dx; 1376 var tmpDx = dx;
1179 ctx.clearRect(0,0,stage.stageWidth,stage.stageHeight); 1495 ctx.clearRect(0,0,stage.stageWidth,stage.stageHeight);
1180 ctx.fillStyle = "#000"; 1496 ctx.fillStyle = "#000";
1181 ctx.fillRect(0,0,canvas.width,canvas.height); 1497 ctx.fillRect(0,0,canvas.width,canvas.height);
1182 1498
1183 for (var i = 0;i<mapsize.height;++i){ 1499 for (var i = 0;i<mapsize.height;++i){
1500 var cell = map_get_cell_ex(0,i);
1184 for (var j=0;j<mapsize.width;++j){ 1501 for (var j=0;j<mapsize.width;++j){
1185 var x = j<<6; 1502 var x = j<<6;
1186 var y = i<<6; 1503 var y = i<<6;
1187 var cellx = map_get_cell(j,i); 1504 var cellx = cell.data;
1188 for (var z=0;z<=2;++z){ 1505 for (var z=0;z<=2;++z){
1189 if (!cellx.tiles[z]) 1506 if (!cellx.tiles[z])
1190 continue; 1507 continue;
1191 var img = tilesInfo.getImgByFaceNum(cellx.tiles[z]); 1508 var img = tilesInfo.getImgByFaceNum(cellx.tiles[z]);
1192 if (img){ 1509 if (img){
1193 ctx.drawImage(img,x,y); 1510 ctx.drawImage(img,x,y);
1194 }else{ 1511 }else{
1195 1512
1196 } 1513 }
1197 } 1514 }
1515 if ((typeof(cellx.stat_hp) == typeof(1))&&cellx.stat_hp>0){
1516 ctx.fillStyle = "#f00";
1517 ctx.fillRect(x,y,((255-cellx.stat_hp)/255)*64,8);
1518
1519 //ctx.fillText(cellx.stat_hp,x,y);
1520 }
1521 cell = cell.nextCell;
1522
1198 } 1523 }
1199 } 1524 }
1200} 1525}
1201 1526
1202function feed_ext (data,dataAsArray){ 1527function feed_ext (data,dataAsArray){
1215 var replyID = parseInt(o[0].split("-")[1]); 1540 var replyID = parseInt(o[0].split("-")[1]);
1216 1541
1217 if (replyID == 100){ 1542 if (replyID == 100){
1218 baseURL = o[1]; 1543 baseURL = o[1];
1219 baseURL = "http://testserver.deliantra.net:13327" + baseURL + ""; 1544 baseURL = "http://testserver.deliantra.net:13327" + baseURL + "";
1220 doSend('requestinfo skill_info'); 1545 doSend('exti ["resource",'+exti.getNextId()+',"exp_table"]');
1546
1221 1547
1222 }else if (replyID==101){ 1548 }else if (replyID==101){
1223 expTableFacenum = parseInt(o[1]); 1549 expTableFacenum = parseInt(o[1]);
1550 doSend ('exti ["resource",'+exti.getNextId() + ',"exp_table", "skill_info", "spell_paths"]');
1551 }else if (replyID==102){
1224 doSend("addme"); 1552 doSend("addme");
1225 } 1553 }
1226 else{ 1554 else{
1227 1555
1228 } 1556 }
1336 this.clientType=0; 1664 this.clientType=0;
1337} 1665}
1338 1666
1339 1667
1340function feed_replyinfo (data){ 1668function feed_replyinfo (data){
1341 doSend('exti ["resource",'+exti.getNextId()+',"exp_table"]'); 1669 return false;
1342
1343 data = data.substr("replyinfo ".length);
1344 var type = data.substr(0,data.indexOf("\n")).trim();
1345 if (type == "skill_info"){
1346 data = data.substr(type.length+1).split("\n");
1347 for (var i=0;i<data.length;++i){
1348 if (data[i].indexOf(":")){
1349 data[i] = (""+data[i]).split(":");
1350 skillNames[parseInt(data[i][0])] = data[i][1];
1351
1352 }
1353
1354
1355 }
1356 }
1357
1358} 1670}
1359 1671
1360function feed_item2 (data,dataAsArray){ 1672function feed_item2 (data,dataAsArray){
1361 var buff = new Buffer(dataAsArray); 1673 var buff = new Buffer(dataAsArray);
1362 buff.position = 6; 1674 buff.position = 6;
1394 for (var i=0;i<floorItems.length;++i){ 1706 for (var i=0;i<floorItems.length;++i){
1395 var item = floorItems[i]; 1707 var item = floorItems[i];
1396 if (item.itemId==null||isNaN(item.itemId)) 1708 if (item.itemId==null||isNaN(item.itemId))
1397 continue; 1709 continue;
1398 var img = tilesInfo.getImgByFaceNum(item.face); 1710 var img = tilesInfo.getImgByFaceNum(item.face);
1399 var div = document.createElement("div"); 1711 var div = $_("div");
1400 xFloorWindow.contents.appendChild(div); 1712 xFloorWindow.contents.appendChild(div);
1401 if (img){ 1713 if (img){
1402 div.innerHTML+="<div><input type='hidden' value='"+item.itemId+"'/><img src='"+img.src+"' alt='' style='width:32px;'/>"+(item.nr_of>1?item.namepl:item.name)+(item.nr_of>1?item.nr_of:"")+"</div>" 1714 div.innerHTML+="<div><input type='hidden' value='"+item.itemId+"'/><img src='"+img.src+"' alt='' style='width:32px;'/>"+(item.nr_of>1?item.namepl:item.name)+(item.nr_of>1?item.nr_of:"")+"</div>"
1403 }else{ 1715 }else{
1404 div.innerHTML+="<div><input type='hidden' value='"+item.itemId+"'/>"+(item.nr_of>1?item.namepl:item.name)+"</div>" 1716 div.innerHTML+="<div><input type='hidden' value='"+item.itemId+"'/>"+(item.nr_of>1?item.namepl:item.name)+"</div>"
1428 content.innerHTML = ""; 1740 content.innerHTML = "";
1429 var table; 1741 var table;
1430 var tr; 1742 var tr;
1431 var td; 1743 var td;
1432 1744
1433 content.appendChild(table = document.createElement("table")); 1745 content.appendChild(table = $_("table"));
1434 table.style.width="100%"; 1746 table.style.width="100%";
1435 if (mySpells.length<=0){ 1747 if (mySpells.length<=0){
1436 return; 1748 return;
1437 } 1749 }
1438 table.appendChild(tr = document.createElement("tr")); 1750 table.appendChild(tr = $_("tr"));
1439 item = mySpells[0]; 1751 item = mySpells[0];
1440 for (s in item){ 1752 for (s in item){
1441 1753
1442 if ((typeof(item[s])==typeof(1))||(typeof(item[s])==typeof(""))){ 1754 if ((typeof(item[s])==typeof(1))||(typeof(item[s])==typeof(""))){
1443 if (s=="tag"){ 1755 if (s=="tag"){
1444 1756
1445 }else if (s=="message"){ 1757 }else if (s=="message"){
1446 1758
1447 }else if (s=="face"){ 1759 }else if (s=="face"){
1448 tr.appendChild(td=document.createElement("td")); 1760 tr.appendChild(td=$_("td"));
1449 td.innerHTML = s; 1761 td.innerHTML = s;
1450 }else{ 1762 }else{
1451 tr.appendChild(td=document.createElement("td")); 1763 tr.appendChild(td=$_("td"));
1452 td.innerHTML = s; 1764 td.innerHTML = s;
1453 } 1765 }
1454 } 1766 }
1455 1767
1456 } 1768 }
1457 1769
1458 1770
1459 mySpells.each(function (item,i,p){ 1771 mySpells.each(function (item,i,p){
1460 1772
1461 table.appendChild(tr = document.createElement("tr")); 1773 table.appendChild(tr = $_("tr"));
1462 tr.index = i; 1774 tr.index = i;
1463 var img = tilesInfo.getImgByFaceNum(item.face); 1775 var img = tilesInfo.getImgByFaceNum(item.face);
1464 1776
1465 var s; 1777 var s;
1466 for (s in item){ 1778 for (s in item){
1472 if (s=="tag"){ 1784 if (s=="tag"){
1473 tr.tag = item[s]; 1785 tr.tag = item[s];
1474 }else if (s=="message"){ 1786 }else if (s=="message"){
1475 tr.message = item[s]; 1787 tr.message = item[s];
1476 }else if (s=="face"){ 1788 }else if (s=="face"){
1477 tr.appendChild(td=document.createElement("td")); 1789 tr.appendChild(td=$_("td"));
1478 td.innerHTML = "<img src='"+img.src+"' alt='' style='width:32px;'/>"; 1790 td.innerHTML = "<img src='"+img.src+"' alt='' style='width:32px;'/>";
1479 }else{ 1791 }else{
1480 tr.appendChild(td=document.createElement("td")); 1792 tr.appendChild(td=$_("td"));
1481 td.innerHTML = item[s]; 1793 td.innerHTML = item[s];
1482 } 1794 }
1483 } 1795 }
1484 1796
1485 } 1797 }
1507 var tableLeft; 1819 var tableLeft;
1508 var tableRight; 1820 var tableRight;
1509 var tr; 1821 var tr;
1510 var td; 1822 var td;
1511 1823
1512 content.appendChild(tableLeft = document.createElement("table")); 1824 content.appendChild(tableLeft = $_("table"));
1513 tableLeft.style.width="45%"; 1825 tableLeft.style.width="45%";
1514 tableLeft.style.float = "left"; 1826 tableLeft.style.float = "left";
1515 content.appendChild(tableRight = document.createElement("table")); 1827 content.appendChild(tableRight = $_("table"));
1516 tableRight.style.width="45%"; 1828 tableRight.style.width="45%";
1517 tableRight.style.float = "right"; 1829 tableRight.style.float = "right";
1518 1830
1519 var j=0; 1831 var j=0;
1520 1832
1523 if (!myStats[i]){ 1835 if (!myStats[i]){
1524 continue; 1836 continue;
1525 } 1837 }
1526 var table = j%2==0 ? tableLeft : tableRight; 1838 var table = j%2==0 ? tableLeft : tableRight;
1527 1839
1528 table.appendChild(tr = document.createElement("tr")); 1840 table.appendChild(tr = $_("tr"));
1529 tr.index = i; 1841 tr.index = i;
1530 1842
1531 1843
1532 tr.appendChild(td=document.createElement("td")); 1844 tr.appendChild(td=$_("td"));
1533 td.innerHTML = skillNames[i]; 1845 td.innerHTML = skillNames[i-CS_STAT_SKILLINFO][0];
1534 1846
1535 for (var k =0 ;k<myStats[i].length;++k){ 1847 for (var k =0 ;k<myStats[i].length;++k){
1536 1848
1537 tr.appendChild(td=document.createElement("td")); 1849 tr.appendChild(td=$_("td"));
1538 td.innerHTML = myStats[i][k]; 1850 td.innerHTML = myStats[i][k];
1539 1851
1540 } 1852 }
1541 tr.appendChild(td=document.createElement("td")); 1853 tr.appendChild(td=$_("td"));
1542 td.innerHTML = Math.floor(myStats[i][1]/expTable[parseInt(myStats[i][0])])*100 + "%"; 1854 td.innerHTML = Math.floor(myStats[i][1]/expTable[parseInt(myStats[i][0])]*100) + "%";
1543 /*tr.addEventListener("click",mySpellItemClick); 1855 /*tr.addEventListener("click",mySpellItemClick);
1544 tr.addEventListener("mouseover",SpellItemMouseOver); 1856 tr.addEventListener("mouseover",SpellItemMouseOver);
1545 tr.addEventListener("mouseout",SpellItemMouseOut); 1857 tr.addEventListener("mouseout",SpellItemMouseOut);
1546 tr.addEventListener("mousemove",SpellItemMouseMove); 1858 tr.addEventListener("mousemove",SpellItemMouseMove);
1547 */ 1859 */
1626 } 1938 }
1627 return false; 1939 return false;
1628} 1940}
1629 1941
1630var expTable = [0,1000,3000,7000,15000,31000,63000,98500,145000,210000,290000,400000,530000,695000,895000,1100000,1400000,1750000,2150000,2650000,3200000,3850000,4650000,5500000,6500000,7650000,8800000,10000000,11500000,13500000,15500000,18000000,20500000,23500000,26500000,30000000,34000000,38500000,43000000,48500000,54000000,60500000,67500000,75000000,83000000,91500000,100000000,110000000,120000000,130000000,145000000,160000000,175000000,190000000,210000000,230000000,250000000,275000000,300000000,325000000,350000000,380000000,410000000,445000000,480000000,520000000,560000000,605000000,655000000,705000000,755000000,810000000,870000000,930000000,990000000,1050000000,1100000000,1200000000,1250000000,1350000000,1450000000,1550000000,1650000000,1800000000,1900000000,2000000000,2150000000,2300000000,2450000000,2600000000,2750000000,2900000000,3100000000,3300000000,3500000000,3750000000,4050000000,4350000000,4750000000,5250000000,5850000000,6650000000,7650000000,9000000000,10500000000,13500000000,17000000000,23000000000,32000000000,47000000000,73000000000,120000000000,215000000000,430000000000,935000000000]; 1942var expTable = [0,1000,3000,7000,15000,31000,63000,98500,145000,210000,290000,400000,530000,695000,895000,1100000,1400000,1750000,2150000,2650000,3200000,3850000,4650000,5500000,6500000,7650000,8800000,10000000,11500000,13500000,15500000,18000000,20500000,23500000,26500000,30000000,34000000,38500000,43000000,48500000,54000000,60500000,67500000,75000000,83000000,91500000,100000000,110000000,120000000,130000000,145000000,160000000,175000000,190000000,210000000,230000000,250000000,275000000,300000000,325000000,350000000,380000000,410000000,445000000,480000000,520000000,560000000,605000000,655000000,705000000,755000000,810000000,870000000,930000000,990000000,1050000000,1100000000,1200000000,1250000000,1350000000,1450000000,1550000000,1650000000,1800000000,1900000000,2000000000,2150000000,2300000000,2450000000,2600000000,2750000000,2900000000,3100000000,3300000000,3500000000,3750000000,4050000000,4350000000,4750000000,5250000000,5850000000,6650000000,7650000000,9000000000,10500000000,13500000000,17000000000,23000000000,32000000000,47000000000,73000000000,120000000000,215000000000,430000000000,935000000000];
1943var spellPaths = [];
1631 1944
1632function feed_fx (data,dataAsArray){ 1945function feed_fx (data,dataAsArray){
1633 1946
1634 var buff = new Buffer(dataAsArray); 1947 var buff = new Buffer(dataAsArray);
1635 buff.position = 3; 1948 buff.position = 3;
1643 var out=""; 1956 var out="";
1644 out+="0123456789abcdef"[c&0xf]; 1957 out+="0123456789abcdef"[c&0xf];
1645 out= "0123456789abcdef"[c>>4]+out; 1958 out= "0123456789abcdef"[c>>4]+out;
1646 nameX+=out; 1959 nameX+=out;
1647 } 1960 }
1648 var img = document.createElement("img"); 1961 var img = $_("img");
1649 1962
1650 var e; 1963 var e;
1651 if (tilesInfo.getImgByFaceNum(id)){ 1964 if (tilesInfo.getImgByFaceNum(id)){
1652 1965
1653 }else{ 1966 }else{
1654 if (nameX.length>3){ 1967 if (nameX.length>3){
1655 if (nameX=="f66e1bc0a5662e59be0253a84ee06c"){ 1968 if (nameX == "5d7a9b7f65deb9e99ce0dd74560eb0"){
1656 var req = new XMLHttpRequest(); 1969 var req = new XMLHttpRequest();
1657 req.open('GET', baseURL+""+nameX, false); 1970 req.open('GET', baseURL+""+nameX, false);
1658 req.send(null); 1971 req.send(null);
1659 if(req.status == 200) 1972 if(req.status == 200)
1660 messageBox(req.responseText); 1973 skillNames = JSON.parse(req.responseText);
1661 /* 1974 }else if (nameX =="6c65c81502952fd958a6f794a0d34c"){
1662 var iframe = $_("iframe"); 1975 var req = new XMLHttpRequest();
1663 appendToBody(iframe); 1976 req.open('GET', baseURL+""+nameX, false);
1664 iframe.style.display = "none"; 1977 req.send(null);
1665 iframe.onload = function (){ 1978 if(req.status == 200)
1666 var doc = null; 1979 spellPaths = JSON.parse(req.responseText);
1667 try{ 1980 }else if (nameX=="f66e1bc0a5662e59be0253a84ee06c"){
1668 doc = iframe.document || iframe.contentDocument || iframe.contentWindow && iframe.contentWindow.document || null; 1981 var req = new XMLHttpRequest();
1669 } catch(err) { 1982 req.open('GET', baseURL+""+nameX, false);
1670 messageBox('error: ' + err.description); 1983 req.send(null);
1671 } 1984 if(req.status == 200)
1672 messageBox (doc.body.innerHTML); 1985 expTable = JSON.parse(req.responseText);
1673 }
1674 iframe.src =baseURL+""+nameX;*/
1675
1676
1677 }else{ 1986 }else{
1678 tilesInfo.listLoading.push (e={name:nameX,id:id,img:img,src:baseURL+""+nameX}); 1987 tilesInfo.listLoading.push (e={name:nameX,id:id,img:img,src:baseURL+""+nameX});
1679 e.img.parent = e; 1988 e.img.parent = e;
1680 e.img.onload = function (){tilesInfo.markAsLoaded(this.parent);} 1989 e.img.onload = function (){tilesInfo.markAsLoaded(this.parent);}
1681 if (!tilesInfo.isLoading){ 1990 if (!tilesInfo.isLoading){
1910 var hi = buff.readUint32(); 2219 var hi = buff.readUint32();
1911 var lo = buff.readUint32(); 2220 var lo = buff.readUint32();
1912 value = [lvl,hi * Math.pow(2,32) + lo]; 2221 value = [lvl,hi * Math.pow(2,32) + lo];
1913 }else{ 2222 }else{
1914 value = buff.readUint16(); 2223 value = buff.readUint16();
2224 if (value > 60000){
2225 value -= 65536;
2226 }
1915 } 2227 }
1916 myStats [stat] = value; 2228 myStats [stat] = value;
1917 //stats_update (stat); 2229 //stats_update (stat);
1918 } 2230 }
1919 2231
2034} 2346}
2035function $_(p){ 2347function $_(p){
2036 if (document.getElementById(p)!=null){ 2348 if (document.getElementById(p)!=null){
2037 return document.getElementById(p); 2349 return document.getElementById(p);
2038 }else{ 2350 }else{
2039 return document.createElement(p); 2351 var ret = document.createElement(p);
2352 unselectable(ret);
2353 return ret;
2040 } 2354 }
2041} 2355}
2042var tiles = []; 2356var tiles = [];
2043 2357
2044function onMessage(evt) 2358function onMessage(evt)

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines