Giter Club home page Giter Club logo

dr4ft's Introduction

dr4ft


CI

dr4ft Discord

dr4ft is a NodeJS based web-application that simulates draft and sealed format between players and/or bots. Most of MTG sets are playable thanks to MTGJson support. We follow as much as possible the rules that determine how a real booster is created.

The application provides the following features:

  • Draft and Sealed format
  • Regular, Cube and Chaos game types
  • Special game modes like "Glimpse Draft" or "Decadent"
  • 1 to 100 players
  • 1 to 12 packs per player
  • All playable sets ever printed
  • Import your custom set and play it
  • In-game chat
  • Pick Timer
  • Autopick
  • Suggest lands
  • Kick players
  • Connection indicators
  • Pick confirmation
  • Grid and column view
  • Card sorting by rarity, type, color or mana cost
  • Bots
  • Notifications when a pack is available
  • API to create and manage a game remotely. More docs here
  • Accurate Booster generation rules from @taw's magic-sealed-data
  • Allow several picks per pack
  • Download draft logs for analysis
  • Export your deck to various other apps
  • Generate deck hashes for competitive play

Technologies

dr4ft is written in ES6 and transpiled with Webpack and Babel, and uses React on the client-side. The application uses SocketIO and the Websocket technology between client and server.


Project History

dr4ft is a fork of arxanas' drafts.ninja fork of aeosynth's draft project:

draft (initial project, discontinued)
    ↳ drafts.ninja (fork, discontinued)
            ↳ dr4ft (fork, current main project)

It supports all their features, and many more.

Known pages running this code:


Installation

Native

  1. Install Node.js >= 16.0.0. Alternatively, install nvm and then run nvm use in this repo, which will install the correct Node version for this repo as defined in the .nvmrc file.
  2. Run
    $ npm ci
    $ npm run build
    $ npm start
  3. Visit http://localhost:1337

Docker

You can also create a Docker image and run the app in a container:

  1. Install Docker
  2. Build the image:
    docker build -t dr4ft-app .
  3. Run it in a container:
    docker run -dp 1337:1337 dr4ft-app
  4. Visit http://localhost:1337

Usage

Start Server

npm start This command start the server

npm run download_allsets This command downloads all sets from MTGJson and integrates them.

npm run update_database This command downloads integrates all files previously downloaded from MTGJson.

npm run download_booster_rules download and parse booster generation rules from magic-sealed-data

Development Notes

VSCode

You can debug this application by adding the following configuration to your launch.json:

{
  "name": "Launch via NPM",
  "type": "node",
  "request": "launch",
  "cwd": "${workspaceFolder}",
  "runtimeExecutable": "npm",
  "runtimeArgs": [
      "run", "start-debug"
  ],
  "port": 1338
}

You should now be able to set breakpoints in backend/ and hit them when you start the debugger. This relies on the --inspect-brk=1338 flag to open port 1338 for the debugger to attach to.

Breakpoints for the frontend should be set in your browser console.

Contributors

❤️ Thank you!

Contribute!

Be a part of this project! You can run the test using the following.

  1. Install dependencies from package.json by running npm ci
  2. Run the test via npm test
  3. Make some fun new modules!

Found bugs or have feature requests? Feel free to open an issue! Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.

Please make sure to update tests as appropriate.

The project is unaffiliated with Wizards of the Coast, and is licensed under the MIT license.

dr4ft's People

Contributors

benjaminpwagner avatar caelen-feller avatar charliepugh92 avatar crookedneighbor avatar dependabot-preview[bot] avatar dependabot-support avatar dependabot[bot] avatar dev-id avatar ebbit1q avatar gitter-badger avatar haganbmj avatar herveh44 avatar keeler avatar kyonlee avatar lrawicz avatar mildmongrel avatar mixmix avatar nex3 avatar noojuno avatar oelarnes avatar pgtest2 avatar psettle avatar skwerlman avatar t-moennich avatar thinkingofmaud avatar tooomm avatar zeldazach avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

dr4ft's Issues

Map Print Runs

Sealed paper packs are not random. The cards are packed according to "(print) Runs". The runs are created to allow for a balanced drafting experience. They ensure that each pack has a certain balance of colors and power.

You can see some detailed information in this video: https://youtu.be/LnCyHJUGg7k which uses this data: https://docs.google.com/spreadsheets/d/1AtO2LGrVxKqfhvZ01zwhBzkDj1XGRFOoj_i7mf5CRTI/edit#gid=1168895507

