//constructor
        public ControllerMain(FormMain view) : base(null, null)
        {
            //connect controller to its view
            this.view                 = view;
            list_customers            = new ArrayList();
            list_networks             = new ArrayList();
            list_networkInventories   = new ArrayList();
            list_allAvailableLicenses = new ArrayList();
            list_licenseInventories   = new ArrayList();
            list_systems              = new ArrayList();
            list_systemInventories    = new ArrayList();
            list_Audits               = new ArrayList();

            //initialising by database
            list_customers            = db.GetCustomers();
            list_allAvailableLicenses = db.GetLicenses();
            list_networks             = db.GetNetworks();
            list_networkInventories   = db.GetNetworkInventories();
            list_licenseInventories   = db.GetLicenseInventories();
            list_systems           = db.GetClientSystems();
            list_systemInventories = db.GetSystemInventories();
            list_Audits            = db.GetAudits();

            //Creating Forms
            fAudit                   = new FormAudit();
            fChanges                 = new FormChange();
            fCustomer                = new FormCustomer();
            fLicense                 = new FormLicense();
            fNetwork                 = new FormNetwork();
            fSystemInventory         = new FormSystemInventory();
            fAudit.Visible           = false;
            fChanges.Visible         = false;
            fCustomer.Visible        = false;
            fLicense.Visible         = false;
            fNetwork.Visible         = false;
            fSystemInventory.Visible = false;

            //Creating Controllers and connect data
            cAudit           = new ControllerAudit(this, fAudit, list_customers, list_licenseInventories, list_systemInventories, list_Audits, list_allAvailableLicenses);
            cChanges         = new ControllerChanges(this, fChanges, list_customers, list_networks, list_networkInventories, list_licenseInventories, list_allAvailableLicenses, list_systems);
            cCustomer        = new ControllerCustomer(this, fCustomer, list_customers);
            cLicense         = new ControllerLicense(this, fLicense, list_customers, list_allAvailableLicenses, list_licenseInventories);
            cNetwork         = new ControllerNetwork(this, fNetwork, list_customers, list_networks, list_networkInventories);
            cSystemInventory = new ControllerSystemInventory(this, fSystemInventory, list_customers, list_networks,
                                                             list_networkInventories, list_systems, list_systemInventories, list_allAvailableLicenses);

            //Connect Controller to View
            fAudit.Currentcontroller           = cAudit;
            fChanges.Currentcontroller         = cChanges;
            fCustomer.Currentcontroller        = cCustomer;
            fLicense.Currentcontroller         = cLicense;
            fNetwork.Currentcontroller         = cNetwork;
            fSystemInventory.Currentcontroller = cSystemInventory;

            //Update View with Information initialised by Database
            UpdateView(true);
        }
 //constrctor
 public ControllerChanges(ControllerParent calling, FormChange view, ArrayList list_customers, ArrayList list_networks, ArrayList list_networkinventories, ArrayList list_licenseInventories, ArrayList list_allAvailableLicenses, ArrayList list_systems) : base(calling, list_customers)
 {
     //connect controller to its view
     this.view                      = view;
     this.list_networks             = list_networks;
     this.list_networkInventories   = list_networkinventories;
     this.list_licenseInventories   = list_licenseInventories;
     this.list_allAvailableLicenses = list_allAvailableLicenses;
     this.list_systems              = list_systems;
 }
Exemple #3
0
 internal static bool IsFormChangeable(PKM pkm, int species)
 {
     if (FormChange.Contains(species))
     {
         return(true);
     }
     if (IsEvolvedFormChange(pkm))
     {
         return(true);
     }
     if (species == 718 && pkm.InhabitedGeneration(7) && pkm.AltForm > 1)
     {
         return(true);
     }
     return(false);
 }
