repo_name
stringlengths
5
122
path
stringlengths
3
232
text
stringlengths
6
1.05M
miguelcjalmeida/vagante-dsmod
src/transformators/character-selection.ts
<filename>src/transformators/character-selection.ts<gh_stars>1-10 import { IRoomContext, IRoomBlock } from '../rooms/context' import { findAct } from '../finders/find-act' import { RoomNames } from '../rooms/names' import { EntityTypes, ItemTypes, ChestTypes } from '../rooms/types' import { findRoomEntities } from '../finders/find-room-entities' import { IEntity, IChestEntity, IItemEntity } from '../rooms/entities' import { createLotteryPicker } from '../tools/create-lottery-picker' const nextWand = createLotteryPicker({ wands: { proportion: 40, possibilities: [ ItemTypes.IceWand, ItemTypes.FireWand, ItemTypes.LightningWand, ItemTypes.WandOfPestilence, ], }, }) export const characterSelection = (context: IRoomContext) => { console.log('creating character selection screen') const intermission = findAct(context, RoomNames.Intermission) if (!intermission) return const blocks = intermission.rooms[0] blocks.forEach((charSelectRoom) => { const entities = charSelectRoom.entities if (!entities) return setQuantity(entities, 'Item_53', 4599) setQuantity(entities, 'Item_41', 4599) setQuantity(entities, 'Item_42', 4599) setQuantity(entities, 'Item_40', 4599) setQuantity(entities, 'Item_39', 12) setQuantity(entities, 'Item_21', 99) }) console.log('items replaced') } function setQuantity(entities: IEntity[], uid: string, quantity: number) { const items = <IItemEntity>entities.find(x => (<IItemEntity>x).uid === uid) if (items) { items.count = quantity } } function multiply(entities: IEntity[], uid: string, quantity: number) { const items = <IItemEntity>entities.find(x => (<IItemEntity>x).uid === uid) if (!items) return items.itemType = nextWand() for (let i = 0; i < quantity; i += 1) { entities.push(<IItemEntity>{ ...items, itemType: nextWand() }) } } function getSpecialChest(charSelectRoom: IRoomBlock, itemInsideUid: string) { return findRoomEntities<IChestEntity>(charSelectRoom, (x: IEntity) => { if (x.type !== EntityTypes.Chest) return false const chest = <IChestEntity>x return !!chest.links && chest.links.length === 1 && chest.links[0] === itemInsideUid })[0] }
miguelcjalmeida/vagante-dsmod
src/transformators/merchant-intermission/replace-yuria-items.ts
import { IBookEntity, IItemEntity } from '../../rooms/entities' import { createLotteryPicker } from '../../tools/create-lottery-picker' import { AttributeTypes, ItemTypes } from '../../rooms/types' import { IEquipmentProfile, EquipmentSubType, EquipmentType } from '../../item-builder/equipment-profile' import { improveEquipment } from '../../item-builder/improve-equipment' const reaper : IEquipmentProfile = { itemType: ItemTypes.SpacerRod, subType: EquipmentSubType.Rod, type: EquipmentType.PrimaryWeapon, attributes: [ [AttributeTypes.Str, 7], [AttributeTypes.Luk, 1], [AttributeTypes.WeaponLifeSteal, 0], ], } const nextReaperVit = createLotteryPicker( { reapers: { proportion: 1, possibilities: [0, -1, -2, -3, -4, -5], }, }, ) export function replaceYuriaItems(placeholders: IItemEntity[], level: number) { placeholders.forEach((x : IBookEntity) => { const negativeVitBonus = nextReaperVit() - level x.itemType = reaper.itemType x.attributes = [...reaper.attributes] improveEquipment(x, -negativeVitBonus, { minCost: 1, addEffect: true, addStackable: true, enhanceCurrentStats: true, }) const foundVit = x.attributes.find(x => x[0] === AttributeTypes.Vit) if (foundVit) foundVit[1] += negativeVitBonus else x.attributes.push([AttributeTypes.Vit, negativeVitBonus]) }) }
miguelcjalmeida/vagante-dsmod
src/transformators/merchant-intermission/replace-karla-items.ts
import { IItemEntity, IBookEntity } from '../../rooms/entities' import { createLotteryPicker } from '../../tools/create-lottery-picker' import { BookTypes, AttributeTypes, ItemTypes } from '../../rooms/types' import { shuffleArray } from '../../tools/shuffle-array' import { priceUp } from '../../item-builder/price-up' import { equipmentProfiles, EquipmentSubType } from '../../item-builder/equipment-profile' import { improveEquipAttr } from '../../item-builder/improve-equipment-attr' import { improveEquipment } from '../../item-builder/improve-equipment' const nextBook = createLotteryPicker( { book: { proportion: 1, possibilities: [ { skill: BookTypes.SummonMonster, cost: 4 }, { skill: BookTypes.Iceball, cost: 4 }, { skill: BookTypes.EvilTransformation, cost: 5 }, ], }, }, ) const nextEquip = createLotteryPicker({ rod: { proportion: 2, possibilities: equipmentProfiles.filter(x => x.subType === EquipmentSubType.Rod), }, dagger: { proportion: 1, possibilities: equipmentProfiles .filter(x => x.subType === EquipmentSubType.Dagger) .map(x => improveEquipAttr({ ...x }, AttributeTypes.Int, 1)), }, }) export function replaceKarlaItems(placeholders: IItemEntity[], lvl: number) { const equip = nextEquip() const item1 = placeholders[0] item1.itemType = equip.itemType item1.attributes = equip.attributes improveEquipment(item1, lvl) const potion = placeholders[1] potion.count = 3 potion.itemType = ItemTypes.MagicPotion priceUp(potion, 4) placeholders.forEach((x : IBookEntity, i) => { if (i < 2) return const book = nextBook() x.itemType = ItemTypes.Book x.skill = book.skill priceUp(x, book.cost) }) }
miguelcjalmeida/vagante-dsmod
src/transformators/merchant-replacer/set-merchant.ts
<filename>src/transformators/merchant-replacer/set-merchant.ts import { IRoomBlock } from '../../rooms/context' import { IShopEntity, IItemEntity, IEntity } from '../../rooms/entities' import { Merchant } from './merchant-profile' import { addLabel } from '../../manipulators/add-label' import { uniqueId } from '../../tools/unique-id' export interface IShopConfig { items: IItemEntity[] } export function setMerchant(entity: IShopEntity, merchant: Merchant, nest: IEntity[]) { entity.uid = entity.uid ? entity.uid : uniqueId() entity.size = merchant.items.length entity.type = 'Shop' entity.links = merchant.items.map(x => x.uid) merchant.items.forEach(x => nest.push(x)) addLabel(nest, { text: merchant.name, x: entity.x, y: entity.y, labelOffsetX: (entity.facingLeft ? 32 : -32), triggerOffsetX: 16 * -20, triggerOffsetY: 16 * -20, triggerWidth: 16 * 60, triggerHeight: 16 * 60, }) }
miguelcjalmeida/vagante-dsmod
src/manipulators/add-item-into-treasure.ts
<reponame>miguelcjalmeida/vagante-dsmod<gh_stars>1-10 import { IEntity, IItemEntity, IChestEntity } from '../rooms/entities' import { EntityTypes, ItemTypes } from '../rooms/types' import { uniqueId } from '../tools/unique-id' export const addItemIntoTreasure = (nest: IEntity[], treasure: IChestEntity, item: ITreasureItem) => { if (!treasure.uid) { const treasureId = uniqueId() treasure.uid = treasureId } const itemId = uniqueId() if (!treasure.links) treasure.links = [] treasure.links.push(itemId) const position = nest.indexOf(treasure) + 1 nest.splice(position, 0, <IItemEntity>{ x: treasure.x, y: treasure.y, type: EntityTypes.Item, uid: itemId, attributes: item.attributes, cursed: item.cursed, count: item.count, itemType: item.itemType, }) } export interface ITreasureItem { attributes?: any[][] cursed: boolean count: number itemType: ItemTypes }
miguelcjalmeida/vagante-dsmod
src/install.ts
<reponame>miguelcjalmeida/vagante-dsmod<filename>src/install.ts import { installMod } from './modder/install-mod' installMod()
miguelcjalmeida/vagante-dsmod
src/transformators/merchant-intermission/replace-patches-items.ts
import { IItemEntity } from '../../rooms/entities' import { createLotteryPicker } from '../../tools/create-lottery-picker' import { EntityTypes, ItemTypes } from '../../rooms/types' import { nextEquipmentPicker } from '../../item-builder/next-equipment-picker' import { IEquipmentProfile } from '../../item-builder/equipment-profile' import { improveEquipment } from '../../item-builder/improve-equipment' const nextItem = createLotteryPicker<IEquipmentProfile | IItemEntity>({ ...nextEquipmentPicker.lottery, custom: { proportion: 4, possibilities: [ createItem(ItemTypes.RuneOrb2), createItem(ItemTypes.RuneOrb3), createItem(ItemTypes.RuneOrb4), createItem(ItemTypes.TreasureKey, 3), ], }, }) export function replacePatchesItems(placeholders: IItemEntity[], equipValue: number) { placeholders.forEach((x) => { const pick = nextItem() const isEquip = pick.type !== EntityTypes.Item if (isEquip) { const equip = pick as IEquipmentProfile x.itemType = equip.itemType x.attributes = equip.attributes x.cursed = true improveEquipment(x, equipValue) } if (!isEquip) { const item = pick as ICustomItemEntity x.itemType = item.itemType x.count = item.count x.attributes = item.attributes x.type = item.type x.cursed = item.custom ? item.cursed : true } }) } function createItem(itemType: ItemTypes, count: number = 1) : ICustomItemEntity { return { itemType, count, cursed: false, type: EntityTypes.Item, x: 0, y: 0, uid: 'any', custom: false, } } export interface ICustomItemEntity extends IItemEntity { custom?: boolean }
miguelcjalmeida/vagante-dsmod
src/transformators/room-instances.ts
import { IRoomContext, IRoom } from '../rooms/context' import { findAct } from '../finders/find-act' import { RoomNames } from '../rooms/names' import { deepClone } from '../tools/deep-clone' export const roomInstances = (context: IRoomContext) => { multiplyRooms(context, RoomNames.ACT_ONE, 3) multiplyRooms(context, RoomNames.ACT_TWO, 5) multiplyRooms(context, RoomNames.ACT_THREE, 15) multiplyRooms(context, RoomNames.ACT_FOUR, 30) multiplyRooms(context, RoomNames.BRANCH_ONE, 15) multiplyRooms(context, RoomNames.BRANCH_TWO, 20) multiplyRooms(context, RoomNames.BRANCH_THREE, 22) multiplyRooms(context, RoomNames.BRANCH_FOUR, 15) multiplyRooms(context, RoomNames.Intermission, 120) const intermission = findAct(context, RoomNames.Intermission) if (!intermission) return intermission.rooms['0'] = [intermission.rooms['0'][0]] intermission.rooms['4'] = [intermission.rooms['4'][0]] intermission.rooms['9'] = [intermission.rooms['9'][0]] } function multiplyRooms(context: IRoomContext, roomName: RoomNames, randomRoomsCount = 10) { const act = findAct(context, roomName) if (!act) return for (const i in act.rooms) { const room = act.rooms[i] createRandomRooms(room, randomRoomsCount) } } function createRandomRooms(roomBlocks: IRoom, randomRoomsCount: number) { const blocksCount = roomBlocks.length for (let i = 0; i < blocksCount; i += 1) { const block = roomBlocks[i] block.uid += i for (let k = 1; k < randomRoomsCount; k += 1) { const newBlock = deepClone(block) newBlock.uid += k roomBlocks.push(newBlock) } } }
miguelcjalmeida/vagante-dsmod
src/transformators/versioning.ts
import { IRoomContext } from '../rooms/context' import { findAct } from '../finders/find-act' import { RoomNames } from '../rooms/names' import { findRoomEntities } from '../finders/find-room-entities' import { EntityTypes } from '../rooms/types' import { IHoverText } from '../rooms/hovertext' import { config } from '../config/config' export const versioning = (ctx: IRoomContext) => { const intermission = findAct(ctx, RoomNames.Intermission) if (!intermission) return const texts = findRoomEntities<IHoverText>( intermission.rooms[4][0], x => x.type === EntityTypes.HoverText, ) const credits = [ ['Scotilen', 'for modding non-stop'], ['Krystal', 'for Velvette\'s, custom designs, and emotional support'], ['Douchel', 'for bunch of intermissions, custom rooms, and ideas'], ['arifallen23', 'for Fire Keeper!'], ['The Last Ranger', 'for balancing and planting ideas'], ['Blue', 'for making me excited at modding fresh content'], ['Bagelrama', 'for helping me scratch the binary code'], ['ddavidd', 'for doors removing script'], ['seth', 'for breaking the game'], ] if (texts.length < 1) return texts[0].entity.text += ` [${config.version}]` if (texts.length < 2) return texts[1].entity.text += ' ' + credits .map(x => `${x[0]}`) .join(', ') .replace(`${credits[6][0]}, `, `${credits[6][0]},\n`) console.log(texts[1].entity.text) console.log(`build version ${config.version}`) }
miguelcjalmeida/vagante-dsmod
src/rooms/context.ts
<gh_stars>1-10 import { IEntity } from './entities' export interface IRoomContext { acts: IRoomAct[] act_specifications: IActSpecification[] } export interface IRoomAct { _comment: string rooms: IRooms } export interface IActSpecification { _comment: string width: number height: number } export interface IRooms { [key: string]: IRoom } export type IRoom = IRoomBlock[] export interface IRoomBlock { uid: string name: string tiles: IRoomTile[] entities?: IEntity[] } export type IRoomTile = number[]
miguelcjalmeida/vagante-dsmod
src/transformators/merchant-replacer/scenes/default-merchant-scene.ts
import { IShopEntity, IEntity } from '../../../rooms/entities' import { createUniqueLotteryPicker } from '../../../tools/create-unique-lottery-picker' import { andreBuilder, lenigrastBuilder, yoelBuilder, siegwardBuilder, patchesBuilder, greiratBuilder, handmaidBuilder, orbeckBuilder, } from '../merchant-profile' import { setMerchant } from '../set-merchant' export function setDefaultMerchantScene(shops: IShopEntity[], actLevel: number, nest: IEntity[]) { setMerchant(shops[0], andreBuilder(actLevel), nest) setMerchant(shops[1], lenigrastBuilder(actLevel), nest) setMerchant(shops[2], greiratBuilder(actLevel), nest) setMerchant(shops[3], yoelBuilder(actLevel), nest) setMerchant(shops[4], siegwardBuilder(actLevel), nest) setMerchant(shops[8], patchesBuilder(actLevel - 1), nest) setMerchant(shops[6], handmaidBuilder(actLevel), nest) setMerchant(shops[7], orbeckBuilder(actLevel), nest) }
miguelcjalmeida/vagante-dsmod
src/transformators/merchant-intermission/replace-irina-items.ts
import { IItemEntity, IBookEntity } from '../../rooms/entities' import { createLotteryPicker } from '../../tools/create-lottery-picker' import { BookTypes, AttributeTypes, ItemTypes } from '../../rooms/types' import { shuffleArray } from '../../tools/shuffle-array' import { priceUp } from '../../item-builder/price-up' const nextBook = createLotteryPicker( { book: { proportion: 1, possibilities: [ { skill: BookTypes.Lightning, cost: 2 }, { skill: BookTypes.ChainLightning, cost: 3 }, { skill: BookTypes.Eleclance, cost: 1 }, ], }, }, ) export function replaceIrinaItems(placeholders: IItemEntity[]) { const wand = placeholders[0] wand.itemType = ItemTypes.WandOfHealing priceUp(wand, 5) const healthPotion = placeholders[1] healthPotion.count = 3 healthPotion.itemType = ItemTypes.HealingPotion priceUp(healthPotion, 4) placeholders.forEach((x : IBookEntity, i) => { if (i < 2) return const book = nextBook() x.itemType = ItemTypes.Book x.skill = book.skill priceUp(x, book.cost) }) }
miguelcjalmeida/vagante-dsmod
src/manipulators/find-room.ts
<reponame>miguelcjalmeida/vagante-dsmod import { IRoomContext } from '../rooms/context' export const findRoom = (ctx: IRoomContext, uid: string) => { for (const i in ctx.acts) { const act = ctx.acts[i] const rooms = act.rooms for (const j in rooms) { const room = rooms[j] for (const k in room) { const block = room[k] if (block.uid === uid) return block } } } return null }
miguelcjalmeida/vagante-dsmod
src/manipulators/next-item-factory.ts
export const nextItemFactory = <T>(list: T[], onNextItemReset?: (list: T[]) => void) => { let cursor = 0 return () => { if (cursor < list.length) { const result = list[cursor] cursor += 1 return result } if (onNextItemReset) onNextItemReset(list) cursor = 1 return list[0] } } export type INextOf<T> = () => T
miguelcjalmeida/vagante-dsmod
src/config/room-loader.ts
<gh_stars>1-10 import * as fs from 'fs' import { IRoomContext } from '../rooms/context' export function loadRoom(path: string) { console.log(`${path} loading`) const content = fs.readFileSync(path, 'utf8') return JSON.parse(content) as IRoomContext } export function saveRoom(path: string, rooms: IRoomContext) { fs.writeFileSync(path, JSON.stringify(rooms), { encoding:'utf8', flag:'w' }) }
miguelcjalmeida/vagante-dsmod
src/transformators/merchant-intermission.ts
import { IRoomContext, IRoomBlock, IRoom, IRoomAct } from '../rooms/context' import { RoomNames } from '../rooms/names' import { findAct } from '../finders/find-act' import { getActValueFromRoomType } from '../item-builder/get-act-value' import { replaceChests } from './merchant-intermission/replace-chests' import { EntityTypes } from '../rooms/types' import { IShopEntity } from '../rooms/entities' import { setRandomMerchantScene } from './merchant-replacer/scenes/random-merchant-scene' export const merchantIntermission = (ctx: IRoomContext) => { console.log('adding merchants') const intermission = findAct(ctx, RoomNames.Intermission) if (!intermission) return for (const i in intermission.rooms) { if (isNotMerchantMap(i)) continue const room = intermission.rooms[i] room.forEach(block => applyChangesIntoBlock(block, i)) } } function applyChangesIntoBlock(block: IRoomBlock, roomsType: string) { if (!block.entities) return const actLevel = getActValueFromRoomType(roomsType) replaceChests(block, actLevel + 2) const nest = block.entities ? block.entities : [] const shops = nest.filter(x => x.type === EntityTypes.Shop) as IShopEntity[] if (roomsType !== '14') { setRandomMerchantScene(shops, actLevel, nest) } } function isNotMerchantMap(roomsType: string) { return (roomsType === '0' || roomsType === '4' || roomsType === '9') }
miguelcjalmeida/vagante-dsmod
src/item-builder/equipment-profile.ts
import { AttributeTypes, ItemTypes } from '../rooms/types' import { IItemAttributes } from '../rooms/entities' export interface IEquipmentProfilesIndex { [index: string] : IEquipmentProfile } export type IEquipmentProfiles = IEquipmentProfile[] & IEquipmentProfilesIndex export enum EquipmentType { PrimaryWeapon = 1, SecondaryWeapon = 2, Armor = 3, Ring = 4, Amulet = 5, Boots = 6, Glove = 7, Cap = 8, } export enum EquipmentSubType { Bow = 0, OtherRanged = 1, Sword = 2, Dagger = 3, Rod = 4, Caestus = 5, Club = 6, Axe = 7, Armor = 8, Accessory = 9, } export interface IEquipmentProfile { type: EquipmentType subType?: EquipmentSubType attributes: IItemAttributes itemType: ItemTypes } export const equipmentProfiles : IEquipmentProfiles = [] as any addAmulet(ItemTypes.Kerchief) addAmulet(ItemTypes.CrossAmulet, [[AttributeTypes.AmuletReincarnate, 0]]) addAmulet(ItemTypes.MonsterTooth) addAmulet(ItemTypes.MagicStone, [[AttributeTypes.Luk, 1]]) addAmulet(ItemTypes.Compass, [[AttributeTypes.Str, 1]]) addAmulet(ItemTypes.BirdAmulet, [[AttributeTypes.Dex, 1]]) addAmulet(ItemTypes.FeatherTalisman, [[AttributeTypes.FeatherFall, 0]]) addAmulet(ItemTypes.Scarf, [[AttributeTypes.ResistCold, 1]]) addAmulet(ItemTypes.SkullNecklace, [[AttributeTypes.ResistPoison, 1]]) addAmulet(ItemTypes.Locket, [[AttributeTypes.Int, 1]]) addAmulet(ItemTypes.StuddedCollar, [[AttributeTypes.Def, 1]]) addAmulet(ItemTypes.ShrunkenHead, [[AttributeTypes.Int, 1]]) addAmulet(ItemTypes.LionTalisman, [[AttributeTypes.Str, 2]]) addAmulet(ItemTypes.PocketWatch, [[AttributeTypes.Spd, 2]]) addAmulet(ItemTypes.WiseManBeard, [[AttributeTypes.Int, 2]]) addAmulet(ItemTypes.Scarab, [[AttributeTypes.Luk, 2]]) addArmor(ItemTypes.BreastPlate) addArmor(ItemTypes.TravelerTunic) addArmor(ItemTypes.Robes) addArmor(ItemTypes.AnimalSkin) addArmor(ItemTypes.ReinforcedArmor, [[AttributeTypes.Def, 1]]) addArmor(ItemTypes.RangerUniform, [[AttributeTypes.Dex, 1]]) addArmor(ItemTypes.AcolyteRobes, [[AttributeTypes.Int, 1]]) addArmor(ItemTypes.DruidCloak, [[AttributeTypes.Luk, 1]]) addArmor(ItemTypes.FullPlateArmor, [[AttributeTypes.Def, 2]]) addArmor(ItemTypes.LeatherArmor, [[AttributeTypes.Spd, 1]]) addArmor(ItemTypes.HighPriestRobes, [[AttributeTypes.Int, 1], [AttributeTypes.Def, 1]]) addArmor(ItemTypes.BeserkerArmor, [[AttributeTypes.Berserk, 0], [AttributeTypes.Str, 1]]) addArmor(ItemTypes.HalfPlate, [[AttributeTypes.Dex, 1], [AttributeTypes.Def, 1]]) addArmor(ItemTypes.AssassinLeathers, [[AttributeTypes.Dex, 1], [AttributeTypes.Int, 1]]) addArmor(ItemTypes.ConjurerRobes, [[AttributeTypes.Int, 2]]) addArmor(ItemTypes.GoldPlate, [[AttributeTypes.Str, 1], [AttributeTypes.Def, 1]]) addCap(ItemTypes.WoodenHelm) addCap(ItemTypes.OldHood) addCap(ItemTypes.WizardHat, [[AttributeTypes.Int, 1]]) addCap(ItemTypes.BoarHead) addCap(ItemTypes.StuddedHelm, [[AttributeTypes.Def, 1]]) addCap(ItemTypes.VagabondCap, [[AttributeTypes.Luk, 1]]) addCap(ItemTypes.BirdMask, [[AttributeTypes.Dex, 1]]) addCap(ItemTypes.RocHead, [[AttributeTypes.Spd, 1]]) addCap(ItemTypes.GreatHelm, [[AttributeTypes.Def, 1]]) addCap(ItemTypes.FlatCap, [[AttributeTypes.Luk, 1]]) addCap(ItemTypes.DemonMask, [[AttributeTypes.Str, 1]]) addCap(ItemTypes.WolfHead, [[AttributeTypes.Dex, 1]]) addCap(ItemTypes.RoyalCrown, [[AttributeTypes.Dex, 1], [AttributeTypes.Str, 1]]) addCap(ItemTypes.AssassinHood, [[AttributeTypes.Dex, 1], [AttributeTypes.Int, 1]]) addCap(ItemTypes.LunarCirclet, [[AttributeTypes.Int, 1], [AttributeTypes.ResistCold, 1]]) addCap(ItemTypes.DragonHead, [[AttributeTypes.ResistAll, 1]]) addBoots(ItemTypes.PageGreaves) addBoots(ItemTypes.PeddlerBoots, [[AttributeTypes.Spd, 1]]) addBoots(ItemTypes.PeasantShoes) addBoots(ItemTypes.FighterSandals) addBoots(ItemTypes.MercenaryGreaves, [[AttributeTypes.Def, 1]]) addBoots(ItemTypes.HighwaymanBoots, [[AttributeTypes.Spd, 1]]) addBoots(ItemTypes.MageShoes, [[AttributeTypes.Int, 1]]) addBoots(ItemTypes.ColosseumClogs, [[AttributeTypes.Str, 1]]) addBoots(ItemTypes.KnightGreaves, [[AttributeTypes.Def, 1]]) addBoots(ItemTypes.BanditBoots, [[AttributeTypes.Luk, 1]]) addBoots(ItemTypes.WarlockShoes, [[AttributeTypes.Int, 1]]) addBoots(ItemTypes.SavageSandals, [[AttributeTypes.Str, 1]]) addBoots(ItemTypes.ChampionGreaves, [[AttributeTypes.Def, 2]]) addBoots(ItemTypes.AssassinBoots, [[AttributeTypes.Dex, 1], [AttributeTypes.Int, 1]]) addBoots(ItemTypes.WitchBoots, [[AttributeTypes.Int, 2]]) addBoots(ItemTypes.DragonSlayerBoots, [[AttributeTypes.Str, 1], [AttributeTypes.ResistFire, 1]]) addRing(ItemTypes.IncompleteRing) addRing(ItemTypes.Ring, [[AttributeTypes.ResistCold, 1]]) addRing(ItemTypes.DamagedRing, [[AttributeTypes.ResistFire, 1]]) addRing(ItemTypes.GemStuddedRing, [[AttributeTypes.ResistElec, 1]]) addRing(ItemTypes.WoodRing, [[AttributeTypes.ResistPoison, 1]]) addRing(ItemTypes.LeafRing, [[AttributeTypes.Str, 1]]) addRing(ItemTypes.FlowerRing, [[AttributeTypes.Dex, 1]]) addRing(ItemTypes.SunRing, [[AttributeTypes.Vit, 1]]) addRing(ItemTypes.BoneRing, [[AttributeTypes.Spd, 1]]) addRing(ItemTypes.SkullRing, [[AttributeTypes.Luk, 1]]) addRing(ItemTypes.StarRing, [[AttributeTypes.Int, 1]]) addRing(ItemTypes.ShieldRing, [[AttributeTypes.Def, 1]]) addRing(ItemTypes.MisteryRing) addRing(ItemTypes.SwordRing, [[AttributeTypes.FamiliarMelee, 1]]) addRing(ItemTypes.MoonRing) addRing(ItemTypes.EyeRing) addGloves(ItemTypes.PageGloves) addGloves(ItemTypes.PeddlerMits, [[AttributeTypes.Luk, 1]]) addGloves(ItemTypes.ApprenticeGloves) addGloves(ItemTypes.FighterGloves) addGloves(ItemTypes.KnightGauntlets, [[AttributeTypes.Def, 1]]) addGloves(ItemTypes.ThiefGloves, [[AttributeTypes.Dex, 1]]) addGloves(ItemTypes.MysticGloves, [[AttributeTypes.Int, 1]]) addGloves(ItemTypes.GladiatorGloves, [[AttributeTypes.Str, 1], [AttributeTypes.Dex, 1]]) addGloves(ItemTypes.CrusaderGloves, [[AttributeTypes.Def, 1]]) addGloves(ItemTypes.RogueGloves, [[AttributeTypes.Dex, 1]]) addGloves(ItemTypes.VoodooGloves, [[AttributeTypes.Int, 1], [AttributeTypes.Luk, 1]]) addGloves(ItemTypes.SavageGloves, [[AttributeTypes.Str, 1]]) addGloves(ItemTypes.ChampionGauntlets, [[AttributeTypes.Def, 1], [AttributeTypes.Str, 1]]) addGloves(ItemTypes.MasterThiefGloves, [[AttributeTypes.Dex, 1], [AttributeTypes.Greedy, 0]]) addGloves(ItemTypes.SageGloves, [[AttributeTypes.Int, 2]]) addGloves(ItemTypes.DragonSlayerGloves, [[AttributeTypes.Str, 1], [AttributeTypes.ResistFire, 1]]) addPrimaryWeapon(ItemTypes.CopperSword, EquipmentSubType.Sword) addPrimaryWeapon(ItemTypes.SteelSword, EquipmentSubType.Sword) addPrimaryWeapon(ItemTypes.BroadSword, EquipmentSubType.Sword, [[AttributeTypes.Str, 1]]) // tslint:disable-next-line:max-line-length addPrimaryWeapon(ItemTypes.DragonSlayer, EquipmentSubType.Sword, [[AttributeTypes.AllWeaponShock, 0], [AttributeTypes.AllWeaponBurn, 0]]) addPrimaryWeapon(ItemTypes.BoneSword, EquipmentSubType.Sword, [[AttributeTypes.Int, 1]]) addPrimaryWeapon(ItemTypes.Spear, EquipmentSubType.Sword, [[AttributeTypes.SwordMagicPogo, 0]]) addPrimaryWeapon(ItemTypes.Dagger, EquipmentSubType.Dagger) addPrimaryWeapon(ItemTypes.Baselard, EquipmentSubType.Dagger) addPrimaryWeapon(ItemTypes.GlassBlade, EquipmentSubType.Dagger, [[AttributeTypes.Dex, 1]]) addPrimaryWeapon(ItemTypes.BlinkDagger, EquipmentSubType.Dagger, [[AttributeTypes.WeaponBlink, 0]]) addPrimaryWeapon(ItemTypes.MagicRod, EquipmentSubType.Rod) // tslint:disable-next-line:max-line-length addPrimaryWeapon(ItemTypes.SpacerRod, EquipmentSubType.Rod, [[AttributeTypes.Int, 1], [AttributeTypes.Str, 1]]) addPrimaryWeapon(ItemTypes.WaveRod, EquipmentSubType.Rod, [[AttributeTypes.Int, 1]]) addPrimaryWeapon(ItemTypes.Caestus, EquipmentSubType.Caestus, [[AttributeTypes.WeaponKnockback, 1]]) addPrimaryWeapon(ItemTypes.Claw, EquipmentSubType.Caestus, [[AttributeTypes.Dex, 1]]) addPrimaryWeapon(ItemTypes.Qatar, EquipmentSubType.Caestus) addPrimaryWeapon(ItemTypes.WoodenClub, EquipmentSubType.Club) addPrimaryWeapon(ItemTypes.FlangedMace, EquipmentSubType.Club) addPrimaryWeapon(ItemTypes.Hammer, EquipmentSubType.Club) addPrimaryWeapon(ItemTypes.Bludgeon, EquipmentSubType.Club, [[AttributeTypes.WeaponLifeSteal, 0]]) // tslint:disable-next-line:max-line-length addPrimaryWeapon(ItemTypes.MorningStart, EquipmentSubType.Club, [[AttributeTypes.Vit, 1]]) addPrimaryWeapon(ItemTypes.WarHammer, EquipmentSubType.Club, [[AttributeTypes.WeaponKnockback, 4]]) addPrimaryWeapon(ItemTypes.SpearheadedBaton, EquipmentSubType.Club) addPrimaryWeapon(ItemTypes.Flail, EquipmentSubType.Club, [[AttributeTypes.WeaponSlowStrike, 0]]) // tslint:disable-next-line:max-line-length addPrimaryWeapon(ItemTypes.ThunderGodsHammer, EquipmentSubType.Club, [[AttributeTypes.WeaponLightning, 0]]) addPrimaryWeapon(ItemTypes.WoodsmanAxe, EquipmentSubType.Axe, [[AttributeTypes.Str, 1]]) // tslint:disable-next-line:max-line-length addPrimaryWeapon(ItemTypes.BattleAxe, EquipmentSubType.Axe, [[AttributeTypes.Berserk, 0], [AttributeTypes.Str, 1]]) addSecondaryWeapon(ItemTypes.ShortBow, EquipmentSubType.Bow, [[AttributeTypes.Luk, 1]]) addSecondaryWeapon(ItemTypes.LongBow, EquipmentSubType.Bow) addSecondaryWeapon(ItemTypes.CrossBow, EquipmentSubType.Bow, [[AttributeTypes.Dex, 1]]) addSecondaryWeapon(ItemTypes.Boomerang, EquipmentSubType.OtherRanged) addSecondaryWeapon(ItemTypes.EnchantedBoomerang, EquipmentSubType.OtherRanged) function add(equip: IEquipmentProfile) { equipmentProfiles[equip.itemType] = equip equipmentProfiles.push(equip) } function addAmulet(itemType: ItemTypes, attributes: IItemAttributes = []) { add({ itemType, attributes, type: EquipmentType.Amulet, subType: EquipmentSubType.Accessory, }) } function addArmor(itemType: ItemTypes, attributes: IItemAttributes = []) { add({ itemType, attributes, type: EquipmentType.Armor, subType: EquipmentSubType.Armor, }) } function addCap(itemType: ItemTypes, attributes: IItemAttributes = []) { add({ itemType, attributes, type: EquipmentType.Cap, subType: EquipmentSubType.Armor, }) } function addBoots(itemType: ItemTypes, attributes: IItemAttributes = []) { add({ itemType, attributes, type: EquipmentType.Boots, subType: EquipmentSubType.Armor, }) } function addRing(itemType: ItemTypes, attributes: IItemAttributes = []) { add({ itemType, attributes, type: EquipmentType.Ring, subType: EquipmentSubType.Accessory, }) } function addGloves(itemType: ItemTypes, attributes: IItemAttributes = []) { add({ itemType, attributes, type: EquipmentType.Glove, subType: EquipmentSubType.Armor, }) } function addPrimaryWeapon( itemType: ItemTypes, subType: EquipmentSubType, attributes: IItemAttributes = []) { add({ itemType, subType, attributes, type: EquipmentType.PrimaryWeapon, }) } function addSecondaryWeapon( itemType: ItemTypes, subType: EquipmentSubType, attributes: IItemAttributes = []) { add({ itemType, subType, attributes, type: EquipmentType.SecondaryWeapon, }) }
miguelcjalmeida/vagante-dsmod
src/transformators/merchant-intermission/replace-handmaid-items.ts
<reponame>miguelcjalmeida/vagante-dsmod import { IItemEntity } from '../../rooms/entities' import { createLotteryPicker } from '../../tools/create-lottery-picker' import { ItemTypes } from '../../rooms/types' import { shuffleArray } from '../../tools/shuffle-array' import { priceUp } from '../../item-builder/price-up' const nextPotion = createLotteryPicker<number>( { permanent: { proportion: 3, possibilities: [ ItemTypes.StrPotion, ItemTypes.IntPotion, ItemTypes.DexPotion, ItemTypes.LukPotion, ItemTypes.SpdPotion, ItemTypes.VitPotion, ], }, }, shuffleArray, ) export function replaceHandmaidItems(placeholders: IItemEntity[]) { placeholders.forEach((x) => { x.itemType = nextPotion() priceUp(x, 2) }) }
miguelcjalmeida/vagante-dsmod
src/tools/create-unique-lottery-picker.ts
import { ILottery, createLotteryPicker, ILotteryNextOf } from './create-lottery-picker' import { INextOf } from '../manipulators/next-item-factory' import { shuffleArray } from './shuffle-array' export function createUniqueLotteryPicker<T extends Object>(lottery: ILottery<T>) : INextOf<T> { const map = new Map<T, Boolean>() let drawSymbol = true const nextItem = createLotteryPicker(lottery, (results) => { drawSymbol = !drawSymbol shuffleArray(results) }) return () => { while (true) { const item = nextItem() if (map.get(item) !== drawSymbol) { map.set(item, drawSymbol) return item } } } }
miguelcjalmeida/vagante-dsmod
src/transformators/merchant-intermission/replace-giant-items.ts
import { IBookEntity, IItemEntity } from '../../rooms/entities' import { AttributeTypes, ItemTypes } from '../../rooms/types' import { improveEquipment } from '../../item-builder/improve-equipment' export function replaceGiantItems(placeholders: IItemEntity[], level: number) { placeholders.forEach((x : IBookEntity) => { x.itemType = ItemTypes.SkullRing x.attributes = [ [AttributeTypes.Archery, 10], [AttributeTypes.LightRadius, 1], [AttributeTypes.Dex, 2], ] improveEquipment(x, level) }) }
miguelcjalmeida/vagante-dsmod
src/transformators/merchant-replacer/merchant-profile.ts
import { IItemEntity } from '../../rooms/entities' import { replaceAndreItems } from '../merchant-intermission/replace-andre-items' import { uniqueId } from '../../tools/unique-id' import { ItemTypes, EntityTypes } from '../../rooms/types' import { replaceLenigrastItems } from '../merchant-intermission/replace-lenigrast-items' import { replaceYoelItems } from '../merchant-intermission/replace-yoel-items' import { replacePatchesItems } from '../merchant-intermission/replace-patches-items' import { replaceGreiratItems } from '../merchant-intermission/replace-greirat-items' import { replaceHandmaidItems } from '../merchant-intermission/replace-handmaid-items' import { replaceOrbeckItems } from '../merchant-intermission/replace-orbeck-items' import { replaceIrinaItems } from '../merchant-intermission/replace-irina-items' import { replaceKarlaItems } from '../merchant-intermission/replace-karla-items' import { replaceCornyxItems } from '../merchant-intermission/replace-cornyx-items' import { replaceYuriaItems } from '../merchant-intermission/replace-yuria-items' import { replaceSirrisItems } from '../merchant-intermission/replace-sirris-items' import { replaceSiegwardItems } from '../merchant-intermission/replace-siegward-items' import { replaceGiantItems } from '../merchant-intermission/replace-giant-items' import { replaceAnriItems } from '../merchant-intermission/replace-anri-items' import { replaceGavlanItems } from '../merchant-intermission/replace-gavlan-items' export interface Merchant { name: string items: IItemEntity[] } export type MerchantBuilder = (lvl: number) => Merchant export const andreBuilder = (lvl: number) => { const items = createPlaceholders(4) replaceAndreItems(items, lvl) return { items, name: '<NAME>' } } export const lenigrastBuilder = (lvl: number) => { const items = createPlaceholders(4) replaceLenigrastItems(items, lvl) return { items, name: '<NAME>' } } export const yoelBuilder = (lvl: number) => { const items = createPlaceholders(3) replaceYoelItems(items) return { items, name: 'Yoel of Londor' } } export const siegwardBuilder = (lvl: number) => { const items = createPlaceholders(5) replaceSiegwardItems(items) return { items, name: 'Siegward of Catarina' } } export const patchesBuilder = (lvl: number) => { const items = createPlaceholders(4) replacePatchesItems(items, lvl) return { items, name: 'Unbreakable Patches' } } export const greiratBuilder = (lvl: number) => { const items = createPlaceholders(4) replaceGreiratItems(items, lvl) return { items, name: 'Greirat of\nUndead Settlement' } } export const handmaidBuilder = (lvl: number) => { const items = createPlaceholders(5) replaceHandmaidItems(items) return { items, name: 'Shrine Handmaid' } } export const orbeckBuilder = (lvl: number) => { const items = createPlaceholders(5) replaceOrbeckItems(items) return { items, name: 'Orbeck of Vinheim' } } export const irinaBuilder = (lvl: number) => { const items = createPlaceholders(5) replaceIrinaItems(items) return { items, name: 'Irina of Carim' } } export const karlaBuilder = (lvl: number) => { const items = createPlaceholders(5) replaceKarlaItems(items, lvl) return { items, name: 'Karla' } } export const cornyxBuilder = (lvl: number) => { const items = createPlaceholders(5) replaceCornyxItems(items, lvl) return { items, name: 'Cornyx of the\nGreat Swamp' } } export const yuriaBuilder = (lvl: number) => { const items = createPlaceholders(3) replaceYuriaItems(items, lvl) return { items, name: 'Yuria of Londor' } } export const sirrisBuilder = (lvl: number) => { const items = createPlaceholders(4) replaceSirrisItems(items, lvl) return { items, name: 'Sirris of the\nSunless' } } export const giantBuilder = (lvl: number) => { const items = createPlaceholders(1) replaceGiantItems(items, lvl) return { items, name: 'Giant of the\nUndead Settlement' } } export const anriBuilder = (lvl: number) => { const items = createPlaceholders(2) replaceAnriItems(items, lvl) return { items, name: 'Anri of Astora' } } export const gavlanBuilder = (lvl: number) => { const items = createPlaceholders(5) replaceGavlanItems(items, lvl) return { items, name: '<NAME>' } } function createPlaceholders(itemCount: number) { const items : IItemEntity[] = [] for (let i = 0; i < itemCount; i += 1) { items.push({ uid: uniqueId(), x: 0, y: 0, count: 1, attributes: [], cursed: false, itemType: ItemTypes.Boomerang, type: EntityTypes.Item, }) } return items }
miguelcjalmeida/vagante-dsmod
src/manipulators/clone-room-from-template.ts
import { IRoomBlock } from '../rooms/context' import { dsmod } from './get-template' import { findRoom } from './find-room' import { cloneRoom } from './clone-room' export const cloneDsRoomInto = (room1: IRoomBlock, templateRoomUid: string) => { const templateRoom = findRoom(dsmod, templateRoomUid) if (!templateRoom) throw new Error(`given template room was not found '${templateRoomUid}'`) cloneRoom(room1, templateRoom) }
miguelcjalmeida/vagante-dsmod
src/item-builder/basic-lottery.ts
import { createLotteryPicker } from '../tools/create-lottery-picker' import { basicAttributes } from './attributes-by-type' export const nextBasicAttribute = createLotteryPicker({ common: { proportion: 1, possibilities: basicAttributes, }, })
miguelcjalmeida/vagante-dsmod
src/tools/unique-id.ts
let pool = 0 export const uniqueId = () => { pool += 1 return `Obj_${pool}` }
miguelcjalmeida/vagante-dsmod
src/transformators/merchant-intermission/replace-shrine.ts
<gh_stars>1-10 import { IRoomBlock } from '../../rooms/context' import { IShrineEntity } from '../../rooms/entities' import { findRoomEntities } from '../../finders/find-room-entities' import { createLotteryPicker } from '../../tools/create-lottery-picker' import { EntityTypes, ShrineTypes } from '../../rooms/types' import { shuffleArray } from '../../tools/shuffle-array' const nextShrine = createLotteryPicker<ShrineTypes>( { common: { proportion: 2, possibilities: [ShrineTypes.Scholar, ShrineTypes.Well], }, rare: { proportion: 1, possibilities: [ShrineTypes.GodCurse, ShrineTypes.Forge], }, }, shuffleArray, ) export function replaceShrine(room: IRoomBlock) { const shrines = findRoomEntities<IShrineEntity>( room, x => x.type === EntityTypes.Shrine, ) shrines.forEach((x) => { x.entity.godType = nextShrine() }) }
miguelcjalmeida/vagante-dsmod
src/transformators/merchant-intermission/replace-yoel-items.ts
import { IBookEntity, IItemEntity } from '../../rooms/entities' import { createLotteryPicker } from '../../tools/create-lottery-picker' import { BookTypes, AttributeTypes, ItemTypes } from '../../rooms/types' import { shuffleArray } from '../../tools/shuffle-array' import { priceUp } from '../../item-builder/price-up' const nextBook = createLotteryPicker( { common: { proportion: 1, possibilities: [ { skill: BookTypes.MagicMissile, cost: 1 }, { skill: BookTypes.Spirits, cost: 1 }, { skill: BookTypes.FrostNova, cost: 2 }, { skill: BookTypes.Charm, cost: 4 }, { skill: BookTypes.Shockwave, cost: 3 }, ], }, }, ) export function replaceYoelItems(itemPlaceholders: IItemEntity[]) { const placeholders = itemPlaceholders.map((x : IBookEntity) => { x.itemType = ItemTypes.Book x.skill = BookTypes.Blink return x }) placeholders.forEach((x) => { const book = nextBook() x.skill = book.skill priceUp(x, book.cost) }) }
miguelcjalmeida/vagante-dsmod
src/item-builder/improve-equipment-attr.ts
<gh_stars>1-10 import { IItemEntity } from '../rooms/entities' import { AttributeTypes } from '../rooms/types' import { IEquipmentProfile } from './equipment-profile' export function improveEquipAttr( equip: IEquipmentProfile, attrType: AttributeTypes, levelupValue: number, ) { if (!equip.attributes) equip.attributes = [] const equipAttrs = [...equip.attributes] const equipAttr = equipAttrs.find(x => x[0] === attrType) equip.attributes = equipAttrs if (equipAttr) { equipAttr[1] += levelupValue return equip } equipAttrs.push([attrType, levelupValue]) return equip }
miguelcjalmeida/vagante-dsmod
src/transformators/merchant-intermission/replace-sirris-items.ts
<reponame>miguelcjalmeida/vagante-dsmod import { IBookEntity, IItemEntity } from '../../rooms/entities' import { AttributeTypes, ItemTypes } from '../../rooms/types' import { improveEquipAttr } from '../../item-builder/improve-equipment-attr' import { improveEquipment } from '../../item-builder/improve-equipment' import { nextAndreEquipPicker } from './replace-andre-items' const nextArmor = () => { const armor = { ...nextAndreEquipPicker()() } armor.attributes = [...armor.attributes] improveEquipAttr(armor, AttributeTypes.CoinHeal, 0) return armor } export function replaceSirrisItems(placeholders: IItemEntity[], level: number) { placeholders.forEach((x : IBookEntity) => { const armor = nextArmor() x.itemType = armor.itemType x.attributes = armor.attributes improveEquipment(x, level - 1) }) }
miguelcjalmeida/vagante-dsmod
src/rooms/types.ts
<reponame>miguelcjalmeida/vagante-dsmod export enum ChestTypes { Small = 0, Locked = 1, } export enum EntityTypes { Chest = 'Chest', Shop = 'Shop', Item = 'Item', Doodad = 'Doodad', Shrine = 'Shrine', Bonfire = 'Bonfire', Grave = 'Grave', LoadSavePoint = 'LoadSavePoint', Boulder = 'Boulder', BoulderTrap = 'BoulderTrap', Spikes = 'Spikes', HoverText = 'HoverText', Trigger = 'Trigger', PendulumAxe = 'PendulumAxe', SawBlade = 'SawBlade', // monsters Bat = 'Bat', Goblin = 'Goblin', Slime = 'Slime', Crawler = 'Crawler', Divebomber = 'Divebomber', Lurker = 'Lurker', Mimic = 'Mimic', Cultist = 'Cultist', DemonKnight = 'DemonArmor', DemonDog = 'DemonDog', Spprigan = 'Spriggan', ManEatingPlant = 'ManeatingPlant', Spider = 'Spider', Harpy = 'Harpy', Thief = 'Thief', Wisp = 'Wisp', Golem = 'Golem', Zombie = 'Zombie', Hand = 'Hand', Ghost = 'Ghost', ElementalMage = 'ElementalMage', Juggernaut = 'Juggernaut', Swooper = 'Swooper', TikiMan = 'TikiMan', FireTortoise = 'Tortoise', FishMan = 'FishMan', Piranha = 'Piranha', FlyingMech = 'FlyingMech', Samurai = 'MiniSamurai', // bosses GoblinKing = 'BossGoblin', BabyDragon = 'BossDragon', Worm = 'BossWorm', SprigganPlant = 'BossSpriggan', GolemBoss = 'BossGolem', WispBoss = 'BossWisp', Chimera = 'BossChimera', DemonMage = 'DemonMage', Necromancer = 'BossNecromancer', Abomination = 'BossAbomination', ZombieDragon = 'BossZombieDragon', ShadowKnight = 'BossShadowKnight', Behemoth = 'BossBehemoth', BroodDemon = 'BossBroodDemon', TowerSerpent = 'BossTowerSerpent', MechBoss = 'BossMech', FinalBoss = 'FinalBoss', } export enum ItemTypes { TreasureKey = 1, MagicMappingScroll = 34, EnchantScroll = 35, TeleportScroll = 36, ChaosScroll = 37, RechargeScroll = 38, UncurseScroll = 39, IdentifyScroll = 40, JumpScroll = 41, Arrow = 3, ExplosiveArrow = 4, HealingPotion = 6, PoisonPotion = 7, FeatherfallPotion = 8, QuicknessPotion = 9, DefensePotion = 10, VigorPotion = 11, MagicPotion = 12, StrPotion = 13, IntPotion = 14, DexPotion = 15, LukPotion = 16, VitPotion = 17, SpdPotion = 18, FireResistPotion = 19, ColdResistPotion = 20, ElectranceResistPotion = 21, PoisonResistPotion = 22, StrDebuffPotion = 23, IntDebuffPotion = 24, DexDebuffPotion = 25, LukDebuffPotion = 26, VitDebuffPotion = 27, FireResistDebuffPotion = 28, ColdResistDebuffPotion = 29, ElectranceResistDebuffPotion = 30, PoisonResistDebuffPotion = 31, // wand LightningWand = 68, FireWand = 69, IceWand = 70, WandOfChaos = 71, WandOfBlink = 72, WandOfPestilence = 73, WandOfDigging = 74, WandOfHealing = 75, BrokenWand = 76, // dagger Dagger = 45, Baselard = 46, GlassBlade = 47, BlinkDagger = 89, // sword CopperSword = 49, SteelSword = 50, BroadSword = 51, DragonSlayer = 52, BoneSword = 53, // club WoodenClub = 55, Hammer = 56, FlangedMace = 57, MorningStart = 58, WarHammer = 59, Bludgeon = 60, SpearheadedBaton = 61, Flail = 62, ThunderGodsHammer = 90, // axe WoodsmanAxe = 64, BattleAxe = 65, // rod MagicRod = 79, SpacerRod = 80, WaveRod = 81, // spear Spear = 83, // cqc Caestus = 85, Claw = 86, Qatar = 87, // bow ShortBow = 93, LongBow = 94, CrossBow = 95, ArmCannon = 96, // Other ranged Bomb = 100, Boomerang = 101, EnchantedBoomerang = 102, ThrowingDagger = 104, // amulet Kerchief = 107, CrossAmulet = 108, MonsterTooth = 109, MagicStone = 110, Compass = 111, BirdAmulet = 112, FeatherTalisman = 113, Scarf = 114, SkullNecklace = 115, Locket = 116, StuddedCollar = 117, ShrunkenHead = 118, LionTalisman = 119, PocketWatch = 120, WiseManBeard = 121, Scarab = 122, // chest BreastPlate = 155, TravelerTunic = 156, Robes = 157, AnimalSkin = 158, ReinforcedArmor = 159, RangerUniform = 160, AcolyteRobes = 161, DruidCloak = 162, FullPlateArmor = 163, LeatherArmor = 164, HighPriestRobes = 165, BeserkerArmor = 166, HalfPlate = 167, AssassinLeathers = 168, ConjurerRobes = 169, GoldPlate = 170, // cap WoodenHelm = 123, OldHood = 124, WizardHat = 125, BoarHead = 126, StuddedHelm = 127, VagabondCap = 128, BirdMask = 129, RocHead = 130, GreatHelm = 131, FlatCap = 132, DemonMask = 133, WolfHead = 134, RoyalCrown = 135, AssassinHood = 136, LunarCirclet = 137, DragonHead = 138, // boots PageGreaves = 171, PeddlerBoots = 172, PeasantShoes = 173, FighterSandals = 174, MercenaryGreaves = 175, HighwaymanBoots = 176, MageShoes = 177, ColosseumClogs = 178, KnightGreaves = 179, BanditBoots = 180, WarlockShoes = 181, SavageSandals = 182, ChampionGreaves = 183, AssassinBoots = 184, WitchBoots = 185, DragonSlayerBoots = 186, // rings IncompleteRing = 139, Ring = 140, DamagedRing = 141, GemStuddedRing = 142, WoodRing = 143, LeafRing = 144, FlowerRing = 145, SunRing = 146, BoneRing = 147, SkullRing = 148, StarRing = 149, ShieldRing = 150, MisteryRing = 151, SwordRing = 152, MoonRing = 153, EyeRing = 154, // gloves PageGloves = 187, PeddlerMits = 188, ApprenticeGloves = 188, FighterGloves = 190, KnightGauntlets = 191, ThiefGloves = 192, MysticGloves = 193, GladiatorGloves = 194, CrusaderGloves = 195, RogueGloves = 196, VoodooGloves = 197, SavageGloves = 198, ChampionGauntlets = 199, MasterThiefGloves = 200, SageGloves = 201, DragonSlayerGloves = 202, Chicken = 224, GrapplingHook = 212, Book = 216, RuneOrb1 = 218, RuneOrb2 = 219, RuneOrb3 = 220, RuneOrb4 = 221, RoastedChicken = 224, RottenChicken = 225, CookedEye = 226, Sashimi = 227, Candy = 228, PorkChop = 217, WeaponStart = 45, WeaponEnd = 90, BowStart = 93, BowEnd = 95, OtherRangedStart = 101, OtherRangedEnd = 104, } export enum DoodadTypes { Dummy = 18, Table = 1, } export enum ShrineTypes { Deranged = 0, Death = 1, Well = 2, Forge = 3, GodCurse = 4, Scholar = 5, } export enum BookTypes { Dash = 0, FireShield = 1, Blink = 2, Iceball = 3, Fireball = 4, Lightning = 5, ChainLightning = 6, Spirits = 7, MagicMissile = 8, Shockwave = 9, Eleclance = 10, FrostNova = 11, FlamePillar = 12, EvilTransformation = 13, Charm = 14, SummonMonster = 15, } export enum AttributeTypes { WeaponLifeSteal = 'ATTRIBUTE_LIFE_STEAL', WeaponEmitsSpirits = 'ATTRIBUTE_EMITS_SPIRITS', WeaponKnockback = 'ATTRIBUTE_KNOCKBACK', WeaponFairyFire = 'ATTRIBUTE_FAIRY_FIRE', WeaponSlowStrike = 'ATTRIBUTE_SLOW_ON_STRIKE', WeaponBlink = 'ATTRIBUTE_BLINK', WeaponLightning = 'ATTRIBUTE_LIGHTNING', WeaponMidas = 'ATTRIBUTE_MIDAS', WeaponSplashAttack = 'ATTRIBUTE_SPLASH_ATTACK', WeaponStrongPoison = 'ATTRIBUTE_STRONG_POISON', WeaponPoisonCoat = 'ATTRIBUTE_WEAPON_POISON', AllWeaponBurn = 'ATTRIBUTE_BURN', AllWeaponFreeze = 'ATTRIBUTE_FREEZE', AllWeaponShock = 'ATTRIBUTE_SHOCK', BowWeightless = 'ATTRIBUTE_ARROW_NO_GRAVITY', BowLight = 'ATTRIBUTE_ARROW_LIGHT', BowTrajectory = 'ATTRIBUTE_ARROW_TRAJECTORY', BowMulti = 'ATTRIBUTE_ARROW_MULTI', BowHomingArrow = 'ATTRIBUTE_HOMING_ARROW', Berserk = 'ATTRIBUTE_BERSERK', DoubleJump = 'ATTRIBUTE_DOUBLE_JUMP', TrippleJump = 'ATTRIBUTE_TRIPPLE_JUMP', FireWalk = 'ATTRIBUTE_FIRE_WALK', Bouncy = 'ATTRIBUTE_BOUNCY', SuperSpeed = 'ATTRIBUTE_SUPER_SPEED', GrabWalls = 'ATTRIBUTE_GRAB_WALLS', ThrowHard = 'ATTRIBUTE_THROWING', TrueSight = 'ATTRIBUTE_TRUE_SIGHT', FamiliarShooter = 'ATTRIBUTE_FAMILIAR_SHOOTER', FamiliarHealer = 'ATTRIBUTE_FAMILIAR_HEALER', FamiliarMelee = 'ATTRIBUTE_FAMILIAR_MELEE', LightRadius = 'ATTRIBUTE_LIGHT_RADIUS', JumpDamage = 'ATTRIBUTE_JUMP_DAMAGE', HeavySink = 'ATTRIBUTE_HEAVY', JumpHigh = 'ATTRIBUTE_JUMP_SPEED', WalkChargeDamage = 'ATTRIBUTE_WALK_CHARGE_DAMAGE', SwimLikeFish = 'ATTRIBUTE_SWIM', BreathUnderWater = 'ATTRIBUTE_BREATH_UNDERWATER', FeatherFall = 'ATTRIBUTE_FEATHERFALL', LightFeet = 'ATTRIBUTE_SNEAKY', PhaseVertical = 'ATTRIBUTE_PHASE_VERTICAL', PhaseHorizontal = 'ATTRIBUTE_PHASE_HORIZONTAL', Merchant = 'ATTRIBUTE_MERCHANT', BoulderProtection = 'ATTRIBUTE_HARD_HEAD', SlowAura = 'ATTRIBUTE_SLOW_AURA', FreezeAura = 'ATTRIBUTE_FREEZE_AURA', FlameAura = 'ATTRIBUTE_FLAME_AURA', Greedy = 'ATTRIBUTE_GREEDY', Slaying = 'ATTRIBUTE_SLAYING', HeavyPunch = 'ATTRIBUTE_PUNCH', Archery = 'ATTRIBUTE_RANGE_FOCUS', CoinHeal = 'ATTRIBUTE_COIN_HEAL', BurnReflect = 'ATTRIBUTE_ARMOR_BURN', ShockReflect = 'ATTRIBUTE_ARMOR_SHOCK', FreezeReflect = 'ATTRIBUTE_ARMOR_FREEZE', PoisonReflect = 'ATTRIBUTE_ARMOR_POISON', DamageReflect = 'ATTRIBUTE_ARMOR_REFLECT', SpiritsReflect = 'ATTRIBUTE_ARMOR_SPIRITS', MistReflect = 'ATTRIBUTE_ARMOR_INCORPOREAL', SpikeProtection = 'ATTRIBUTE_SPIKE_BREAKING', FlappyJump = 'ATTRIBUTE_FLAPPY_JUMP', RepulseAttackers = 'ATTRIBUTE_REPULSE_ATTACKERS', ProjectileDeflection = 'ATTRIBUTE_PROJECTILE_DEFLECTION', ReachUpgrade = 'ATTRIBUTE_WEAPON_REACH', FamiliarMaster = 'ATTRIBUTE_FAMILIAR_MASTER', Zygox = 'ATTRIBUTE_ZYGOX', Seltioc = 'ATTRIBUTE_SELTIOC', GodCurse = 'ATTRIBUTE_GOD_CURSE', ArmorDA = 'ATTRIBUTE_MORTAL', AmuletReincarnate = 'ATTRIBUTE_REINCARNATE', BootsFireJump = 'ATTRIBUTE_FIRE_JUMP', CapSpellCost = 'ATTRIBUTE_SPELL_COST_REDUCTION', ArmorMagicShield = 'ATTRIBUTE_MAGIC_SHIELD', GloveExplosionAffinity = 'ATTRIBUTE_EXPLOSION_AFFINITY', RingChestSpirits = 'ATTRIBUTE_CHEST_SPIRITS', RingChestHeal = 'ATTRIBUTE_CHEST_HEAL', SwordMagicPogo = 'ATTRIBUTE_MAGIC_POGO', Str = 'ATTRIBUTE_STR', Dex = 'ATTRIBUTE_DEX', Vit = 'ATTRIBUTE_VIT', Spd = 'ATTRIBUTE_SPD', Int = 'ATTRIBUTE_INT', Luk = 'ATTRIBUTE_LUK', Def = 'ATTRIBUTE_DEFENSE', Sta = 'ATTRIBUTE_STA', ResistFire = 'ATTRIBUTE_RESIST_FIRE', ResistCold = 'ATTRIBUTE_RESIST_COLD', ResistPoison = 'ATTRIBUTE_RESIST_POISON', ResistElec = 'ATTRIBUTE_RESIST_ELEC', ResistAll = 'ATTRIBUTE_RESIST_ALL', }
miguelcjalmeida/vagante-dsmod
src/transformators/merchant-intermission/replace-greirat-items.ts
<reponame>miguelcjalmeida/vagante-dsmod<gh_stars>1-10 import { ItemTypes, EntityTypes, BookTypes } from '../../rooms/types' import { IItemEntity, IBookEntity } from '../../rooms/entities' import { createLotteryPicker } from '../../tools/create-lottery-picker' import { improveEquipment, IImproveEquipConfig } from '../../item-builder/improve-equipment' import { priceUp } from '../../item-builder/price-up' const nextGimmickItem = createLotteryPicker<(lvl : number) => IItemEntity>({ explosives: { proportion: 18, possibilities: [ () => createItem(ItemTypes.Bomb, 3), () => createItem(ItemTypes.ExplosiveArrow, 16), ], }, throwDagger: { proportion: 18, possibilities: [ lvl => createImprovedItem(ItemTypes.ThrowingDagger, lvl, { addEffect: true, addStackable: false, enhanceCurrentStats: false, minCost: 1, }), ], }, wands: { proportion: 2, possibilities: [ () => createItem(ItemTypes.LightningWand), () => createItem(ItemTypes.FireWand), () => createItem(ItemTypes.IceWand), () => createItem(ItemTypes.WandOfBlink), () => createItem(ItemTypes.WandOfChaos), () => createItem(ItemTypes.WandOfDigging), () => createItem(ItemTypes.WandOfPestilence), lvl => createImprovedItem(ItemTypes.BrokenWand, lvl + 1), ], }, healingWand: { proportion: 1, possibilities: [ () => createItem(ItemTypes.WandOfHealing), ], }, boomerang: { proportion: 8, possibilities: [ lvl => createImprovedItem(ItemTypes.Boomerang, lvl), ], }, hook: { proportion: 4, possibilities: [ () => createItem(ItemTypes.GrapplingHook), ], }, }) const nextBook = createLotteryPicker({ books: { proportion: 1, possibilities: [ { skill: BookTypes.Dash, cost: 2 }, { skill: BookTypes.Blink, cost: 1 }, ], }, }) const nextItemReplacer = createLotteryPicker({ gimmicks: { proportion: 2, possibilities: [ (placeholder: IItemEntity, level: number) => { const item = nextGimmickItem()(level) placeholder.itemType = item.itemType placeholder.cursed = false placeholder.count = item.count placeholder.attributes = item.attributes placeholder.type = EntityTypes.Item }, ], }, books: { proportion: 1, possibilities: [ (placeholder: IBookEntity, level: number) => { const book = nextBook() placeholder.itemType = ItemTypes.Book placeholder.skill = book.skill priceUp(placeholder, book.cost) }, ], }, }) export function replaceGreiratItems(placeholders: IItemEntity[], level: number) { placeholders.forEach(x => nextItemReplacer()(x, level)) } function createItem(type: ItemTypes, quantity = 1) { return <IItemEntity>{ count: quantity, cursed: false, itemType: type, type: EntityTypes.Item, } } function createImprovedItem(type: ItemTypes, equipValue: ItemTypes, config?: IImproveEquipConfig) { const item = createItem(type) item.attributes = [] improveEquipment(item, equipValue, config) return item }
miguelcjalmeida/vagante-dsmod
src/transformators/merchant-intermission/replace-siegward-items.ts
import { IBookEntity, IItemEntity } from '../../rooms/entities' import { createLotteryPicker } from '../../tools/create-lottery-picker' import { BookTypes, AttributeTypes, ItemTypes } from '../../rooms/types' import { priceUp } from '../../item-builder/price-up' const nextFood = createLotteryPicker( { foods: { proportion: 1, possibilities: [ { food: ItemTypes.PorkChop, cost: 0, count: 1 }, { food: ItemTypes.Chicken, cost: -12, count: 1 }, { food: ItemTypes.Sashimi, cost: -12, count: 3 }, { food: ItemTypes.Candy, cost: -12, count: 1 }, { food: ItemTypes.CookedEye, cost: -12, count: 2 }, ], }, }, ) export function replaceSiegwardItems(placeholders: IItemEntity[]) { placeholders.forEach((x) => { const item = nextFood() x.itemType = item.food x.cursed = true x.count = item.count priceUp(x, item.cost) }) }
miguelcjalmeida/vagante-dsmod
src/item-builder/improve-equipment.ts
import { createLotteryPicker, ILottery, ILotteryNextOf } from '../tools/create-lottery-picker' import { IItemEntity, IItemAttributes } from '../rooms/entities' import { nextBasicAttribute } from './basic-lottery' import { IAttributeProfile, attributeProfiles } from './attribute-profile' import { equipmentProfiles, IEquipmentProfile, EquipmentType, EquipmentSubType, } from './equipment-profile' import { INextOf } from '../manipulators/next-item-factory' import { nextNonRestrictToEffectAttribute, nextWeaponEffectAttributes, nextBowEffectAttribute, nextOtherRangedEffectAttribute, nextAttributeByRestrictTo, nextStackableAttribute, } from './attributes-by-type' import { deepClone } from '../tools/deep-clone' import { AttributeTypes } from '../rooms/types' enum AttrPickCommand { Stackable = 1, Effect = 2, } const nextEnhanceableAttribute = createLotteryPicker({ basic: { proportion: 2, possibilities: [() => nextBasicAttribute()], }, other: { proportion: 1, possibilities: [() => nextStackableAttribute()], }, }) export function improveEquipment( equip: IItemEntity, actValue: number, optConfig?: IImproveEquipConfig, ) { const config = optConfig ? optConfig : getDefaultConfig() if (!equip.attributes) equip.attributes = [] equip.attributes = deepClone(equip.attributes) const nextStackableAttr = getEnhanceableAttrs(equip.attributes, config) const nextEffect = getPossibleEffects(equip) let currentEquipValue = 0 const nextAttrCommand = getNextCommandPicker(config) while (currentEquipValue < actValue) { const command = nextAttrCommand() const attrToImprove = pickNextAttrToImprove( command, equip, nextEffect, currentEquipValue, actValue, nextStackableAttr) if (!attrToImprove) return const attrCost = Math.max(config.minCost, attrToImprove.cost) if (currentEquipValue + attrCost > actValue) continue currentEquipValue += attrCost improveEquipmentWith(equip.attributes, attrToImprove) } } function pickNextAttrToImprove( command: AttrPickCommand, equip: IItemEntity, nextEffect: INextOf<IAttributeProfile>, currentEquipValue: number, actValue: number, nextStackableAttr: ILotteryNextOf<IAttributeProfile> ) { if (!equip.attributes) return if (command === AttrPickCommand.Effect) { return grabNextPossibleEffect(equip.attributes, nextEffect, currentEquipValue, actValue) } if (command === AttrPickCommand.Stackable) { return nextStackableAttr() } return null } function grabNextPossibleEffect( currentAttrs: IItemAttributes, next: INextOf<IAttributeProfile>, currentEquipValue: number, maxValue: number, ) { while (true) { const attr = next() if (currentEquipValue + attr.cost <= maxValue) { const alreadyHasAttr = !!currentAttrs.find(x => x[0] === attr.type) if (!alreadyHasAttr) return attr } } } function getPossibleEffects(equip: IItemEntity) { const equipProfile = equipmentProfiles[equip.itemType] if (equipProfile === undefined) return nextNonRestrictToEffectAttribute return getPossibleEffectsByType(equipProfile) } function getPossibleEffectsByType(equip: IEquipmentProfile) { if (equip.type === EquipmentType.PrimaryWeapon) { return nextWeaponEffectAttributes } if (equip.subType === EquipmentSubType.Bow) { return nextBowEffectAttribute } if (equip.subType === EquipmentSubType.OtherRanged) { return nextOtherRangedEffectAttribute } if (equip.type === EquipmentType.Amulet) { return nextAttributeByRestrictTo[equip.type] } return nextNonRestrictToEffectAttribute } function getEnhanceableAttrs(allEquipAttrs: IItemAttributes, config: IImproveEquipConfig) { const equipsStackableAttrs = getStackableEquipAttrs(allEquipAttrs) const nextExtraAttrsToImprove = getExtraAttrsToImprovePicker(equipsStackableAttrs) nextExtraAttrsToImprove() const lottery : ILottery<IAttributeProfile> = {} if (config.addStackable) { lottery.extraStats = { proportion: 4, possibilities: nextExtraAttrsToImprove(), } } if (config.enhanceCurrentStats) { lottery.improveCurrentStats = { proportion: 6, possibilities: equipsStackableAttrs, } } return createLotteryPicker(lottery) } function getExtraAttrsToImprovePicker( equipStackableAttrs: IAttributeProfile[], ) { const lotteryConfig : ILottery<IAttributeProfile[]> = {} const maxExtraAttrs = Math.max(3 - equipStackableAttrs.length, 1) for (let i = 0; i < maxExtraAttrs; i += 1) { const possibilities = [] const attrsVarietyCount = i + 1 for (let j = 0; j < attrsVarietyCount; j += 1) { const attr = nextEnhanceableAttribute()() possibilities.push(attr) } lotteryConfig[`extraAttr${i}`] = { possibilities: [possibilities], proportion: attrsVarietyCount, } } return createLotteryPicker(lotteryConfig) } function getStackableEquipAttrs(equipAttrs: IItemAttributes) { return equipAttrs .filter((attr) => { const attrProfile = attributeProfiles[attr[0]] return attrProfile !== undefined && attrProfile.stackable }) .map(attr => attributeProfiles[attr[0]]) } function improveEquipmentWith(equipAttrs: IItemAttributes, attr: IAttributeProfile) { const equipAttr = equipAttrs.find(x => x[0] === attr.type) const levelupValue = attr.increaseValue if (equipAttr) { equipAttr[1] += levelupValue return } equipAttrs.push([attr.type, levelupValue]) } export interface IImproveEquipConfig { minCost: number addEffect: boolean addStackable: boolean enhanceCurrentStats: boolean } function getDefaultConfig() { return { minCost: 0, addEffect: true, addStackable: true, enhanceCurrentStats: true, } } function getNextCommandPicker(config: IImproveEquipConfig) { const commandLottery : ILottery<AttrPickCommand> = {} if (config.addStackable) { commandLottery.stackableAttr = { proportion: 3, possibilities: [AttrPickCommand.Stackable], } } if (config.addEffect) { commandLottery.effectAttr = { proportion: 1, possibilities: [AttrPickCommand.Effect], } } return createLotteryPicker(commandLottery) }
miguelcjalmeida/vagante-dsmod
src/tools/deep-clone.ts
<filename>src/tools/deep-clone.ts const cloneDeep = require('clone-deep') export function deepClone<T>(src: T) { return cloneDeep(src) as T }
miguelcjalmeida/vagante-dsmod
src/transformators/merchant-intermission/replace-lenigrast-items.ts
<reponame>miguelcjalmeida/vagante-dsmod import { equipmentProfiles, EquipmentType, EquipmentSubType } from '../../item-builder/equipment-profile' import { ItemTypes, EntityTypes } from '../../rooms/types' import { IItemEntity } from '../../rooms/entities' import { createLotteryPicker } from '../../tools/create-lottery-picker' import { shuffleArray } from '../../tools/shuffle-array' import { improveEquipment } from '../../item-builder/improve-equipment' const weapons = equipmentProfiles.filter( x => x.type === EquipmentType.PrimaryWeapon, ) const bows = equipmentProfiles.filter( x => x.subType === EquipmentSubType.Bow, ) const nextEquip = createLotteryPicker( { weapons: { proportion: 3, possibilities: weapons, }, bows: { proportion: 9, possibilities: bows, }, }, shuffleArray, ) export function replaceLenigrastItems(placeholders: IItemEntity[], actValue: number) { placeholders.forEach((x) => { const equip = nextEquip() x.itemType = equip.itemType x.cursed = false x.count = 1 x.attributes = equip.attributes x.type = EntityTypes.Item improveEquipment(x, actValue) }) }
miguelcjalmeida/vagante-dsmod
src/manipulators/get-template.ts
<reponame>miguelcjalmeida/vagante-dsmod import { config } from '../config/config' import { loadRoom } from '../config/room-loader' export const dsmod = loadRoom(config.buildroom)
miguelcjalmeida/vagante-dsmod
src/transformators/merchant-replacer/scenes/random-merchant-scene.ts
import { IShopEntity, IEntity } from '../../../rooms/entities' import { createUniqueLotteryPicker } from '../../../tools/create-unique-lottery-picker' import { andreBuilder, lenigrastBuilder, yoelBuilder, siegwardBuilder, patchesBuilder, greiratBuilder, handmaidBuilder, orbeckBuilder, irinaBuilder, cornyxBuilder, yuriaBuilder, sirrisBuilder, giantBuilder, anriBuilder, gavlanBuilder, karlaBuilder, } from '../merchant-profile' import { setMerchant } from '../set-merchant' export function setRandomMerchantScene(shops: IShopEntity[], actLevel: number, nest: IEntity[]) { const nextShopBuilder = createUniqueLotteryPicker({ all: { proportion: 1, possibilities: [ andreBuilder, lenigrastBuilder, yoelBuilder, siegwardBuilder, patchesBuilder, greiratBuilder, handmaidBuilder, orbeckBuilder, irinaBuilder, cornyxBuilder, yuriaBuilder, sirrisBuilder, giantBuilder, anriBuilder, gavlanBuilder, karlaBuilder, ], }, }) shops.forEach((shop) => { setMerchant(shop, nextShopBuilder()(actLevel), nest) }) }
miguelcjalmeida/vagante-dsmod
src/transformators/fairy-replace.ts
<reponame>miguelcjalmeida/vagante-dsmod<filename>src/transformators/fairy-replace.ts import { IRoomContext } from '../rooms/context' import { findEntities } from '../finders/find-entities' import { EntityTypes } from '../rooms/types' import { IHoverText } from '../rooms/hovertext' export const fairyReplace = (context: IRoomContext) => { console.log('replacing the placeholders') context.acts.forEach((act) => { const placeholders = findEntities(act, x => x.type === EntityTypes.HoverText) const fairyPlaceholders = placeholders.filter((x) => { if (x.entity.type !== EntityTypes.HoverText) return false const text = <IHoverText>x.entity return text.text === 'fairy' }) fairyPlaceholders.forEach((x) => { x.entity.type = 'FairyCage' }) }) }
miguelcjalmeida/vagante-dsmod
src/rooms/entities.ts
import { ChestTypes, ItemTypes, DoodadTypes, ShrineTypes, BookTypes, AttributeTypes } from './types' export interface IEntity { type: string x: number y: number champion?: number } export interface IChestEntity extends IEntity { uid?: string chestType: ChestTypes type: 'Chest' links?: string[] } export interface IItemEntity extends IEntity { type: 'Item' uid: string itemType: ItemTypes count: number cursed: boolean attributes?: IItemAttributes } export interface IShopEntity extends IEntity { uid: string type: 'Shop' facingLeft: boolean size: number links: string[] | undefined } export type IItemAttributes = [AttributeTypes, number][] export interface IBookEntity extends IItemEntity { skill: BookTypes } export interface IShrineEntity extends IEntity { godType: ShrineTypes } export interface IDoodadEntity extends IEntity { doodadType: DoodadTypes } export interface IPendulumEntity extends IEntity { oscillationCycle: number } export interface ISawBladeEntity extends IEntity { behavior: number }
miguelcjalmeida/vagante-dsmod
src/transformators/transformator.ts
import { IRoomContext } from '../rooms/context' export type ITransformator = (context: IRoomContext) => void
miguelcjalmeida/vagante-dsmod
src/finders/find-act.ts
import { IRoomContext } from '../rooms/context' import { RoomNames } from '../rooms/names' export const findAct = (context: IRoomContext, name: RoomNames) => { for (const act of context.acts) { if (act._comment === name) return act } return null }
miguelcjalmeida/vagante-dsmod
src/transformators/items-creator.ts
import { IRoomContext, IRoomAct } from '../rooms/context' import { findAct } from '../finders/find-act' import { RoomNames } from '../rooms/names' import { EntityTypes, ItemTypes, ChestTypes } from '../rooms/types' import { findEntities } from '../finders/find-entities' import { IChestEntity, IItemEntity } from '../rooms/entities' import { addItem } from '../manipulators/add-item' import { shuffleArray } from '../tools/shuffle-array' import { improveEquipment } from '../item-builder/improve-equipment' import { getActValue } from '../item-builder/get-act-value' import { nextEquipmentPicker } from '../item-builder/next-equipment-picker' import { createLotteryPicker } from '../tools/create-lottery-picker' import { equipmentProfiles } from '../item-builder/equipment-profile' import { addItemIntoTreasure } from '../manipulators/add-item-into-treasure' const nextShouldPlaceEquipment = createLotteryPicker( { shouldPlace: { proportion: 1, possibilities: [true], }, shouldNotPlace: { proportion: 2, possibilities: [false], }, }, shuffleArray, ) export const itemsCreator = (ctx: IRoomContext) => { createActItems(ctx, RoomNames.ACT_ONE) createActItems(ctx, RoomNames.ACT_TWO) createActItems(ctx, RoomNames.ACT_THREE) createActItems(ctx, RoomNames.ACT_FOUR) createActItems(ctx, RoomNames.BRANCH_ONE) createActItems(ctx, RoomNames.BRANCH_TWO) createActItems(ctx, RoomNames.BRANCH_THREE) createActItems(ctx, RoomNames.BRANCH_FOUR) } function createActItems(ctx: IRoomContext, actName: RoomNames) { const act = findAct(ctx, actName) if (!act) return const actValue = getActValue(act) replaceChests(act) replacePlaceholders(act) improveAllItems(act, actValue) } function replaceChests(act: IRoomAct) { const chests = findEntities<IChestEntity>( act, x => x.type === EntityTypes.Chest && (<IChestEntity>x).chestType === ChestTypes.Small, ) shuffleArray(chests) let current = 0 chests.forEach((chest) => { const shouldPlace = nextShouldPlaceEquipment() const newEquip = nextEquipmentPicker() const item = <IItemEntity>{ attributes: newEquip.attributes, count: 1, cursed: act._comment === RoomNames.BRANCH_FOUR, itemType: newEquip.itemType, x: chest.entity.x, y: chest.entity.y, } if (!shouldPlace) return addItem(chest.nest, item) chest.nest.splice(chest.nest.indexOf(chest.entity), 1) current += 1 }) console.log(`items placed ${current}/${chests.length}`) } function replacePlaceholders(act: IRoomAct) { const placeHolders = findEntities<IItemEntity>( act, x => x.type === EntityTypes.Item && (<IItemEntity>x).itemType === ItemTypes.MagicMappingScroll && (<IItemEntity>x).count === 33, ) placeHolders.forEach((p) => { const equip = nextEquipmentPicker() p.entity.count = 1 p.entity.type = EntityTypes.Item p.entity.cursed = false p.entity.attributes = equip.attributes p.entity.itemType = equip.itemType console.log('replaced with', equip.itemType) }) } function improveAllItems(act: IRoomAct, actValue: number) { const items = findEntities<IItemEntity>( act, x => x.type === EntityTypes.Item && equipmentProfiles[(<IItemEntity>x).itemType] !== undefined, ) items.forEach((item) => { improveEquipment(item.entity, actValue) }) }
miguelcjalmeida/vagante-dsmod
src/finders/find-entities.ts
<gh_stars>1-10 import { IRoomAct, IRoomBlock } from '../rooms/context' import { IEntity } from '../rooms/entities' export type findEntitiesMatcher = (entity: IEntity) => boolean export interface IFindEntityResult<T> { nest: IEntity[] entity: T tiles: any[] block: IRoomBlock } export const findEntities = <T extends IEntity>(act: IRoomAct, matcher: findEntitiesMatcher) => { const results = [] as IFindEntityResult<T>[] for (const roomName in act.rooms) { const room = act.rooms[roomName] room.forEach((block) => { if (!block.entities) return block.entities.forEach((entity) => { if (matcher(entity)) { results.push({ block, entity: entity as T, nest: block.entities as IEntity[], tiles: block.tiles, }) } }) }) } return results }
miguelcjalmeida/vagante-dsmod
src/manipulators/add-item.ts
import { IEntity, IItemEntity, IChestEntity } from '../rooms/entities' import { EntityTypes, ItemTypes } from '../rooms/types' import { uniqueId } from '../tools/unique-id' import { ITreasureItem } from './add-item-into-treasure' export const addItem = (nest: IEntity[], item: IItemOptions) => { const itemId = uniqueId() const newItem = <IItemEntity>{ type: EntityTypes.Item, uid: itemId, x: item.x, y: item.y, attributes: item.attributes, cursed: item.cursed, count: item.count, itemType: item.itemType, } nest.push(newItem) return newItem } export interface IItemOptions extends ITreasureItem { x: number y: number }
miguelcjalmeida/vagante-dsmod
src/item-builder/get-act-value.ts
import { IRoomAct } from '../rooms/context' import { RoomNames } from '../rooms/names' export function getActValue(act: IRoomAct) { return getActValueByName(act._comment) } export function getActValueFromRoomType(roomType: string) { if (roomType === '0') return getActValueByName(RoomNames.ACT_ONE) if (roomType === '2') return getActValueByName(RoomNames.ACT_ONE) if (roomType === '3') return getActValueByName(RoomNames.BRANCH_ONE) if (roomType === '1') return getActValueByName(RoomNames.ACT_ONE) if (roomType === '5') return getActValueByName(RoomNames.ACT_TWO) if (roomType === '6') return getActValueByName(RoomNames.ACT_TWO) if (roomType === '7') return getActValueByName(RoomNames.BRANCH_TWO) if (roomType === '12') return getActValueByName(RoomNames.ACT_THREE) if (roomType === '8') return getActValueByName(RoomNames.ACT_THREE) if (roomType === '13') return getActValueByName(RoomNames.BRANCH_THREE) if (roomType === '10') return getActValueByName(RoomNames.ACT_FOUR) if (roomType === '14') return getActValueByName(RoomNames.BRANCH_FOUR) return getActValueByName(RoomNames.ACT_ONE) } export function getActValueByName(name: string) { if (name === RoomNames.ACT_ONE) return 1 if (name === RoomNames.ACT_TWO) return 1 if (name === RoomNames.ACT_THREE) return 2 if (name === RoomNames.ACT_FOUR) return 2 if (name === RoomNames.BRANCH_ONE) return 2 if (name === RoomNames.BRANCH_TWO) return 2 if (name === RoomNames.BRANCH_THREE) return 3 if (name === RoomNames.BRANCH_FOUR) return 3 return 0 }
miguelcjalmeida/vagante-dsmod
src/finders/find-room-entities.ts
<gh_stars>1-10 import { IRoomAct, IRoomBlock } from '../rooms/context' import { IEntity } from '../rooms/entities' import { IFindEntityResult, findEntitiesMatcher } from './find-entities' export const findRoomEntities = <T extends IEntity>( block: IRoomBlock, matcher: findEntitiesMatcher) => { const results = [] as IFindEntityResult<T>[] if (!block.entities) return [] block.entities.forEach((entity) => { if (matcher(entity)) { results.push({ block, entity: entity as T, nest: block.entities as IEntity[], tiles: block.tiles, }) } }) return results }
miguelcjalmeida/vagante-dsmod
src/item-builder/price-up.ts
<filename>src/item-builder/price-up.ts import { IItemEntity } from '../rooms/entities' import { AttributeTypes } from '../rooms/types' const possibilites = [ AttributeTypes.Str, AttributeTypes.Dex, AttributeTypes.Vit, AttributeTypes.Spd, AttributeTypes.Int, AttributeTypes.Luk, AttributeTypes.Def, AttributeTypes.ResistFire, AttributeTypes.ResistCold, AttributeTypes.ResistPoison, AttributeTypes.ResistElec, AttributeTypes.ResistAll, ] export function priceUp(item: IItemEntity, level: number) { if (!item.attributes) item.attributes = [] else item.attributes = [...item.attributes] const monetaryValue = level >= 0 ? 0 : -1 for (let i = 0; i < Math.abs(level) && i < possibilites.length; i += 1) { item.attributes.push([possibilites[i], monetaryValue]) } }
miguelcjalmeida/vagante-dsmod
src/manipulators/add-simple-entity.ts
import { IEntity } from '../rooms/entities' import { EntityTypes } from '../rooms/types' export const addSimpleEntity = (nest: IEntity[], options: ISimpleEntityOptions) => { nest.push(<IEntity>{ x: options.x, y: options.y, type: options.type, }) } export interface ISimpleEntityOptions { x: number y: number type: EntityTypes doodadType?: number, }
miguelcjalmeida/vagante-dsmod
src/config/config.ts
import * as configJson from '../../config.json' import * as packageJson from '../../package.json' class Config { public buildroom : string public version: string public gameRootDir: string public gameModPath: string private assetsDir: string private distDir: string private projectRootDir: string public constructor() { this.projectRootDir = __dirname this.assetsDir = this.translateDir(configJson.assetsDir) this.distDir = this.translateDir(configJson.distDir) this.buildroom = configJson.buildroom this.version = packageJson.version this.gameRootDir = configJson.vaganteRootPath this.gameModPath = configJson.vaganteModPath } private translateDir(dir: string) { return dir.replace('./', `${this.projectRootDir}/../../../`) } public asset(name: string) { return `${this.assetsDir}/${name}` } public dist(name: string) { return `${this.distDir}/${name}` } } export const config = new Config
miguelcjalmeida/vagante-dsmod
src/modder/apply-mod.ts
<reponame>miguelcjalmeida/vagante-dsmod import { getAllTransformators } from './get-all-transformators' import { config } from '../config/config' import { loadRoom, saveRoom } from '../config/room-loader' export function applyMod() { const rooms = loadRoom(config.asset('rooms.json')) getAllTransformators().forEach(transform => transform(rooms)) saveRoom(config.dist('rooms.json'), rooms) }
miguelcjalmeida/vagante-dsmod
src/rooms/names.ts
<gh_stars>1-10 export enum RoomNames { ACT_ONE = 'ACT_ONE', ACT_TWO = 'ACT_TWO', ACT_THREE = 'ACT_THREE', ACT_FOUR = 'ACT_FOUR', BRANCH_ONE = 'BRANCH_ONE', BRANCH_TWO = 'BRANCH_TWO', BRANCH_THREE = 'BRANCH_THREE', BRANCH_FOUR = 'BRANCH_FOUR', Intermission = 'INTERMISSION', Tutorial = 'TUTORIAL', Arena = 'ARENA', FinalFight = 'FINAL_FIGHT', }
miguelcjalmeida/vagante-dsmod
src/manipulators/add-treasure.ts
import { IEntity, IChestEntity } from '../rooms/entities' import { uniqueId } from '../tools/unique-id' import { EntityTypes, ChestTypes } from '../rooms/types' import { ITreasureItem, addItemIntoTreasure } from './add-item-into-treasure' import { addLabel } from './add-label' export const addTreasure = (nest: IEntity[], treasure: ITreasureOptions) => { const entity : IChestEntity = { uid: uniqueId(), type: EntityTypes.Chest, x: treasure.x, y: treasure.y, chestType: treasure.chestType, } nest.push(entity) treasure.items.forEach((item) => { addItemIntoTreasure(nest, entity, item) }) if (treasure.label) { addLabel(nest, { text: treasure.label, x: treasure.x, y: treasure.y, }) } } export interface ITreasureOptions { x: number y: number chestType: ChestTypes items: ITreasureItem[] label?: string }
miguelcjalmeida/vagante-dsmod
src/manipulators/clone-room.ts
<reponame>miguelcjalmeida/vagante-dsmod<gh_stars>1-10 import { IRoomContext, IRoomBlock } from '../rooms/context' export const cloneRoom = (targetRoom: IRoomBlock, modelRoom: IRoomBlock) => { targetRoom.entities = deepCopy(modelRoom.entities) targetRoom.tiles = modelRoom.tiles } function deepCopy(obj: any) { let copy : any if (null == obj || 'object' !== typeof obj) return obj if (obj instanceof Array) { copy = [] for (let i = 0, len = obj.length; i < len; i += 1) { copy[i] = deepCopy(obj[i]) } return copy } // Handle Object if (obj instanceof Object) { copy = {} for (const attr in obj) { if (obj.hasOwnProperty(attr)) copy[attr] = deepCopy(obj[attr]) } return copy } throw new Error('Type not supported for deep coping') }
miguelcjalmeida/vagante-dsmod
src/rooms/hovertext.ts
import { IEntity } from './entities' export interface IHoverText extends IEntity { uid: string w: number h: number text: string animated: boolean animDelay: number } export interface ITriggerCondition extends IEntity { type: TriggerTypes } export enum TriggerTypes { touchingPlayer = 'TOUCHING_PLAYER', } export interface ITrigger extends IEntity { uid: string links: string[] x: number y: number w: number h: number condition: ITriggerCondition }
miguelcjalmeida/vagante-dsmod
src/modder/install-mod.ts
<reponame>miguelcjalmeida/vagante-dsmod<gh_stars>1-10 import * as fs from 'fs' import { applyMod } from './apply-mod' import * as Shell from 'node-powershell' import { config } from '../config/config' export function installMod() { applyMod() const roomsPath = config.dist('rooms.json') const vagantePath = config.gameRootDir const installModPath = config.gameModPath fs.copyFileSync(roomsPath, installModPath) console.log('installing...') const ps = new Shell({ executionPolicy: 'Bypass', noProfile: true, }) ps.addCommand(`cd "${vagantePath}"`) ps.addCommand(`./VaganteModLoader.ps1`) ps.invoke() .then((output) => { console.log(output) ps.dispose() }) .catch((err) => { console.log(err) ps.dispose() }) }
miguelcjalmeida/vagante-dsmod
src/transformators/label-firekeeper.ts
<gh_stars>1-10 import { IRoomContext, IRoomBlock, IActSpecification, IRoomAct } from '../rooms/context' import { RoomNames } from '../rooms/names'; import { addLabel } from '../manipulators/add-label'; export const labelFirekeepr = (ctx: IRoomContext) => { console.log('labeling firekeepr') ctx.acts.forEach((act) => { if (act._comment === RoomNames.Tutorial) return for (const i in act.rooms) { const room = act.rooms[i] room.forEach((block, line) => { addFirekeeperLabel(act, block) }) } }) } function addFirekeeperLabel(act: IRoomAct, block: IRoomBlock) { const tilesIndex = -1 block.tiles.forEach((rowTiles, line) => { for (let i = 0; i < rowTiles.length; i += 6) { const foreTileIndex = i + 4 const foreTile = rowTiles[foreTileIndex] if (foreTile !== 640 && foreTile !== 704) continue if (!block.entities) block.entities = [] addLabel(block.entities, { text: 'Fire Keeper', x: i * 16 / 6, y: line * 16 + 16, triggerWidth: 48, triggerOffsetX: -16, triggerOffsetY: -16, triggerHeight: 64, }) } }) }
miguelcjalmeida/vagante-dsmod
src/item-builder/attribute-profile.ts
import { AttributeTypes as x, AttributeTypes } from '../rooms/types' export interface IAttributeProfilesIndex { [index: string] : IAttributeProfile } export type IAttributeProfiles = IAttributeProfile[] & IAttributeProfilesIndex export enum AttributeRestrictions { Weapon = 0, Bow = 1, AllWeapon = 2, Armor = 3, Ring = 4, Amulet = 5, Boots = 6, Glove = 7, Cap = 8, None = 9, } export interface IAttributeProfile { type: AttributeTypes cost: number increaseValue: number restrictTo: AttributeRestrictions stackable: boolean basic: boolean } export const attributeProfiles : IAttributeProfiles = [] as any addRestrictEffect(x.WeaponLifeSteal, AttributeRestrictions.Weapon) addRestrictEffect(x.WeaponEmitsSpirits, AttributeRestrictions.Weapon) addRestrictEffect(x.WeaponKnockback, AttributeRestrictions.Weapon, 1, 2) addRestrictEffect(x.WeaponFairyFire, AttributeRestrictions.Weapon) addRestrictEffect(x.WeaponSlowStrike, AttributeRestrictions.Weapon) addRestrictEffect(x.WeaponBlink, AttributeRestrictions.Weapon, 3) addRestrictEffect(x.WeaponLightning, AttributeRestrictions.Weapon, 3) addRestrictEffect(x.WeaponMidas, AttributeRestrictions.Weapon, 2) addRestrictEffect(x.WeaponSplashAttack, AttributeRestrictions.Weapon, 2) addRestrictEffect(x.WeaponStrongPoison, AttributeRestrictions.Weapon) addRestrictEffect(x.WeaponPoisonCoat, AttributeRestrictions.Weapon, 0) addRestrictEffect(x.AllWeaponBurn, AttributeRestrictions.AllWeapon, 0) addRestrictEffect(x.AllWeaponFreeze, AttributeRestrictions.AllWeapon, 0) addRestrictEffect(x.AllWeaponShock, AttributeRestrictions.AllWeapon, 0) addRestrictEffect(x.BowWeightless, AttributeRestrictions.Bow, 0) addRestrictEffect(x.BowLight, AttributeRestrictions.Bow, 0) addRestrictEffect(x.BowTrajectory, AttributeRestrictions.Bow, 0) addRestrictEffect(x.BowMulti, AttributeRestrictions.Bow, 1) addRestrictEffect(x.BowHomingArrow, AttributeRestrictions.Bow, 1) addEffect(x.Berserk) addEffect(x.DoubleJump) addEffect(x.TrippleJump) addEffect(x.FireWalk, 0) addEffect(x.Bouncy, 0) addEffect(x.SuperSpeed) addEffect(x.GrabWalls, 0) addEffect(x.ThrowHard) addEffect(x.FamiliarShooter) addEffect(x.FamiliarHealer) addEffect(x.FamiliarMelee) addEffect(x.HeavySink, 0) addEffect(x.JumpHigh, 0, 1) addEffect(x.WalkChargeDamage, 0) addEffect(x.BreathUnderWater, 0) addEffect(x.FeatherFall) addEffect(x.LightFeet) addEffect(x.PhaseVertical) addEffect(x.PhaseHorizontal) addEffect(x.Merchant, 2) addEffect(x.BoulderProtection) addEffect(x.SlowAura, 0) addEffect(x.FreezeAura, 0) addEffect(x.FlameAura, 0) addEffect(x.Greedy) addEffect(x.HeavyPunch) addEffect(x.Archery) addEffect(x.CoinHeal) addEffect(x.BurnReflect, 0) addEffect(x.ShockReflect, 0) addEffect(x.FreezeReflect, 0) addEffect(x.PoisonReflect, 0) addEffect(x.DamageReflect, 0) addEffect(x.SpiritsReflect, 0) addEffect(x.MistReflect, 0) addEffect(x.SpikeProtection) addEffect(x.FlappyJump) addEffect(x.RepulseAttackers) addEffect(x.ProjectileDeflection) addEffect(x.FamiliarMaster, 2) addEffect(x.Zygox, 1) addEffect(x.Seltioc, 1) addEffect(x.GodCurse, 2) addEffect(x.TrueSight) addStackable(x.LightRadius, 0, 1) addStackable(x.Slaying, 2, 1) addStackable(x.ReachUpgrade, 0, 4) addStackable(x.JumpDamage, 0, 5) addRestrictEffect(x.ArmorDA, AttributeRestrictions.Armor, 1) addRestrictEffect(x.ArmorMagicShield, AttributeRestrictions.Armor, 1) addRestrictEffect(x.AmuletReincarnate, AttributeRestrictions.Amulet, 1) addRestrictEffect(x.BootsFireJump, AttributeRestrictions.Boots, 1) addRestrictEffect(x.CapSpellCost, AttributeRestrictions.Cap, 1) addRestrictEffect(x.GloveExplosionAffinity, AttributeRestrictions.Glove, 1) addRestrictEffect(x.RingChestSpirits, AttributeRestrictions.Ring, 1) addRestrictEffect(x.RingChestHeal, AttributeRestrictions.Ring, 1) addBasic(x.Str) addBasic(x.Dex) addBasic(x.Vit) addBasic(x.Spd, 2) addBasic(x.Int) addBasic(x.Luk) addBasic(x.Def, 2) addStackable(x.ResistAll, 2, 1) addStackable(x.ResistCold) addStackable(x.ResistFire) addStackable(x.ResistElec) addStackable(x.ResistPoison) function add(attr: IAttributeProfile) { attributeProfiles[attr.type] = attr attributeProfiles.push(attr) } function addStackable(type: x, cost = 1, value = 1) { add({ type, cost, increaseValue: value, basic: false, restrictTo: AttributeRestrictions.None, stackable: true, }) } function addBasic(type: x, increaseValue: number = 1) { add({ type, increaseValue, cost: 1, basic: true, restrictTo: AttributeRestrictions.None, stackable: true, }) } function addEffect(type: x, cost = 1, value = 0) { add({ type, cost, increaseValue: value, basic: false, restrictTo: AttributeRestrictions.None, stackable: false, }) } function addRestrictEffect(type: x, restrictTo: AttributeRestrictions, cost = 1, value = 0) { add({ type, cost, restrictTo, increaseValue: value, basic: false, stackable: false, }) }
miguelcjalmeida/vagante-dsmod
src/manipulators/add-label.ts
import { IEntity, IChestEntity } from '../rooms/entities' import { uniqueId } from '../tools/unique-id' import { EntityTypes, ChestTypes } from '../rooms/types' import { IHoverText, ITrigger, TriggerTypes } from '../rooms/hovertext' export const addLabel = (nest: IEntity[], label: ILabelOptions) => { const labelId = uniqueId() const textParts = label.text.split('\n') const textSize = textParts .reduce((previous, current) => previous.length < current.length ? current : previous) .length const centeredTextParts = textParts.map((x) => { const leftAppendSize = Math.floor(textSize - x.length / 2) return ' '.repeat(leftAppendSize < 0 ? 0 : leftAppendSize) + x }) nest.push(<IHoverText>{ uid: labelId, type: EntityTypes.HoverText, x: label.x + (label.labelOffsetX ? label.labelOffsetX : 0) - (textSize * 10.5) / 2 , y: label.y + (label.labelOffsetY ? label.labelOffsetY : 0) - (textParts.length * 13), w: 32, h: 32, text: centeredTextParts.join('\n'), animated: true, animDelay: 0, }) nest.push(<ITrigger>{ uid: uniqueId(), links: [labelId], type: EntityTypes.Trigger, x: label.x + (label.triggerOffsetX ? label.triggerOffsetX : 0), y: label.y + (label.triggerOffsetY ? label.triggerOffsetY : 0), w: label.triggerWidth ? label.triggerWidth : 15, h: label.triggerHeight ? label.triggerHeight : 30, condition: { type: TriggerTypes.touchingPlayer, }, }) } export interface ILabelOptions { x: number y: number text: string triggerOffsetX?: number triggerOffsetY?: number labelOffsetX?: number labelOffsetY?: number triggerWidth?: number triggerHeight?: number }
miguelcjalmeida/vagante-dsmod
src/transformators/merchant-intermission/replace-chests.ts
<filename>src/transformators/merchant-intermission/replace-chests.ts<gh_stars>1-10 import { IRoomBlock } from '../../rooms/context' import { IChestEntity, IItemEntity } from '../../rooms/entities' import { findRoomEntities } from '../../finders/find-room-entities' import { EntityTypes } from '../../rooms/types' import { nextEquipmentPicker } from '../../item-builder/next-equipment-picker' import { addItemIntoTreasure } from '../../manipulators/add-item-into-treasure' import { improveEquipment } from '../../item-builder/improve-equipment' import { createLotteryPicker } from '../../tools/create-lottery-picker' const nextShouldHaveRareItem = createLotteryPicker({ shouldHave: { proportion: 1, possibilities: [true], }, shouldNot: { proportion: 1, possibilities: [false], }, }) export function replaceChests(room: IRoomBlock, equipValue: number) { const placeholders = findRoomEntities<IChestEntity>( room, x => x.type === EntityTypes.Chest, ) placeholders.forEach((x) => { const shouldHaveRareItem = nextShouldHaveRareItem() if (!shouldHaveRareItem) return const equip = nextEquipmentPicker() const item = <IItemEntity>{ attributes: equip.attributes, count: 1, cursed: false, itemType: equip.itemType, } improveEquipment(item, equipValue) addItemIntoTreasure(x.nest, x.entity, item) }) }
tomconte/AzSearchStore
src/reducers/facets.ts
<gh_stars>0 import { FacetsAction, SetFacetRangeAction, ToggleCheckboxFacetAction, AddCheckboxFacetAction, AddRangeFacetAction, SetFacetModeAction, SetFacetsValuesAction, UpdateFacetValuesAction, ClearFacetsSelectionsAction, SetGlobalFilterAction } from "../actions/facetsActions"; import { Store } from "../store"; import * as objectAssign from "object-assign"; import { updateObject, updateObjectAtKey } from "./reducerUtils"; export const initialState: Store.Facets = { facetMode: "simple", globalFilters: {}, facets: {} }; const odataString = "@odata"; export function facets(state: Store.Facets = initialState, action: FacetsAction): Store.Facets { switch (action.type) { case "SET_FACET_MODE": return setFacetMode(state, action); case "ADD_RANGE_FACET": return addRangeFacetAction(state, action); case "ADD_CHECKBOX_FACET": return addCheckboxFacet(state, action); case "TOGGLE_CHECKBOX_SELECTION": return toggleFacetSelection(state, action); case "SET_FACET_RANGE": return setFacetRange(state, action); case "SET_FACETS_VALUES": return setFacetsValues(state, action); case "UPDATE_FACETS_VALUES": return updateFacetsValues(state, action); case "CLEAR_FACETS_SELECTIONS": return clearFacetsSelections(state, action); case "SET_GLOBAL_FILTER": return setGlobalFilter(state, action); default: return state; } } function setGlobalFilter(state: Store.Facets, action: SetGlobalFilterAction): Store.Facets { const { filter, key } = action; const globalFilters = updateObjectAtKey(state.globalFilters, filter, key); return updateObject(state, { globalFilters }); } function clearFacetsSelections(state: Store.Facets, action: ClearFacetsSelectionsAction): Store.Facets { let facets: { [key: string]: Store.Facet } = {}; Object.keys(state.facets).forEach((key) => { const facet = state.facets[key]; switch (facet.type) { case "CheckboxFacet": const values: { [key: string]: Store.CheckboxFacetItem } = {}; Object.keys(facet.values).forEach((value) => { const currentItem = facet.values[value]; const item = updateObject(currentItem, { selected: false, count: 0 }); values[value] = item; }); facets[key] = updateObject(facet, { values, filterClause: "" }); break; case "RangeFacet": facets[key] = updateObject(facet, { filterLowerBound: facet.min, filterUpperBound: facet.max, lowerBucketCount: 0, middleBucketCount: 0, upperBucketCount: 0, filterClause: "" } ); break; default: break; } }); return updateObject(state, { facets }); } function setFacetsValues(state: Store.Facets, action: SetFacetsValuesAction): Store.Facets { let facets: { [key: string]: Store.Facet } = {}; const keysToUpdate = Object.keys(action.facets).filter((key) => { const facet = state.facets[key]; return facet; }); keysToUpdate.forEach((key) => { const facet = state.facets[key]; const facetResults: Store.FacetResult[] = action.facets[key]; switch (facet.type) { case "CheckboxFacet": facets[key] = setCheckboxFacetValues(facet as Store.CheckboxFacet, facetResults); break; case "RangeFacet": facets[key] = setRangeFacetValues(facet as Store.RangeFacet, facetResults); break; default: break; } }); return updateObject(state, { facets }); } function setRangeFacetValues(facet: Store.RangeFacet, facetResults: Store.FacetResult[]): Store.RangeFacet { return updateObject(facet, { filterLowerBound: facet.min, filterUpperBound: facet.max, lowerBucketCount: 0, upperBucketCount: 0, middleBucketCount: facetResults[1].count, filterClause: "" }); } function setCheckboxFacetValues(facet: Store.CheckboxFacet, facetResults: Store.FacetResult[]): Store.CheckboxFacet { let values: { [key: string]: Store.CheckboxFacetItem } = {}; facetResults.forEach((facetResult) => { const { value, count } = facetResult; values[value] = { value, count, selected: false }; }); return updateObject(facet, { values, filterClause: "" }); } function updateFacetsValues(state: Store.Facets, action: UpdateFacetValuesAction): Store.Facets { const updatedFacets: { [key: string]: Store.Facet } = {}; // filter out @odata type annotations const keys = Object.keys(action.facets).filter((key) => { return key.toLowerCase().indexOf(odataString) < 0; }); keys.forEach((key) => { let facet = state.facets[key]; const currentItem = action.facets[key]; switch (facet.type) { case "RangeFacet": updatedFacets[key] = updateObject(facet, { lowerBucketCount: currentItem[0].count, middleBucketCount: currentItem[1].count, upperBucketCount: currentItem[2].count }); break; case "CheckboxFacet": // set counts for values that got updates const checkboxFacet = facet as Store.CheckboxFacet; const hasSelection = facet.filterClause.length > 0; const updatedFacet: Store.CheckboxFacet = hasSelection ? mergeCheckboxFacetValues(checkboxFacet, currentItem) : setCheckboxFacetValues(checkboxFacet, currentItem); updatedFacets[key] = updatedFacet; break; default: break; } }); const facets = updateObject(state.facets, updatedFacets); return updateObject(state, { facets }); } function mergeCheckboxFacetValues(facet: Store.CheckboxFacet, facetResults: Store.FacetResult[]): Store.CheckboxFacet { let values: { [key: string]: Store.CheckboxFacetItem } = {}; const currentItemKeys = facetResults.map((item) => { return item.value.toString(); }); Object.keys(facet.values).forEach((valueKey) => { // do we have an update for the current key const updateIndex = currentItemKeys.indexOf(valueKey); if (updateIndex >= 0) { const item = facetResults[updateIndex]; values[valueKey] = { count: item.count, value: item.value, selected: facet.values[item.value] ? facet.values[item.value].selected : false }; } else { const value = facet.values[valueKey]; values[valueKey] = { count: 0, selected: value.selected, value: value.value }; } }); // fill in new values at the end facetResults.forEach((item) => { if (!values[item.value]) { values[item.value] = { count: item.count, value: item.value, selected: facet.values[item.value] ? facet.values[item.value].selected : false }; } }); return updateObject(facet, { values }); } function setFacetMode(state: Store.Facets, action: SetFacetModeAction): Store.Facets { const { facetMode } = action; return updateObject(state, { facetMode }); } function getRangeFacetClause(dataType: Store.RangeDataType, key: string, filterLowerBound: number | Date, filterUpperBound: number | Date): string { let lowerClause; let upperClause; switch (dataType) { case "number": lowerClause = filterLowerBound; upperClause = filterUpperBound; break; case "date": lowerClause = (filterLowerBound as Date).toISOString(); upperClause = (filterUpperBound as Date).toISOString(); break; default: break; } return `${key},values:${lowerClause}|${upperClause}`; } function addRangeFacetAction(state: Store.Facets, action: AddRangeFacetAction): Store.Facets { let { key, min, max, dataType } = action; switch (dataType) { case "number": case "date": break; default: throw new Error("dataType of RangeFacet must be 'number' | 'date'"); } const filterLowerBound = min, filterUpperBound = max; const rangeFacet: Store.RangeFacet = { type: "RangeFacet", dataType, key, min, max, filterLowerBound: min, filterUpperBound: max, lowerBucketCount: 0, middleBucketCount: 0, upperBucketCount: 0, filterClause: "", facetClause: getRangeFacetClause(dataType, key, filterLowerBound, filterUpperBound) }; const facets = updateObjectAtKey(state.facets, rangeFacet, key); return updateObject(state, { facets }); } function addCheckboxFacet(state: Store.Facets, action: AddCheckboxFacetAction): Store.Facets { const { dataType, key } = action; const sort = "count", count = 5; switch (dataType) { case "number": case "collection": case "collectionComplex": case "string": break; default: throw new Error("dataType of CheckboxFacet must be 'number' | 'collection' | 'collectionComplex' | 'string'"); } const checkFacet: Store.CheckboxFacet = { type: "CheckboxFacet", key, dataType, values: {}, count, sort, filterClause: "", facetClause: `${key},count:${count},sort:${sort}` }; const facets = updateObjectAtKey(state.facets, checkFacet, key); return updateObject(state, { facets }); } function toggleFacetSelection(state: Store.Facets, action: ToggleCheckboxFacetAction): Store.Facets { const { key, value } = action; const existingFacet = state.facets[key]; if (existingFacet.type !== "CheckboxFacet") { throw new Error(`TOGGLE_CHECKBOX_SELECTION must be called on facet of type 'CheckboxFacet', actual: ${existingFacet.type}`); } const checkboxFacet = existingFacet as Store.CheckboxFacet; const oldFacetItem = checkboxFacet.values[value]; const updatedFacetItem = updateObject(oldFacetItem, { selected: !oldFacetItem.selected }); const newValue: { [key: string]: Store.CheckboxFacetItem } = {}; const values = updateObjectAtKey(checkboxFacet.values, updatedFacetItem, value.toString()); const newFacet = updateObject(checkboxFacet, { values }); const filterClause = buildCheckboxFilter(newFacet); const newFacetWithFilter = updateObject(newFacet, { filterClause }); const facets = updateObjectAtKey(state.facets, newFacetWithFilter, key); return updateObject(state, { facets }); } function setFacetRange(state: Store.Facets, action: SetFacetRangeAction): Store.Facets { const { key, lowerBound, upperBound } = action; const existingFacet = state.facets[key]; if (existingFacet.type !== "RangeFacet") { throw new Error(`SET_FACET_RANGE must be called on facet of type 'RangeFacet', actual: ${existingFacet.type}`); } const existingRangeFacet = existingFacet as Store.RangeFacet; const newRangeFacet = updateObject(existingRangeFacet, { filterLowerBound: lowerBound, filterUpperBound: upperBound }); const filter = buildRangeFilter(newRangeFacet); const facetClause = getRangeFacetClause(newRangeFacet.dataType, newRangeFacet.key, lowerBound, upperBound); const newFacetWithFilter = updateObject(newRangeFacet, { filterClause: filter, facetClause }); const facets = updateObjectAtKey(state.facets, newFacetWithFilter, key); return updateObject(state, { facets }); } function buildCheckboxFilter(facet: Store.CheckboxFacet): string { const selectedFacets = Object.keys(facet.values).filter((value) => { return facet.values[value].selected; }); let clauses = selectedFacets.map((selectedValue) => { let clause; switch (facet.dataType) { case "number": clause = `${facet.key} eq ${facet.values[selectedValue].value}`; break; case "string": clause = `${facet.key} eq '${facet.values[selectedValue].value}'`; break; case "collection": clause = `${facet.key}/any(t: t eq '${facet.values[selectedValue].value}')`; break; case "collectionComplex": let splitKey = facet.key.split('/'); clause = `${splitKey[0]}/any(t: t/${splitKey[1]} eq '${facet.values[selectedValue].value}')`; break; default: clause = ""; break; } return clause; }); let filter = clauses.join(" or "); filter.length ? filter = `(${filter})` : filter = ""; return filter; } function buildRangeFilter(facet: Store.RangeFacet): string { let lowerFilter; let upperFilter; switch (facet.dataType) { case "number": lowerFilter = facet.filterLowerBound; upperFilter = facet.filterUpperBound; break; case "date": lowerFilter = (facet.filterLowerBound as Date).toISOString(); upperFilter = (facet.filterUpperBound as Date).toISOString(); break; default: break; } if (facet.min === facet.filterLowerBound && facet.max === facet.filterUpperBound) { return ""; } if (facet.min === facet.filterLowerBound) { return `${facet.key} le ${upperFilter}`; } if (facet.max === facet.filterUpperBound) { return `${facet.key} ge ${lowerFilter}`; } return `${facet.key} ge ${lowerFilter} and ${facet.key} le ${upperFilter}`; }
abkl/csim
src/pages/index.tsx
<reponame>abkl/csim<filename>src/pages/index.tsx import React from "react" import SEO from "../components/seo" import styled from "@emotion/styled" import Image from "../components/image" import { graphql } from "gatsby" const PageHeader = styled.h1` text-align: center; ` const SubText = styled.p` text-align: center; font-style: italic; ` const IndexPage = ({ data }: { data: any }) => { /* const teams = data.allSitePage.edges .filter((node: any) => /teams/.test(node.node.id)) .map((node: any) => node.node.id.match(/\d+/g)) .filter((a: any) => a !== null && a.length > 0) .map((a: any) => a[0]) */ return ( <> <SEO title="Home" description="Scouting Application for Team 4159" keywords={[`scouting`, `application`, `Team 4159`]} /> <Image /> <PageHeader>Cardinal Scout Imporved(CSIM)</PageHeader> <SubText>Welcolme to the 2019 Scouting Application</SubText> </> ) } // const a = exampleQuery.data.allSitePage.edges.filter(node => /teams/.test(node.node.id)).map(node => node.node.id.match(/\d+/g)).filter(a => a !== null && a.length > 0).map(a => a[0]) export const query = graphql` query { allSitePage { edges { node { id } } } } ` export default IndexPage
abkl/csim
src/components/charts/piechart.tsx
<reponame>abkl/csim<gh_stars>0 import React from "react" import { VictoryPie, VictoryTheme } from "victory" import styled from "@emotion/styled" const OuterDiv = styled.div` max-width: 500px; max-height: 500px; margin: auto; ` export default function PieChart() { return ( <OuterDiv> <VictoryPie theme={VictoryTheme.material} colorScale="warm" data={[ { x: "Platform", y: 35 }, { x: "Balls", y: 40 }, { x: "Rings", y: 55 }, ]} labels={d => `${d.x} amount: ${d.y}`} style={{ labels: { fontSize: 5, fill: "#fff", }, }} radius={50} width={100} height={100} labelRadius={20} /> </OuterDiv> ) }
abkl/csim
src/components/form-components/checkbox.tsx
import React from "react" // TODO: Store checkbox data in csv and not array const csvToArray = (str: string): string[] => str.split(",") const arrayToCsv = (strA: string[]): string => strA.join(",") export const updateValues = (checkboxValue: string, values: string): string => { const valuesArray = csvToArray(values) if (values === "") return checkboxValue if (valuesArray.includes(checkboxValue)) return arrayToCsv(valuesArray.filter(v => v !== checkboxValue)) return arrayToCsv(valuesArray.concat(checkboxValue)) } export default function CheckboxGroup({ name, options, onChange, value, }: { name: string options: string[] onChange: (value: string) => void value: string }) { return ( <div css={{ display: "inline-flex", alignItems: "flex-start", flexDirection: "column", alignSelf: "center", width: "100%", maxWidth: "300px", }} > <label>{name}</label> <br /> {options.map(option => ( <label css={{ marginLeft: "10%" }}> <input type="checkbox" name={name} value={option} checked={csvToArray(value).includes(option)} onChange={() => onChange(updateValues(option, value))} /> {option} <br /> </label> ))} </div> ) }
abkl/csim
src/templates/default-layout.tsx
import React from "react" import RootContext from "../contexts/root-context" import { ThemeProvider } from "emotion-theming" import theme from "../utils/theme" import { StaticQuery, graphql } from "gatsby" import { rhythm } from "../utils/typography" import AppBar from "../components/app-bar" const Layout = ({ children }: LayoutProps) => { return ( <StaticQuery query={graphql` query SiteTitleQuery { site { siteMetadata { title } } } `} render={data => { return ( <ThemeProvider theme={theme}> <RootContext> <AppBar siteTitle={data.site.siteMetadata.title} /> <div css={{ "@media (max-width: 600px)": { padding: `${rhythm(1)}`, }, padding: `${rhythm(2)}`, }} > {children} </div> </RootContext> </ThemeProvider> ) }} /> ) } interface LayoutProps { children: React.ReactNode } export default Layout
abkl/csim
src/components/form-components/display-values.tsx
<gh_stars>0 import React from "react" import ReactTable from "react-table" import "react-table/react-table.css" const DisplayValues = ({ values }: { values: { [s: string]: string } }) => ( <ReactTable data={Object.keys(values).map(key => ({ property: key, value: values[key], }))} defaultPageSize={10} showPagination css={{ width: "100%", fontSize: ".65rem", }} columns={[ { Header: "Field Names", accessor: "property", minWidth: 200, style: { overflow: "visible", }, }, { Header: "Values", accessor: "value", minWidth: 200, Cell(props: { value: string }) { return <div>{props.value.toString()}</div> }, }, ]} /> ) export default DisplayValues
abkl/csim
src/components/form-components/form-template.tsx
import React, { useState } from "react" import { Formik } from "formik" import Button from "../primatives/button" import { initiallizeFormState } from "./form-util" import { css } from "@emotion/core/" import DisplayFields from "./display-fields" import { Fields } from "../../utils/game-constants" import { rhythm } from "../../utils/typography" import Modal from "../primatives/modal" import DisplayValues from "./display-values" import axios from "axios" import localforage from "localforage" import uuid from "uuid/v4" const FormTemplate = ({ fields, submitUrl, storageKey, }: { fields: Fields submitUrl: string storageKey: string }) => { const initialModalState = { modalOpen: false, error: false, showValues: true, } const [modalState, setModalState] = useState(initialModalState) const ModalContent = ({ isSubmitting, values, }: { isSubmitting: boolean values: any }) => { if (isSubmitting) return <p>loading...</p> if (modalState.showValues) return <DisplayValues values={values} /> if (!modalState.error) return <p> Data submitted!</p> if (modalState.error) return ( <p> There was an error submitting your form, please try again later(don't worry your values are stored in local storage) </p> ) } return ( <div> <Formik initialValues={initiallizeFormState(fields)} onSubmit={( values: { "Event Code"?: string; [s: string]: any }, actions ) => { const proxyurl = "https://cors-app-scouting.herokuapp.com/" // function getURL() { // switch (values["Event Code"]) { // case "sfr": // return "https://script.google.com/macros/s/AKfycbxdqDlv5M1Et_yQ4qrANEzwBN0FcrXLQitbKtMYfN84XiKQ_HI4/exec" // case "svr": // return "https://script.google.com/macros/s/AKfycbxd9o5VOvlJT4SqTeJTAoUmT9WNxmagGafiTARnFCyU7bgPlcnR/exec" // default: // return "https://script.google.com/macros/s/AKfycbw6coSc3fptX7wLepvJ6idwzkEx9uZwxsKMhcfFuWCit-9WZJIO/exec" // } // } axios .post(proxyurl + submitUrl, JSON.stringify(values), { headers: { "content-type": "json" }, }) .then(r => { setModalState({ ...modalState, showValues: false }) localforage.getItem(storageKey, (err, items: any) => { if (err) return console.log(err) console.log(items) if (items === null) return localforage.setItem(storageKey, [ { ...values, submitted: true, id: uuid() }, ]) localforage.setItem(storageKey, [ ...items, { ...values, submitted: true, id: uuid() }, ]) }) }) .catch(() => { setModalState({ ...modalState, showValues: false, error: true }) localforage.getItem(storageKey, (err, items: any) => { if (err) return console.log(err) console.log(items) if (items === null) return localforage.setItem(storageKey, [ { ...values, submitted: false, id: uuid() }, ]) localforage.setItem(storageKey, [ ...items, { ...values, submitted: false, id: uuid() }, ]) }) }) .then(() => { actions.setSubmitting(false) actions.resetForm(initiallizeFormState(fields)) }) }} > {props => ( <form onSubmit={props.handleSubmit} css={css` display: flex; flex-direction: column; justify-content: center; align-items: center; text-align: center; `} > {Object.keys(fields).map(gamePhase => ( <div css={css` display: flex; flex-direction: column; justify-content: center; width: 100%; `} key={gamePhase} > <h2 css={css` margin-top: ${rhythm(1)}; `} > {gamePhase} </h2> <DisplayFields fields={fields[gamePhase]} setFieldValue={props.setFieldValue} values={props.values} /> </div> ))} <Button type="button" onClick={() => setModalState({ ...modalState, modalOpen: true, showValues: true, }) } > Confirm </Button> {modalState.modalOpen && ( <Modal onClose={() => { if (!props.isSubmitting) { setModalState(initialModalState) } }} > <h1> Confirm </h1> <ModalContent isSubmitting={props.isSubmitting} values={props.values} /> {!modalState.showValues ? ( <Button onClick={() => setModalState(initialModalState)}> Close </Button> ) : ( <Button disabled={props.isSubmitting} type="submit"> Submit </Button> )} </Modal> )} </form> )} </Formik> </div> ) } export default FormTemplate
abkl/csim
src/pages/offline-data.tsx
import React, { useEffect, useState } from "react" import localforage from "localforage" import Button from "../components/primatives/button" import ReactTable from "react-table" import "react-table/react-table.css" import axios from "axios" import Modal from "../components/primatives/modal" const proxyurl = "https://cors-app-scouting.herokuapp.com/" const matchScoutUrl = "https://script.google.com/macros/s/AKfycbxd9o5VOvlJT4SqTeJTAoUmT9WNxmagGafiTARnFCyU7bgPlcnR/exec" const pitScoutUrl = "https://script.google.com/macros/s/AKfycbzpOJMML-rkyz_HB-GRstlAke0OayBeMEFVW21a04lpD9TJrKc/exec" const updateStorage = async (key: string, data: { [s: string]: any }) => { const ogData = await localforage.getItem(key) if (Array.isArray(ogData)) localforage .setItem( key, ogData.map(v => (v.id === data.id ? { ...data, submitted: true } : v)) ) .then(t => console.log(t)) } export default function OfflinePage() { const [items, setItems] = useState({ matchScout: [], pitScout: [], }) const fetchData = async () => { const matchScoutData = await localforage.getItem("match-scouting") const pitScoutData = await localforage.getItem("pit-scouting") setItems({ matchScout: matchScoutData ? (matchScoutData as any[]) : [], pitScout: pitScoutData ? (pitScoutData as any[]) : [], }) } const [modalState, setModalState] = useState({ error: false, modalOpen: false, loading: false, }) useEffect(() => { fetchData() }, []) return ( <> <h1>All the data you've ever submitted</h1> <h2> Pitscouting </h2> {console.log(items.matchScout)} {Array.isArray(items.matchScout) ? ( <ReactTable data={items.pitScout.filter(t => t !== null)} pageSize={10} columns={[ { Header: "(re)Submit", Cell({ original }: { original: any }) { return ( <Button onClick={() => { console.log("doing stuff") setModalState({ modalOpen: true, loading: true, error: false, }) axios .post( proxyurl + pitScoutUrl, JSON.stringify(original), { headers: { "content-type": "json" }, } ) .then(() => { console.log("updating storage") updateStorage("pit-scouting", original) .then(() => setModalState({ modalOpen: true, loading: false, error: false, }) ) .then(() => fetchData()) }) .catch(() => setModalState({ modalOpen: true, loading: false, error: true, }) ) }} > Submit </Button> ) }, }, { Header: "Team Number", accessor: "Team Number" }, { Header: "Submitted", accessor: "submitted", Cell(props: { value: any }) { return <p>{props.value.toString()}</p> }, }, ]} /> ) : ( "none" )} <h2> Match Scouting </h2> {Array.isArray(items.matchScout) ? ( <ReactTable data={items.matchScout.filter(t => t !== null)} pageSize={10} columns={[ { Header: "(re)Submit", Cell({ original }: { original: any }) { return ( <Button onClick={() => { console.log("doing stuff") setModalState({ modalOpen: true, loading: true, error: false, }) axios .post( proxyurl + matchScoutUrl, JSON.stringify(original), { headers: { "content-type": "json" }, } ) .then(() => { console.log("updating storage") updateStorage("match-scouting", original) .then(() => setModalState({ modalOpen: true, loading: false, error: false, }) ) .then(() => fetchData()) }) .catch(() => setModalState({ modalOpen: true, loading: false, error: true, }) ) }} > Submit </Button> ) }, }, { Header: "Team Number", accessor: "Team Number" }, { Header: "Match Number", accessor: "Match Number" }, { Header: "Submitted", accessor: "submitted", Cell(props: { value: any }) { return <p>{props.value.toString()}</p> }, }, ]} /> ) : ( "none" )} {modalState.modalOpen && ( <Modal onClose={() => setModalState({ error: false, modalOpen: false, loading: false }) } > <h1> Submitting</h1> <p> {!modalState.error && !modalState.loading ? "Data summitted!" : ""} </p> <p>{modalState.loading ? "loading...." : ""}</p> <p>{modalState.error ? "error! please try again later" : ""}</p> </Modal> )} </> ) }
abkl/csim
lib/data-functions.ts
<reponame>abkl/csim import { mean, sampleStandardDeviation } from "simple-statistics" import { fields, gameValues } from "../src/utils/game-constants" // Types: interface TotalStats { totalMeans: { [s: string]: number } totalStdDeviations: { [s: string]: number } } type GameItem = "Cargo" | "Hatch Panel" export interface ScoresObj { "Robot Starting Platform": "level 1" | "level 2" "Leave Habitat": "TRUE" | "FALSE" "Habitat Return": "Did not return" | "level 1" | "level 2" | "level 3" "Team Number": string "Match Number": string "Your Name": string [s: string]: string } export interface Score { Cargo: number "Hatch Panel": number "Sandstorm Cross": number "Habitat Return": number "Total Score": number "Team Number": string [s: string]: number | string } export interface MatchData { "Team Number": string "Match Number": string [s: string]: any } interface Stats { "Mean Number of Balls": { mean: number; standardDeviation: number } "Mean Number of Rings": { mean: number; standardDeviation: number } "Points Scored": { mean: number; standardDeviation: number } [key: string]: { mean: number; standardDeviation: number } } export interface Teams { [s: string]: { matchData: MatchData[] stats: Stats | {} } } export interface TeamCollection { originalScores: Score[] | [] teams: Teams } // Convert Sheets data into Collection of Teams Objects Functions: export const sheetsDataToJSON = (sheetsData: any[][]) => { if (sheetsData.length < 2) { throw Error("invalid data passed!") } const dataKeys = sheetsData[0] const d = sheetsData.slice(1) return d.map(rows => rows.reduce( (currentObject, cell, index) => ({ ...currentObject, [dataKeys[index]]: cell, }), {} ) ) } // Transform Match Data into total game Items and calculate total scores functions: export const getGameItemKeyFromMatchDataKey = ( keys: string[], gameItem: GameItem, dropped?: boolean ) => !dropped ? keys.filter(key => RegExp(gameItem).test(key) && !/dropped/.test(key)) : keys.filter(key => RegExp(gameItem).test(key) && /dropped/.test(key)) export const calculateScore = (data: ScoresObj): Score => { const scoreCargo = getGameItemKeyFromMatchDataKey(Object.keys(data), "Cargo") .map(key => data[key]) .reduce((pv: number, cv) => pv + parseInt(cv, 10), 0) * gameValues.Cargo const scoreHatchPanel = getGameItemKeyFromMatchDataKey(Object.keys(data), "Hatch Panel") .map(key => data[key]) .reduce((pv: number, cv) => pv + parseInt(cv, 10), 0) * gameValues["Hatch Panel"] const scoreHabitatReturn = // @ts-ignore gameValues["Habitat Return"][data["Habitat Return"]] || 0 const scoreSandstormCross = // @ts-ignore data["Leave Habitat"] === "TRUE" ? gameValues["Sandstorm Cross"][data["Robot Starting Platform"]] : 0 return { "Match Number": data["Match Number"], Cargo: scoreCargo, "Hatch Panel": scoreHatchPanel, "Habitat Return": scoreHabitatReturn, "Sandstorm Cross": scoreSandstormCross, // @ts-ignore "Team Number": data["Team Number"], "Scouter Name": data["<NAME>"], "Total Score": scoreCargo + scoreHatchPanel + scoreSandstormCross + scoreHabitatReturn, } } export const collectMatchDataIntoTeamObj = (d: MatchData[]): TeamCollection => d.reduce( (teamTotals: TeamCollection, matchData) => { return teamTotals.teams[matchData["Team Number"]] ? { teams: { ...teamTotals.teams, [matchData["Team Number"]]: { matchData: [ ...teamTotals.teams[matchData["Team Number"]].matchData, matchData, ], stats: {}, }, }, originalScores: [ ...teamTotals.originalScores, calculateScore(matchData as ScoresObj), ], } : { teams: { ...teamTotals.teams, [matchData["Team Number"]]: { matchData: [matchData], stats: {} }, }, originalScores: [ ...teamTotals.originalScores, calculateScore(matchData as ScoresObj), ], } }, { teams: {}, originalScores: [], } ) export const calculateTotalStats = (scores: Score[]): TotalStats => { const intermediateObj = scores.reduce( (pv, cv) => { return { Cargo: [...pv.Cargo, cv.Cargo], "Hatch Panel": [...pv["Hatch Panel"], cv["Hatch Panel"]], "Sandstorm Cross": [...pv["Sandstorm Cross"], cv["Sandstorm Cross"]], "Habitat Return": [...pv["Habitat Return"], cv["Habitat Return"]], "Total Score": [...pv["Total Score"], cv["Total Score"]], } }, { Cargo: [], "Hatch Panel": [], "Sandstorm Cross": [], "Habitat Return": [], "Total Score": [], } ) return { totalMeans: { Cargo: intermediateObj.Cargo.length > 0 ? mean(intermediateObj.Cargo) : 0, "Hatch Panel": intermediateObj["Hatch Panel"].length > 0 ? mean(intermediateObj["Hatch Panel"]) : 0, "Sandstorm Cross": intermediateObj["Sandstorm Cross"].length > 0 ? mean(intermediateObj["Sandstorm Cross"]) : 0, "Habitat Return": intermediateObj["Habitat Return"].length > 0 ? mean(intermediateObj["Habitat Return"]) : 0, "Total Score": intermediateObj["Total Score"].length > 0 ? mean(intermediateObj["Total Score"]) : 0, }, totalStdDeviations: { Cargo: intermediateObj.Cargo.length > 0 ? sampleStandardDeviation(intermediateObj.Cargo) : 0, "Hatch Panel": intermediateObj["Hatch Panel"].length > 0 ? sampleStandardDeviation(intermediateObj["Hatch Panel"]) : 0, "Sandstorm Cross": intermediateObj["Sandstorm Cross"].length > 0 ? sampleStandardDeviation(intermediateObj["Sandstorm Cross"]) : 0, "Habitat Return": intermediateObj["Habitat Return"].length > 0 ? sampleStandardDeviation(intermediateObj["Habitat Return"]) : 0, "Total Score": intermediateObj["Total Score"].length > 0 ? sampleStandardDeviation(intermediateObj["Total Score"]) : 0, }, } }
abkl/csim
src/components/primatives/link.tsx
<reponame>abkl/csim import { Link } from "gatsby" import styled from "@emotion/styled" const StyledLink = styled(Link)` color: ${props => props.theme.shadow.light}; &:active { color: ${props => props.theme.shadow.dark}; } ` export default StyledLink
abkl/csim
src/components/form-components/slider.tsx
<filename>src/components/form-components/slider.tsx<gh_stars>0 import React from "react" import Slider, { createSliderWithTooltip } from "rc-slider" import theme from "../../utils/theme" import "rc-slider/assets/index.css" interface FormSliderProps { onChange: (v: any) => void name: string value: string min?: number max: number step: number marks: { [s: string]: string } } const SliderWithToolTip = createSliderWithTooltip(Slider) export default function FormSlider({ onChange, name, value, max, step, marks, min, }: FormSliderProps) { return ( <div css={{ paddingBottom: "30px", }} > <label>{name}</label> <SliderWithToolTip trackStyle={{ backgroundColor: theme.primary.red }} handleStyle={{ borderColor: theme.primary.red }} dots onChange={onChange} value={parseInt(value)} css={{ margin: "auto", width: "50%" }} max={max} min={min || 0} marks={marks} step={step} /> </div> ) }
abkl/csim
src/utils/randomData.ts
<reponame>abkl/csim<filename>src/utils/randomData.ts export default [ { "Your Name": "Skinner", "Team Number": 0, "Event Code": "sfr", "Match Number": 16, "Robot Starting Platform": "level 1", "Leave Habitat": "FALSE", "Number of Hatch Panels(Sandstorm)": 37, "Number of Cargo(Sandstorm)": 34, "Number of Hatch Panels dropped(Sandstorm)": 45, "Number of Cargo dropped(Sandstorm)": 11, "Number of Hatch Panels(Teleop)": 46, "Number of Cargo(Teleop)": 29, "Number of Hatch Panels dropped(Teleop)": 40, "Number of Cargo dropped(Teleop)": 31, "Number of Fouls": 47, "Habitat Return": "level 1", "Rocket Completion": "FALSE", "Robot Deadtime": "less than 5 seconds", Comments: "hello", }, { "Your Name": "Oconnor", "Team Number": 0, "Event Code": "sfr", "Match Number": 38, "Robot Starting Platform": "level 1", "Leave Habitat": "FALSE", "Number of Hatch Panels(Sandstorm)": 8, "Number of Cargo(Sandstorm)": 22, "Number of Hatch Panels dropped(Sandstorm)": 8, "Number of Cargo dropped(Sandstorm)": 33, "Number of Hatch Panels(Teleop)": 42, "Number of Cargo(Teleop)": 9, "Number of Hatch Panels dropped(Teleop)": 32, "Number of Cargo dropped(Teleop)": 11, "Number of Fouls": 17, "Habitat Return": "level 1", "Rocket Completion": "FALSE", "Robot Deadtime": "less than 5 seconds", Comments: "hello", }, { "Your Name": "Travis", "Team Number": 5, "Event Code": "sfr", "Match Number": 11, "Robot Starting Platform": "level 2", "Leave Habitat": "TRUE", "Number of Hatch Panels(Sandstorm)": 35, "Number of Cargo(Sandstorm)": 32, "Number of Hatch Panels dropped(Sandstorm)": 42, "Number of Cargo dropped(Sandstorm)": 44, "Number of Hatch Panels(Teleop)": 40, "Number of Cargo(Teleop)": 49, "Number of Hatch Panels dropped(Teleop)": 4, "Number of Cargo dropped(Teleop)": 1, "Number of Fouls": 10, "Habitat Return": "level 1", "Rocket Completion": "TRUE", "Robot Deadtime": "less than 5 seconds", Comments: "hello", }, { "Your Name": "Evangelina", "Team Number": 2, "Event Code": "sfr", "Match Number": 12, "Robot Starting Platform": "level 2", "Leave Habitat": "TRUE", "Number of Hatch Panels(Sandstorm)": 27, "Number of Cargo(Sandstorm)": 18, "Number of Hatch Panels dropped(Sandstorm)": 26, "Number of Cargo dropped(Sandstorm)": 36, "Number of Hatch Panels(Teleop)": 23, "Number of Cargo(Teleop)": 28, "Number of Hatch Panels dropped(Teleop)": 2, "Number of Cargo dropped(Teleop)": 29, "Number of Fouls": 7, "Habitat Return": "level 1", "Rocket Completion": "TRUE", "Robot Deadtime": "less than 5 seconds", Comments: "hello", }, { "Your Name": "Jacobson", "Team Number": 2, "Event Code": "sfr", "Match Number": 49, "Robot Starting Platform": "level 1", "Leave Habitat": "TRUE", "Number of Hatch Panels(Sandstorm)": 13, "Number of Cargo(Sandstorm)": 4, "Number of Hatch Panels dropped(Sandstorm)": 49, "Number of Cargo dropped(Sandstorm)": 45, "Number of Hatch Panels(Teleop)": 0, "Number of Cargo(Teleop)": 9, "Number of Hatch Panels dropped(Teleop)": 4, "Number of Cargo dropped(Teleop)": 37, "Number of Fouls": 32, "Habitat Return": "level 1", "Rocket Completion": "TRUE", "Robot Deadtime": "less than 5 seconds", Comments: "hello", }, { "Your Name": "Minerva", "Team Number": 3, "Event Code": "sfr", "Match Number": 20, "Robot Starting Platform": "level 1", "Leave Habitat": "FALSE", "Number of Hatch Panels(Sandstorm)": 25, "Number of Cargo(Sandstorm)": 32, "Number of Hatch Panels dropped(Sandstorm)": 29, "Number of Cargo dropped(Sandstorm)": 22, "Number of Hatch Panels(Teleop)": 18, "Number of Cargo(Teleop)": 50, "Number of Hatch Panels dropped(Teleop)": 41, "Number of Cargo dropped(Teleop)": 42, "Number of Fouls": 24, "Habitat Return": "level 1", "Rocket Completion": "TRUE", "Robot Deadtime": "less than 5 seconds", Comments: "hello", }, { "Your Name": "Stafford", "Team Number": 5, "Event Code": "sfr", "Match Number": 9, "Robot Starting Platform": "level 2", "Leave Habitat": "FALSE", "Number of Hatch Panels(Sandstorm)": 35, "Number of Cargo(Sandstorm)": 6, "Number of Hatch Panels dropped(Sandstorm)": 4, "Number of Cargo dropped(Sandstorm)": 37, "Number of Hatch Panels(Teleop)": 31, "Number of Cargo(Teleop)": 14, "Number of Hatch Panels dropped(Teleop)": 23, "Number of Cargo dropped(Teleop)": 40, "Number of Fouls": 38, "Habitat Return": "level 1", "Rocket Completion": "TRUE", "Robot Deadtime": "less than 5 seconds", Comments: "hello", }, { "Your Name": "Gregory", "Team Number": 3, "Event Code": "sfr", "Match Number": 26, "Robot Starting Platform": "level 1", "Leave Habitat": "TRUE", "Number of Hatch Panels(Sandstorm)": 11, "Number of Cargo(Sandstorm)": 25, "Number of Hatch Panels dropped(Sandstorm)": 18, "Number of Cargo dropped(Sandstorm)": 31, "Number of Hatch Panels(Teleop)": 32, "Number of Cargo(Teleop)": 36, "Number of Hatch Panels dropped(Teleop)": 18, "Number of Cargo dropped(Teleop)": 10, "Number of Fouls": 24, "Habitat Return": "level 1", "Rocket Completion": "TRUE", "Robot Deadtime": "less than 5 seconds", Comments: "hello", }, { "Your Name": "Howell", "Team Number": 2, "Event Code": "sfr", "Match Number": 14, "Robot Starting Platform": "level 1", "Leave Habitat": "FALSE", "Number of Hatch Panels(Sandstorm)": 3, "Number of Cargo(Sandstorm)": 48, "Number of Hatch Panels dropped(Sandstorm)": 34, "Number of Cargo dropped(Sandstorm)": 43, "Number of Hatch Panels(Teleop)": 34, "Number of Cargo(Teleop)": 44, "Number of Hatch Panels dropped(Teleop)": 27, "Number of Cargo dropped(Teleop)": 22, "Number of Fouls": 25, "Habitat Return": "level 1", "Rocket Completion": "TRUE", "Robot Deadtime": "less than 5 seconds", Comments: "hello", }, { "Your Name": "Irwin", "Team Number": 4, "Event Code": "sfr", "Match Number": 2, "Robot Starting Platform": "level 2", "Leave Habitat": "TRUE", "Number of Hatch Panels(Sandstorm)": 11, "Number of Cargo(Sandstorm)": 29, "Number of Hatch Panels dropped(Sandstorm)": 5, "Number of Cargo dropped(Sandstorm)": 37, "Number of Hatch Panels(Teleop)": 10, "Number of Cargo(Teleop)": 15, "Number of Hatch Panels dropped(Teleop)": 47, "Number of Cargo dropped(Teleop)": 36, "Number of Fouls": 29, "Habitat Return": "level 1", "Rocket Completion": "TRUE", "Robot Deadtime": "less than 5 seconds", Comments: "hello", }, ]
abkl/csim
src/components/app-bar.tsx
import { Link } from "gatsby" import { css } from "@emotion/core" import { rhythm } from "../utils/typography" import React from "react" import styled from "@emotion/styled" interface HeaderProps { siteTitle: string } const LinkP = styled.p` display: inline-block; align-self: flex-end; font-style: normal; padding-right: ${rhythm(0.3)}; text-decoration: none; margin-top: ${rhythm(1)}; ` const LinkH1 = styled.h1` display: inline-block; font-style: normal; padding-left: ${rhythm(1)}; text-decoration: none; margin-top: ${rhythm(1)}; ` const StyledLink = styled(Link)` text-decoration: none; background-image: none; text-shadow: none; color: white; ` const HeaderLinks = ({ children, to }: { children: string; to: string }) => ( <LinkP> <StyledLink to={to}>{children}</StyledLink> </LinkP> ) const AppBar = ({ siteTitle }: HeaderProps) => ( <div css={theme => css` padding: ${rhythm(1 / 5)}; background-color: ${theme.primary.red}; display: flex; flex-direction: row; justify-content: space-between; `} > <LinkH1> <StyledLink to="/">{siteTitle}</StyledLink> </LinkH1> <div css={css` align-self: flex-end; `} > <HeaderLinks to="/scouting-form"> (Scouting) </HeaderLinks> <HeaderLinks to="/pit-scouting"> (Pit) </HeaderLinks> <HeaderLinks to="/offline-data"> (Offline) </HeaderLinks> </div> </div> ) export default AppBar
abkl/csim
src/pages/scouting-form.tsx
import React from "react" import { css } from "@emotion/core" import Form from "../components/form-components/form-template" import { fields } from "../utils/game-constants" const ScoutingFormPage = () => ( <> <h1 css={css` text-align: center; `} > Scouting Form </h1> <p css={css` font-style: italic; text-align: center; `} > U means upper, L means lower </p> <Form storageKey="match-scouting" fields={fields} submitUrl={ "https://script.google.com/macros/s/AKfycbxd9o5VOvlJT4SqTeJTAoUmT9WNxmagGafiTARnFCyU7bgPlcnR/exec" } /> </> ) export default ScoutingFormPage
abkl/csim
src/components/primatives/divs.tsx
import styled from "@emotion/styled" export const FlexAlignCenter = styled.div` display: flex; justify-content: center; align-content: center; flex-direction: column; height: 100%; width: 100%; `
abkl/csim
src/globals.d.ts
<filename>src/globals.d.ts<gh_stars>0 /* eslint-disable import/export */ declare module "tailwind.macro" { export default function tw(a: TemplateStringsArray): string } declare module "react-table/lib/hoc/foldableTable" { import { Column, TableProps } from "react-table" interface FoldableColumn<T> extends Column<T> { foldable?: boolean } interface FoldableTableProps<D = any> extends TableProps<D> { columns: FoldableColumn<D>[] } export default function foldableTable<D>( a: React.ComponentType ): React.ComponentType<Partial<FoldableTableProps<D>>> } declare module "uuid/v4" { export default function uuid(): string }
abkl/csim
src/components/form-components/counter.tsx
<reponame>abkl/csim import React from "react" import Button from "../primatives/button" import css from "@emotion/css" import { MdArrowUpward, MdArrowDownward } from "react-icons/md" interface CounterProps { setFieldValue: (field: string, value: any) => void name: string values: { [s: string]: string } dropped: boolean } function Grouping({ setFieldValue, values, dropped, name }: CounterProps) { return ( <div css={css` display: flex; flex-direction: column; justify-content: flex-start; width: 100%; text-align: left; `} > <label css={{ fontWeight: "bold" }}> {dropped ? "Dropped:" : "Scored"} </label> <div css={css` display: flex; flex-direction: row; width: 60%; justify-content: space-between; `} > <div css={css` display: flex; flex-direction: column; width: 50px; height: 84.5px; `} > <Button type="button" onClick={() => parseInt(values[name]) >= 0 ? setFieldValue(name, parseInt(values[name]) + 1) : "" } css={css` border-radius: 9px 9px 0 0; border-bottom-width: 0.5px; `} > <MdArrowUpward /> </Button> <Button type="button" onClick={() => parseInt(values[name]) ? setFieldValue(name, parseInt(values[name]) - 1) : "" } css={css` border-radius: 0 0 9px 9px; border-top-width: 0.5px; `} > <MdArrowDownward /> </Button> </div> <label css={{ alignSelf: "center", justifySelf: "flex-end" }}> {values[name] ? values[name] : 0} </label> </div> </div> ) } export default function Counter(props: CounterProps) { const { name, setFieldValue, values, dropped } = props return ( <div css={{ display: "flex", flexDirection: "column", borderWidth: "5px", paddingBottom: "5%", justifyContent: "center", alignItems: "center", maxWidth: "300px", width: "100%", alignSelf: "center", textAlign: "left", }} > <label css={{ alignSelf: "flex-start" }}>{name}:</label> {dropped ? ( <div css={css` display: flex; flex-direction: row; width: 70%; max-width: 300px; `} > <Grouping {...props} dropped={false} /> <Grouping {...props} name={`${name} dropped`} /> </div> ) : ( <div css={css` display: flex; flex-direction: row; justify-content: space-around; width: 50%; max-width: 160px; `} > <Button type="button" onClick={() => parseInt(values[name]) >= 0 ? setFieldValue(name, parseInt(values[name]) + 1) : "" } > + </Button> <label css={{ textAlign: "center", alignSelf: "center" }}> {values[name] ? values[name] : 0} </label> <Button type="button" onClick={() => parseInt(values[name]) ? setFieldValue(name, parseInt(values[name]) - 1) : "" } > - </Button> </div> )} <br /> </div> ) }
abkl/csim
src/pages/picklist.tsx
import React from "react" const PickListPage = () => { return ( <div> <h1> Your PickList </h1> <em> Not synced to the internet, local only. </em> </div> ) } export default PickListPage
abkl/csim
src/utils/apiRequests.ts
<gh_stars>0 import axios from "axios" export const fetchTeamsFromTBA = async (eventKey: string) => { try { let res = await axios.get( `https://www.thebluealliance.com/api/v3/event/${eventKey}/teams/simple`, { headers: { "X-TBA-Auth-Key": "<KEY>", }, } ) return res } catch (err) { console.error(err) } }
abkl/csim
lib/transform-fields.ts
<filename>lib/transform-fields.ts<gh_stars>0 import { Fields } from "../src/utils/game-constants" import { fetchTeamsFromTBA } from "./apiFetches" // run using ts-node, use: ` ts-node -O '{"module": "commonjs"}' ./transform-fields.ts ` const fields: Fields = { General: [ "Scouter Name", "Team Number", { "field-name": "How much experience do your drivers have?", type: "Radio", options: ["1 year", "2 years", "3 years+"], scoring: false, }, { "field-name": "Where is your robot capable of placing hatches?(Check all that apply)", type: "Checkbox", options: ["Not Capable", "level 1", "level 2", "level 3"], scoring: false, }, { "field-name": "Where is your robot capable of placing cargo?(Check all that apply)", type: "Checkbox", options: ["Not Capable", "level 1", "level 2", "level 3"], scoring: false, }, ], Sandstorm: [ { "field-name": "Where does your robot start during Sandstorm?", type: "Radio", options: ["level 1", "level 2"], scoring: false, }, { "field-name": "Do you preload hatch or cargo?", type: "Radio", options: ["Hatch", "Cargo"], scoring: false, }, ], Endgame: [ { "field-name": "Is your robot capable of climbing?", type: "Radio", options: ["Not capable", "level 2", "level 3"], scoring: false, }, { "field-name": "If you can climb, how many robots are you able to bring with you?", type: "Slider", min: 0, max: 2, marks: { 0: "None", 1: "One", 2: "Two", }, step: 1, scoring: false, }, ], Problems: [ "Recent problems with robot", { "field-name": "If so, what is your progress in solving those issues?", type: "Radio", options: [ "No problems", "In progress but kind of stuck", "In progress, & we know what we're doing", "Solved", ], scoring: false, }, ], } const transfromFields = Object.keys(fields) .map(key => fields[key]) .reduce((acc, val) => acc.concat(val), []) .map(fieldKey => typeof fieldKey === "string" ? fieldKey : fieldKey.type === "Number" ? fieldKey.dropped ? `${fieldKey["field-name"]}\n ${fieldKey["field-name"]} dropped` : fieldKey["field-name"] : fieldKey["field-name"] ) .reduce( (p, c) => `${p} ${c}`, "" ) console.log(transfromFields)
abkl/csim
test/form-utils.spec.ts
<gh_stars>0 // import { updateValues } from "../src/components/form-components/checkbox" // describe("util function works", () => { // test("updateValues should work", () => { // expect(updateValues("hello", "world,haha")).toBe("world,haha,hello") // }) // })
abkl/csim
src/templates/all-teams-template.tsx
<reponame>abkl/csim<filename>src/templates/all-teams-template.tsx import React, { useContext } from "react" import { TeamObject } from "./team-template" import Link from "../components/primatives/link" import ReactTable from "react-table" import foldableTable from "react-table/lib/hoc/foldableTable" import "react-table/react-table.css" import { RootContext, RootState } from "../contexts/root-context" import Button from "../components/primatives/button" const FTBL = foldableTable<TeamObject>(ReactTable) export default function AllTeamsTemplate({ pageContext: { teams }, }: { pageContext: { teams: TeamObject[] } }) { const { state, changeState } = useContext(RootContext) return ( <div> <h1>Teams</h1> <em>yes there are duplicates</em> <br /> <FTBL filterable data={teams} showPageSizeOptions={false} pageSize={20} columns={[ { Header: "Information", foldable: true, columns: [ { Header: "Add to Picklist", accessor: "team_number", Cell(props: { value: string }) { return ( <> {!state.pickList.includes(parseInt(props.value)) ? ( <> <Button onClick={() => changeState((s: RootState) => ({ ...s, pickList: [...s.pickList, props.value], })) } css={{ marginRight: "1%" }} > + to Picklist </Button> </> ) : ( <Button onClick={() => changeState( (s: RootState): RootState => ({ ...s, pickList: s.pickList.filter( t => t !== parseInt(props.value) ), }) ) } > - from Picklist </Button> )} </> ) }, minWidth: 117, }, { Header: "Team Number", accessor: "team_number", Cell(props: { value: string }) { return <Link to={`/teams/${props.value}`}>{props.value}</Link> }, }, { Header: "Nickname", accessor: "nickname", }, { Header: "Competition", accessor: "competition", filterAll: true, filterMethod: (filter: { value: string }, row: TeamObject[]) => !filter.value || filter.value === "all" ? row : row.filter(team => team.competition === filter.value), Filter({ filter, onChange, }: { filter: { value: string } onChange: (a: any) => void }) { return ( <select onChange={event => onChange(event.target.value)} style={{ width: "100%" }} value={filter ? filter.value : "all"} > <option value="all">all</option> <option value="sfr">SFR</option> <option value="svr">SVR</option> </select> ) }, }, ], }, { Header: "stats", foldable: true, columns: [ { Header: "Mean Rings", id: "mean rings", accessor: d => state.teams[d.team_number].stats["Number of Rings"] ? state.teams[d.team_number].stats["Number of Rings"].mean : 0, }, { Header: "Mean Balls", id: "mean balls", accessor: d => state.teams[d.team_number].stats["Number of Balls"] ? state.teams[d.team_number].stats["Number of Balls"].mean : 0, }, { Header: "Mean % Score Contrib", id: "mean score", accessor: d => state.teams[d.team_number].stats["% Contrib to Team"] ? state.teams[d.team_number].stats["% Contrib to Team"].mean : 0, }, ], }, ]} /> </div> ) }
abkl/csim
src/utils/theme.ts
export default { primary: { red: "#8A0002", black: "#000", white: "#fff", }, highlight: { light: "#E6E6E6", dark: "#A5A4AA", }, shadow: { light: "#6B0000", dark: "#4D0002", }, }
abkl/csim
src/contexts/root-context.tsx
import React, { createContext, useState } from "react" import { MatchData, Teams } from "../../lib/data-functions" import { data } from "../../lib/randomData" export interface RootState { matchData: MatchData[] | [] teams: Teams | {} pickList: number[] } interface Props { children: React.ReactNode } export const RootContext = createContext<{ state: RootState changeState: (a: (b: RootState) => any) => void | any }>({ state: { matchData: [], pickList: [], teams: {}, }, changeState: () => {}, }) export default function RootContextContainer(props: Props) { const [state, changeState] = useState<RootState>({ matchData: [], teams: {}, pickList: [], }) return ( <RootContext.Provider value={{ state, changeState }}> {props.children} </RootContext.Provider> ) }
abkl/csim
src/pages/pit-scouting.tsx
import React from "react" import css from "@emotion/css" import Form from "../components/form-components/form-template" import { Fields } from "../utils/game-constants" export const fields: Fields = { General: [ "Scouter Name", "Team Number", { "field-name": "How much experience do your drivers have?", type: "Radio", options: ["1 year", "2 years", "3 years+"], scoring: false, }, { "field-name": "Where is your robot capable of placing hatches?(Check all that apply)", type: "Checkbox", options: ["Not Capable", "level 1", "level 2", "level 3"], scoring: false, }, { "field-name": "Where is your robot capable of placing cargo?(Check all that apply)", type: "Checkbox", options: ["Not Capable", "level 1", "level 2", "level 3"], scoring: false, }, ], Sandstorm: [ { "field-name": "Where does your robot start during Sandstorm?", type: "Radio", options: ["level 1", "level 2"], scoring: false, }, { "field-name": "Do you preload hatch or cargo?", type: "Radio", options: ["Hatch", "Cargo"], scoring: false, }, ], Endgame: [ { "field-name": "Is your robot capable of climbing?", type: "Radio", options: ["Not capable", "level 2", "level 3"], scoring: false, }, { "field-name": "If you can climb, how many robots are you able to bring with you?", type: "Slider", min: 0, max: 2, marks: { 0: "None", 1: "One", 2: "Two", }, step: 1, scoring: false, }, ], Problems: [ "Recent problems with robot", { "field-name": "If so, what is your progress in solving those issues?", type: "Radio", options: [ "No problems", "In progress but kind of stuck", "In progress, & we know what we're doing", "Solved", ], scoring: false, }, ], } export default function PitScoutingForm() { return ( <> <h1 css={css` text-align: center; `} > Pit Scouting Form </h1> <Form storageKey="pit-scouting" fields={fields} submitUrl={ "https://script.google.com/macros/s/AKfycbzpOJMML-rkyz_HB-GRstlAke0OayBeMEFVW21a04lpD9TJrKc/exec" } /> </> ) }
abkl/csim
src/templates/team-template.tsx
<gh_stars>0 import React, { useContext } from "react" import { RootContext, RootState } from "../contexts/root-context" import Button from "../components/primatives/button" import PieChart from "../components/charts/piechart" import ReactTable from "react-table" import { navigate } from "gatsby" /* eslint camelcase: "off" */ export interface TeamObject { team_number: number nickname: string city: string country: string state_prov: string address: string website: string competition: string } const TeamTemplate = ({ pageContext: { team }, }: { pageContext: { team: TeamObject } }) => { const { state, changeState } = useContext(RootContext) const stats = state.teams[team.team_number].stats return ( <div> <h1> Team {team.team_number}: {team.nickname} </h1> <em>Team Website: </em> <a href={team.website} target="_blank"> {team.website} </a> <br /> {!state.pickList.includes(team.team_number) ? ( <> <Button onClick={() => changeState((s: RootState) => ({ ...s, pickList: [...s.pickList, team.team_number], })) } css={{ marginRight: "1%" }} > + Team to Picklist </Button> <Button onClick={() => navigate("picklist")}>Go to Picklist</Button> </> ) : ( <Button onClick={() => changeState( (s: RootState): RootState => ({ ...s, pickList: s.pickList.filter(t => t !== team.team_number), }) ) } > - Team to Picklist </Button> )} <div css={{ textAlign: "center", marginTop: "5%" }}> <h1> Stats Summary Table </h1> <ReactTable data={ stats ? Object.keys(stats).map(key => ({ label: key, ...stats[key] })) : [] } pageSize={10} showPagination={false} columns={[ { Header: "Stat", accessor: "label", }, { Header: "Mean", accessor: "mean", }, { Header: "Standard Deviation", accessor: "standardDeviation", }, ]} /> <h1> Charts </h1> <h2>Point Composition Breakdown</h2> <PieChart /> </div> </div> ) } export default TeamTemplate
abkl/csim
src/utils/last-year-data.ts
const data = [ { Timestamp: "10/6/2018 8:48:39", "Team number": "3501", "Match number": "16", "Scout name(your name)": "<NAME>", "Cross baseline during auto?": "No", "Number of cubes dropped off in the switch (during auto)": "0", "Number of cubes dropped off in the scale (during auto)": "0", "Number of cubes picked up from the pyramid": "0", "Number of cubes picked up from the portal": "0", "Number of cubes picked up from the field": "0", "Number of cubes dropped off in the vault (during teleop)": "0", "Number of cubes dropped off in the scale (during teleop)": "1", "Number of cubes dropped off in your alliance switch (during teleop)": "0", "Number of cubes dropped off in your opponent's alliance switch (during teleop)": "0", "Total number of cubes fumbled(robot lost control of cube)": "0", Endgame: "Failed to make it onto the scale area", "Problems with robot/driver": "Robot got more than 3 fouls, Robot dead for less than 1 minute", }, { Timestamp: "10/6/2018 8:50:26", "Team number": "6174", "Match number": "16", "Scout name(your name)": "<NAME>", "Cross baseline during auto?": "Yes", "Number of cubes dropped off in the switch (during auto)": "0", "Number of cubes dropped off in the scale (during auto)": "0", "Number of cubes picked up from the pyramid": "0", "Number of cubes picked up from the portal": "0", "Number of cubes picked up from the field": "2", "Number of cubes dropped off in the vault (during teleop)": "0", "Number of cubes dropped off in the scale (during teleop)": "1", "Number of cubes dropped off in your alliance switch (during teleop)": "0", "Number of cubes dropped off in your opponent's alliance switch (during teleop)": "0", "Total number of cubes fumbled(robot lost control of cube)": "1", Endgame: "Climbed on ramp", "Problems with robot/driver": "No problems with robot.", }, { Timestamp: "10/6/2018 8:57:56", "Team number": "2643", "Match number": "16", "Scout name(your name)": "<NAME> ", "Cross baseline during auto?": "Yes", "Number of cubes dropped off in the switch (during auto)": "1", "Number of cubes dropped off in the scale (during auto)": "0", "Number of cubes picked up from the pyramid": "0", "Number of cubes picked up from the portal": "0", "Number of cubes picked up from the field": "4", "Number of cubes dropped off in the vault (during teleop)": "0", "Number of cubes dropped off in the scale (during teleop)": "3", "Number of cubes dropped off in your alliance switch (during teleop)": "0", "Number of cubes dropped off in your opponent's alliance switch (during teleop)": "0", "Total number of cubes fumbled(robot lost control of cube)": "2", Endgame: "Parked", "Problems with robot/driver": "No problems with robot.", }, { Timestamp: "10/6/2018 9:14:45", "Team number": "1684", "Match number": "16", "Scout name(your name)": "<NAME>", "Cross baseline during auto?": "Yes", "Number of cubes dropped off in the switch (during auto)": "0", "Number of cubes dropped off in the scale (during auto)": "0", "Number of cubes picked up from the pyramid": "6", "Number of cubes picked up from the portal": "0", "Number of cubes picked up from the field": "0", "Number of cubes dropped off in the vault (during teleop)": "6", "Number of cubes dropped off in the scale (during teleop)": "0", "Number of cubes dropped off in your alliance switch (during teleop)": "1", "Number of cubes dropped off in your opponent's alliance switch (during teleop)": "0", "Total number of cubes fumbled(robot lost control of cube)": "1", Endgame: "Failed to make it onto the scale area", "Problems with robot/driver": "No problems with robot.", }, { Timestamp: "10/6/2018 9:48:19", "Team number": "1458", "Match number": "16", "Scout name(your name)": "<NAME>", "Cross baseline during auto?": "No", "Number of cubes dropped off in the switch (during auto)": "0", "Number of cubes dropped off in the scale (during auto)": "0", "Number of cubes picked up from the pyramid": "3", "Number of cubes picked up from the portal": "0", "Number of cubes picked up from the field": "2", "Number of cubes dropped off in the vault (during teleop)": "4", "Number of cubes dropped off in the scale (during teleop)": "0", "Number of cubes dropped off in your alliance switch (during teleop)": "1", "Number of cubes dropped off in your opponent's alliance switch (during teleop)": "0", "Total number of cubes fumbled(robot lost control of cube)": "0", Endgame: "Climbed on ramp", "Problems with robot/driver": "No problems with robot.", }, { Timestamp: "10/6/2018 9:09:15", "Team number": "114", "Match number": "16.1", "Scout name(your name)": "<NAME>", "Cross baseline during auto?": "No", "Number of cubes dropped off in the switch (during auto)": "0", "Number of cubes dropped off in the scale (during auto)": "0", "Number of cubes picked up from the pyramid": "1", "Number of cubes picked up from the portal": "0", "Number of cubes picked up from the field": "2", "Number of cubes dropped off in the vault (during teleop)": "0", "Number of cubes dropped off in the scale (during teleop)": "3", "Number of cubes dropped off in your alliance switch (during teleop)": "0", "Number of cubes dropped off in your opponent's alliance switch (during teleop)": "0", "Total number of cubes fumbled(robot lost control of cube)": "1", Endgame: "Dropped partner", "Problems with robot/driver": "No problems with robot.", }, { Timestamp: "10/6/2018 9:16:33", "Team number": "114", "Match number": "16.2", "Scout name(your name)": "<NAME>", "Cross baseline during auto?": "Yes", "Number of cubes dropped off in the switch (during auto)": "0", "Number of cubes dropped off in the scale (during auto)": "0", "Number of cubes picked up from the pyramid": "1", "Number of cubes picked up from the portal": "0", "Number of cubes picked up from the field": "3", "Number of cubes dropped off in the vault (during teleop)": "0", "Number of cubes dropped off in the scale (during teleop)": "3", "Number of cubes dropped off in your alliance switch (during teleop)": "1", "Number of cubes dropped off in your opponent's alliance switch (during teleop)": "0", "Total number of cubes fumbled(robot lost control of cube)": "2", Endgame: "Failed to make it onto the scale area", "Problems with robot/driver": "No problems with robot.", }, { Timestamp: "10/6/2018 8:56:41", "Team number": "1967", "Match number": "17", "Scout name(your name)": "<NAME>", "Cross baseline during auto?": "No", "Number of cubes dropped off in the switch (during auto)": "0", "Number of cubes dropped off in the scale (during auto)": "0", "Number of cubes picked up from the pyramid": "1", "Number of cubes picked up from the portal": "0", "Number of cubes picked up from the field": "2", "Number of cubes dropped off in the vault (during teleop)": "0", "Number of cubes dropped off in the scale (during teleop)": "3", "Number of cubes dropped off in your alliance switch (during teleop)": "1", "Number of cubes dropped off in your opponent's alliance switch (during teleop)": "0", "Total number of cubes fumbled(robot lost control of cube)": "3", Endgame: "Parked", "Problems with robot/driver": "Robot tipped over", }, { Timestamp: "10/6/2018 8:57:35", "Team number": "2489", "Match number": "17", "Scout name(your name)": "<NAME>", "Cross baseline during auto?": "Yes", "Number of cubes dropped off in the switch (during auto)": "0", "Number of cubes dropped off in the scale (during auto)": "0", "Number of cubes picked up from the pyramid": "5", "Number of cubes picked up from the portal": "0", "Number of cubes picked up from the field": "0", "Number of cubes dropped off in the vault (during teleop)": "5", "Number of cubes dropped off in the scale (during teleop)": "0", "Number of cubes dropped off in your alliance switch (during teleop)": "0", "Number of cubes dropped off in your opponent's alliance switch (during teleop)": "0", "Total number of cubes fumbled(robot lost control of cube)": "0", Endgame: "Climbed on ramp", "Problems with robot/driver": "No problems with robot.", }, { Timestamp: "10/6/2018 8:59:12", "Team number": "4904", "Match number": "17", "Scout name(your name)": "<NAME>", "Cross baseline during auto?": "Yes", "Number of cubes dropped off in the switch (during auto)": "0", "Number of cubes dropped off in the scale (during auto)": "0", "Number of cubes picked up from the pyramid": "3", "Number of cubes picked up from the portal": "0", "Number of cubes picked up from the field": "3", "Number of cubes dropped off in the vault (during teleop)": "3", "Number of cubes dropped off in the scale (during teleop)": "4", "Number of cubes dropped off in your alliance switch (during teleop)": "0", "Number of cubes dropped off in your opponent's alliance switch (during teleop)": "0", "Total number of cubes fumbled(robot lost control of cube)": "2", Endgame: "Parked", "Problems with robot/driver": "No problems with robot.", }, { Timestamp: "10/6/2018 9:16:54", "Team number": "7108", "Match number": "17", "Scout name(your name)": "<NAME>", "Cross baseline during auto?": "Yes", "Number of cubes dropped off in the switch (during auto)": "1", "Number of cubes dropped off in the scale (during auto)": "0", "Number of cubes picked up from the pyramid": "4", "Number of cubes picked up from the portal": "1", "Number of cubes picked up from the field": "1", "Number of cubes dropped off in the vault (during teleop)": "0", "Number of cubes dropped off in the scale (during teleop)": "0", "Number of cubes dropped off in your alliance switch (during teleop)": "6", "Number of cubes dropped off in your opponent's alliance switch (during teleop)": "0", "Total number of cubes fumbled(robot lost control of cube)": "1", Endgame: "Failed to make it onto the scale area", "Problems with robot/driver": "No problems with robot.", }, { Timestamp: "10/6/2018 9:18:01", "Team number": "4904", "Match number": "17", "Scout name(your name)": "<NAME>", "Cross baseline during auto?": "Yes", "Number of cubes dropped off in the switch (during auto)": "0", "Number of cubes dropped off in the scale (during auto)": "0", "Number of cubes picked up from the pyramid": "1", "Number of cubes picked up from the portal": "0", "Number of cubes picked up from the field": "0", "Number of cubes dropped off in the vault (during teleop)": "0", "Number of cubes dropped off in the scale (during teleop)": "1", "Number of cubes dropped off in your alliance switch (during teleop)": "0", "Number of cubes dropped off in your opponent's alliance switch (during teleop)": "0", "Total number of cubes fumbled(robot lost control of cube)": "1", Endgame: "Parked", "Problems with robot/driver": "Robot tipped over", }, { Timestamp: "10/6/2018 9:49:54", "Team number": "1700", "Match number": "17", "Scout name(your name)": "<NAME>", "Cross baseline during auto?": "Yes", "Number of cubes dropped off in the switch (during auto)": "0", "Number of cubes dropped off in the scale (during auto)": "0", "Number of cubes picked up from the pyramid": "0", "Number of cubes picked up from the portal": "0", "Number of cubes picked up from the field": "1", "Number of cubes dropped off in the vault (during teleop)": "0", "Number of cubes dropped off in the scale (during teleop)": "0", "Number of cubes dropped off in your alliance switch (during teleop)": "1", "Number of cubes dropped off in your opponent's alliance switch (during teleop)": "0", "Total number of cubes fumbled(robot lost control of cube)": "0", Endgame: "Failed to make it onto the scale area", "Problems with robot/driver": "No problems with robot.", }, { Timestamp: "10/6/2018 9:04:46", "Team number": "6884", "Match number": "18", "Scout name(your name)": "<NAME>", "Cross baseline during auto?": "Yes", "Number of cubes dropped off in the switch (during auto)": "0", "Number of cubes dropped off in the scale (during auto)": "0", "Number of cubes picked up from the pyramid": "0", "Number of cubes picked up from the portal": "0", "Number of cubes picked up from the field": "0", "Number of cubes dropped off in the vault (during teleop)": "0", "Number of cubes dropped off in the scale (during teleop)": "0", "Number of cubes dropped off in your alliance switch (during teleop)": "0", "Number of cubes dropped off in your opponent's alliance switch (during teleop)": "0", "Total number of cubes fumbled(robot lost control of cube)": "0", Endgame: "Failed to make it onto the scale area", "Problems with robot/driver": "Robot dead for less than 1 minute", }, { Timestamp: "10/6/2018 9:05:24", "Team number": "4255", "Match number": "18", "Scout name(your name)": "<NAME>", "Cross baseline during auto?": "No", "Number of cubes dropped off in the switch (during auto)": "0", "Number of cubes dropped off in the scale (during auto)": "0", "Number of cubes picked up from the pyramid": "1", "Number of cubes picked up from the portal": "1", "Number of cubes picked up from the field": "3", "Number of cubes dropped off in the vault (during teleop)": "1", "Number of cubes dropped off in the scale (during teleop)": "2", "Number of cubes dropped off in your alliance switch (during teleop)": "1", "Number of cubes dropped off in your opponent's alliance switch (during teleop)": "2", "Total number of cubes fumbled(robot lost control of cube)": "3", Endgame: "Failed to make it onto the scale area", "Problems with robot/driver": "Robot dead for less than 1 minute", }, { Timestamp: "10/6/2018 9:05:55", "Team number": "5430", "Match number": "18", "Scout name(your name)": "Lavinie", "Cross baseline during auto?": "No", "Number of cubes dropped off in the switch (during auto)": "0", "Number of cubes dropped off in the scale (during auto)": "0", "Number of cubes picked up from the pyramid": "2", "Number of cubes picked up from the portal": "0", "Number of cubes picked up from the field": "1", "Number of cubes dropped off in the vault (during teleop)": "0", "Number of cubes dropped off in the scale (during teleop)": "0", "Number of cubes dropped off in your alliance switch (during teleop)": "1", "Number of cubes dropped off in your opponent's alliance switch (during teleop)": "0", "Total number of cubes fumbled(robot lost control of cube)": "1", Endgame: "Failed to make it onto the scale area", "Problems with robot/driver": "No problems with robot.", }, { Timestamp: "10/6/2018 9:06:17", "Team number": "199", "Match number": "18", "Scout name(your name)": "<NAME>", "Cross baseline during auto?": "Yes", "Number of cubes dropped off in the switch (during auto)": "1", "Number of cubes dropped off in the scale (during auto)": "0", "Number of cubes picked up from the pyramid": "0", "Number of cubes picked up from the portal": "0", "Number of cubes picked up from the field": "2", "Number of cubes dropped off in the vault (during teleop)": "0", "Number of cubes dropped off in the scale (during teleop)": "0", "Number of cubes dropped off in your alliance switch (during teleop)": "1", "Number of cubes dropped off in your opponent's alliance switch (during teleop)": "0", "Total number of cubes fumbled(robot lost control of cube)": "2", Endgame: "Climbed on ramp", "Problems with robot/driver": "No problems with robot.", }, { Timestamp: "10/6/2018 9:06:18", "Team number": "199", "Match number": "18", "Scout name(your name)": "<NAME>", "Cross baseline during auto?": "Yes", "Number of cubes dropped off in the switch (during auto)": "1", "Number of cubes dropped off in the scale (during auto)": "0", "Number of cubes picked up from the pyramid": "0", "Number of cubes picked up from the portal": "0", "Number of cubes picked up from the field": "4", "Number of cubes dropped off in the vault (during teleop)": "0", "Number of cubes dropped off in the scale (during teleop)": "1", "Number of cubes dropped off in your alliance switch (during teleop)": "3", "Number of cubes dropped off in your opponent's alliance switch (during teleop)": "0", "Total number of cubes fumbled(robot lost control of cube)": "1", Endgame: "Parked", "Problems with robot/driver": "No problems with robot.", }, { Timestamp: "10/6/2018 9:06:38", "Team number": "5430", "Match number": "18", "Scout name(your name)": "<NAME>", "Cross baseline during auto?": "No", "Number of cubes dropped off in the switch (during auto)": "0", "Number of cubes dropped off in the scale (during auto)": "0", "Number of cubes picked up from the pyramid": "1", "Number of cubes picked up from the portal": "0", "Number of cubes picked up from the field": "0", "Number of cubes dropped off in the vault (during teleop)": "0", "Number of cubes dropped off in the scale (during teleop)": "0", "Number of cubes dropped off in your alliance switch (during teleop)": "1", "Number of cubes dropped off in your opponent's alliance switch (during teleop)": "0", "Total number of cubes fumbled(robot lost control of cube)": "1", Endgame: "Parked", "Problems with robot/driver": "No problems with robot.", }, { Timestamp: "10/6/2018 9:06:54", "Team number": "2813", "Match number": "18", "Scout name(your name)": "<NAME>", "Cross baseline during auto?": "Yes", "Number of cubes dropped off in the switch (during auto)": "0", "Number of cubes dropped off in the scale (during auto)": "0", "Number of cubes picked up from the pyramid": "4", "Number of cubes picked up from the portal": "0", "Number of cubes picked up from the field": "0", "Number of cubes dropped off in the vault (during teleop)": "4", "Number of cubes dropped off in the scale (during teleop)": "0", "Number of cubes dropped off in your alliance switch (during teleop)": "0", "Number of cubes dropped off in your opponent's alliance switch (during teleop)": "0", "Total number of cubes fumbled(robot lost control of cube)": "0", Endgame: "Climbed on ramp", "Problems with robot/driver": "No problems with robot.", }, { Timestamp: "10/6/2018 9:12:40", "Team number": "6884", "Match number": "18", "Scout name(your name)": "<NAME>", "Cross baseline during auto?": "Yes", "Number of cubes dropped off in the switch (during auto)": "0", "Number of cubes dropped off in the scale (during auto)": "0", "Number of cubes picked up from the pyramid": "0", "Number of cubes picked up from the portal": "0", "Number of cubes picked up from the field": "0", "Number of cubes dropped off in the vault (during teleop)": "0", "Number of cubes dropped off in the scale (during teleop)": "0", "Number of cubes dropped off in your alliance switch (during teleop)": "0", "Number of cubes dropped off in your opponent's alliance switch (during teleop)": "0", "Total number of cubes fumbled(robot lost control of cube)": "0", Endgame: "Failed to make it onto the scale area", "Problems with robot/driver": "No problems with robot.", }, { Timestamp: "10/6/2018 9:47:08", "Team number": "2473", "Match number": "18", "Scout name(your name)": "<NAME>", "Cross baseline during auto?": "No", "Number of cubes dropped off in the switch (during auto)": "0", "Number of cubes dropped off in the scale (during auto)": "0", "Number of cubes picked up from the pyramid": "0", "Number of cubes picked up from the portal": "3", "Number of cubes picked up from the field": "0", "Number of cubes dropped off in the vault (during teleop)": "0", "Number of cubes dropped off in the scale (during teleop)": "0", "Number of cubes dropped off in your alliance switch (during teleop)": "1", "Number of cubes dropped off in your opponent's alliance switch (during teleop)": "3", "Total number of cubes fumbled(robot lost control of cube)": "2", Endgame: "Parked", "Problems with robot/driver": "No problems with robot.", }, { Timestamp: "10/6/2018 9:13:45", "Team number": "4159", "Match number": "19", "Scout name(your name)": "<NAME>", "Cross baseline during auto?": "Yes", "Number of cubes dropped off in the switch (during auto)": "0", "Number of cubes dropped off in the scale (during auto)": "1", "Number of cubes picked up from the pyramid": "0", "Number of cubes picked up from the portal": "1", "Number of cubes picked up from the field": "1", "Number of cubes dropped off in the vault (during teleop)": "1", "Number of cubes dropped off in the scale (during teleop)": "0", "Number of cubes dropped off in your alliance switch (during teleop)": "0", "Number of cubes dropped off in your opponent's alliance switch (during teleop)": "0", "Total number of cubes fumbled(robot lost control of cube)": "3", Endgame: "Climbed on ramp", "Problems with robot/driver": "No problems with robot.", }, { Timestamp: "10/6/2018 9:13:53", "Team number": "846", "Match number": "19", "Scout name(your name)": "<NAME>", "Cross baseline during auto?": "Yes", "Number of cubes dropped off in the switch (during auto)": "0", "Number of cubes dropped off in the scale (during auto)": "1", "Number of cubes picked up from the pyramid": "0", "Number of cubes picked up from the portal": "0", "Number of cubes picked up from the field": "6", "Number of cubes dropped off in the vault (during teleop)": "0", "Number of cubes dropped off in the scale (during teleop)": "4", "Number of cubes dropped off in your alliance switch (during teleop)": "0", "Number of cubes dropped off in your opponent's alliance switch (during teleop)": "1", "Total number of cubes fumbled(robot lost control of cube)": "2", Endgame: "Lift partner", "Problems with robot/driver": "No problems with robot.", }, { Timestamp: "10/6/2018 9:13:54", "Team number": "5104", "Match number": "19", "Scout name(your name)": "Lavinie ", "Cross baseline during auto?": "Yes", "Number of cubes dropped off in the switch (during auto)": "1", "Number of cubes dropped off in the scale (during auto)": "0", "Number of cubes picked up from the pyramid": "5", "Number of cubes picked up from the portal": "0", "Number of cubes picked up from the field": "0", "Number of cubes dropped off in the vault (during teleop)": "0", "Number of cubes dropped off in the scale (during teleop)": "2", "Number of cubes dropped off in your alliance switch (during teleop)": "1", "Number of cubes dropped off in your opponent's alliance switch (during teleop)": "1", "Total number of cubes fumbled(robot lost control of cube)": "2", Endgame: "Failed to make it onto the scale area", "Problems with robot/driver": "No problems with robot.", }, { Timestamp: "10/6/2018 9:14:11", "Team number": "4990", "Match number": "19", "Scout name(your name)": "<NAME>", "Cross baseline during auto?": "Yes", "Number of cubes dropped off in the switch (during auto)": "0", "Number of cubes dropped off in the scale (during auto)": "0", "Number of cubes picked up from the pyramid": "4", "Number of cubes picked up from the portal": "0", "Number of cubes picked up from the field": "0", "Number of cubes dropped off in the vault (during teleop)": "3", "Number of cubes dropped off in the scale (during teleop)": "0", "Number of cubes dropped off in your alliance switch (during teleop)": "1", "Number of cubes dropped off in your opponent's alliance switch (during teleop)": "0", "Total number of cubes fumbled(robot lost control of cube)": "2", Endgame: "Climbed on ramp", "Problems with robot/driver": "No problems with robot.", }, { Timestamp: "10/6/2018 9:20:47", "Team number": "668", "Match number": "19", "Scout name(your name)": "<NAME>", "Cross baseline during auto?": "Yes", "Number of cubes dropped off in the switch (during auto)": "0", "Number of cubes dropped off in the scale (during auto)": "0", "Number of cubes picked up from the pyramid": "1", "Number of cubes picked up from the portal": "0", "Number of cubes picked up from the field": "2", "Number of cubes dropped off in the vault (during teleop)": "1", "Number of cubes dropped off in the scale (during teleop)": "2", "Number of cubes dropped off in your alliance switch (during teleop)": "1", "Number of cubes dropped off in your opponent's alliance switch (during teleop)": "0", "Total number of cubes fumbled(robot lost control of cube)": "3", Endgame: "Failed to make it onto the scale area", "Problems with robot/driver": "No problems with robot.", }, { Timestamp: "10/6/2018 9:28:56", "Team number": "114", "Match number": "19", "Scout name(your name)": "<NAME>", "Cross baseline during auto?": "Yes", "Number of cubes dropped off in the switch (during auto)": "0", "Number of cubes dropped off in the scale (during auto)": "0", "Number of cubes picked up from the pyramid": "2", "Number of cubes picked up from the portal": "0", "Number of cubes picked up from the field": "4", "Number of cubes dropped off in the vault (during teleop)": "0", "Number of cubes dropped off in the scale (during teleop)": "5", "Number of cubes dropped off in your alliance switch (during teleop)": "0", "Number of cubes dropped off in your opponent's alliance switch (during teleop)": "0", "Total number of cubes fumbled(robot lost control of cube)": "1", Endgame: "Parked", "Problems with robot/driver": "No problems with robot.", }, { Timestamp: "10/6/2018 9:49:22", "Team number": "1351", "Match number": "19", "Scout name(your name)": "<NAME>", "Cross baseline during auto?": "Yes", "Number of cubes dropped off in the switch (during auto)": "0", "Number of cubes dropped off in the scale (during auto)": "0", "Number of cubes picked up from the pyramid": "4", "Number of cubes picked up from the portal": "0", "Number of cubes picked up from the field": "1", "Number of cubes dropped off in the vault (during teleop)": "3", "Number of cubes dropped off in the scale (during teleop)": "0", "Number of cubes dropped off in your alliance switch (during teleop)": "4", "Number of cubes dropped off in your opponent's alliance switch (during teleop)": "0", "Total number of cubes fumbled(robot lost control of cube)": "1", Endgame: "Failed to make it onto the scale area", "Problems with robot/driver": "No problems with robot.", }, { Timestamp: "10/6/2018 9:21:34", "Team number": "1868", "Match number": "20", "Scout name(your name)": "<NAME>", "Cross baseline during auto?": "Yes", "Number of cubes dropped off in the switch (during auto)": "0", "Number of cubes dropped off in the scale (during auto)": "1", "Number of cubes picked up from the pyramid": "4", "Number of cubes picked up from the portal": "1", "Number of cubes picked up from the field": "4", "Number of cubes dropped off in the vault (during teleop)": "0", "Number of cubes dropped off in the scale (during teleop)": "6", "Number of cubes dropped off in your alliance switch (during teleop)": "4", "Number of cubes dropped off in your opponent's alliance switch (during teleop)": "0", "Total number of cubes fumbled(robot lost control of cube)": "1", Endgame: "Failed to make it onto the scale area", "Problems with robot/driver": "No problems with robot.", }, { Timestamp: "10/6/2018 9:21:48", "Team number": "3501", "Match number": "20", "Scout name(your name)": "<NAME>", "Cross baseline during auto?": "Yes", "Number of cubes dropped off in the switch (during auto)": "0", "Number of cubes dropped off in the scale (during auto)": "0", "Number of cubes picked up from the pyramid": "1", "Number of cubes picked up from the portal": "0", "Number of cubes picked up from the field": "2", "Number of cubes dropped off in the vault (during teleop)": "3", "Number of cubes dropped off in the scale (during teleop)": "0", "Number of cubes dropped off in your alliance switch (during teleop)": "0", "Number of cubes dropped off in your opponent's alliance switch (during teleop)": "0", "Total number of cubes fumbled(robot lost control of cube)": "1", Endgame: "Failed to make it onto the scale area", "Problems with robot/driver": "Robot dead for less than 1 minute", }, { Timestamp: "10/6/2018 9:21:51", "Team number": "115", "Match number": "20", "Scout name(your name)": "Lavinie", "Cross baseline during auto?": "Yes", "Number of cubes dropped off in the switch (during auto)": "1", "Number of cubes dropped off in the scale (during auto)": "0", "Number of cubes picked up from the pyramid": "2", "Number of cubes picked up from the portal": "1", "Number of cubes picked up from the field": "2", "Number of cubes dropped off in the vault (during teleop)": "1", "Number of cubes dropped off in the scale (during teleop)": "2", "Number of cubes dropped off in your alliance switch (during teleop)": "0", "Number of cubes dropped off in your opponent's alliance switch (during teleop)": "2", "Total number of cubes fumbled(robot lost control of cube)": "2", Endgame: "Failed to make it onto the scale area", "Problems with robot/driver": "No problems with robot.", }, { Timestamp: "10/6/2018 9:28:21", "Team number": "253", "Match number": "20", "Scout name(your name)": "<NAME>", "Cross baseline during auto?": "No", "Number of cubes dropped off in the switch (during auto)": "0", "Number of cubes dropped off in the scale (during auto)": "0", "Number of cubes picked up from the pyramid": "2", "Number of cubes picked up from the portal": "2", "Number of cubes picked up from the field": "4", "Number of cubes dropped off in the vault (during teleop)": "2", "Number of cubes dropped off in the scale (during teleop)": "0", "Number of cubes dropped off in your alliance switch (during teleop)": "1", "Number of cubes dropped off in your opponent's alliance switch (during teleop)": "1", "Total number of cubes fumbled(robot lost control of cube)": "3", Endgame: "Failed to make it onto the scale area", "Problems with robot/driver": "No problems with robot.", }, { Timestamp: "10/6/2018 9:29:50", "Team number": "7308", "Match number": "20", "Scout name(your name)": "<NAME>", "Cross baseline during auto?": "Yes", "Number of cubes dropped off in the switch (during auto)": "1", "Number of cubes dropped off in the scale (during auto)": "0", "Number of cubes picked up from the pyramid": "0", "Number of cubes picked up from the portal": "0", "Number of cubes picked up from the field": "5", "Number of cubes dropped off in the vault (during teleop)": "0", "Number of cubes dropped off in the scale (during teleop)": "5", "Number of cubes dropped off in your alliance switch (during teleop)": "0", "Number of cubes dropped off in your opponent's alliance switch (during teleop)": "0", "Total number of cubes fumbled(robot lost control of cube)": "1", Endgame: "Parked", "Problems with robot/driver": "No problems with robot.", }, { Timestamp: "10/6/2018 9:51:32", "Team number": "1700", "Match number": "20", "Scout name(your name)": "<NAME>", "Cross baseline during auto?": "Yes", "Number of cubes dropped off in the switch (during auto)": "0", "Number of cubes dropped off in the scale (during auto)": "0", "Number of cubes picked up from the pyramid": "2", "Number of cubes picked up from the portal": "0", "Number of cubes picked up from the field": "0", "Number of cubes dropped off in the vault (during teleop)": "0", "Number of cubes dropped off in the scale (during teleop)": "0", "Number of cubes dropped off in your alliance switch (during teleop)": "1", "Number of cubes dropped off in your opponent's alliance switch (during teleop)": "0", "Total number of cubes fumbled(robot lost control of cube)": "1", Endgame: "Parked", "Problems with robot/driver": "No problems with robot.", }, { Timestamp: "10/6/2018 9:28:26", "Team number": "6814", "Match number": "21", "Scout name(your name)": "<NAME>", "Cross baseline during auto?": "Yes", "Number of cubes dropped off in the switch (during auto)": "0", "Number of cubes dropped off in the scale (during auto)": "0", "Number of cubes picked up from the pyramid": "1", "Number of cubes picked up from the portal": "0", "Number of cubes picked up from the field": "1", "Number of cubes dropped off in the vault (during teleop)": "0", "Number of cubes dropped off in the scale (during teleop)": "1", "Number of cubes dropped off in your alliance switch (during teleop)": "0", "Number of cubes dropped off in your opponent's alliance switch (during teleop)": "0", "Total number of cubes fumbled(robot lost control of cube)": "2", Endgame: "Failed to make it onto the scale area", "Problems with robot/driver": "No problems with robot.", }, { Timestamp: "10/6/2018 9:29:11", "Team number": "2473", "Match number": "21", "Scout name(your name)": "<NAME>", "Cross baseline during auto?": "Crashed into other robot", "Number of cubes dropped off in the switch (during auto)": "0", "Number of cubes dropped off in the scale (during auto)": "0", "Number of cubes picked up from the pyramid": "0", "Number of cubes picked up from the portal": "5", "Number of cubes picked up from the field": "0", "Number of cubes dropped off in the vault (during teleop)": "0", "Number of cubes dropped off in the scale (during teleop)": "0", "Number of cubes dropped off in your alliance switch (during teleop)": "4", "Number of cubes dropped off in your opponent's alliance switch (during teleop)": "0", "Total number of cubes fumbled(robot lost control of cube)": "3", Endgame: "Parked", "Problems with robot/driver": "No problems with robot.", }, { Timestamp: "10/6/2018 9:29:12", "Team number": "6884", "Match number": "21", "Scout name(your name)": "Lavinie", "Cross baseline during auto?": "Yes", "Number of cubes dropped off in the switch (during auto)": "0", "Number of cubes dropped off in the scale (during auto)": "0", "Number of cubes picked up from the pyramid": "1", "Number of cubes picked up from the portal": "0", "Number of cubes picked up from the field": "0", "Number of cubes dropped off in the vault (during teleop)": "1", "Number of cubes dropped off in the scale (during teleop)": "0", "Number of cubes dropped off in your alliance switch (during teleop)": "0", "Number of cubes dropped off in your opponent's alliance switch (during teleop)": "0", "Total number of cubes fumbled(robot lost control of cube)": "0", Endgame: "Failed to make it onto the scale area", "Problems with robot/driver": "Robot dead for less than 1 minute", }, { Timestamp: "10/6/2018 9:31:01", "Team number": "4765", "Match number": "21", "Scout name(your name)": "<NAME>", "Cross baseline during auto?": "Yes", "Number of cubes dropped off in the switch (during auto)": "0", "Number of cubes dropped off in the scale (during auto)": "0", "Number of cubes picked up from the pyramid": "0", "Number of cubes picked up from the portal": "0", "Number of cubes picked up from the field": "1", "Number of cubes dropped off in the vault (during teleop)": "0", "Number of cubes dropped off in the scale (during teleop)": "1", "Number of cubes dropped off in your alliance switch (during teleop)": "0", "Number of cubes dropped off in your opponent's alliance switch (during teleop)": "0", "Total number of cubes fumbled(robot lost control of cube)": "3", Endgame: "Parked", "Problems with robot/driver": "No problems with robot.", }, { Timestamp: "10/6/2018 9:53:02", "Team number": "972", "Match number": "21", "Scout name(your name)": "<NAME>", "Cross baseline during auto?": "No", "Number of cubes dropped off in the switch (during auto)": "0", "Number of cubes dropped off in the scale (during auto)": "0", "Number of cubes picked up from the pyramid": "0", "Number of cubes picked up from the portal": "0", "Number of cubes picked up from the field": "7", "Number of cubes dropped off in the vault (during teleop)": "1", "Number of cubes dropped off in the scale (during teleop)": "0", "Number of cubes dropped off in your alliance switch (during teleop)": "3", "Number of cubes dropped off in your opponent's alliance switch (during teleop)": "0", "Total number of cubes fumbled(robot lost control of cube)": "5", Endgame: "Failed to make it onto the scale area", "Problems with robot/driver": "No problems with robot.", }, { Timestamp: "10/6/2018 9:37:51", "Team number": "2643", "Match number": "22", "Scout name(your name)": "<NAME>", "Cross baseline during auto?": "Yes", "Number of cubes dropped off in the switch (during auto)": "1", "Number of cubes dropped off in the scale (during auto)": "0", "Number of cubes picked up from the pyramid": "0", "Number of cubes picked up from the portal": "1", "Number of cubes picked up from the field": "5", "Number of cubes dropped off in the vault (during teleop)": "1", "Number of cubes dropped off in the scale (during teleop)": "3", "Number of cubes dropped off in your alliance switch (during teleop)": "0", "Number of cubes dropped off in your opponent's alliance switch (during teleop)": "1", "Total number of cubes fumbled(robot lost control of cube)": "2", Endgame: "Failed to make it onto the scale area", "Problems with robot/driver": "No problems with robot.", }, { Timestamp: "10/6/2018 9:38:41", "Team number": "2854", "Match number": "22", "Scout name(your name)": "<NAME>", "Cross baseline during auto?": "Yes", "Number of cubes dropped off in the switch (during auto)": "0", "Number of cubes dropped off in the scale (during auto)": "1", "Number of cubes picked up from the pyramid": "0", "Number of cubes picked up from the portal": "0", "Number of cubes picked up from the field": "2", "Number of cubes dropped off in the vault (during teleop)": "2", "Number of cubes dropped off in the scale (during teleop)": "0", "Number of cubes dropped off in your alliance switch (during teleop)": "0", "Number of cubes dropped off in your opponent's alliance switch (during teleop)": "4", "Total number of cubes fumbled(robot lost control of cube)": "1", Endgame: "Failed to make it onto the scale area", "Problems with robot/driver": "No problems with robot.", }, { Timestamp: "10/6/2018 9:38:59", "Team number": "1458", "Match number": "22", "Scout name(your name)": "<NAME>", "Cross baseline during auto?": "Yes", "Number of cubes dropped off in the switch (during auto)": "0", "Number of cubes dropped off in the scale (during auto)": "0", "Number of cubes picked up from the pyramid": "6", "Number of cubes picked up from the portal": "0", "Number of cubes picked up from the field": "0", "Number of cubes dropped off in the vault (during teleop)": "5", "Number of cubes dropped off in the scale (during teleop)": "0", "Number of cubes dropped off in your alliance switch (during teleop)": "1", "Number of cubes dropped off in your opponent's alliance switch (during teleop)": "0", "Total number of cubes fumbled(robot lost control of cube)": "1", Endgame: "Lift self only", "Problems with robot/driver": "No problems with robot.", }, { Timestamp: "10/6/2018 9:39:00", "Team number": "2813", "Match number": "22", "Scout name(your name)": "<NAME>", "Cross baseline during auto?": "Yes", "Number of cubes dropped off in the switch (during auto)": "0", "Number of cubes dropped off in the scale (during auto)": "0", "Number of cubes picked up from the pyramid": "0", "Number of cubes picked up from the portal": "0", "Number of cubes picked up from the field": "0", "Number of cubes dropped off in the vault (during teleop)": "0", "Number of cubes dropped off in the scale (during teleop)": "0", "Number of cubes dropped off in your alliance switch (during teleop)": "0", "Number of cubes dropped off in your opponent's alliance switch (during teleop)": "0", "Total number of cubes fumbled(robot lost control of cube)": "0", Endgame: "Failed to make it onto the scale area", "Problems with robot/driver": "Robot dead for more than 1 minute", }, { Timestamp: "10/6/2018 9:39:31", "Team number": "649", "Match number": "22", "Scout name(your name)": "Lavinie", "Cross baseline during auto?": "Yes", "Number of cubes dropped off in the switch (during auto)": "1", "Number of cubes dropped off in the scale (during auto)": "0", "Number of cubes picked up from the pyramid": "2", "Number of cubes picked up from the portal": "0", "Number of cubes picked up from the field": "5", "Number of cubes dropped off in the vault (during teleop)": "0", "Number of cubes dropped off in the scale (during teleop)": "4", "Number of cubes dropped off in your alliance switch (during teleop)": "0", "Number of cubes dropped off in your opponent's alliance switch (during teleop)": "0", "Total number of cubes fumbled(robot lost control of cube)": "2", Endgame: "Failed to make it onto the scale area", "Problems with robot/driver": "No problems with robot.", }, { Timestamp: "10/6/2018 9:54:16", "Team number": "3045", "Match number": "22", "Scout name(your name)": "<NAME>", "Cross baseline during auto?": "Yes", "Number of cubes dropped off in the switch (during auto)": "0", "Number of cubes dropped off in the scale (during auto)": "0", "Number of cubes picked up from the pyramid": "0", "Number of cubes picked up from the portal": "0", "Number of cubes picked up from the field": "1", "Number of cubes dropped off in the vault (during teleop)": "0", "Number of cubes dropped off in the scale (during teleop)": "0", "Number of cubes dropped off in your alliance switch (during teleop)": "0", "Number of cubes dropped off in your opponent's alliance switch (during teleop)": "0", "Total number of cubes fumbled(robot lost control of cube)": "2", Endgame: "Parked", "Problems with robot/driver": "Robot dead for more than 1 minute", }, { Timestamp: "10/6/2018 9:45:14", "Team number": "4255", "Match number": "23", "Scout name(your name)": "<NAME>", "Cross baseline during auto?": "Yes", "Number of cubes dropped off in the switch (during auto)": "0", "Number of cubes dropped off in the scale (during auto)": "0", "Number of cubes picked up from the pyramid": "1", "Number of cubes picked up from the portal": "1", "Number of cubes picked up from the field": "4", "Number of cubes dropped off in the vault (during teleop)": "2", "Number of cubes dropped off in the scale (during teleop)": "1", "Number of cubes dropped off in your alliance switch (during teleop)": "1", "Number of cubes dropped off in your opponent's alliance switch (during teleop)": "0", "Total number of cubes fumbled(robot lost control of cube)": "2", Endgame: "Failed to make it onto the scale area", "Problems with robot/driver": "No problems with robot.", }, { Timestamp: "10/6/2018 9:45:39", "Team number": "5430", "Match number": "23", "Scout name(your name)": "<NAME>", "Cross baseline during auto?": "No", "Number of cubes dropped off in the switch (during auto)": "0", "Number of cubes dropped off in the scale (during auto)": "0", "Number of cubes picked up from the pyramid": "0", "Number of cubes picked up from the portal": "0", "Number of cubes picked up from the field": "0", "Number of cubes dropped off in the vault (during teleop)": "0", "Number of cubes dropped off in the scale (during teleop)": "0", "Number of cubes dropped off in your alliance switch (during teleop)": "0", "Number of cubes dropped off in your opponent's alliance switch (during teleop)": "0", "Total number of cubes fumbled(robot lost control of cube)": "0", Endgame: "Parked", "Problems with robot/driver": "No problems with robot.", }, { Timestamp: "10/6/2018 9:46:05", "Team number": "6418", "Match number": "23", "Scout name(your name)": "Lavinie", "Cross baseline during auto?": "Yes", "Number of cubes dropped off in the switch (during auto)": "0", "Number of cubes dropped off in the scale (during auto)": "0", "Number of cubes picked up from the pyramid": "2", "Number of cubes picked up from the portal": "0", "Number of cubes picked up from the field": "0", "Number of cubes dropped off in the vault (during teleop)": "0", "Number of cubes dropped off in the scale (during teleop)": "0", "Number of cubes dropped off in your alliance switch (during teleop)": "1", "Number of cubes dropped off in your opponent's alliance switch (during teleop)": "0", "Total number of cubes fumbled(robot lost control of cube)": "2", Endgame: "Failed to make it onto the scale area", "Problems with robot/driver": "Robot dead for more than 1 minute", }, { Timestamp: "10/6/2018 9:46:41", "Team number": "2489", "Match number": "23", "Scout name(your name)": "<NAME>", "Cross baseline during auto?": "Yes", "Number of cubes dropped off in the switch (during auto)": "0", "Number of cubes dropped off in the scale (during auto)": "0", "Number of cubes picked up from the pyramid": "3", "Number of cubes picked up from the portal": "0", "Number of cubes picked up from the field": "1", "Number of cubes dropped off in the vault (during teleop)": "4", "Number of cubes dropped off in the scale (during teleop)": "0", "Number of cubes dropped off in your alliance switch (during teleop)": "0", "Number of cubes dropped off in your opponent's alliance switch (during teleop)": "0", "Total number of cubes fumbled(robot lost control of cube)": "0", Endgame: "Parked", "Problems with robot/driver": "No problems with robot.", }, { Timestamp: "10/6/2018 9:58:25", "Team number": "6174", "Match number": "23", "Scout name(your name)": "<NAME>", "Cross baseline during auto?": "Yes", "Number of cubes dropped off in the switch (during auto)": "1", "Number of cubes dropped off in the scale (during auto)": "0", "Number of cubes picked up from the pyramid": "0", "Number of cubes picked up from the portal": "0", "Number of cubes picked up from the field": "6", "Number of cubes dropped off in the vault (during teleop)": "0", "Number of cubes dropped off in the scale (during teleop)": "2", "Number of cubes dropped off in your alliance switch (during teleop)": "1", "Number of cubes dropped off in your opponent's alliance switch (during teleop)": "2", "Total number of cubes fumbled(robot lost control of cube)": "1", Endgame: "Parked", "Problems with robot/driver": "No problems with robot.", }, { Timestamp: "10/6/2018 9:54:42", "Team number": "6822", "Match number": "24", "Scout name(your name)": "Nathan", "Cross baseline during auto?": "No", "Number of cubes dropped off in the switch (during auto)": "0", "Number of cubes dropped off in the scale (during auto)": "0", "Number of cubes picked up from the pyramid": "2", "Number of cubes picked up from the portal": "0", "Number of cubes picked up from the field": "2", "Number of cubes dropped off in the vault (during teleop)": "4", "Number of cubes dropped off in the scale (during teleop)": "0", "Number of cubes dropped off in your alliance switch (during teleop)": "0", "Number of cubes dropped off in your opponent's alliance switch (during teleop)": "0", "Total number of cubes fumbled(robot lost control of cube)": "1", Endgame: "Parked", "Problems with robot/driver": "No problems with robot.", }, { Timestamp: "10/6/2018 9:54:57", "Team number": "4904", "Match number": "24", "Scout name(your name)": "Thanawat", "Cross baseline during auto?": "Yes", "Number of cubes dropped off in the switch (during auto)": "0", "Number of cubes dropped off in the scale (during auto)": "0", "Number of cubes picked up from the pyramid": "2", "Number of cubes picked up from the portal": "0", "Number of cubes picked up from the field": "0", "Number of cubes dropped off in the vault (during teleop)": "0", "Number of cubes dropped off in the scale (during teleop)": "2", "Number of cubes dropped off in your alliance switch (during teleop)": "0", "Number of cubes dropped off in your opponent's alliance switch (during teleop)": "0", "Total number of cubes fumbled(robot lost control of cube)": "1", Endgame: "Parked", "Problems with robot/driver": "No problems with robot.", }, { Timestamp: "10/6/2018 9:55:09", "Team number": "100", "Match number": "24", "Scout name(your name)": "<NAME>", "Cross baseline during auto?": "Yes", "Number of cubes dropped off in the switch (during auto)": "1", "Number of cubes dropped off in the scale (during auto)": "0", "Number of cubes picked up from the pyramid": "2", "Number of cubes picked up from the portal": "0", "Number of cubes picked up from the field": "4", "Number of cubes dropped off in the vault (during teleop)": "0", "Number of cubes dropped off in the scale (during teleop)": "4", "Number of cubes dropped off in your alliance switch (during teleop)": "0", "Number of cubes dropped off in your opponent's alliance switch (during teleop)": "0", "Total number of cubes fumbled(robot lost control of cube)": "1", Endgame: "Failed to make it onto the scale area", "Problems with robot/driver": "Robot dead for less than 1 minute", }, { Timestamp: "10/6/2018 9:55:45", "Team number": "1967", "Match number": "24", "Scout name(your name)": "<NAME>", "Cross baseline during auto?": "Yes", "Number of cubes dropped off in the switch (during auto)": "0", "Number of cubes dropped off in the scale (during auto)": "0", "Number of cubes picked up from the pyramid": "6", "Number of cubes picked up from the portal": "0", "Number of cubes picked up from the field": "0", "Number of cubes dropped off in the vault (during teleop)": "4", "Number of cubes dropped off in the scale (during teleop)": "1", "Number of cubes dropped off in your alliance switch (during teleop)": "2", "Number of cubes dropped off in your opponent's alliance switch (during teleop)": "0", "Total number of cubes fumbled(robot lost control of cube)": "0", Endgame: "Parked", "Problems with robot/driver": "No problems with robot.", }, { Timestamp: "10/6/2018 9:58:19", "Team number": "199", "Match number": "24", "Scout name(your name)": "<NAME>", "Cross baseline during auto?": "Yes", "Number of cubes dropped off in the switch (during auto)": "0", "Number of cubes dropped off in the scale (during auto)": "1", "Number of cubes picked up from the pyramid": "0", "Number of cubes picked up from the portal": "1", "Number of cubes picked up from the field": "2", "Number of cubes dropped off in the vault (during teleop)": "0", "Number of cubes dropped off in the scale (during teleop)": "0", "Number of cubes dropped off in your alliance switch (during teleop)": "0", "Number of cubes dropped off in your opponent's alliance switch (during teleop)": "0", "Total number of cubes fumbled(robot lost control of cube)": "2", Endgame: "Parked", "Problems with robot/driver": "No problems with robot.", }, { Timestamp: "10/6/2018 10:06:55", "Team number": "649", "Match number": "25", "Scout name(your name)": "Thanawat", "Cross baseline during auto?": "Yes", "Number of cubes dropped off in the switch (during auto)": "0", "Number of cubes dropped off in the scale (during auto)": "1", "Number of cubes picked up from the pyramid": "1", "Number of cubes picked up from the portal": "4", "Number of cubes picked up from the field": "2", "Number of cubes dropped off in the vault (during teleop)": "2", "Number of cubes dropped off in the scale (during teleop)": "5", "Number of cubes dropped off in your alliance switch (during teleop)": "0", "Number of cubes dropped off in your opponent's alliance switch (during teleop)": "0", "Total number of cubes fumbled(robot lost control of cube)": "1", Endgame: "Failed to make it onto the scale area", "Problems with robot/driver": "No problems with robot.", }, { Timestamp: "10/6/2018 10:07:42", "Team number": "114", "Match number": "25", "Scout name(your name)": "Nathan", "Cross baseline during auto?": "Yes", "Number of cubes dropped off in the switch (during auto)": "0", "Number of cubes dropped off in the scale (during auto)": "0", "Number of cubes picked up from the pyramid": "5", "Number of cubes picked up from the portal": "1", "Number of cubes picked up from the field": "0", "Number of cubes dropped off in the vault (during teleop)": "6", "Number of cubes dropped off in the scale (during teleop)": "0", "Number of cubes dropped off in your alliance switch (during teleop)": "2", "Number of cubes dropped off in your opponent's alliance switch (during teleop)": "0", "Total number of cubes fumbled(robot lost control of cube)": "2", Endgame: "Failed to make it onto the scale area", "Problems with robot/driver": "No problems with robot.", }, { Timestamp: "10/6/2018 10:08:16", "Team number": "253", "Match number": "25", "Scout name(your name)": "<NAME>", "Cross baseline during auto?": "Yes", "Number of cubes dropped off in the switch (during auto)": "0", "Number of cubes dropped off in the scale (during auto)": "0", "Number of cubes picked up from the pyramid": "2", "Number of cubes picked up from the portal": "0", "Number of cubes picked up from the field": "0", "Number of cubes dropped off in the vault (during teleop)": "1", "Number of cubes dropped off in the scale (during teleop)": "0", "Number of cubes dropped off in your alliance switch (during teleop)": "1", "Number of cubes dropped off in your opponent's alliance switch (during teleop)": "0", "Total number of cubes fumbled(robot lost control of cube)": "0", Endgame: "Failed to make it onto the scale area", "Problems with robot/driver": "No problems with robot.", }, { Timestamp: "10/6/2018 10:08:37", "Team number": "115", "Match number": "25", "Scout name(your name)": "<NAME>", "Cross baseline during auto?": "Yes", "Number of cubes dropped off in the switch (during auto)": "1", "Number of cubes dropped off in the scale (during auto)": "0", "Number of cubes picked up from the pyramid": "3", "Number of cubes picked up from the portal": "0", "Number of cubes picked up from the field": "4", "Number of cubes dropped off in the vault (during teleop)": "0", "Number of cubes dropped off in the scale (during teleop)": "5", "Number of cubes dropped off in your alliance switch (during teleop)": "0", "Number of cubes dropped off in your opponent's alliance switch (during teleop)": "0", "Total number of cubes fumbled(robot lost control of cube)": "1", Endgame: "Parked", "Problems with robot/driver": "No problems with robot.", }, { Timestamp: "10/6/2018 10:14:57", "Team number": "3045", "Match number": "26", "Scout name(your name)": "Thanawat", "Cross baseline during auto?": "Foul", "Number of cubes dropped off in the switch (during auto)": "0", "Number of cubes dropped off in the scale (during auto)": "0", "Number of cubes picked up from the pyramid": "1", "Number of cubes picked up from the portal": "0", "Number of cubes picked up from the field": "0", "Number of cubes dropped off in the vault (during teleop)": "1", "Number of cubes dropped off in the scale (during teleop)": "0", "Number of cubes dropped off in your alliance switch (during teleop)": "0", "Number of cubes dropped off in your opponent's alliance switch (during teleop)": "0", "Total number of cubes fumbled(robot lost control of cube)": "0", Endgame: "Failed to make it onto the scale area", "Problems with robot/driver": "Robot dead for more than 1 minute", }, { Timestamp: "10/6/2018 10:15:46", "Team number": "1351", "Match number": "26", "Scout name(your name)": "<NAME>", "Cross baseline during auto?": "Yes", "Number of cubes dropped off in the switch (during auto)": "0", "Number of cubes dropped off in the scale (during auto)": "0", "Number of cubes picked up from the pyramid": "2", "Number of cubes picked up from the portal": "0", "Number of cubes picked up from the field": "0", "Number of cubes dropped off in the vault (during teleop)": "2", "Number of cubes dropped off in the scale (during teleop)": "0", "Number of cubes dropped off in your alliance switch (during teleop)": "0", "Number of cubes dropped off in your opponent's alliance switch (during teleop)": "0", "Total number of cubes fumbled(robot lost control of cube)": "4", Endgame: "Failed to make it onto the scale area", "Problems with robot/driver": "No problems with robot.", }, { Timestamp: "10/6/2018 10:15:59", "Team number": "2473", "Match number": "26", "Scout name(your name)": "Nathan", "Cross baseline during auto?": "Yes", "Number of cubes dropped off in the switch (during auto)": "0", "Number of cubes dropped off in the scale (during auto)": "0", "Number of cubes picked up from the pyramid": "0", "Number of cubes picked up from the portal": "5", "Number of cubes picked up from the field": "0", "Number of cubes dropped off in the vault (during teleop)": "0", "Number of cubes dropped off in the scale (during teleop)": "0", "Number of cubes dropped off in your alliance switch (during teleop)": "0", "Number of cubes dropped off in your opponent's alliance switch (during teleop)": "5", "Total number of cubes fumbled(robot lost control of cube)": "0", Endgame: "Parked", "Problems with robot/driver": "Robot dead for less than 1 minute", }, { Timestamp: "10/6/2018 10:18:46", "Team number": "1458", "Match number": "26", "Scout name(your name)": "<NAME>", "Cross baseline during auto?": "Yes", "Number of cubes dropped off in the switch (during auto)": "0", "Number of cubes dropped off in the scale (during auto)": "0", "Number of cubes picked up from the pyramid": "2", "Number of cubes picked up from the portal": "0", "Number of cubes picked up from the field": "2", "Number of cubes dropped off in the vault (during teleop)": "2", "Number of cubes dropped off in the scale (during teleop)": "0", "Number of cubes dropped off in your alliance switch (during teleop)": "1", "Number of cubes dropped off in your opponent's alliance switch (during teleop)": "0", "Total number of cubes fumbled(robot lost control of cube)": "0", Endgame: "Parked", "Problems with robot/driver": "No problems with robot.", }, { Timestamp: "10/6/2018 10:23:44", "Team number": "972", "Match number": "27", "Scout name(your name)": "Thanawat", "Cross baseline during auto?": "No", "Number of cubes dropped off in the switch (during auto)": "0", "Number of cubes dropped off in the scale (during auto)": "0", "Number of cubes picked up from the pyramid": "3", "Number of cubes picked up from the portal": "0", "Number of cubes picked up from the field": "0", "Number of cubes dropped off in the vault (during teleop)": "3", "Number of cubes dropped off in the scale (during teleop)": "0", "Number of cubes dropped off in your alliance switch (during teleop)": "0", "Number of cubes dropped off in your opponent's alliance switch (during teleop)": "1", "Total number of cubes fumbled(robot lost control of cube)": "1", Endgame: "Parked", "Problems with robot/driver": "No problems with robot.", }, { Timestamp: "10/6/2018 10:24:14", "Team number": "751", "Match number": "27", "Scout name(your name)": "<NAME>", "Cross baseline during auto?": "Yes", "Number of cubes dropped off in the switch (during auto)": "0", "Number of cubes dropped off in the scale (during auto)": "0", "Number of cubes picked up from the pyramid": "0", "Number of cubes picked up from the portal": "0", "Number of cubes picked up from the field": "1", "Number of cubes dropped off in the vault (during teleop)": "0", "Number of cubes dropped off in the scale (during teleop)": "0", "Number of cubes dropped off in your alliance switch (during teleop)": "0", "Number of cubes dropped off in your opponent's alliance switch (during teleop)": "1", "Total number of cubes fumbled(robot lost control of cube)": "1", Endgame: "Failed to make it onto the scale area", "Problems with robot/driver": "Robot tipped over, Robot dead for less than 1 minute", }, { Timestamp: "10/6/2018 10:24:53", "Team number": "2813", "Match number": "27", "Scout name(your name)": "<NAME>", "Cross baseline during auto?": "Yes", "Number of cubes dropped off in the switch (during auto)": "0", "Number of cubes dropped off in the scale (during auto)": "0", "Number of cubes picked up from the pyramid": "3", "Number of cubes picked up from the portal": "0", "Number of cubes picked up from the field": "1", "Number of cubes dropped off in the vault (during teleop)": "3", "Number of cubes dropped off in the scale (during teleop)": "0", "Number of cubes dropped off in your alliance switch (during teleop)": "3", "Number of cubes dropped off in your opponent's alliance switch (during teleop)": "0", "Total number of cubes fumbled(robot lost control of cube)": "0", Endgame: "Failed to make it onto the scale area", "Problems with robot/driver": "No problems with robot.", }, { Timestamp: "10/6/2018 10:25:05", "Team number": "4990", "Match number": "27", "Scout name(your name)": "Nathan", "Cross baseline during auto?": "Yes", "Number of cubes dropped off in the switch (during auto)": "0", "Number of cubes dropped off in the scale (during auto)": "0", "Number of cubes picked up from the pyramid": "1", "Number of cubes picked up from the portal": "0", "Number of cubes picked up from the field": "3", "Number of cubes dropped off in the vault (during teleop)": "0", "Number of cubes dropped off in the scale (during teleop)": "3", "Number of cubes dropped off in your alliance switch (during teleop)": "1", "Number of cubes dropped off in your opponent's alliance switch (during teleop)": "0", "Total number of cubes fumbled(robot lost control of cube)": "3", Endgame: "Parked", "Problems with robot/driver": "No problems with robot.", }, { Timestamp: "10/6/2018 10:27:59", "Team number": "1868", "Match number": "25", "Scout name(your name)": "<NAME>", "Cross baseline during auto?": "Yes", "Number of cubes dropped off in the switch (during auto)": "1", "Number of cubes dropped off in the scale (during auto)": "0", "Number of cubes picked up from the pyramid": "0", "Number of cubes picked up from the portal": "1", "Number of cubes picked up from the field": "5", "Number of cubes dropped off in the vault (during teleop)": "0", "Number of cubes dropped off in the scale (during teleop)": "3", "Number of cubes dropped off in your alliance switch (during teleop)": "0", "Number of cubes dropped off in your opponent's alliance switch (during teleop)": "0", "Total number of cubes fumbled(robot lost control of cube)": "4", Endgame: "Parked", "Problems with robot/driver": "No problems with robot.", }, { Timestamp: "10/6/2018 10:29:23", "Team number": "670", "Match number": "24", "Scout name(your name)": "<NAME> ", "Cross baseline during auto?": "Yes", "Number of cubes dropped off in the switch (during auto)": "1", "Number of cubes dropped off in the scale (during auto)": "0", "Number of cubes picked up from the pyramid": "0", "Number of cubes picked up from the portal": "0", "Number of cubes picked up from the field": "6", "Number of cubes dropped off in the vault (during teleop)": "0", "Number of cubes dropped off in the scale (during teleop)": "3", "Number of cubes dropped off in your alliance switch (during teleop)": "1", "Number of cubes dropped off in your opponent's alliance switch (during teleop)": "2", "Total number of cubes fumbled(robot lost control of cube)": "1", Endgame: "Lift self only", "Problems with robot/driver": "No problems with robot.", }, { Timestamp: "10/6/2018 10:29:34", "Team number": "1700", "Match number": "26", "Scout name(your name)": "<NAME>", "Cross baseline during auto?": "Yes", "Number of cubes dropped off in the switch (during auto)": "0", "Number of cubes dropped off in the scale (during auto)": "0", "Number of cubes picked up from the pyramid": "0", "Number of cubes picked up from the portal": "0", "Number of cubes picked up from the field": "0", "Number of cubes dropped off in the vault (during teleop)": "0", "Number of cubes dropped off in the scale (during teleop)": "0", "Number of cubes dropped off in your alliance switch (during teleop)": "0", "Number of cubes dropped off in your opponent's alliance switch (during teleop)": "0", "Total number of cubes fumbled(robot lost control of cube)": "1", Endgame: "Failed to make it onto the scale area", "Problems with robot/driver": "No problems with robot.", }, { Timestamp: "10/6/2018 10:32:46", "Team number": "6884", "Match number": "27", "Scout name(your name)": "<NAME>", "Cross baseline during auto?": "No show", "Number of cubes dropped off in the switch (during auto)": "0", "Number of cubes dropped off in the scale (during auto)": "0", "Number of cubes picked up from the pyramid": "0", "Number of cubes picked up from the portal": "0", "Number of cubes picked up from the field": "0", "Number of cubes dropped off in the vault (during teleop)": "0", "Number of cubes dropped off in the scale (during teleop)": "0", "Number of cubes dropped off in your alliance switch (during teleop)": "0", "Number of cubes dropped off in your opponent's alliance switch (during teleop)": "0", "Total number of cubes fumbled(robot lost control of cube)": "0", Endgame: "Failed to make it onto the scale area", "Problems with robot/driver": "Robot didn't show up", }, { Timestamp: "10/6/2018 10:36:33", "Team number": "2643", "Match number": "25", "Scout name(your name)": "<NAME> ", "Cross baseline during auto?": "Yes", "Number of cubes dropped off in the switch (during auto)": "0", "Number of cubes dropped off in the scale (during auto)": "0", "Number of cubes picked up from the pyramid": "2", "Number of cubes picked up from the portal": "0", "Number of cubes picked up from the field": "3", "Number of cubes dropped off in the vault (during teleop)": "0", "Number of cubes dropped off in the scale (during teleop)": "1", "Number of cubes dropped off in your alliance switch (during teleop)": "1", "Number of cubes dropped off in your opponent's alliance switch (during teleop)": "0", "Total number of cubes fumbled(robot lost control of cube)": "2", Endgame: "Parked", "Problems with robot/driver": "No problems with robot.", }, { Timestamp: "10/6/2018 10:40:41", "Team number": "846", "Match number": "26", "Scout name(your name)": "<NAME> ", "Cross baseline during auto?": "Yes", "Number of cubes dropped off in the switch (during auto)": "1", "Number of cubes dropped off in the scale (during auto)": "0", "Number of cubes picked up from the pyramid": "4", "Number of cubes picked up from the portal": "0", "Number of cubes picked up from the field": "4", "Number of cubes dropped off in the vault (during teleop)": "0", "Number of cubes dropped off in the scale (during teleop)": "3", "Number of cubes dropped off in your alliance switch (during teleop)": "1", "Number of cubes dropped off in your opponent's alliance switch (during teleop)": "0", "Total number of cubes fumbled(robot lost control of cube)": "3", Endgame: "Lift partner", "Problems with robot/driver": "Robot dead for less than 1 minute", }, { Timestamp: "10/6/2018 10:45:09", "Team number": "5430", "Match number": "26", "Scout name(your name)": "<NAME>", "Cross baseline during auto?": "Yes", "Number of cubes dropped off in the switch (during auto)": "0", "Number of cubes dropped off in the scale (during auto)": "0", "Number of cubes picked up from the pyramid": "1", "Number of cubes picked up from the portal": "0", "Number of cubes picked up from the field": "2", "Number of cubes dropped off in the vault (during teleop)": "2", "Number of cubes dropped off in the scale (during teleop)": "0", "Number of cubes dropped off in your alliance switch (during teleop)": "0", "Number of cubes dropped off in your opponent's alliance switch (during teleop)": "0", "Total number of cubes fumbled(robot lost control of cube)": "0", Endgame: "Climbed on ramp", "Problems with robot/driver": "No problems with robot.", }, { Timestamp: "10/6/2018 10:46:13", "Team number": "4765", "Match number": "28", "Scout name(your name)": "<NAME>", "Cross baseline during auto?": "Yes", "Number of cubes dropped off in the switch (during auto)": "0", "Number of cubes dropped off in the scale (during auto)": "0", "Number of cubes picked up from the pyramid": "1", "Number of cubes picked up from the portal": "0", "Number of cubes picked up from the field": "3", "Number of cubes dropped off in the vault (during teleop)": "0", "Number of cubes dropped off in the scale (during teleop)": "1", "Number of cubes dropped off in your alliance switch (during teleop)": "2", "Number of cubes dropped off in your opponent's alliance switch (during teleop)": "0", "Total number of cubes fumbled(robot lost control of cube)": "1", Endgame: "Lift self only", "Problems with robot/driver": "No problems with robot.", }, { Timestamp: "10/6/2018 10:46:39", "Team number": "4904", "Match number": "28", "Scout name(your name)": "<NAME>", "Cross baseline during auto?": "No", "Number of cubes dropped off in the switch (during auto)": "0", "Number of cubes dropped off in the scale (during auto)": "0", "Number of cubes picked up from the pyramid": "0", "Number of cubes picked up from the portal": "0", "Number of cubes picked up from the field": "3", "Number of cubes dropped off in the vault (during teleop)": "0", "Number of cubes dropped off in the scale (during teleop)": "3", "Number of cubes dropped off in your alliance switch (during teleop)": "0", "Number of cubes dropped off in your opponent's alliance switch (during teleop)": "0", "Total number of cubes fumbled(robot lost control of cube)": "2", Endgame: "Climbed on ramp", "Problems with robot/driver": "No problems with robot.", }, { Timestamp: "10/6/2018 10:47:18", "Team number": "1987", "Match number": "27", "Scout name(your name)": "<NAME> ", "Cross baseline during auto?": "Yes", "Number of cubes dropped off in the switch (during auto)": "0", "Number of cubes dropped off in the scale (during auto)": "0", "Number of cubes picked up from the pyramid": "5", "Number of cubes picked up from the portal": "0", "Number of cubes picked up from the field": "0", "Number of cubes dropped off in the vault (during teleop)": "5", "Number of cubes dropped off in the scale (during teleop)": "0", "Number of cubes dropped off in your alliance switch (during teleop)": "0", "Number of cubes dropped off in your opponent's alliance switch (during teleop)": "0", "Total number of cubes fumbled(robot lost control of cube)": "0", Endgame: "Climbed on ramp", "Problems with robot/driver": "Robot tipped over", }, { Timestamp: "10/6/2018 10:48:48", "Team number": "2854", "Match number": "28", "Scout name(your name)": "<NAME>", "Cross baseline during auto?": "Yes", "Number of cubes dropped off in the switch (during auto)": "1", "Number of cubes dropped off in the scale (during auto)": "0", "Number of cubes picked up from the pyramid": "0", "Number of cubes picked up from the portal": "2", "Number of cubes picked up from the field": "4", "Number of cubes dropped off in the vault (during teleop)": "0", "Number of cubes dropped off in the scale (during teleop)": "3", "Number of cubes dropped off in your alliance switch (during teleop)": "0", "Number of cubes dropped off in your opponent's alliance switch (during teleop)": "3", "Total number of cubes fumbled(robot lost control of cube)": "0", Endgame: "Climbed on ramp", "Problems with robot/driver": "No problems with robot.", }, { Timestamp: "10/6/2018 10:56:40", "Team number": "3501", "Match number": "29", "Scout name(your name)": "<NAME>", "Cross baseline during auto?": "No", "Number of cubes dropped off in the switch (during auto)": "0", "Number of cubes dropped off in the scale (during auto)": "0", "Number of cubes picked up from the pyramid": "3", "Number of cubes picked up from the portal": "0", "Number of cubes picked up from the field": "2", "Number of cubes dropped off in the vault (during teleop)": "0", "Number of cubes dropped off in the scale (during teleop)": "3", "Number of cubes dropped off in your alliance switch (during teleop)": "2", "Number of cubes dropped off in your opponent's alliance switch (during teleop)": "0", "Total number of cubes fumbled(robot lost control of cube)": "0", Endgame: "Failed to make it onto the scale area", "Problems with robot/driver": "Robot tipped over", }, { Timestamp: "10/6/2018 10:58:55", "Team number": "4765", "Match number": "28", "Scout name(your name)": "<NAME>", "Cross baseline during auto?": "Yes", "Number of cubes dropped off in the switch (during auto)": "0", "Number of cubes dropped off in the scale (during auto)": "0", "Number of cubes picked up from the pyramid": "0", "Number of cubes picked up from the portal": "0", "Number of cubes picked up from the field": "3", "Number of cubes dropped off in the vault (during teleop)": "0", "Number of cubes dropped off in the scale (during teleop)": "0", "Number of cubes dropped off in your alliance switch (during teleop)": "2", "Number of cubes dropped off in your opponent's alliance switch (during teleop)": "0", "Total number of cubes fumbled(robot lost control of cube)": "1", Endgame: "Climbed on ramp", "Problems with robot/driver": "No problems with robot.", }, { Timestamp: "10/6/2018 11:00:51", "Team number": "174", "Match number": "29", "Scout name(your name)": "<NAME>", "Cross baseline during auto?": "Yes", "Number of cubes dropped off in the switch (during auto)": "1", "Number of cubes dropped off in the scale (during auto)": "0", "Number of cubes picked up from the pyramid": "0", "Number of cubes picked up from the portal": "0", "Number of cubes picked up from the field": "3", "Number of cubes dropped off in the vault (during teleop)": "0", "Number of cubes dropped off in the scale (during teleop)": "0", "Number of cubes dropped off in your alliance switch (during teleop)": "2", "Number of cubes dropped off in your opponent's alliance switch (during teleop)": "0", "Total number of cubes fumbled(robot lost control of cube)": "1", Endgame: "Lift self only", "Problems with robot/driver": "Robot tipped over, No problems with robot., Robot didn't show up", }, { Timestamp: "10/6/2018 11:07:16", "Team number": "100", "Match number": "30", "Scout name(your name)": "<NAME>", "Cross baseline during auto?": "Yes", "Number of cubes dropped off in the switch (during auto)": "0", "Number of cubes dropped off in the scale (during auto)": "0", "Number of cubes picked up from the pyramid": "0", "Number of cubes picked up from the portal": "0", "Number of cubes picked up from the field": "4", "Number of cubes dropped off in the vault (during teleop)": "0", "Number of cubes dropped off in the scale (during teleop)": "3", "Number of cubes dropped off in your alliance switch (during teleop)": "0", "Number of cubes dropped off in your opponent's alliance switch (during teleop)": "4", "Total number of cubes fumbled(robot lost control of cube)": "0", Endgame: "Lift self only", "Problems with robot/driver": "No problems with robot.", }, { Timestamp: "10/6/2018 11:08:31", "Team number": "6814", "Match number": "30", "Scout name(your name)": "Jennifer", "Cross baseline during auto?": "Yes", "Number of cubes dropped off in the switch (during auto)": "0", "Number of cubes dropped off in the scale (during auto)": "0", "Number of cubes picked up from the pyramid": "3", "Number of cubes picked up from the portal": "0", "Number of cubes picked up from the field": "2", "Number of cubes dropped off in the vault (during teleop)": "0", "Number of cubes dropped off in the scale (during teleop)": "3", "Number of cubes dropped off in your alliance switch (during teleop)": "1", "Number of cubes dropped off in your opponent's alliance switch (during teleop)": "0", "Total number of cubes fumbled(robot lost control of cube)": "2", Endgame: "Failed to make it onto the scale area", "Problems with robot/driver": "No problems with robot.", }, { Timestamp: "10/6/2018 11:09:54", "Team number": "6418", "Match number": "30", "Scout name(your name)": "<NAME>", "Cross baseline during auto?": "No", "Number of cubes dropped off in the switch (during auto)": "0", "Number of cubes dropped off in the scale (during auto)": "0", "Number of cubes picked up from the pyramid": "1", "Number of cubes picked up from the portal": "0", "Number of cubes picked up from the field": "2", "Number of cubes dropped off in the vault (during teleop)": "0", "Number of cubes dropped off in the scale (during teleop)": "2", "Number of cubes dropped off in your alliance switch (during teleop)": "1", "Number of cubes dropped off in your opponent's alliance switch (during teleop)": "0", "Total number of cubes fumbled(robot lost control of cube)": "0", Endgame: "Failed to make it onto the scale area", "Problems with robot/driver": "No problems with robot.", }, { Timestamp: "10/6/2018 11:10:08", "Team number": "6418", "Match number": "30", "Scout name(your name)": "<NAME>", "Cross baseline during auto?": "No", "Number of cubes dropped off in the switch (during auto)": "0", "Number of cubes dropped off in the scale (during auto)": "0", "Number of cubes picked up from the pyramid": "1", "Number of cubes picked up from the portal": "0", "Number of cubes picked up from the field": "2", "Number of cubes dropped off in the vault (during teleop)": "0", "Number of cubes dropped off in the scale (during teleop)": "2", "Number of cubes dropped off in your alliance switch (during teleop)": "1", "Number of cubes dropped off in your opponent's alliance switch (during teleop)": "0", "Total number of cubes fumbled(robot lost control of cube)": "0", Endgame: "Failed to make it onto the scale area", "Problems with robot/driver": "No problems with robot.", }, { Timestamp: "10/6/2018 11:10:38", "Team number": "668", "Match number": "30", "Scout name(your name)": "<NAME>", "Cross baseline during auto?": "Yes", "Number of cubes dropped off in the switch (during auto)": "1", "Number of cubes dropped off in the scale (during auto)": "0", "Number of cubes picked up from the pyramid": "0", "Number of cubes picked up from the portal": "0", "Number of cubes picked up from the field": "4", "Number of cubes dropped off in the vault (during teleop)": "0", "Number of cubes dropped off in the scale (during teleop)": "2", "Number of cubes dropped off in your alliance switch (during teleop)": "1", "Number of cubes dropped off in your opponent's alliance switch (during teleop)": "0", "Total number of cubes fumbled(robot lost control of cube)": "3", Endgame: "Climbed on ramp", "Problems with robot/driver": "No problems with robot.", }, { Timestamp: "10/6/2018 11:19:32", "Team number": "1351", "Match number": "31", "Scout name(your name)": "<NAME>", "Cross baseline during auto?": "No", "Number of cubes dropped off in the switch (during auto)": "0", "Number of cubes dropped off in the scale (during auto)": "0", "Number of cubes picked up from the pyramid": "1", "Number of cubes picked up from the portal": "0", "Number of cubes picked up from the field": "0", "Number of cubes dropped off in the vault (during teleop)": "0", "Number of cubes dropped off in the scale (during teleop)": "0", "Number of cubes dropped off in your alliance switch (during teleop)": "0", "Number of cubes dropped off in your opponent's alliance switch (during teleop)": "0", "Total number of cubes fumbled(robot lost control of cube)": "2", Endgame: "Failed to make it onto the scale area", "Problems with robot/driver": "No problems with robot.", }, { Timestamp: "10/6/2018 11:25:50", "Team number": "3501", "Match number": "32", "Scout name(your name)": "<NAME>", "Cross baseline during auto?": "Yes", "Number of cubes dropped off in the switch (during auto)": "0", "Number of cubes dropped off in the scale (during auto)": "0", "Number of cubes picked up from the pyramid": "0", "Number of cubes picked up from the portal": "0", "Number of cubes picked up from the field": "0", "Number of cubes dropped off in the vault (during teleop)": "0", "Number of cubes dropped off in the scale (during teleop)": "0", "Number of cubes dropped off in your alliance switch (during teleop)": "0", "Number of cubes dropped off in your opponent's alliance switch (during teleop)": "0", "Total number of cubes fumbled(robot lost control of cube)": "3", Endgame: "Lift self only", "Problems with robot/driver": "No problems with robot.", }, { Timestamp: "10/6/2018 11:37:32", "Team number": "5104", "Match number": "33", "Scout name(your name)": "<NAME>", "Cross baseline during auto?": "Yes", "Number of cubes dropped off in the switch (during auto)": "0", "Number of cubes dropped off in the scale (during auto)": "0", "Number of cubes picked up from the pyramid": "7", "Number of cubes picked up from the portal": "0", "Number of cubes picked up from the field": "1", "Number of cubes dropped off in the vault (during teleop)": "8", "Number of cubes dropped off in the scale (during teleop)": "0", "Number of cubes dropped off in your alliance switch (during teleop)": "2", "Number of cubes dropped off in your opponent's alliance switch (during teleop)": "0", "Total number of cubes fumbled(robot lost control of cube)": "1", Endgame: "Climbed on ramp", "Problems with robot/driver": "No problems with robot.", }, { Timestamp: "10/6/2018 11:44:56", "Team number": "6418", "Match number": "34", "Scout name(your name)": "<NAME>", "Cross baseline during auto?": "Yes", "Number of cubes dropped off in the switch (during auto)": "0", "Number of cubes dropped off in the scale (during auto)": "0", "Number of cubes picked up from the pyramid": "5", "Number of cubes picked up from the portal": "0", "Number of cubes picked up from the field": "0", "Number of cubes dropped off in the vault (during teleop)": "4", "Number of cubes dropped off in the scale (during teleop)": "0", "Number of cubes dropped off in your alliance switch (during teleop)": "2", "Number of cubes dropped off in your opponent's alliance switch (during teleop)": "0", "Total number of cubes fumbled(robot lost control of cube)": "0", Endgame: "Climbed on ramp", "Problems with robot/driver": "No problems with robot.", }, { Timestamp: "10/6/2018 11:51:16", "Team number": "4765", "Match number": "35", "Scout name(your name)": "<NAME>", "Cross baseline during auto?": "No", "Number of cubes dropped off in the switch (during auto)": "0", "Number of cubes dropped off in the scale (during auto)": "0", "Number of cubes picked up from the pyramid": "3", "Number of cubes picked up from the portal": "0", "Number of cubes picked up from the field": "0", "Number of cubes dropped off in the vault (during teleop)": "2", "Number of cubes dropped off in the scale (during teleop)": "0", "Number of cubes dropped off in your alliance switch (during teleop)": "1", "Number of cubes dropped off in your opponent's alliance switch (during teleop)": "0", "Total number of cubes fumbled(robot lost control of cube)": "0", Endgame: "Climbed on ramp", "Problems with robot/driver": "No problems with robot.", }, ] export default data
abkl/csim
src/components/primatives/button.tsx
import styled from "@emotion/styled" interface ButtonProps { primary: boolean } const Button = styled.button` min-width: 2rem; padding: 6px 16px; box-shadow: 0 8px 16px 0 rgba(0, 0, 0, 0.1), 0 6px 20px 0 rgba(0, 0, 0, 0.09); border: 2px solid ${props => props.theme.primary.red}; border-radius: 4px; outline: none; font-size: 14px; text-decoration: none; background: none; color: #c41e3a; &:active { background-color: ${props => props.theme.primary.red}; color: white; } ` export default Button
abkl/csim
src/components/form-components/form-util.ts
import * as Yup from "yup" import { Fields } from "../../utils/game-constants" export const initiallizeFormState = (fields: Fields): { [s: string]: any } => Object.keys(fields) .map(f => fields[f]) // map out the fields into [[fields]] .reduce((acc, val) => acc.concat(val), []) // flattens the array .reduce((state, field) => { if (typeof field === "object") { switch (field["type"]) { case "Number": return field.dropped ? { ...state, [field["field-name"]]: 0, [field["field-name"] + " dropped"]: 0, } : { ...state, [field["field-name"]]: 0, } case "Radio": return { ...state, [field["field-name"]]: field["options"] ? field["options"][0] : "none-selected", } case "Checkbox": return { ...state, [field["field-name"]]: "", } case "Switch": return { ...state, [field["field-name"]]: false, } case "Slider": return { ...state, [field["field-name"]]: 0, } default: return state } } if (typeof field === "string") return { ...state, [field]: "", } return state }, {}) // initializes the form state export const createValidateObject = (fields: Fields) => { const shape = Object.keys(fields) .map(f => fields[f]) .reduce((acc, val) => acc.concat(val), []) .reduce((vobj, field) => { if (typeof field === "object") { switch (field.type) { case "Number": return { ...vobj, [field["field-name"]]: Yup.number().min(0), } case "Radio": return { ...vobj, [field["field-name"]]: Yup.string().required(), } case "Switch": return { ...vobj, [field["field-name"]]: Yup.boolean().required(), } } } return { ...vobj, [field as string]: "", } }, {}) return Yup.object().shape(shape) }
abkl/csim
src/components/form-components/radio.tsx
import React from "react" import css from "@emotion/css" import { FieldProps } from "formik" const Radio = (props: FieldProps & { options: string[] }) => ( <fieldset css={css` display: inline-flex; position: relative; flex-direction: column; align-items: flex-start; width: 100%; border: 0; max-width: 300px; align-self: center; `} > <legend css={css` text-align: left; `} > {props.field.name}: </legend> <div css={css` display: flex; margin: 8px 0; flex-direction: column; `} > {props.options.map(option => ( <label css={css` display: inline-flex; vertical-align: middle; align-items: center; `} key={option} > <span css={css` padding: 12px; `} > <input onChange={props.field.onChange} name={props.field.name} value={option} type="radio" checked={props.field.value === option} /> </span> {option} <br /> </label> ))} </div> </fieldset> ) export default Radio
abkl/csim
lib/script.ts
/* eslint-disable @typescript-eslint/no-var-requires */ import { fetchDataFromSheets } from "./apiFetches" import { sheetsDataToJSON, calculateScore, collectMatchDataIntoTeamObj, calculateTotalStats, } from "./data-functions" import { sampleStandardDeviation } from "simple-statistics" import fs from "fs" // ts-node -O '{"module": "commonjs"}' ./script.ts // fetchDataFromSheets() // .then(c => sheetsDataToJSON(c)) // .then(c => collectMatchDataIntoTeamObj(c)) // .then(c => fs.writeFileSync("./data.json", JSON.stringify(c))) // .then(c => console.log(c)) // fs.readFile("./data.json", (err, data) => { // if (err) console.error(err) // const teams = JSON.parse(data.toString()) // }) console.log(sampleStandardDeviation([6, 6, 6, 1, 2, 4, 8, 12]))
abkl/csim
src/components/form-components/display-fields.tsx
import React from "react" import Counter from "./counter" import { Field } from "formik" import { FieldType } from "../../utils/game-constants" import Radio from "./radio" import Switch from "./switch" import CheckboxGroup from "./checkbox" import css from "@emotion/css" import FormSlider from "./slider" interface DisplayFieldsProps { fields: FieldType[] setFieldValue: (field: string, value: any) => void values: any } export default function DisplayFields({ fields, setFieldValue, values, }: DisplayFieldsProps) { return ( <> {fields.map(f => { if (typeof f === "string") return ( <div css={css` padding-bottom: 15px; `} key={f as string} > <Field component={ f === "Comments" || f === "Recent problems with robot" ? "textarea" : "input" } type={/Number/.test(f) ? "number" : "text"} name={f} placeholder={f} /> <br /> </div> ) if (typeof f === "object") { switch (f.type) { case "Number": return ( <Counter values={values} setFieldValue={setFieldValue} name={f["field-name"]} key={f["field-name"]} dropped={f.dropped} /> ) case "Switch": return ( <Field component={Switch} name={f["field-name"]} key={f["field-name"]} /> ) case "Radio": return ( <Field component={Radio} name={f["field-name"]} options={f["options"] as string[]} key={f["field-name"]} /> ) case "Slider": return ( <FormSlider value={values[f["field-name"]]} onChange={v => setFieldValue(f["field-name"] as string, v)} name={f["field-name"]} max={f.max} min={f.min} step={f.step} marks={f.marks} key={f["field-name"]} /> ) case "Checkbox": return ( <CheckboxGroup name={f["field-name"]} options={f.options} onChange={v => setFieldValue(f["field-name"], v)} value={values[f["field-name"]]} key={f["field-name"]} /> ) } } })} </> ) }
abkl/csim
src/components/form-components/switch.tsx
import React from "react" import { FieldProps } from "formik" import styled from "@emotion/styled" const GlobalContainer = styled.label` display: flex; justify-content: center; align-items: center; padding-bottom: 5%; ` const InputContainer = styled.label` position: relative; display: inline-block; width: ${(props: { width: number; height: number }) => props.width}px; height: ${props => props.height}px; > input { display: none; } ` const Input = styled.input` &:checked + span { background-color: ${props => props.theme.primary.red}; } &:disabled + span { background-color: ${props => props.theme.primary.red}; opacity: 0.4; cursor: not-allowed; } &:disabled:checked + span { background-color: ${props => props.theme.primary.red}; opacity: 0.4; cursor: not-allowed; } &:focus + span { box-shadow: 0 0 1px #2196f3; } &:checked + span:before { -webkit-transform: translateX(26px); -ms-transform: translateX(26px); transform: translateX(26px); } ` const Slider = styled.span` position: absolute; cursor: pointer; display: flex; align-items: center; top: 0; left: 0; right: 0; bottom: 0; background-color: ${props => props.theme.highlight.light}; -webkit-transition: 0.4s; transition: 0.4s; border-radius: 34px; &:before { position: relative; border-radius: 50%; content: ""; height: ${(props: { sliderHeight: number; sliderWidth: number }) => props.sliderHeight}px; width: ${props => props.sliderWidth}px; left: 4px; background-color: ${props => props.theme.shadow.light}; -webkit-transition: 0.4s; transition: 0.4s; } ` export default function Switch(props: FieldProps) { return ( <GlobalContainer> <label> {props.field.name}: &nbsp;</label> <InputContainer width={60} height={34}> <Input onChange={props.field.onChange} name={props.field.name} type="checkbox" value={props.field.value} checked={props.field.value} /> <Slider sliderHeight={26} sliderWidth={26} /> </InputContainer> <br /> </GlobalContainer> ) }
abkl/csim
src/utils/game-constants.ts
export const gameValues = { "Hatch Panel": 2, Cargo: 3, "Sandstorm Cross": { "level 1": 3, "level 2": 6, }, "Habitat Return": { "level 1": 3, "level 2": 6, "level 3": 12, }, Defending: 5, "Hab Docking": "1 RP", "Complete Rocket": "1 RP", } export type FieldType = | string | { "field-name": string type: "Switch" [s: string]: string | boolean scoring: boolean } | { "field-name": string type: "Number" scoring: boolean dropped: boolean [s: string]: string | boolean } | { "field-name": string type: "Radio" | "Checkbox" options: string[] [s: string]: string | string[] | boolean scoring: boolean } | { "field-name": string type: "Slider" min?: number max: number step: number scoring: boolean marks: { [s: string]: string } } export interface Fields { [s: string]: FieldType[] } export const fields: Fields = { "Pre-game": [ "Your Name", "Team Number", "Match Number", { "field-name": "Robot Starting Platform", type: "Radio", options: ["level 1", "level 2"], scoring: true, }, { "field-name": "Started With", type: "Radio", options: ["none", "Cargo", "Hatch Panel"], scoring: false, }, ], Sandstorm: [ { "field-name": "Leave Habitat", type: "Switch", scoring: true }, { "field-name": "Number Hatch Panels ST lvl 1/cgshp", type: "Number", scoring: true, dropped: true, }, { "field-name": "Number Hatch Panels ST lvl 2", type: "Number", scoring: true, dropped: true, }, { "field-name": "Number Hatch Panels ST lvl 3", type: "Number", scoring: true, dropped: true, }, { "field-name": "Number Cargo ST lvl 1/cgshp", type: "Number", scoring: true, dropped: true, }, { "field-name": "Number Cargo ST lvl 2", type: "Number", scoring: true, dropped: true, }, { "field-name": "Number Cargo ST lvl 3", type: "Number", scoring: true, dropped: true, }, ], Teleop: [ { "field-name": "Number Hatch Panels TLOP lvl1/cgshp", type: "Number", scoring: true, dropped: true, }, { "field-name": "Number Hatch Panels TLOP lvl 2", type: "Number", scoring: true, dropped: true, }, { "field-name": "Number Hatch Panels TLOP lvl 3", type: "Number", scoring: true, dropped: true, }, { "field-name": "Number Cargo TLOP lvl 1/cgshp", type: "Number", scoring: true, dropped: true, }, { "field-name": "Number Cargo TLOP lvl 2", type: "Number", scoring: true, dropped: true, }, { "field-name": "Number Cargo TLOP lvl 3", type: "Number", scoring: true, dropped: true, }, { "field-name": "Number of Fouls", type: "Number", scoring: false, dropped: false, }, { "field-name": "Number of Tech Fouls", type: "Number", scoring: false, dropped: false, }, { "field-name": "Yellow Card", type: "Switch", scoring: false, }, { "field-name": "Red Card", type: "Switch", scoring: false, }, ], "End game": [ { "field-name": "Habitat Return", type: "Radio", options: ["Did not return", "level 1", "level 2", "level 3"], scoring: true, }, { "field-name": "Habitat Assist(Buddy Climb)", type: "Radio", options: [ "Did not help another robot climb", "Helped another robot to lvl 2", "Helped another robot to lvl 3", ], scoring: true, }, { "field-name": "Rocket Completion", type: "Switch", scoring: false }, { "field-name": "Robot Deadtime(seconds)", type: "Slider", scoring: false, max: 20, step: 5, marks: { "0": "0", "5": "5", "10": "10", "15": "15", "20": "20 =<", }, }, { "field-name": "Driver Skill", type: "Slider", scoring: false, min: 1, max: 4, step: 1, marks: { "1": "1", "2": "2", "3": "3", "4": "4", }, }, "Comments", ], }
abkl/csim
test/data-functions.spec.ts
import { sheetsDataToJSON, collectMatchDataIntoTeamObj, getGameItemKeyFromMatchDataKey, calculateScore, ScoresObj, } from "../lib/data-functions" import { mean, standardDeviation } from "simple-statistics" import { fields, gameValues } from "../src/utils/game-constants" const fieldString = Object.keys(fields) .map(key => fields[key]) .reduce((acc, val) => acc.concat(val), []) .map(fieldKey => typeof fieldKey === "string" ? fieldKey : fieldKey["field-name"] ) describe("Turn Sheets Data into JSON", () => { test("sheetsDataToJSON should properly converts data from google sheets to JSON", () => { const mockData = [["hello", "world"], [0, 1], [1, 0]] const mockData2 = [ ["team", "cubes", "scale", "auto"], ["4159", 612, 0, false], ["245", 534, 1, true], ] expect(sheetsDataToJSON(mockData)).toEqual([ { hello: 0, world: 1, }, { hello: 1, world: 0, }, ]) expect(sheetsDataToJSON(mockData2)).toEqual([ { auto: false, cubes: 612, scale: 0, team: "4159", }, { auto: true, cubes: 534, scale: 1, team: "245", }, ]) }) test("sheetsDataToJSON should throw an error when invalid data is passed to it", () => { const mockData = [["hello"]] expect(() => { sheetsDataToJSON(mockData) }).toThrowError(Error("invalid data passed!")) }) }) describe.only("properly calculate scores for individual matches", () => { test("getGameItemKeyFromMatchDataKey properly searches for the right key", () => { getGameItemKeyFromMatchDataKey(fieldString, "Cargo").forEach(key => { expect(RegExp("Cargo").test(key)).toBe(true) expect(/dropped/.test(key)).toBe(false) }) getGameItemKeyFromMatchDataKey(fieldString, "Hatch Panel").forEach(key => { expect(RegExp("Hatch Panel").test(key)).toBe(true) expect(/dropped/.test(key)).toBe(false) }) getGameItemKeyFromMatchDataKey(fieldString, "Hatch Panel", true).forEach( key => { expect(RegExp("Hatch Panel").test(key)).toBe(true) expect(/dropped/.test(key)).toBe(true) } ) getGameItemKeyFromMatchDataKey(fieldString, "Hatch Panel", true).forEach( key => { expect(RegExp("Hatch Panel").test(key)).toBe(true) expect(/dropped/.test(key)).toBe(true) } ) }) test("calculateScore properly calculate score", () => { const mockData: ScoresObj = { "Robot Starting Platform": "level 1", "Leave Habitat": "FALSE", "Number of Hatch Panels(Sandstorm)": "0", "Number of Cargo(Sandstorm)": "0", "Number of Hatch Panels(Teleop)": "0", "Number of Cargo(Teleop)": "0", "Habitat Return": "Did not return", "Team Number": "1", "Match Number": "1", "Your Name": "t", } expect(calculateScore(mockData)).toEqual({ Cargo: 0, "Hatch Panel": 0, "Habitat Return": 0, "Sandstorm Cross": 0, "Total Score": 0, "Team Number": "1", "Match Number": "1", "Scouter Name": "t", }) const mockData2: ScoresObj = { "Robot Starting Platform": "level 1", "Leave Habitat": "TRUE", "Number of Hatch Panels(Sandstorm)": "1", "Number of Cargo(Sandstorm)": "4", "Number of Hatch Panels(Teleop)": "2", "Number of Cargo(Teleop)": "4", "Habitat Return": "level 3", "Team Number": "1", "Match Number": "1", "Your Name": "t", } expect(calculateScore(mockData2)).toEqual({ "Team Number": "1", "Match Number": "1", Cargo: 8 * gameValues.Cargo, "Hatch Panel": 3 * gameValues["Hatch Panel"], "Habitat Return": gameValues["Habitat Return"]["level 3"], "Sandstorm Cross": gameValues["Sandstorm Cross"]["level 1"], "Total Score": 8 * gameValues.Cargo + 3 * gameValues["Hatch Panel"] + gameValues["Habitat Return"]["level 3"] + gameValues["Sandstorm Cross"]["level 1"], "Scouter Name": "t", }) const mockData3: ScoresObj = { "Robot Starting Platform": "level 1", "Leave Habitat": "FALSE", "Number of Hatch Panels(Sandstorm)": "1", "Number of Cargo(Sandstorm)": "4", "Number of Hatch Panels(Teleop)": "2", "Number of Cargo(Teleop)": "4", "Habitat Return": "level 3", "Team Number": "1", "Match Number": "1", "Your Name": "t", } expect(calculateScore(mockData3)).toEqual({ Cargo: 8 * gameValues.Cargo, "Hatch Panel": 3 * gameValues["Hatch Panel"], "Habitat Return": gameValues["Habitat Return"]["level 3"], "Sandstorm Cross": 0, "Total Score": 8 * gameValues.Cargo + 3 * gameValues["Hatch Panel"] + gameValues["Habitat Return"]["level 3"], "Team Number": "1", "Match Number": "1", "Scouter Name": "t", }) }) // test("collectMatchDataIntoTeamObj should collect matchData into respective teams and calculate scores for individual data points", () => { // const d = collectMatchDataIntoTeamObj(data) // Object.keys(d.teams).forEach(key => { // d.teams[key].matchData.forEach(matchData => // expect(matchData["Team Number"].toString()).toEqual(key) // ) // }) // expect(data.length).toEqual(d.originalScores.length) // }) }) describe("calculate mean and standard deviations", () => {})
abkl/csim
src/components/primatives/modal.tsx
<filename>src/components/primatives/modal.tsx<gh_stars>0 import React, { useEffect, useRef, useLayoutEffect } from "react" import styled from "@emotion/styled" const ModalOverlay = styled.div` align-items: center; justify-content: center; background-color: rgba(0, 0, 0, 0.65); display: flex; padding: 1em; position: fixed; top: 0; left: 0; height: 100%; width: 100%; ` const ModalPaper = styled.div` background-color: white; border-radius: 3px; padding: 1rem 2rem; text-align: center; overflow: visible; max-height: 100vh; overflow-y: auto; ` // Hooks function useOnClickOutside( ref: React.RefObject<HTMLDivElement>, handler: (a: any) => void ) { useEffect(() => { const listener = (event: Event) => { // Do nothing if clicking ref's element or descendent elements if (!ref.current || ref.current.contains(event.target as Node)) { return } handler(event) } document.addEventListener("mousedown", listener) document.addEventListener("touchstart", listener) return () => { document.removeEventListener("mousedown", listener) document.removeEventListener("touchstart", listener) } }, []) // Empty array ensures that effect is only run on mount and unmount } function useLockBodyScroll() { useLayoutEffect(() => { // Prevent scrolling on mount document.body.style.overflow = "hidden" // Re-enable scrolling when component unmounts return () => (document.body.style.overflow = "visible") }, []) // Empty array ensures effect is only run on mount and unmount } export default function Modal({ onClose, children, }: { onClose: () => void children: React.ReactNode }) { const ref = useRef(null) useOnClickOutside(ref, () => onClose()) useLockBodyScroll() return ( <ModalOverlay> <ModalPaper ref={ref}>{children}</ModalPaper> </ModalOverlay> ) }
abkl/csim
lib/apiFetches.d.ts
<filename>lib/apiFetches.d.ts import { TeamObject } from "../src/templates/team-template" export function fetchTeamsFromTBA( eventKey: string, event: string ): Promise<TeamObject[]> export function fetchDataFromSheets(): Promise<any[][]>
abkl/csim
src/utils/typography.ts
<reponame>abkl/csim<filename>src/utils/typography.ts<gh_stars>0 import Typography, { TypographyOptions } from "typography" // @ts-ignore import oceanBeachTheme from "typography-theme-ocean-beach" ;(oceanBeachTheme as TypographyOptions).overrideThemeStyles = () => ({ "h1,h2,h3,h4,h5": { marginTop: 0, }, }) const typography = new Typography(oceanBeachTheme) export default typography export const rhythm = typography.rhythm
srdejo/-adn-ceiba-front-comercio
src/app/feature/comercio/comercio.module.ts
<filename>src/app/feature/comercio/comercio.module.ts import { NgModule } from '@angular/core'; import { CommonModule } from '@angular/common'; import { ComercioRoutingModule } from './comercio-routing.module'; import { ComercioComponent } from './components/comercio/comercio.component'; import { CrearComercioComponent } from './components/crear-comercio/crear-comercio.component'; import { ListarComercioComponent } from './components/listar-comercio/listar-comercio.component'; @NgModule({ declarations: [ ComercioComponent, CrearComercioComponent, ListarComercioComponent ], imports: [ CommonModule, ComercioRoutingModule ] }) export class ComercioModule { }
srdejo/-adn-ceiba-front-comercio
src/app/app.component.ts
import { Component } from '@angular/core'; import { MenuItem } from '@core/modelo/menu-item'; @Component({ selector: 'app-root', templateUrl: './app.component.html', styleUrls: ['./app.component.scss'] }) export class AppComponent { title = 'app-base'; public menuItems: MenuItem[] = [ { url: '/home', nombre: 'Inicio' }, { url: '/pedido', nombre: 'Pedidos' }, { url: '/producto', nombre: 'Productos' }, { url: '/comercio', nombre: 'Comercios' }, { url: '/horario', nombre: 'Horarios' }, { url: '/oferta', nombre: 'Ofertas' } ]; }
srdejo/-adn-ceiba-front-comercio
src/app/shared/service/comercio.service.ts
import { Injectable } from '@angular/core'; import { HttpService } from '@core/services/http.service'; import { Comercio } from '@shared/modelo/comercio'; import { CookieService } from 'ngx-cookie-service'; import { throwError } from 'rxjs'; import { environment } from 'src/environments/environment'; @Injectable() export class ComercioService { constructor( protected http: HttpService, private cookieService: CookieService ) { } public consultar() { return this.http.doGet<Comercio[]>(`${environment.endpoint}/comercios`, this.http.optsName('consultar comercios')); } public seleccionar(comercio: Comercio): void { this.cookieService.set('comercio', JSON.stringify(comercio)); } public comercioSeleccionado(): Comercio { try { return JSON.parse(this.cookieService.get('comercio')); } catch (error) { throwError('No se ha seleccionado un comercio'); } } }
srdejo/-adn-ceiba-front-comercio
src/app/shared/components/toast/toast.component.ts
import { Component, TemplateRef } from '@angular/core'; import { ToastService } from '@shared/service/toast.service'; @Component({ selector: 'app-toast', templateUrl: './toast.component.html', styleUrls: ['./toast.component.scss'] }) export class ToastComponent { constructor(public toastService: ToastService) { } isTemplate(toast) { return toast.textOrTpl instanceof TemplateRef; } showStandard() { this.toastService.show('I am a standard toast'); } showSuccess() { this.toastService.show('I am a success toast', { classname: 'bg-success text-light', delay: 10000 }); } showDanger(dangerTpl) { this.toastService.show(dangerTpl, { classname: 'bg-danger text-light', delay: 15000 }); } }