In that example, Kaladesh has 4 distinct common print runs. Packs of KLD will have 2-4 cards from Run A, 2 or 4 cards from Run B, and depending on how many cards from Run A, either 5-6 cards from Run C1 or 4 cards from C2.

I have not ascertained the frequency of the double-size Run B or the relative frequencies of C1 and C2.

Basic Lands not included in Foil Calculations

Currently the foil insertion algorithm does not account for basic lands.

Basics also aren't assigned to the cards file, so if/when Basics are included, if they're actually inserted, they'll need to be put in cards.json by make/cards.js

setup Heroku Review Apps

It's a pretty fancy and useful tool to check changes within PR's live!
We should be all good with just the free plan, and it seamlessly integrates with GitHub.

Announcement in blog: https://blog.heroku.com/heroku-review-apps-ga
Documentation: https://devcenter.heroku.com/articles/github-integration-review-apps

Other (hopefully helpful) links:
https://github.com/infusionsoft/heroku-review-app-guide
http://blog.skorfmann.com/heroku-review-apps
https://robots.thoughtbot.com/running-acceptance-with-review-apps

@HerveH44 you had some concerns or additional requirements that would need to change before we could use it. Can you let us know here again, please?


Note: https://zeit.co/now could be an interesting alternative

Cube Sealed requires 720 cards

Cube sealed requires a minimum cube list size, but the number of players in the event is unknown at the time of cube size verification.

add info about game type/packs to room

Copied over from old repo: arxanas/drafts.ninja#34

(Just had a game where somebody left after he realized that the draft was to test the new set (tripple emn draft) instead of being a perfect styled emn-emn-soi draft. Draft got destroyed in last pack.)

In general a nice information and avoids problems.
It should be displayed inside the room, as well as outside.

It could be in a new box next to settings/players. Or as some kind of headline?
Could also be removed completely once the draft starts or when it finishes to get replaced by the lands box for example.

This information used to be around and got removed in your fork.

To stress, and further clarify this issue I'll attach two screenshots:

  • view as room creator:
    host

  • view as joined player:
    joined_player

So as long as a player joins a draft over a link he has no clue what he actually joined, and what he is going to play. The host could fool around with them, or the player could easily end up in a scenario as mentioned above.
There should be a Game Information or Room Type/Settings panel for everybody. Instead a Start Game one only for the creator.

My suggestion is to change the name and content a bit (#22), make it available to all players and only display the Start Game button for the creator/admin of the room.


Linking #19 here as well.

MTGO import compatibility

I'm wondering if dr4ft is compatible with the import functionality in MTGO?!
See: http://magic.wizards.com/en/articles/archive/importing-and-creating-decks
Is there any format you can download from the draft site working as an import there?

Why? Deck building practice and e.g. sealed preparation is just so much worse on the draft site or within Cockatrice...
Missing a simple kitchen table style building experience as with real cards. Filtering/Sorting as a nice-to-have on top.

Three and Single Pack Sealed for Leagues

dr4ft is awesome! I just wanted to see if you could add an option for sealed decks to where you could choose either three packs or single packs for Magic leagues. Thanks!

"suggest lands" not working

Copied over from old repo: arxanas/drafts.ninja#37
Check there for former discussion and questions.

Clicking the button does nothing. reset lands works though.

Retested today with both Chrome and Firefox on dr4ft.com (Running Version 54e7908).
Same problem still persists for me.

Cleanup + transition issues from old repos

There is a lot of outdated and already fixed stuff hanging around at the former repositories.

I think if we clean them up and transition useful requests over to this one, everyone can benefit and we lower possible confusion for hosts and users.

I reopened (copied) already several of mine old requests and closed them in the old places.
Here are the ones we can still deal with...

Open Issues and PR's by @dev-id:

Open Issues by @tooomm:


If the old maintainers put a note+link to this repo at one point, that would be very helpful as well.

more information about public rooms

Copied over from old repo: arxanas/drafts.ninja#40

Public rooms miss some information:

  • Format not named. It's called Format, but actually there are just used packs listed
    better go with Draft (EMN/EMN/SOI), Sealed (EMN/EMN/SOI/EMN/EMN/SOI), Chaos Draft, ..?
  • no room age / creation time

Also Seats sounds a bit weird to me. Would Players be a better term? (I'm not a native speaker!)

age-format-seat

hide picks during draft (paper draft simulation)

  • hide picks during draft
  • review time in between packs

As option in comparison to mtgo like drafts with more time during picks, but without review time between packs.

This would allow for drafts like you're used to at your LGS at FNM or even big tournaments on international competitive level. Has to be an option for sure.

notifications for hidden chat window

Copied over from old old repo: https://github.com/aeosynth/draft/issues/131

I sometimes miss the chat because I forget to check at all, or just don't check on a regular basis during a draft or a complex sealed pool building session.
You need as much space as possible for a nice building experience, so I end up hiding the chat... but also missing many (some important) messages!

I would like to see the Chat text flashing for example or some other visual notification of new messages. Especially when the chat window is hidden.

More modern and interactive Web Notifications are also a viable consideration.

install instructions incomplete

It still lacks an important thing, in my opinion :
In order to install the app (before make run), one needs to launch make 'install'

By itself, make run will not launch the app :(

See #60 (comment)

smarter default file name for deck downloads

Make the default deck name something like:
gamemode_timestamp or date_localtimestamp_gamemode, not sure if other informatin like playercount would be too helpful

So a filename could look like: 2017-04-23_17-21_sealed.txt or 2017-04-23_draft_17-21.cod (with the timestamp at the end)

The idea is get a useful filename which you don't have to change all the time, which isn't overwriting other files and actually provides useful information!

Edit: Even more important... just realized that the name is also baked into the .cod file and therefore shows up if you load the deck file in the deck editor, plus it can't really be changed there by the ordinary user:

  <deckname>16-04-2017_3</deckname>

Create set list file on-the-fly

Currently the public/src/data.js file is manually curated. It should be generated automatically from data/sets.json

This will save one step when adding a set

Will need to bring in set type to set file

Clean install issue

Hello, I am getting this:

sudo make run
npm install
npm WARN deprecated [email protected]: Please update to minimatch 3.0.2 or higher to avoid a RegExp DoS issue
npm ERR! code 128
npm ERR! Command failed: /usr/bin/git clone --depth=1 -q -b master git://github.com/arxanas/utils.git /root/.npm/_cacache/tmp/git-clone-47a3b3c7
npm ERR! fatal: could not create leading directories of '/root/.npm/_cacache/tmp/git-clone-47a3b3c7': Permission denied
npm ERR!

npm ERR! A complete log of this run can be found in:
npm ERR! /root/.npm/_logs/2017-11-10T20_18_40_708Z-debug.log
Makefile:14: recipe for target 'install' failed
make: *** [install] Error 1

Dockerfile

Hi,

At work, I'm working a lot with docker. Actually, I've been thinking of a way to deploy easily at home multiple instances of dr4ft to check the different versions. So I wrote a simple Dockerfile to help testing the results between multiple branches. It could be interesting to have it on the root directory (then it just needs to run "docker build URL_OF_GIT#BRANCH" to build the image locally.

Would you be interested ? This looks like that at the moment :

FROM node:8.4.0

# Install "make" from build-essential
RUN apt-get update \
&& apt-get install -y build-essential

# Add sources to /app 
ADD . /app/

# Set working dir as /app
WORKDIR /app

# Install the dependencies
# Make all install the cards
RUN npm install && make all

# Publish the port 1337
EXPOSE 1337

# By default, run the command make run
CMD make run

Let me know what you think,I'll put it as a pull request

Cheers,
Herve

Allow clicking anywhere in the chat window to select the chat box

Copied over from arxanas/drafts.ninja#31, originally opened by @arxanas

Similar to the Messenger windows on the Facebook desktop site.

This might be possible with a clever use of the label tag to wrap the whole chat window. Otherwise probably just use Javascript.

Addition:
Since we don't support any kind of hotkeys in the interface of the page (there could actually be one to show/hide the chat for example!) normal text input could always go to the chat by default if possible.
(Or any other text field if actively selected, with fallback to chat again if clicked elsewhere)

piles for summarized cmc's are not labeled well

Copied over from old repo: arxanas/drafts.ninja#46

When sorting for cmc the last card pile merges cards with cost of 6 and more mana.
The pile should tell you that it's summarizing cards --> rename 6 to 6/6+ or ≥6 👍

cmc=7 card in cmc=6 card pile
cmc grouping


Here a better view of some mixed cmc cost cards in the same pile:
cmc grouping2

add game type "Team Limited"

Copied over from old repo: arxanas/drafts.ninja#38

additional requirements:

  • specify up to 12 boosters
  • have more deck zones.
    maybe a tab for each of the 3 decks + sideboards and one shared junk zone.
  • safe each deck individually + show all 3 hashes

Two-Headed Giant Sealed with 8 Packs to build 2 decks would be possible too then!


Addition:
To get a Team Draft working it would require to change the seat order of joined people (admin only).
It would also allow to practice with friends etc. where you want to have a special seat order or something.

The last part with Team Drafting should be covered by #23 and it's fix #33

Draft Log

Hi,

I've been trying to make a draft log from the app. I'll suggest a pull request, tell me if it's fine !

I tried, and it works with the site : http://magic.flooey.org
I contacted them, and they replied that my file is fine.

Let me know, what you think about it,

Herve

Custom pack counts for draft and sealed

Draft

Sealed


I guess it would be best to have fully customizable packs for sealed and draft instead all this check boxes for different pre-configured pack counts
Also, because there is a lot of crazy stuff out there that we can't keep up with:

add related card pictures (dfc)

I highly like to see the back sites of Double-Faced-Cards in the preview window!

Otherwise you have no way to know about the back site in draft or during building of limited pools.
So this information is very critical, especially for new sets or cubes with older or less common cards.

It could look like this:

  • normal DFC (transform, flip)
    dr4ft_dfc
  • special DFC (melt)
    melt
    Where the both halves actually show the combined melted card in normal card size.

Back sides should be displayed a bit transparent for all of them.


allsets.json from mtgjson holds useful information about the relevant cards.
In the "layout" key they are tagged with "meld" or "double faced" and have the names of the other sites/cards, in that object too.

format wrong info + pack info missing

Format: is actually "Packs", and format is missing at all.

Should be:

Format: Sealed
Packs: AKH / AKH / AKH / AKH / AKH / AKH

or

Format: Draft
Packs: FRF / KTK / KTK

chaos just shows "CHAOS!" as format - but it should say "Chaos (only Modern)" or "Chaos (all Sets)"
Chaos should also have the actual pack info:

Format: Chaos (only Modern)"
Packs: SOI / THS / AKH

Card search capability

During deck building it would be very handy to have some kind of card search to check e.g. how many deserts you have or if your trial is supported by enough cartouches etc. without going trough all cards in your color.
Would also help with analyzing for specific keywords (like cycle) to evaluate if special archetypes are worth playing and much more.

Depending on how this is implemented and how powerful it would be, it's a kinda big project. :)

Create preset cubes

Create a list of preset cubes such as the ones from MTGO and allow them to be easily loaded into the cube list.

host: possibility to change seating

A host should be able to swap the position of players before the draft starts (with little arrows for example).
This would allow for easier team drafts which have a fixed seating.
Also, when an external site/service requires a specific player order for example or there is any other reason you want to influence things (redo a draft with same order...) it would be nice to be more flexible.

no beep for new pack on autopick

At least if you selected a card for autopick before.
For random autopick I didn't check.

Update: Seems to not happen consistantly!?

disable instant autopick for last card in pack

Let people pick the last card instead auto-adding it immediately.
Mostly it's a card that you rather put into your sideboard or junk.
Right now you have to search for it in between your other playables in main to move it again all the time.

use mtgjson allset data + xml/json extensions as card input

Instead only one allset.json data file.
Right now you have to combine and include all spoilers into the mtgjson data and create a new file with all data mixed.

I think it would be way better and cleaner to manage if we handle the mtgjson allset file and and any additional data (spoilers, other games, custom sets, ...) as separate files.
Allows to easily update without changing all data and recreating of a new big all-in-on file, smaller files in general, better overview, no merge of unrelated or approved/unconfirmed cards etc.pp.

visually separate card piles

Right now it's more of a single carpet of cards instead several piles:
card piles

Adding very few pixel space in between each would be nice.

fallback for mana symobls (add a tooltip e.g.)

The idea is taken from old repo and should serve as simple but productive fallback for problems with image loading for any reason: arxanas/drafts.ninja#35

Some ideas:

  • have a fallback image or text like (W), (R) etc. if images can't get loaded
  • add a tooltip to the image (which tells you the type of mana you're going to add, even if the image is not loading properly)

I guess a tooltip should display even if the picture isn't loading properly?

constantly show pick timer as little overlay somewhere

Something like the card preview for example.

You always need to scroll up to check the timer right now.

Happens several times now to me:
You mark a card for autopick while re-considering other cards. To skip to the next pack you still double click on the card selected for autopick. But since the timer went down and/or due to the server delay I end up immediately picking the next card at the same position from the following pack.
If you always see the time, that won't happen.

Xln Database and draft time setting

hi there
i set a local host of dr4fer, but i can not find the latest release XLN data, how could i get it .
another question how could i change the time setting of draft. i want double the time for it .

thank you very much

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.