Fix visual bugs
This commit is contained in:
parent
08c1e307eb
commit
7e0a834e97
|
@ -9,7 +9,6 @@ import (
|
||||||
"github.com/ectrc/snow/aid"
|
"github.com/ectrc/snow/aid"
|
||||||
"github.com/ectrc/snow/fortnite"
|
"github.com/ectrc/snow/fortnite"
|
||||||
p "github.com/ectrc/snow/person"
|
p "github.com/ectrc/snow/person"
|
||||||
"github.com/google/uuid"
|
|
||||||
|
|
||||||
"github.com/gofiber/fiber/v2"
|
"github.com/gofiber/fiber/v2"
|
||||||
)
|
)
|
||||||
|
@ -429,33 +428,34 @@ func clientCopyCosmeticLoadoutAction(c *fiber.Ctx, person *p.Person, profile *p.
|
||||||
return fmt.Errorf("sandbox loadout not found")
|
return fmt.Errorf("sandbox loadout not found")
|
||||||
}
|
}
|
||||||
|
|
||||||
lastAppliedLoadout := profile.Loadouts.GetLoadout(aid.JSONParse(lastAppliedLoadoutAttribute.ValueJSON).(string))
|
lastAppliedLoadout := profile.Loadouts.GetLoadout(p.AttributeConvert[string](lastAppliedLoadoutAttribute))
|
||||||
if lastAppliedLoadout == nil {
|
if lastAppliedLoadout == nil {
|
||||||
return fmt.Errorf("last applied loadout not found")
|
return fmt.Errorf("last applied loadout not found")
|
||||||
}
|
}
|
||||||
|
|
||||||
if body.TargetIndex >= len(loadouts) {
|
if body.TargetIndex >= len(loadouts) {
|
||||||
clone := lastAppliedLoadout.Copy()
|
aid.Print("creating a new loadout with source", body.SourceIndex, "and target", body.TargetIndex)
|
||||||
clone.ID = uuid.New().String()
|
|
||||||
clone.LockerName = body.OptNewNameForTarget
|
newLoadout := p.NewLoadout(body.OptNewNameForTarget, profile)
|
||||||
profile.Loadouts.AddLoadout(&clone)
|
newLoadout.CopyFrom(lastAppliedLoadout)
|
||||||
go clone.Save()
|
profile.Loadouts.AddLoadout(newLoadout)
|
||||||
|
go newLoadout.Save()
|
||||||
|
|
||||||
lastAppliedLoadout.CopyFrom(sandboxLoadout)
|
lastAppliedLoadout.CopyFrom(sandboxLoadout)
|
||||||
go lastAppliedLoadout.Save()
|
go lastAppliedLoadout.Save()
|
||||||
|
|
||||||
sandboxLoadout.CopyFrom(&clone)
|
lastAppliedLoadoutAttribute.ValueJSON = aid.JSONStringify(newLoadout.ID)
|
||||||
go sandboxLoadout.Save()
|
|
||||||
|
|
||||||
loadouts = append(loadouts, clone.ID)
|
|
||||||
loadoutsAttribute.ValueJSON = aid.JSONStringify(loadouts)
|
|
||||||
go loadoutsAttribute.Save()
|
|
||||||
|
|
||||||
lastAppliedLoadoutAttribute.ValueJSON = aid.JSONStringify(clone.ID)
|
|
||||||
activeLoadoutIndexAttribute.ValueJSON = aid.JSONStringify(body.TargetIndex)
|
activeLoadoutIndexAttribute.ValueJSON = aid.JSONStringify(body.TargetIndex)
|
||||||
go lastAppliedLoadoutAttribute.Save()
|
go lastAppliedLoadoutAttribute.Save()
|
||||||
go activeLoadoutIndexAttribute.Save()
|
go activeLoadoutIndexAttribute.Save()
|
||||||
|
|
||||||
|
loadouts = append(loadouts, newLoadout.ID)
|
||||||
|
loadoutsAttribute.ValueJSON = aid.JSONStringify(loadouts)
|
||||||
|
go loadoutsAttribute.Save()
|
||||||
|
|
||||||
|
sandboxLoadout.CopyFrom(newLoadout)
|
||||||
|
go sandboxLoadout.Save()
|
||||||
|
|
||||||
if len(profile.Changes) == 0 {
|
if len(profile.Changes) == 0 {
|
||||||
profile.CreateLoadoutChangedChange(sandboxLoadout, "DanceID")
|
profile.CreateLoadoutChangedChange(sandboxLoadout, "DanceID")
|
||||||
}
|
}
|
||||||
|
@ -464,6 +464,8 @@ func clientCopyCosmeticLoadoutAction(c *fiber.Ctx, person *p.Person, profile *p.
|
||||||
}
|
}
|
||||||
|
|
||||||
if body.SourceIndex > 0 {
|
if body.SourceIndex > 0 {
|
||||||
|
aid.Print("saving source loadout", body.SourceIndex, "to sandbox")
|
||||||
|
|
||||||
sourceLoadout := profile.Loadouts.GetLoadout(loadouts[body.SourceIndex])
|
sourceLoadout := profile.Loadouts.GetLoadout(loadouts[body.SourceIndex])
|
||||||
if sourceLoadout == nil {
|
if sourceLoadout == nil {
|
||||||
return fmt.Errorf("target loadout not found")
|
return fmt.Errorf("target loadout not found")
|
||||||
|
@ -471,28 +473,34 @@ func clientCopyCosmeticLoadoutAction(c *fiber.Ctx, person *p.Person, profile *p.
|
||||||
|
|
||||||
sandboxLoadout.CopyFrom(sourceLoadout)
|
sandboxLoadout.CopyFrom(sourceLoadout)
|
||||||
go sandboxLoadout.Save()
|
go sandboxLoadout.Save()
|
||||||
|
|
||||||
lastAppliedLoadoutAttribute.ValueJSON = aid.JSONStringify(sourceLoadout.ID)
|
lastAppliedLoadoutAttribute.ValueJSON = aid.JSONStringify(sourceLoadout.ID)
|
||||||
activeLoadoutIndexAttribute.ValueJSON = aid.JSONStringify(body.SourceIndex)
|
activeLoadoutIndexAttribute.ValueJSON = aid.JSONStringify(body.SourceIndex)
|
||||||
|
|
||||||
go lastAppliedLoadoutAttribute.Save()
|
go lastAppliedLoadoutAttribute.Save()
|
||||||
go activeLoadoutIndexAttribute.Save()
|
go activeLoadoutIndexAttribute.Save()
|
||||||
|
|
||||||
if len(profile.Changes) == 0{
|
if len(profile.Changes) == 0{
|
||||||
profile.CreateLoadoutChangedChange(sandboxLoadout, "DanceID")
|
profile.CreateLoadoutChangedChange(sandboxLoadout, "DanceID")
|
||||||
|
profile.CreateLoadoutChangedChange(sourceLoadout, "DanceID")
|
||||||
}
|
}
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
activeLoadout := profile.Loadouts.GetLoadout(loadouts[body.TargetIndex])
|
aid.Print("loading target loadout", body.TargetIndex, "to sandbox")
|
||||||
if activeLoadout == nil {
|
|
||||||
|
targetLoadout := profile.Loadouts.GetLoadout(loadouts[body.TargetIndex])
|
||||||
|
if targetLoadout == nil {
|
||||||
return fmt.Errorf("target loadout not found")
|
return fmt.Errorf("target loadout not found")
|
||||||
}
|
}
|
||||||
|
|
||||||
sandboxLoadout.CopyFrom(activeLoadout)
|
sandboxLoadout.CopyFrom(targetLoadout)
|
||||||
go sandboxLoadout.Save()
|
go sandboxLoadout.Save()
|
||||||
|
|
||||||
if len(profile.Changes) == 0{
|
if len(profile.Changes) == 0{
|
||||||
profile.CreateLoadoutChangedChange(sandboxLoadout, "DanceID")
|
profile.CreateLoadoutChangedChange(sandboxLoadout, "DanceID")
|
||||||
|
profile.CreateLoadoutChangedChange(targetLoadout, "DanceID")
|
||||||
}
|
}
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
|
|
Loading…
Reference in New Issue
Block a user