• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

TypeScript camelot-unchained.registerSlashCommand函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了TypeScript中camelot-unchained.registerSlashCommand函数的典型用法代码示例。如果您正苦于以下问题:TypeScript registerSlashCommand函数的具体用法?TypeScript registerSlashCommand怎么用?TypeScript registerSlashCommand使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了registerSlashCommand函数的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的TypeScript代码示例。

示例1: default

export default () => {
  /**
   * Play the Dance 1 emote
   */
  registerSlashCommand('dance1', 'Dance!', () => client.Emote(emotes.DANCE1));

  /**
   * Play the Dance 2 emote
   */
  registerSlashCommand('dance2', 'Dance!', () => client.Emote(emotes.DANCE2));

  /**
   * Play the Wave 1 emote
   */
  registerSlashCommand('wave1', 'Wave!', () => client.Emote(emotes.WAVE1));

  /**
   * Play the Wave 2 emote
   */
  registerSlashCommand('wave2', 'Wave!', () => client.Emote(emotes.WAVE2));


  /**
   * Stop your repeating emote
   */
  registerSlashCommand('stop', 'Stop!', () => client.Emote(emotes.STOP));

};
开发者ID:JoelTerMeer,项目名称:Camelot-Unchained,代码行数:28,代码来源:emoteCommands.ts


示例2: default

export default () => {
  /**
   * Reload the UI or a single UI Module
   */
  registerSlashCommand('reloadui', 'reload the ui, or a single module if a name is provided', (params: string = '') => {
    client.ReleaseInputOwnership();
    if (params.length > 0) {
      client.ReloadUI(params);
    } else {
      client.ReloadAllUI();
    }
  });

  /**
   * Open a UI Module
   */
  registerSlashCommand('openui', 'open a ui module', (params: string) => {
    if (params.length > 0) client.OpenUI(params);
  });

  /**
   * Close a UI Module
   */
  registerSlashCommand('closeui', 'close a ui module', (params: string) => {
    if (params.length > 0) {
      client.ReleaseInputOwnership();
      client.CloseUI(params);
    }
  });

  /**
   * Show a hidden UI module
   */
  registerSlashCommand('showui', 'show a hidden ui module', (params: string) => {
    if (params.length > 0) client.ShowUI(params);
  })

  /**
   * Hide a UI module
   */
  registerSlashCommand('hideui', 'hide a ui module', (params: string) => {
    if (params.length > 0) client.HideUI(params);
  })
}
开发者ID:Fidaman,项目名称:Camelot-Unchained,代码行数:44,代码来源:uiCommands.ts


示例3: default

export default () => {
  /**
   * Print registered slash command help
   */
  registerSlashCommand('help', 'show available slash commands', () => {
    const commands = getSlashCommands();
    for (let i = 0; i < commands.length; ++i) {
      systemMessage(`${commands[i].command} : ${commands[i].helpText}`);
    }
  });

  /**
   * Unstuck! (kills you and respawns for now)
   */
  registerSlashCommand('stuck', 'get your character unstuck', () => client.Stuck());

  /**
   * Change your zone -- Only works on Hatchery / Debug & Internal builds
   */
  registerSlashCommand('zone', 'change your zone', (params: string) => client.ChangeZone(parseInt(params, 10)));

  /**
   * Change camera mode
   */
  registerSlashCommand('togglecamera', 'toggles the camera mode', () => client.ToggleCamera());

  /**
   * Crash the game -- Yes, this really just crashes the game
   */
  registerSlashCommand('crashthegame', 'CRASH the game client!!', () => client.CrashTheGame());

  /**
   * Get your characters current x, y, z coordinates -- ONLY DURING DEVELOPMENT
   */
  registerSlashCommand('loc', 'tells you your current location', () => {
    setTimeout(() => systemMessage(`${client.locationX},${client.locationY},${client.locationZ}`), 100);
  });
};
开发者ID:JoelTerMeer,项目名称:Camelot-Unchained,代码行数:38,代码来源:generalCommands.ts


示例4: default

