How to use the ranvier.Broadcast.sayAt function in ranvier

To help you get started, we’ve selected a few ranvier examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github RanvierMUD / ranviermud / bundles / ranvier-bug-report / commands / bug.js View on Github external
command: state => (args, player, arg0) => {
    if (!args) {
      return Broadcast.sayAt(player, '<b>Please describe the bug you have found.</b>');
    }

    // TODO: There's absolutely no reason for this to be an event, just move the event code into the command
    player.emit('bugReport', {
      description: args,
      type: arg0
    });

    Broadcast.sayAt(player, `<b>Your ${arg0} report has been submitted as:</b>\n${args}`);
    Broadcast.sayAt(player, '<b>Thanks!</b>');
  }
};
github RanvierMUD / ranviermud / bundles / ranvier-combat / player-events.js View on Github external
}

      let buf = '';
      if (damage.source) {
        buf = `Your <b>${damage.source.name}</b> hit`;
      } else {
        buf = "You hit";
      }

      buf += ` <b>${target.name}</b> for <b>${damage.finalAmount}</b> damage.`;

      if (damage.critical) {
        buf += ' <b>(Critical)</b>';
      }

      B.sayAt(this, buf);

      if (this.equipment.has('wield')) {
        this.equipment.get('wield').emit('hit', damage, target);
      }

      // show damage to party members
      if (!this.party) {
        return;
      }

      for (const member of this.party) {
        if (member === this || member.room !== this.room) {
          continue;
        }

        let buf = '';
github RanvierMUD / ranviermud / bundles / ranvier-commands / commands / inventory.js View on Github external
command : (state) => (args, player) => {
    if (!player.inventory || !player.inventory.size) {
      return Broadcast.sayAt(player, "You aren't carrying anything.");
    }

    Broadcast.at(player, "You are carrying");
    if (isFinite(player.inventory.getMax())) {
      Broadcast.at(player, ` (${player.inventory.size}/${player.inventory.getMax()})`);
    }
    Broadcast.sayAt(player, ':');

    // TODO: Implement grouping
    for (const [, item ] of player.inventory) {
      Broadcast.sayAt(player, ItemUtil.display(item));
    }
  }
};
github RanvierMUD / ranviermud / bundles / ranvier-combat / player-events.js View on Github external
buf = `<b>${damage.attacker.name}</b>`;
      }

      if (damage.source) {
        buf += (damage.attacker ? "'s " : " ") + `<b>${damage.source.name}</b>`;
      } else if (!damage.attacker) {
        buf += "Something";
      }

      buf += ` hit <b>You</b> for <b>${damage.finalAmount}</b> damage.`;

      if (damage.critical) {
        buf += ' <b>(Critical)</b>';
      }

      B.sayAt(this, buf);

      // show damage to party members
      if (!this.party) {
        return;
      }

      for (const member of this.party) {
        if (member === this || member.room !== this.room) {
          continue;
        }

        let buf = '';
        if (damage.attacker) {
          buf = `<b>${damage.attacker.name}</b>`;
        }
github RanvierMUD / ranviermud / bundles / ranvier-combat / player-events.js View on Github external
} else {
          throw e;
        }
      }

      if (!hadActions) {
        return;
      }

      const usingWebsockets = this.socket instanceof WebsocketStream;
      // don't show the combat prompt to a websockets server
      if (!this.hasPrompt('combat') && !usingWebsockets) {
        this.addPrompt('combat', _ => promptBuilder(this));
      }

      B.sayAt(this, '');
      if (!usingWebsockets) {
        B.prompt(this);
      }
    },
github RanvierMUD / ranviermud / bundles / ranvier-classes / skills / fireball.js View on Github external
run: state =&gt; function (args, player, target) {
    const damage = new Damage({
      attribute: 'health',
      amount: getDamage(player),
      attacker: player,
      type: 'physical',
      source: this
    });

    Broadcast.sayAt(player, 'With a wave of your hand, you unleash a fireball at your target!');
    Broadcast.sayAtExcept(player.room, `With a wave of their hand, ${player.name} unleashes a fireball at ${target.name}!`, [player, target]);
    if (!target.isNpc) {
      Broadcast.sayAt(target, `With a wave of their hand, ${player.name} unleashes a fireball at you!`);
    }
    damage.commit(target);
  },
github RanvierMUD / ranviermud / bundles / ranvier-classes / skills / lunge.js View on Github external
run: state =&gt; function (args, player, target) {
    const damage = new Damage({
      attribute: 'health',
      amount: getDamage(player),
      attacker: player,
      type: 'physical',
      source: this
    });

    Broadcast.sayAt(player, 'You shift your feet and let loose a mighty attack!');
    Broadcast.sayAtExcept(player.room, `${player.name} lets loose a lunging attack on ${target.name}!`, [player, target]);
    if (!target.isNpc) {
      Broadcast.sayAt(target, `${player.name} lunges at you with a fierce attack!`);
    }
    damage.commit(target);
  },
github RanvierMUD / ranviermud / bundles / ranvier-commands / commands / quit.js View on Github external
player.save(() => {
      Broadcast.sayAt(player, "Goodbye!");
      Broadcast.sayAtExcept(player.room, `${player.name} disappears.`, player);
      player.socket.emit('close');
    });
  }
github RanvierMUD / ranviermud / bundles / ranvier-classes / player-events.js View on Github external
target = [...this.combatants][0];
          } else {
            target = null;
          }
        } else {
          try {
            const targetSearch = args.split(' ').pop();
            target = Combat.findCombatant(this, targetSearch);
          } catch (e) {
            if (
              e instanceof CombatErrors.CombatSelfError ||
              e instanceof CombatErrors.CombatNonPvpError ||
              e instanceof CombatErrors.CombatInvalidTargetError ||
              e instanceof CombatErrors.CombatPacifistError
            ) {
              return B.sayAt(this, e.message);
            }

            Logger.error(e.message);
          }
        }

        if (!target) {
          return B.sayAt(this, `Use ${ability.name} on whom?`);
        }
      }

      try {
        ability.execute(args, this, target);
      } catch (e) {
        if (e instanceof SkillErrors.CooldownError) {
          if (ability.cooldownGroup) {
github RanvierMUD / ranviermud / bundles / ranvier-classes / effects / potion.buff.js View on Github external
effectRefreshed: function (newEffect) {
      this.startedAt = Date.now();
      Broadcast.sayAt(this.target, "You refresh the potion's magic.");
    },

ranvier

MUD game engine

MIT
Latest version published 6 years ago

Package Health Score

42 / 100
Full package analysis

Popular ranvier functions

Similar packages