Skip to content

Commit

Permalink
add chat source flags (server/admin/moder)
Browse files Browse the repository at this point in the history
  • Loading branch information
Barbosik committed Jul 7, 2016
1 parent eb81636 commit 95da302
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 3 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# MultiOgar
Ogar game server with fast and smooth vanilla physics and multi-protocol support.

Current version: **1.2.19**
Current version: **1.2.20**

## Project Info
![Language](https://img.shields.io/badge/language-node.js-yellow.svg)
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "MultiOgar",
"version": "1.2.19",
"version": "1.2.20",
"description": "Open source Ogar server",
"author": "Barbosik (https://github.com/Barbosik/MultiOgar)",
"homepage": "https://github.com/Barbosik/MultiOgar",
Expand Down
13 changes: 12 additions & 1 deletion src/packet/ChatMessage.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
// Import
var BinaryWriter = require("./BinaryWriter");
var UserRoleEnum = require("../enum/UserRoleEnum");


function ChatMessage(sender, message) {
Expand Down Expand Up @@ -29,7 +30,17 @@ ChatMessage.prototype.build = function (protocol) {

var writer = new BinaryWriter();
writer.writeUInt8(0x63); // message id (decimal 99)
writer.writeUInt8(0x00); // flags for client; for future use

// flags
var flags = 0;
if (this.sender == null)
flags = 0x80; // server message
else if (this.sender.userRole == UserRoleEnum.ADMIN)
flags = 0x40; // admin message
else if (this.sender.userRole == UserRoleEnum.MODER)
flags = 0x20; // moder message

writer.writeUInt8(flags);
writer.writeUInt8(color.r >> 0);
writer.writeUInt8(color.g >> 0);
writer.writeUInt8(color.b >> 0);
Expand Down

0 comments on commit 95da302

Please sign in to comment.