// Generated by CoffeeScript 1.4.0
(function() {

  this.mycard = {};

  this.mycard.room_name = function(name, password, pvp, rule, mode, start_lp) {
    var result;
    if (pvp == null) {
      pvp = false;
    }
    if (rule == null) {
      rule = 0;
    }
    if (mode == null) {
      mode = 0;
    }
    if (start_lp == null) {
      start_lp = 8000;
    }
    if (rule !== 0 || start_lp !== 8000) {
      result = "" + rule + mode + "FFF" + start_lp + ",5,1,";
    } else if (mode === 2) {
      result = "T#";
    } else if (pvp && mode === 1) {
      result = "PM#";
    } else if (pvp) {
      result = "P#";
    } else if (mode === 1) {
      result = "M#";
    } else {
      result = "";
    }
    result += name;
    if (password) {
      result += '$' + password;
    }
    return result;
  };

  this.mycard.join = function(ip, port, room, username, password) {
    var result;
    result = 'mycard://';
    if (username) {
      result += encodeURIComponent(username);
      if (password) {
        result += ':' + encodeURIComponent(password);
      }
      result += '@';
    }
    result += ip + ':' + port + '/' + encodeURIComponent(room);
    return window.location.href = result;
  };

}).call(this);
