mirror of
https://github.com/Mezeporta/Erupe.git
synced 2025-12-14 07:55:33 +01:00
fix signing of min/max Rank Distributions
This commit is contained in:
@@ -6,10 +6,31 @@ BEGIN;
|
|||||||
CREATE TABLE public.distribution_items
|
CREATE TABLE public.distribution_items
|
||||||
(
|
(
|
||||||
id serial PRIMARY KEY,
|
id serial PRIMARY KEY,
|
||||||
distribution_id integer,
|
distribution_id integer NOT NULL,
|
||||||
item_type integer,
|
item_type integer,
|
||||||
item_id integer,
|
item_id integer,
|
||||||
quantity integer
|
quantity integer
|
||||||
);
|
);
|
||||||
|
|
||||||
|
ALTER TABLE IF EXISTS public.distribution ALTER COLUMN min_hr DROP DEFAULT;
|
||||||
|
ALTER TABLE IF EXISTS public.distribution ALTER COLUMN max_hr DROP DEFAULT;
|
||||||
|
ALTER TABLE IF EXISTS public.distribution ALTER COLUMN min_sr DROP DEFAULT;
|
||||||
|
ALTER TABLE IF EXISTS public.distribution ALTER COLUMN max_sr DROP DEFAULT;
|
||||||
|
ALTER TABLE IF EXISTS public.distribution ALTER COLUMN min_gr DROP DEFAULT;
|
||||||
|
ALTER TABLE IF EXISTS public.distribution ALTER COLUMN max_gr DROP DEFAULT;
|
||||||
|
|
||||||
|
ALTER TABLE IF EXISTS public.distribution ALTER COLUMN min_hr DROP NOT NULL;
|
||||||
|
ALTER TABLE IF EXISTS public.distribution ALTER COLUMN max_hr DROP NOT NULL;
|
||||||
|
ALTER TABLE IF EXISTS public.distribution ALTER COLUMN min_sr DROP NOT NULL;
|
||||||
|
ALTER TABLE IF EXISTS public.distribution ALTER COLUMN max_sr DROP NOT NULL;
|
||||||
|
ALTER TABLE IF EXISTS public.distribution ALTER COLUMN min_gr DROP NOT NULL;
|
||||||
|
ALTER TABLE IF EXISTS public.distribution ALTER COLUMN max_gr DROP NOT NULL;
|
||||||
|
|
||||||
|
UPDATE distribution SET min_hr=NULL WHERE min_hr=65535;
|
||||||
|
UPDATE distribution SET max_hr=NULL WHERE max_hr=65535;
|
||||||
|
UPDATE distribution SET min_sr=NULL WHERE min_sr=65535;
|
||||||
|
UPDATE distribution SET max_sr=NULL WHERE max_sr=65535;
|
||||||
|
UPDATE distribution SET min_gr=NULL WHERE min_gr=65535;
|
||||||
|
UPDATE distribution SET max_gr=NULL WHERE max_gr=65535;
|
||||||
|
|
||||||
END;
|
END;
|
||||||
@@ -14,12 +14,12 @@ type ItemDist struct {
|
|||||||
Deadline time.Time `db:"deadline"`
|
Deadline time.Time `db:"deadline"`
|
||||||
TimesAcceptable uint16 `db:"times_acceptable"`
|
TimesAcceptable uint16 `db:"times_acceptable"`
|
||||||
TimesAccepted uint16 `db:"times_accepted"`
|
TimesAccepted uint16 `db:"times_accepted"`
|
||||||
MinHR uint16 `db:"min_hr"`
|
MinHR int16 `db:"min_hr"`
|
||||||
MaxHR uint16 `db:"max_hr"`
|
MaxHR int16 `db:"max_hr"`
|
||||||
MinSR uint16 `db:"min_sr"`
|
MinSR int16 `db:"min_sr"`
|
||||||
MaxSR uint16 `db:"max_sr"`
|
MaxSR int16 `db:"max_sr"`
|
||||||
MinGR uint16 `db:"min_gr"`
|
MinGR int16 `db:"min_gr"`
|
||||||
MaxGR uint16 `db:"max_gr"`
|
MaxGR int16 `db:"max_gr"`
|
||||||
EventName string `db:"event_name"`
|
EventName string `db:"event_name"`
|
||||||
Description string `db:"description"`
|
Description string `db:"description"`
|
||||||
Data []byte `db:"data"`
|
Data []byte `db:"data"`
|
||||||
@@ -31,7 +31,9 @@ func handleMsgMhfEnumerateDistItem(s *Session, p mhfpacket.MHFPacket) {
|
|||||||
distCount := 0
|
distCount := 0
|
||||||
dists, err := s.server.db.Queryx(`
|
dists, err := s.server.db.Queryx(`
|
||||||
SELECT d.id, event_name, description, times_acceptable,
|
SELECT d.id, event_name, description, times_acceptable,
|
||||||
min_hr, max_hr, min_sr, max_sr, min_gr, max_gr,
|
COALESCE(min_hr, -1) AS min_hr, COALESCE(max_hr, -1) AS max_hr,
|
||||||
|
COALESCE(min_sr, -1) AS min_sr, COALESCE(max_sr, -1) AS max_sr,
|
||||||
|
COALESCE(min_gr, -1) AS min_gr, COALESCE(max_gr, -1) AS max_gr,
|
||||||
(
|
(
|
||||||
SELECT count(*)
|
SELECT count(*)
|
||||||
FROM distributions_accepted da
|
FROM distributions_accepted da
|
||||||
@@ -59,12 +61,12 @@ func handleMsgMhfEnumerateDistItem(s *Session, p mhfpacket.MHFPacket) {
|
|||||||
bf.WriteUint16(distData.TimesAcceptable)
|
bf.WriteUint16(distData.TimesAcceptable)
|
||||||
bf.WriteUint16(distData.TimesAccepted)
|
bf.WriteUint16(distData.TimesAccepted)
|
||||||
bf.WriteUint16(0) // Unk
|
bf.WriteUint16(0) // Unk
|
||||||
bf.WriteUint16(distData.MinHR)
|
bf.WriteInt16(distData.MinHR)
|
||||||
bf.WriteUint16(distData.MaxHR)
|
bf.WriteInt16(distData.MaxHR)
|
||||||
bf.WriteUint16(distData.MinSR)
|
bf.WriteInt16(distData.MinSR)
|
||||||
bf.WriteUint16(distData.MaxSR)
|
bf.WriteInt16(distData.MaxSR)
|
||||||
bf.WriteUint16(distData.MinGR)
|
bf.WriteInt16(distData.MinGR)
|
||||||
bf.WriteUint16(distData.MaxGR)
|
bf.WriteInt16(distData.MaxGR)
|
||||||
bf.WriteUint8(0)
|
bf.WriteUint8(0)
|
||||||
bf.WriteUint16(0)
|
bf.WriteUint16(0)
|
||||||
bf.WriteUint8(0)
|
bf.WriteUint8(0)
|
||||||
|
|||||||
Reference in New Issue
Block a user