Exemple #4
0
        internal static EncounterStatic getValidStaticEncounter(PKM pkm)
        {
            // Get possible encounters
            IEnumerable <EncounterStatic> poss = getStaticEncounters(pkm);

            // Back Check against pkm
            foreach (EncounterStatic e in poss)
            {
                if (e.Nature != Nature.Random && pkm.Nature != (int)e.Nature)
                {
                    continue;
                }
                if (e.EggLocation != pkm.Egg_Location)
                {
                    continue;
                }
                if (e.Location != 0 && e.Location != pkm.Met_Location)
                {
                    continue;
                }
                if (e.Gender != -1 && e.Gender != pkm.Gender)
                {
                    continue;
                }
                if (e.Level != pkm.Met_Level)
                {
                    continue;
                }
                if (e.Form != pkm.AltForm && !FormChange.Contains(pkm.Species) && !e.SkipFormCheck)
                {
                    continue;
                }

                // Defer to EC/PID check
                // if (e.Shiny != null && e.Shiny != pkm.IsShiny)
                // continue;

                // Defer ball check to later
                // if (e.Gift && pkm.Ball != 4) // PokéBall
                // continue;

                // Passes all checks, valid encounter
                return(e);
            }
            return(null);
        }
Exemple #5
0
        private static IEnumerable <MysteryGift> getMatchingWC7(PKM pkm, IEnumerable <MysteryGift> DB)
        {
            List <MysteryGift> validWC7 = new List <MysteryGift>();

            if (DB == null)
            {
                return(validWC7);
            }
            var vs = getValidPreEvolutions(pkm).ToArray();

            foreach (WC7 wc in DB.OfType <WC7>().Where(wc => vs.Any(dl => dl.Species == wc.Species)))
            {
                if (pkm.Egg_Location == 0) // Not Egg
                {
                    if (wc.OTGender != 3)
                    {
                        if (wc.SID != pkm.SID)
                        {
                            continue;
                        }
                        if (wc.TID != pkm.TID)
                        {
                            continue;
                        }
                        if (wc.OTGender != pkm.OT_Gender)
                        {
                            continue;
                        }
                    }
                    if (!string.IsNullOrEmpty(wc.OT) && wc.OT != pkm.OT_Name)
                    {
                        continue;
                    }
                    if (wc.OriginGame != 0 && wc.OriginGame != pkm.Version)
                    {
                        continue;
                    }
                    if (wc.EncryptionConstant != 0 && wc.EncryptionConstant != pkm.EncryptionConstant)
                    {
                        continue;
                    }
                    if (wc.Language != 0 && wc.Language != pkm.Language)
                    {
                        continue;
                    }
                }
                if (wc.Form != pkm.AltForm && vs.All(dl => !FormChange.Contains(dl.Species)))
                {
                    continue;
                }
                if (wc.MetLocation != pkm.Met_Location)
                {
                    continue;
                }
                if (wc.EggLocation != pkm.Egg_Location)
                {
                    continue;
                }
                if (wc.MetLevel != pkm.Met_Level)
                {
                    continue;
                }
                if (wc.Ball != pkm.Ball)
                {
                    continue;
                }
                if (wc.OTGender < 3 && wc.OTGender != pkm.OT_Gender)
                {
                    continue;
                }
                if (wc.Nature != 0xFF && wc.Nature != pkm.Nature)
                {
                    continue;
                }
                if (wc.Gender != 3 && wc.Gender != pkm.Gender)
                {
                    continue;
                }

                if (wc.CNT_Cool > pkm.CNT_Cool)
                {
                    continue;
                }
                if (wc.CNT_Beauty > pkm.CNT_Beauty)
                {
                    continue;
                }
                if (wc.CNT_Cute > pkm.CNT_Cute)
                {
                    continue;
                }
                if (wc.CNT_Smart > pkm.CNT_Smart)
                {
                    continue;
                }
                if (wc.CNT_Tough > pkm.CNT_Tough)
                {
                    continue;
                }
                if (wc.CNT_Sheen > pkm.CNT_Sheen)
                {
                    continue;
                }

                if (wc.PIDType == 2 && !pkm.IsShiny)
                {
                    continue;
                }
                if (wc.PIDType == 3 && pkm.IsShiny)
                {
                    continue;
                }

                if ((pkm.SID << 16 | pkm.TID) == 0x79F57B49) // Greninja WC has variant PID and can arrive @ 36 or 37
                {
                    if (!pkm.IsShiny)
                    {
                        validWC7.Add(wc);
                    }
                    continue;
                }
                if (wc.PIDType == 0 && pkm.PID != wc.PID)
                {
                    continue;
                }

                // Some checks are best performed separately as they are caused by users screwing up valid data.
                // if (!wc.RelearnMoves.SequenceEqual(pkm.RelearnMoves)) continue; // Defer to relearn legality
                // if (wc.OT.Length > 0 && pkm.CurrentHandler != 1) continue; // Defer to ownership legality
                // if (wc.OT.Length > 0 && pkm.OT_Friendship != PKX.getBaseFriendship(pkm.Species)) continue; // Friendship
                // if (wc.Level > pkm.CurrentLevel) continue; // Defer to level legality
                // RIBBONS: Defer to ribbon legality

                validWC7.Add(wc);
            }
            return(validWC7);
        }
