From f381dee8a006d8c197104c698be8967de29c2086 Mon Sep 17 00:00:00 2001 From: Kaan Soral Date: Sat, 22 Oct 2016 19:54:44 +0300 Subject: [PATCH] handle_command + draw_circle --- runner_functions.js | 31 ++++++++++++++++++++++++++----- 1 file changed, 26 insertions(+), 5 deletions(-) diff --git a/runner_functions.js b/runner_functions.js index 73ba8a7..faae878 100644 --- a/runner_functions.js +++ b/runner_functions.js @@ -12,8 +12,9 @@ function get_map() return parent.G.maps[parent.current_map]; } -function set_message(text) +function set_message(text,color) { + if(color) text=""+text+""; $('#gg').html(text); } @@ -109,9 +110,9 @@ function exchange(item_num) parent.exchange(); } -function say(message) // please use "say()" and not socket.emit("say") manually, thank you! :) +function say(message) // please use responsibly, thank you! :) { - parent.socket.emit("say",{message:message,code:true}); + parent.say(message,1); } function move(x,y) @@ -184,6 +185,13 @@ function loot() } } +function handle_command(command,args) // command's are things like "/party" that are entered through Chat - args is a string +{ + // game_log("Command: /"+command+" Args: "+args); + // return true; + return -1; +} + var PIXI=parent.PIXI; // for drawing stuff into the game var drawings=parent.drawings; @@ -191,8 +199,8 @@ var drawings=parent.drawings; function draw_line(x,y,x2,y2,size,color) { // keep in mind that drawings could significantly slow redraws, especially if you don't .destroy() them - if(!color) color=0x00E186; - if(!size) size=2; + if(!color) color=0xF38D00; + if(!size) size=1; e=new PIXI.Graphics(); e.lineStyle(size, color); e.moveTo(x,y); @@ -203,6 +211,19 @@ function draw_line(x,y,x2,y2,size,color) return e; } +// Example: draw_circle(character.real_x,character.real_y,character.range) :) [22/10/16] +function draw_circle(x,y,radius,size,color) +{ + if(!color) color=0x00F33E; + if(!size) size=1; + e=new PIXI.Graphics(); + e.lineStyle(size, color); + e.drawCircle(x,y,radius); + parent.drawings.push(e); + parent.map.addChild(e); + return e; +} + function clear_drawings() { drawings.forEach(function(e){