export default () => {
  if (!hasClientAPI()) return;

  /**
   * Set field of view
   */
  registerSlashCommand('fov', 'set your field of view, client accepts values from 20 -> 179.9', (params: string) => {
    const argv = parseArgs(params);
    const degrees = argv._.length > 0 ? argv._[0] : 120;
    client.FOV(degrees);
  });

  /**
   * Drop a temporary light at the characters feet
   */
  registerSlashCommand('droplight',
   'drop a light at your location, options: (colors are 0-255) droplight <intensity> <radius> <red> <green> <blue>',
   (params: string) => {
    if (params.length == 0) return;

    const argv = parseArgs(params);
    if (argv._.length > 0) {
      const intensity = argv._.length >= 0 ? argv._[0] : 1;
      const radius = argv._.length > 1 ? argv._[1] : 20;
      const red = argv._.length > 2 ? argv._[2] : 100;
      const green = argv._.length > 3 ? argv._[3] : 100;
      const blue = argv._.length > 4 ? argv._[4] : 100;
      client.DropLight(intensity, radius, red, green, blue);
      return;
    }

    const intensity = argv.intensity ? argv.intensity : 1;
    const radius = argv.radius > 1 ? argv.radius : 20;
    const red = argv.red > 2 ? argv.red : 100;
    const green = argv.green > 3 ? argv.green : 100;
    const blue = argv.blue > 4 ? argv.blue : 100;
    client.DropLight(intensity, radius, red, green, blue);
  });

  /**
   * Remove all lights placed with the drop light command
   */
  registerSlashCommand('resetlights', 'removes all dropped lights from the world', (params: string) => {
    client.ResetLights();
  });

  /**
   * Count all the placed blocks in the world
   */
  registerSlashCommand('countblocks', 'count all placed blocks in the world.', () => {
    client.CountBlocks();
    setTimeout(() => systemMessage(`There are ${client.placedBlockCount} blocks in this world.`), 1000);
  });

  /**
   * Quit the game
   */
  registerSlashCommand('exit', 'quit the game', () => client.Quit());

  /**
   * Build Var handling -- generally for dev use things only
   */
  registerSlashCommand('var', 'Buildvar control: No params = help, var name only = get value, var name and value = set value', (params: string) => {
    if (params.length == 0) {
      client.SendSlashCommand('help');
    } else {
      client.SendSlashCommand(params);
    }
  });
  registerSlashCommand('replacesubstance', 'replace blocks with type args[0] with blocks with type of args[1]', (params: string) => {
    if (params.length == 0) return;
    const argv = parseArgs(params);
    if(argv._.length >= 2){
      client.ReplaceSubstance(argv._[0], argv._[1]);
    }
    return;
  });
  registerSlashCommand('replaceshape', 'replace blocks with shape args[0] with blocks with shape of args[1]', (params: string) => {
    if (params.length == 0) return;
    const argv = parseArgs(params);
    if(argv._.length >= 2){
      client.ReplaceShapes(argv._[0], argv._[1]);
    }
    return;
  });
  registerSlashCommand('replaceselectedsubstance', 'replace blocks with type args[0] with blocks with type of args[1] within selected range', (params: string) => {
    if (params.length == 0) return;
    const argv = parseArgs(params);
    if(argv._.length >= 2){
      client.ReplaceSelectedSubstance(argv._[0], argv._[1]);
    }
    return;
  });
  registerSlashCommand('replaceselectedshape', 'replace blocks with shape args[0] to blocks with shape of args[1] within selected range', (params: string) => {
    if (params.length == 0) return;
    const argv = parseArgs(params);
    if(argv._.length >= 2){
      client.ReplaceSelectedShapes(argv._[0], argv._[1]);
    }
    return;
//.........这里部分代码省略.........
开发者ID:Shane7,项目名称:Camelot-Unchained,代码行数:101,代码来源:clientCommands.ts


示例5: default

export default () => {
  if (!hasClientAPI()) return;

  /**
   * Create a new Warband
   * 
   * usage:
   * 
   *   1. Create a temporary warband, this type of warband will go away after all members leave. This is the standard "Party".
   *    /createWarband
   * 
   *   2. Create a permanent warband, this type of warband will live on until it is abandonded by all its members.
   *    /createWarband Friendship Warriors
   */
  registerSlashCommand('createWarband', 'Create a Warband. Optionally, accepts a name if you wish to make this a permanent Warband.', (name: string = '') => {
    webAPI.warbands.createWarband(client.shardID, client.characterID, false, name)
      .then((response: any) => {
        if (!response.ok) {
          // something went wrong
          console.error(response);

          return;
        }
        
        // success

      });
  });

  /**
   * Invite a player to your warband you are invite
   * 
   * usage:  /invite mehuge
   */

  let friendlyTargetName: string = '';
  client.OnFriendlyTargetNameChanged((name: string) => {
    friendlyTargetName = name;
  });

  registerSlashCommand('invite', 'Invite a player to your warband. Will use either your current friendly target, or a character name if you provide one.',
   (name: string = '') => {
     if (name.length > 0) {
       webAPI.warbands.inviteCharacterToWarbandByName(client.shardID, client.characterID, name)
        .then((response: any) => {
          if (!response.ok) {
            // something went wrong
            console.error(response);
            
            return;
          }

          // success

        });
     } else if (friendlyTargetName && friendlyTargetName !== '') {
       webAPI.warbands.inviteCharacterToWarbandByName(client.shardID, client.characterID, friendlyTargetName)
        .then((response: any) => {
          if (!response.ok) {
            // something went wrong
            console.error(response);
            return;
          }
          // success
        });
     } else {
       systemMessage('No friendly target to invite. Provide a name or select a friendly target and try again.');
     }
  });


  registerSlashCommand('joinWarband', 'Join an existing Warband.', (args: string) => {
    let argv = yargs(args);
    if (argv._.length === 1) {
      // name only

      webAPI.warbands.joinWarbandByName(client.shardID, argv._[0], client.characterID)
        .then((response: any) => {
          if (!response.ok) {
            // something went wrong
            console.error(response);
            return;
          }
          // success
        });

    } else if (argv._.length === 2) {
      // name and invite code

      webAPI.warbands.joinWarbandByName(client.shardID, argv._[0], client.characterID, argv._[1])
        .then((response: any) => {
          if (!response.ok) {
            // something went wrong
            console.error(response);
            return;
          }
          // success
        });

    } else {
//.........这里部分代码省略.........
开发者ID:Shane7,项目名称:Camelot-Unchained,代码行数:101,代码来源:slashCommands.ts



注:本文中的camelot-unchained.registerSlashCommand函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
TypeScript camelot-unchained.client类代码示例发布时间:2022-05-25
下一篇:
TypeScript camelot-unchained.hasClientAPI函数代码示例发布时间:2022-05-25
热门推荐
热门话题
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap