-
Notifications
You must be signed in to change notification settings - Fork 3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: slots minigame #480
base: main
Are you sure you want to change the base?
feat: slots minigame #480
Conversation
# If the active status is not set, set it to false by default | ||
change_slots_active(true) | ||
true |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
# If the active status is not set, set it to false by default | |
change_slots_active(true) | |
true | |
# If the active status is not set, set it to true by default | |
change_slots_active(true) | |
true |
Comment says something and the opposite is happening.
Phoenix.PubSub.broadcast(@pubsub, slots_config_topic(config), {config, value}) | ||
end | ||
|
||
alias Safira.Minigames.SlotsPayline |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Bring this to the top of the file.
@doc """ | ||
Spins the wheel for the given attendee. | ||
|
||
## Examples | ||
|
||
iex> spin_wheel(attendee) | ||
{:ok, :prize, %WheelDrop{}} | ||
|
||
iex> spin_wheel(attendee) | ||
{:ok, :tokens, %WheelDrop{}} | ||
|
||
iex> spin_wheel(attendee) | ||
{:ok, nil, %WheelDrop{}} | ||
""" | ||
def spin_slots(attendee, bet) do |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Change docs to match what function does.
if Enum.any?(paylines, fn p -> | ||
[p.position_0, p.position_1, p.position_2] == target | ||
end) do |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just to make sure, is this accounting for cases where paylines have positions with ANY (nil) ?
|
||
schema "slots_paytables" do | ||
field :multiplier, :integer | ||
field :probability, :float | ||
|
||
timestamps(type: :utc_datetime) | ||
end | ||
|
||
@doc false | ||
def changeset(slots_paytable, attrs) do | ||
slots_paytable | ||
|> cast(attrs, [:multiplier, :probability]) | ||
|> validate_required([:multiplier, :probability]) | ||
|> validate_number(:multiplier, greater_than: 0) | ||
|> validate_number(:probability, greater_than_or_equal_to: 0, less_than_or_equal_to: 1) | ||
end |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add @required_fields
.
<.field field={form[:multiplier]} type="number" wrapper_class="col-span-2" /> | ||
<.field field={form[:probability]} type="number" wrapper_class="col-span-2" /> | ||
<.link | ||
phx-click={JS.push("delete-entry", value: %{id: id})} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
phx-click={JS.push("delete-entry", value: %{id: id})} | |
phx-click="delete-entry" phx-value={%{id: id}}} |
{:noreply, assign(socket, form: to_form(changeset, action: :validate))} | ||
end | ||
|
||
# Update save handler to use new consume_image_data |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
# Update save handler to use new consume_image_data |
Ecto.Multi.new() | ||
|> update_reel_order(reel_order["reel-0"], visibility[0], :reel_0_index) | ||
|> update_reel_order(reel_order["reel-1"], visibility[1], :reel_1_index) | ||
|> update_reel_order(reel_order["reel-2"], visibility[2], :reel_2_index) | ||
|> Safira.Repo.transaction() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please put this logic inside the context!!
live "/slots", MinigamesLive.Index, :edit_slots | ||
live "/slots/reels_icons", MinigamesLive.Index, :edit_slots_reel_icons_icons | ||
live "/slots/reels_position", MinigamesLive.Index, :edit_slots_reel_icons_position | ||
live "/slots/paytable", MinigamesLive.Index, :edit_slots_paytable | ||
live "/slots/payline", MinigamesLive.Index, :edit_slots_payline |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
live "/slots", MinigamesLive.Index, :edit_slots | |
live "/slots/reels_icons", MinigamesLive.Index, :edit_slots_reel_icons_icons | |
live "/slots/reels_position", MinigamesLive.Index, :edit_slots_reel_icons_position | |
live "/slots/paytable", MinigamesLive.Index, :edit_slots_paytable | |
live "/slots/payline", MinigamesLive.Index, :edit_slots_payline | |
scope "/slots", MinigamesLive do | |
live "/", Index, :edit_slots | |
live "/reels_icons", Index, :edit_slots_reel_icons_icons | |
live "/reels_position", Index, :edit_slots_reel_icons_position | |
live "/paytable", Index, :edit_slots_paytable | |
live "/payline", Index, :edit_slots_payline | |
end |
def change do | ||
create table(:slots_paytables, primary_key: false) do | ||
add :id, :binary_id, primary_key: true | ||
add :multiplier, :integer | ||
add :probability, :float | ||
|
||
timestamps(type: :utc_datetime) | ||
end |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the multiplier column should be unique, but I might be missing something.
No description provided.