0.27.18 • Published 3 years ago
@trim21/cactbot v0.27.18
Cactbot in npm package.
you can install @trim21/cactbot
with npm, so you don't need cactbot source.
./resources
, ./ui/
and ./types/
are generated with tsc
from cactbot source.
./dist
are generated from npm run build
This package is intent to be used with typescript, and your own webpack or esbuild packaging tool.
quick start
dsr.ts
:
import type {
Data as BaseData,
} from '@trim21/cactbot/ui/raidboss/data/06-ew/ultimate/dragonsongs_reprise_ultimate';
interface DSRData {
marked: boolean;
nameToJobID?: Record<string, number>,
p5Lightning: Array<{ name: string, jobID: number }>;
p5DeadCall: Array<{ name: string, jobID: number }>;
tower: Array<{
x: number;
y: number;
num: number;
}>;
}
export default {
zoneId: ZoneId.DragonsongsRepriseUltimate,
initData() {
return {
marked: false,
tower: [],
p5Lightning: [],
p5DeadCall: [],
};
},
triggers: [
{
id: 'DSR ...',
type: 'StartsUsing',
netRegex: NetRegexes.startsUsing({...}),
preRun: (data, matches) => {},
alertText: (data) => {}
}
],
};
index.ts
import trigger from './dsr';
import _Conditions from '@trim21/cactbot/resources/conditions';
import _ContentType from '@trim21/cactbot/resources/content_type';
import _NetRegexes from '@trim21/cactbot/resources/netregexes';
import _Regexes from '@trim21/cactbot/resources/regexes';
import { Responses as _Responses } from '@trim21/cactbot/resources/responses';
import _Outputs from '@trim21/cactbot/resources/outputs';
import _Util from '@trim21/cactbot/resources/util';
import _ZoneId from '@trim21/cactbot/resources/zone_id';
import _ZoneInfo from '@trim21/cactbot/resources/zone_info';
import type { RaidbossData } from '@trim21/cactbot/types/data';
import type { TriggerSet } from '@trim21/cactbot/types/trigger';
import type { EventMap, EventType } from '@trim21/cactbot/types/event';
type IAddOverlayListener = <T extends EventType>(
event: T,
cb: EventMap[T]
) => void;
declare global {
const addOverlayListener: IAddOverlayListener;
const Options: {
PlayerNicks: Record<string, string>;
Triggers: {
push(item: any): void
};
};
// Global variables
const Conditions: typeof _Conditions;
const ContentType: typeof _ContentType;
const NetRegexes: typeof _NetRegexes;
const Regexes: typeof _Regexes;
const Responses: typeof _Responses;
const Outputs: typeof _Outputs;
const Util: typeof _Util;
const ZoneId: typeof _ZoneId;
const ZoneInfo: typeof _ZoneInfo;
// options of modules
// const RaidbossOptions: typeof _RaidbossOptions;
}
Options.Triggers.push(trigger);