Exemplo n.º 1
0
        public void ModifyPhasesReferences(PhaseRef phaseRef, int references)
        {
            phaseRef.References += references;

            if (!IsDbPhaseShift)
            {
                if (phaseRef.Flags.HasAnyFlag(PhaseFlags.Cosmetic))
                {
                    CosmeticReferences += references;
                }
                else if (phaseRef.Id != 169)
                {
                    NonCosmeticReferences += references;
                }
                else
                {
                    DefaultReferences += references;
                }

                if (CosmeticReferences != 0)
                {
                    Flags |= PhaseShiftFlags.NoCosmetic;
                }
                else
                {
                    Flags &= ~PhaseShiftFlags.NoCosmetic;
                }

                UpdateUnphasedFlag();
            }
        }
Exemplo n.º 2
0
        public bool AddPhase(uint phaseId, PhaseFlags flags, List <Condition> areaConditions, int references = 1)
        {
            var phase = new PhaseRef(phaseId, flags, null);

            ModifyPhasesReferences(phase, references);
            if (areaConditions != null)
            {
                phase.AreaConditions = areaConditions;
            }

            Phases.Add(phase);
            return(true);
        }
Exemplo n.º 3
0
        public bool RemovePhase(uint phaseId)
        {
            var phaseRef = new PhaseRef(phaseId, PhaseFlags.None, null);

            if (Phases.Contains(phaseRef))
            {
                ModifyPhasesReferences(phaseRef, -1);
                if (phaseRef.References == 0)
                {
                    Phases.Remove(phaseRef);
                    return(true);
                }

                return(false);
            }
            return(false);
        }