Exemple #6
0
        internal static IEnumerable <WC6> getValidWC6s(PK6 pk6)
        {
            var        vs       = getValidPreEvolutions(pk6).ToArray();
            List <WC6> validWC6 = new List <WC6>();

            foreach (WC6 wc in WC6DB.Where(wc => vs.Any(dl => dl.Species == wc.Species)))
            {
                if (pk6.Egg_Location == 0) // Not Egg
                {
                    if (wc.CardID != pk6.SID)
                    {
                        continue;
                    }
                    if (wc.TID != pk6.TID)
                    {
                        continue;
                    }
                    if (wc.OT != pk6.OT_Name)
                    {
                        continue;
                    }
                    if (wc.OTGender != pk6.OT_Gender)
                    {
                        continue;
                    }
                    if (wc.PIDType == 0 && pk6.PID != wc.PID)
                    {
                        continue;
                    }
                    if (wc.PIDType == 2 && !pk6.IsShiny)
                    {
                        continue;
                    }
                    if (wc.PIDType == 3 && pk6.IsShiny)
                    {
                        continue;
                    }
                    if (wc.OriginGame != 0 && wc.OriginGame != pk6.Version)
                    {
                        continue;
                    }
                    if (wc.EncryptionConstant != 0 && wc.EncryptionConstant != pk6.EncryptionConstant)
                    {
                        continue;
                    }
                    if (wc.Language != 0 && wc.Language != pk6.Language)
                    {
                        continue;
                    }
                }
                if (wc.Form != pk6.AltForm && vs.All(dl => !FormChange.Contains(dl.Species)))
                {
                    continue;
                }
                if (wc.MetLocation != pk6.Met_Location)
                {
                    continue;
                }
                if (wc.EggLocation != pk6.Egg_Location)
                {
                    continue;
                }
                if (wc.Level != pk6.Met_Level)
                {
                    continue;
                }
                if (wc.Pokéball != pk6.Ball)
                {
                    continue;
                }
                if (wc.OTGender < 3 && wc.OTGender != pk6.OT_Gender)
                {
                    continue;
                }
                if (wc.Nature != 0xFF && wc.Nature != pk6.Nature)
                {
                    continue;
                }
                if (wc.Gender != 3 && wc.Gender != pk6.Gender)
                {
                    continue;
                }

                if (wc.CNT_Cool > pk6.CNT_Cool)
                {
                    continue;
                }
                if (wc.CNT_Beauty > pk6.CNT_Beauty)
                {
                    continue;
                }
                if (wc.CNT_Cute > pk6.CNT_Cute)
                {
                    continue;
                }
                if (wc.CNT_Smart > pk6.CNT_Smart)
                {
                    continue;
                }
                if (wc.CNT_Tough > pk6.CNT_Tough)
                {
                    continue;
                }
                if (wc.CNT_Sheen > pk6.CNT_Sheen)
                {
                    continue;
                }

                // Some checks are best performed separately as they are caused by users screwing up valid data.
                // if (!wc.RelearnMoves.SequenceEqual(pk6.RelearnMoves)) continue; // Defer to relearn legality
                // if (wc.OT.Length > 0 && pk6.CurrentHandler != 1) continue; // Defer to ownership legality
                // if (wc.OT.Length > 0 && pk6.OT_Friendship != PKX.getBaseFriendship(pk6.Species)) continue; // Friendship
                // if (wc.Level > pk6.CurrentLevel) continue; // Defer to level legality
                // RIBBONS: Defer to ribbon legality

                validWC6.Add(wc);
            }
            return(validWC6);
        }
Exemple #7
0
 // Use this for initialization
 void Start()
 {
     _image  = ImageObject.GetComponent <Image> ();
     _player = playerObject.GetComponent <FormChange> ();
 }
Exemple #8
0
 // Use this for initialization
 void Start()
 {
     _player = playerObject.GetComponent <FormChange> ();
     _exp    = expObject.GetComponent <ExpImage> ();
 }