Ejemplo n.º 1
0
        private static void OnAddRace(CommandEventArgs e)
        {
            Mobile      from      = e.Mobile;
            RaceControl r_control = null;
            bool        r_active  = false;

            foreach (Item i in World.Items.Values)
            {
                if (i is RCChest)
                {
                    r_active = true;
                }
            }

            if (r_active)
            {
                RaceOrb r_orb = new RaceOrb();

                foreach (Item i in World.Items.Values)
                {
                    if (i is RaceControl)
                    {
                        r_control = i as RaceControl;
                    }
                }

                if (r_control != null)
                {
                    r_orb.RaceNumber    = r_control.A_Races + 1;
                    r_control.A_Current = r_orb.RaceNumber;
                }

                from.SendGump(new AddRaceGump(from, r_orb));
            }
        }
Ejemplo n.º 2
0
        public override void OnResponse(NetState sender, RelayInfo info)
        {
            Mobile      from      = sender.Mobile;
            RaceOrb     r_orb     = null;
            RaceControl r_control = null;

            foreach (Item h in World.Items.Values)
            {
                if (h is RaceControl)
                {
                    r_control = h as RaceControl;
                }
            }

            foreach (Item i in World.Items.Values)
            {
                if (i is RaceOrb)
                {
                    r_orb = i as RaceOrb;
                    if (info.ButtonID == r_orb.RaceNumber)
                    {
                        r_control.R_Current = r_orb.RaceNumber;
                        from.SendGump(new ShapeChangeGump2(from, r_orb));
                    }
                }
            }


            if (info.ButtonID == 0)
            {
            }
        }
Ejemplo n.º 3
0
        void raceComponent_SubraceChanged(object sender, EventArgs e)
        {
            RaceControl incoming = sender as RaceControl;

            if (incoming != null)
            {
                alignmentComponent.updateRaceAlignmentDescription(WM.Choices.RaceChoice.getSelectedSubrace());
                ageComponent.updateRaceAgeDescription(WM.Choices.RaceChoice.getSelectedSubrace().Name);
                bodyComponent.updateMinMax(WM.Choices.RaceChoice.getSelectedSubrace().Name);
            }
        }
Ejemplo n.º 4
0
        public override void OnResponse(NetState sender, RelayInfo info)
        {
            Mobile      from      = sender.Mobile;
            RaceOrb     r_orb     = null;
            RaceControl r_control = null;
            RCCONTROL   rc        = from.Backpack.FindItemByType(typeof(RCCONTROL)) as RCCONTROL;

            foreach (Item h in World.Items.Values)
            {
                if (h is RaceControl)
                {
                    r_control = h as RaceControl;
                }
            }

            foreach (Item i in World.Items.Values)
            {
                if (i is RaceOrb)
                {
                    r_orb = i as RaceOrb;
                    if (rc.Race == r_orb.RaceName)
                    {
                        break;
                    }
                }
            }

            for (int i = 0; i < 5; i++)
            {
                if (info.ButtonID == i)
                {
                    if (r_orb.BodyValue[i] != 0)
                    {
                        if (from.Mount != null)
                        {
                            from.Mount.Rider = null;
                        }
                        from.PlaySound(0x228);
                        from.BodyMod = r_orb.BodyValue[i];
                        from.HueMod  = r_orb.SS_Hue[i];
                        from.NameMod = r_orb.SS_Name[i];
                    }
                }
            }

            if (info.ButtonID == 0)
            {
            }
        }
Ejemplo n.º 5
0
        public override void OnResponse(NetState sender, RelayInfo info)
        {
            Mobile      from      = sender.Mobile;
            RaceOrb     r_orb     = null;
            RCCONTROL   rc        = null;
            RaceControl r_control = null;
            Bag         d_bag     = new Bag();

            foreach (Item h in World.Items.Values)
            {
                if (h is RaceControl)
                {
                    r_control = h as RaceControl;
                }
            }

            foreach (Item i in World.Items.Values)
            {
                if (i is RaceOrb)
                {
                    r_orb = i as RaceOrb;
                    if (info.ButtonID == r_orb.RaceNumber)
                    {
                        foreach (Item j in World.Items.Values)
                        {
                            if (j is RCCONTROL)
                            {
                                rc = j as RCCONTROL;
                                if (rc.Race == r_orb.RaceName)
                                {
                                    d_bag.AddItem(rc);
                                }
                            }
                        }
                        d_bag.Delete();
                        r_orb.Delete();
                        r_control.A_Races -= 1;
                        resetROrbNums();
                        break;
                    }
                }
            }

            if (info.ButtonID == 0)
            {
            }
        }
Ejemplo n.º 6
0
        public ShapeChangeGump(Mobile from)
            : base(20, 30)
        {
            m_From = from;
            RaceOrb     r_orb     = null;
            RaceControl r_control = null;
            int         h         = 60;

            foreach (Item i in World.Items.Values)
            {
                if (i is RaceControl)
                {
                    r_control = i as RaceControl;
                }
            }

            AddPage(0);
            AddBackground(0, 0, 340, (r_control.A_Races * 25) + 80, 5054);

            AddImageTiled(10, 10, 320, 23, 0x52);
            AddImageTiled(11, 11, 318, 23, 0xBBC);

            AddLabel(100, 11, 0, "Race/Class System");

            AddLabel(30, 34, 0, "Edit Shapeshift for which Race?");

            foreach (Item i in World.Items.Values)
            {
                if (i is RaceOrb)
                {
                    r_orb = i as RaceOrb;
                    if (r_orb.Activated)
                    {
                        AddButton(11, h, 0x15E3, 0x15E7, r_orb.RaceNumber, GumpButtonType.Reply, 1);
                        AddLabel(30, h - 1, 0, r_orb.RaceName);
                        h += 25;
                    }
                }
            }
        }
Ejemplo n.º 7
0
 private void initializeUserControls()
 {
     introComponent                = new IntroControl(WM);
     raceComponent                 = new RaceControl(WM);
     alignmentComponent            = new AlignmentControl(WM);
     raceComponent.SubraceChanged += new EventHandler(raceComponent_SubraceChanged);
     ageComponent        = new AgeControl(WM);
     bodyComponent       = new BodyControl(WM);
     appearanceComponent = new AppearanceControl(WM);
     appearanceComponent.AppearanceChanged += new EventHandler(appearanceComponent_AppearanceChanged);
     classComponent = new ClassControl(WM);
     classComponent.ClassChanged       += new EventHandler(classComponent_ClassChanged);
     classComponent.ClassChoiceChanged += new EventHandler(classComponent_ClassChoiceChanged);
     backgroundComponent = new BackgroundControl(WM);
     abilityComponent    = new AbilityControl(WM);
     abilityComponent.AbilityAssigned      += new EventHandler(abilityComponent_AbilityAssigned);
     abilityComponent.AbilityBonusAssigned += new EventHandler(abilityComponent_AbilityBonusAssigned);
     languageComponent = new LanguageControl(WM);
     languageComponent.LanguageSelectionChanged += new EventHandler(languageComponent_LanguageSelectionChanged);
     skillComponent              = new SkillControl(WM);
     skillComponent.SkillChosen += new EventHandler(skillComponent_SkillChosen);
     equipmentComponent          = new EquipmentControl(WM);
     equipmentComponent.EquipmentSelectionChanged += new EventHandler(equipmentComponent_EquipmentSelectionChanged);
     spellComponent              = new SpellControl(WM);
     spellComponent.SpellChosen += new EventHandler(spellComponent_SpellChosen);
     extraRaceChoiceComponent    = new ExtraRaceChoiceControl(WM);
     extraRaceChoiceComponent.ExtraRaceChoiceChanged += new EventHandler(extraRaceChoiceComponent_ExtraRaceChoiceChanged);
     extraClassChoiceComponent = new ExtraClassChoiceControl(WM);
     extraClassChoiceComponent.SubcontrolOptionChosen += new EventHandler(extraClassChoiceComponent_SubcontrolOptionChosen);
     extraSubclassChoiceComponent = new ExtraSubclassChoiceControl(WM);
     extraSubclassChoiceComponent.SubcontrolOptionChosen += new EventHandler(extraSubclassChoiceComponent_SubcontrolOptionChosen);
     nameComponent                          = new NameControl(WM);
     nameComponent.NameChanged             += new EventHandler(nameComponent_NameChanged);
     storyComponent                         = new StoryControl(WM);
     storyComponent.SubcontrolOptionChosen += new EventHandler(storyComponent_SubcontrolOptionChosen);
     exportComponent                        = new ExportControl(WM);
 }
Ejemplo n.º 8
0
        public override void OnResponse(NetState sender, RelayInfo info)
        {
            Mobile      from          = sender.Mobile;
            RaceOrb     r_orb         = null;
            RaceControl r_control     = null;
            bool        is_void       = false;
            bool        isInt         = true;
            int         current_shift = 0;

            foreach (Item h in World.Items.Values)
            {
                if (h is RaceControl)
                {
                    r_control = h as RaceControl;
                }
            }

            foreach (Item i in World.Items.Values)
            {
                if (i is RaceOrb)
                {
                    r_orb = i as RaceOrb;
                    if (r_orb.RaceNumber == r_control.R_Current)
                    {
                        break;
                    }
                }
            }

            for (int i = 0; i < 5; i++)
            {
                if (r_orb.BodyValue[i] != 0)
                {
                    current_shift += 1;
                }
                else
                {
                    break;
                }
            }


            if (info.ButtonID == 0)
            {
                m_From.SendMessage(0x35, "No Shapeshift Form Added");
            }

            if (info.ButtonID == 1)
            {
                TextRelay m_name    = info.GetTextEntry(1);
                string    text_name = (m_name == null ? "" : m_name.Text.Trim());

                if (text_name.Length == 0)
                {
                    m_From.SendMessage(0x35, "You must enter a Shapeshift Name.");
                    m_From.SendGump(new AddShapeChangeGump(from, r_orb));
                    is_void = true;
                }
                else
                {
                    r_orb.SS_Name[current_shift] = text_name;
                }

                TextRelay m_bv    = info.GetTextEntry(2);
                string    text_bv = (m_bv == null ? "" : m_bv.Text.Trim());

                if (text_bv.Length == 0)
                {
                    m_From.SendMessage(0x35, "You must Enter a Body Value");
                    if (!is_void)
                    {
                        m_From.SendGump(new AddShapeChangeGump(from, r_orb));
                        is_void = true;
                    }
                }
                else
                {
                    isInt = true;
                    try
                    {
                        int ibv = Convert.ToInt32(text_bv);
                    }
                    catch
                    {
                        from.SendMessage(0x35, "Body Values must be numbers!");
                        if (!is_void)
                        {
                            m_From.SendGump(new AddShapeChangeGump(from, r_orb));
                            is_void = true;
                        }
                        isInt = false;
                    }
                    if (isInt)
                    {
                        int r_bv = Convert.ToInt32(text_bv);

                        if (r_bv == 0)
                        {
                            from.SendMessage(0x35, "Body Values cannot be 0");
                            if (!is_void)
                            {
                                m_From.SendGump(new AddShapeChangeGump(from, r_orb));
                                is_void = true;
                            }
                        }

                        else
                        {
                            r_orb.BodyValue[current_shift] = r_bv;
                        }
                    }
                }

                TextRelay m_hue    = info.GetTextEntry(3);
                string    text_hue = (m_hue == null ? "" : m_hue.Text.Trim());

                if (text_hue.Length == 0)
                {
                    m_From.SendMessage(0x35, "You must Enter a Hue Value");
                    if (!is_void)
                    {
                        m_From.SendGump(new AddShapeChangeGump(from, r_orb));
                        is_void = true;
                    }
                }
                else
                {
                    isInt = true;
                    try
                    {
                        int ihue = Convert.ToInt32(text_hue);
                    }
                    catch
                    {
                        from.SendMessage(0x35, "Hue Values must be numbers!");
                        if (!is_void)
                        {
                            m_From.SendGump(new AddShapeChangeGump(from, r_orb));
                            is_void = true;
                        }
                        isInt = false;
                    }
                    if (isInt)
                    {
                        int r_hue = Convert.ToInt32(text_hue);
                        r_orb.SS_Hue[current_shift] = r_hue;
                    }
                }

                if (!is_void)
                {
                    from.SendMessage(6, "Shapeshift has been added");
                }
            }
        }
Ejemplo n.º 9
0
        public override void OnResponse(NetState sender, RelayInfo info)
        {
            Mobile      from      = sender.Mobile;
            RaceOrb     r_orb     = null;
            RaceControl r_control = null;
            int         num       = 0;

            foreach (Item h in World.Items.Values)
            {
                if (h is RaceControl)
                {
                    r_control = h as RaceControl;
                }
            }

            foreach (Item i in World.Items.Values)
            {
                if (i is RaceOrb)
                {
                    r_orb = i as RaceOrb;
                    if (r_orb.RaceNumber == r_control.R_Current)
                    {
                        break;
                    }
                }
            }

            for (int i = 0; i < 5; i++)
            {
                if (info.ButtonID == i)
                {
                    r_orb.BodyValue[i] = 0;
                    r_orb.SS_Hue[i]    = 0;
                    r_orb.SS_Name[i]   = null;
                }
            }

            if (info.ButtonID == 10)
            {
                for (int i = 0; i < 5; i++)
                {
                    if (r_orb.BodyValue[i] != 0)
                    {
                        num += 1;
                    }
                }
                if (num == 5)
                {
                    m_From.SendMessage(0x35, "Race already has 5 Shapeshift Forms, remove one to add.");
                }
                else
                {
                    from.SendGump(new AddShapeChangeGump(from, r_orb));
                }
            }

            if (info.ButtonID == 0)
            {
                from.SendGump(new ShapeChangeGump(from));
            }
        }
Ejemplo n.º 10
0
        private static void OnRaceBag(CommandEventArgs e)
        {
            int amount = 0;

            if (e.Length >= 1)
            {
                amount = e.GetInt32(0);
            }

            Mobile      from      = e.Mobile;
            bool        r_active  = false;
            RaceOrb     r_orb     = null;
            Bag         m_bag     = null;
            RaceControl r_control = null;

            foreach (Item i in World.Items.Values)
            {
                if (i is RCChest)
                {
                    r_active = true;
                }
            }

            foreach (Item i in World.Items.Values)
            {
                if (i is RaceControl)
                {
                    r_control = i as RaceControl;
                }
            }

            if (r_active)
            {
                foreach (Item i in World.Items.Values)
                {
                    if (i is RaceOrb)
                    {
                        r_orb = i as RaceOrb;
                        if (r_orb.RaceNumber == amount)
                        {
                            Bag r_bag = new Bag();
                            r_bag.Name = r_orb.RaceName + " Race";
                            Bag i_bag = new Bag();
                            i_bag.Name = r_orb.RaceName + " Items";
                            r_bag.AddItem(i_bag);
                            r_bag.AddItem(r_orb);
                            foreach (Item k in World.Items.Values)
                            {
                                if (k is Bag && k.Name == "RACES")
                                {
                                    m_bag = k as Bag;
                                    m_bag.AddItem(r_bag);
                                    break;
                                }
                            }
                            r_orb.Activated = true;
                            break;
                        }
                    }
                }
            }
        }
Ejemplo n.º 11
0
        public override void OnResponse(NetState sender, RelayInfo info)
        {
            Mobile      from      = sender.Mobile;
            RaceOrb     r_orb     = null;
            RaceControl r_control = null;
            bool        is_void   = false;
            bool        isInt     = true;

            foreach (Item h in World.Items.Values)
            {
                if (h is RaceControl)
                {
                    r_control = h as RaceControl;
                }
            }

            foreach (Item i in World.Items.Values)
            {
                if (i is RaceOrb)
                {
                    r_orb = i as RaceOrb;
                    if (r_orb.RaceNumber == r_control.R_Current)
                    {
                        break;
                    }
                }
            }


            for (int i = 0; i < 10; i++)
            {
                if (info.ButtonID == i + 11)
                {
                    TextRelay m_hue_hair    = info.GetTextEntry(i + 11);
                    string    text_hue_hair = (m_hue_hair == null ? "" : m_hue_hair.Text.Trim());

                    if (text_hue_hair.Length == 0)
                    {
                        if (i == 0)
                        {
                            from.SendMessage(0x35, "Hue 1 cannot be blank");
                            if (!is_void)
                            {
                                m_From.SendGump(new HueEditGump3(from, r_orb, r_orb.HairHues[0]));
                                is_void = true;
                            }
                            break;
                        }
                        else
                        {
                            m_From.SendGump(new HueEditGump3(from, r_orb, r_orb.HairHues[0]));
                        }
                    }
                    else
                    {
                        isInt = true;
                        try
                        {
                            int ihue = Convert.ToInt32(text_hue_hair);
                        }
                        catch
                        {
                            from.SendMessage(0x35, "Hues must be numbers!");
                            if (!is_void)
                            {
                                m_From.SendGump(new HueEditGump3(from, r_orb, r_orb.HairHues[0]));
                                is_void = true;
                            }
                            isInt = false;
                        }
                        if (isInt)
                        {
                            int r_hue = Convert.ToInt32(text_hue_hair);
                            if (i == 0 && r_hue == 0)
                            {
                                from.SendMessage(0x35, "Hue 1 cannot be 0");
                                if (!is_void)
                                {
                                    m_From.SendGump(new HueEditGump3(from, r_orb, r_orb.HairHues[0]));
                                    is_void = true;
                                }
                            }
                            else
                            {
                                if (r_orb.HairHues[i] == 0 && r_hue != 0)
                                {
                                    r_orb.AmountHairHues += 1;
                                }

                                if (r_orb.HairHues[i] != 0 && r_hue == 0)
                                {
                                    r_orb.AmountHairHues -= 1;
                                }

                                r_orb.HairHues[i] = r_hue;
                                from.SendGump(new HueEditGump3(from, r_orb, r_orb.HairHues[i]));
                            }
                        }
                    }
                }
            }


            if (info.ButtonID == 25)
            {
            }

            if (info.ButtonID == 0)
            {
                m_From.SendGump(new HueEditGump(from));
            }
        }
Ejemplo n.º 12
0
        public override void OnResponse(NetState sender, RelayInfo info)
        {
            Mobile      from      = sender.Mobile;
            RaceControl r_control = null;
            RaceOrb     r_orb     = null;
            RaceOrb     t_orb     = null;
            bool        name_used = false;
            bool        isInt     = true;
            bool        is_void   = false;
            string      c_name    = null;
            string      n_name    = null;

            foreach (Item i in World.Items.Values)
            {
                if (i is RaceControl)
                {
                    r_control = i as RaceControl;
                }
            }

            foreach (Item i in World.Items.Values)
            {
                if (i is RaceOrb)
                {
                    r_orb = i as RaceOrb;
                    if (r_orb.RaceNumber == r_control.A_Current)
                    {
                        break;
                    }
                }
            }

            Map map = null;

            for (int i = 0; i < info.Switches.Length; i++)
            {
                int m = info.Switches[i];
                switch (m)
                {
                case 6:  map = Map.Trammel;  break;

                case 7:  map = Map.Felucca;  break;

                case 8:  map = Map.Malas;    break;

                case 9:  map = Map.Ilshenar; break;

                case 10: map = Map.Tokuno;   break;
                }
            }


            if (info.ButtonID == 0)
            {
                r_orb.Delete();
            }

            if (info.ButtonID == 1)
            {
                if (r_orb != null)
                {
                    TextRelay m_name    = info.GetTextEntry(21);
                    string    text_name = (m_name == null ? "" : m_name.Text.Trim());

                    if (text_name.Length == 0)
                    {
                        m_From.SendMessage(0x35, "You must enter a Race Name.");
                        m_From.SendGump(new AddRaceGump(from, r_orb));
                        is_void = true;
                    }
                    else
                    {
                        foreach (Item x in World.Items.Values)
                        {
                            if (x is RaceOrb)
                            {
                                t_orb = x as RaceOrb;
                                if (text_name != null)
                                {
                                    n_name = text_name.ToLower();
                                }
                                if (t_orb.RaceName != null)
                                {
                                    c_name = t_orb.RaceName.ToLower();
                                }
                                if (c_name == n_name)
                                {
                                    name_used = true;
                                }
                            }
                        }
                        if (name_used)
                        {
                            m_From.SendMessage(0x35, "That Race Name is already used.");
                            if (!is_void)
                            {
                                m_From.SendGump(new AddRaceGump(from, r_orb));
                                is_void = true;
                            }
                        }
                        else
                        {
                            r_orb.RaceName   = text_name;
                            r_orb.BackUpName = text_name;
                        }
                    }

                    TextRelay m_desc    = info.GetTextEntry(22);
                    string    text_desc = (m_desc == null ? "" : m_desc.Text.Trim());

                    if (text_desc.Length == 0)
                    {
                        m_From.SendMessage(0x35, "You must enter a Race Description.");
                        if (!is_void)
                        {
                            m_From.SendGump(new AddRaceGump(from, r_orb));
                            is_void = true;
                        }
                    }
                    else
                    {
                        r_orb.Description = text_desc;
                    }

                    TextRelay m_x    = info.GetTextEntry(23);
                    string    text_x = (m_x == null ? "" : m_x.Text.Trim());

                    if (text_x.Length == 0)
                    {
                        m_From.SendMessage(0x35, "You must enter a X Coordinate");
                        if (!is_void)
                        {
                            m_From.SendGump(new AddRaceGump(from, r_orb));
                            is_void = true;
                        }
                    }
                    else
                    {
                        isInt = true;
                        try
                        {
                            int ix = Convert.ToInt32(text_x);
                        }
                        catch
                        {
                            from.SendMessage(0x35, "Coordinates must be numbers!");
                            if (!is_void)
                            {
                                m_From.SendGump(new AddRaceGump(from, r_orb));
                                is_void = true;
                            }
                            isInt = false;
                        }
                        if (isInt)
                        {
                            int r_x = Convert.ToInt32(text_x);
                            r_orb.Race_X = r_x;
                        }
                    }

                    TextRelay m_y    = info.GetTextEntry(24);
                    string    text_y = (m_y == null ? "" : m_y.Text.Trim());

                    if (text_y.Length == 0)
                    {
                        m_From.SendMessage(0x35, "You must enter a Y Coordinate");
                        if (!is_void)
                        {
                            m_From.SendGump(new AddRaceGump(from, r_orb));
                            is_void = true;
                        }
                    }
                    else
                    {
                        isInt = true;
                        try
                        {
                            int iy = Convert.ToInt32(text_y);
                        }
                        catch
                        {
                            from.SendMessage(0x35, "Coordinates must be numbers!");
                            if (!is_void)
                            {
                                m_From.SendGump(new AddRaceGump(from, r_orb));
                                is_void = true;
                            }
                            isInt = false;
                        }
                        if (isInt)
                        {
                            int r_y = Convert.ToInt32(text_y);
                            r_orb.Race_Y = r_y;
                        }
                    }

                    TextRelay m_z    = info.GetTextEntry(25);
                    string    text_z = (m_z == null ? "" : m_z.Text.Trim());

                    if (text_z.Length == 0)
                    {
                        m_From.SendMessage(0x35, "You must enter a Z Coordinate");
                        if (!is_void)
                        {
                            m_From.SendGump(new AddRaceGump(from, r_orb));
                            is_void = true;
                        }
                    }
                    else
                    {
                        isInt = true;
                        try
                        {
                            int iz = Convert.ToInt32(text_x);
                        }
                        catch
                        {
                            from.SendMessage(0x35, "Coordinates must be numbers!");
                            if (!is_void)
                            {
                                m_From.SendGump(new AddRaceGump(from, r_orb));
                                is_void = true;
                            }
                            isInt = false;
                        }
                        if (isInt)
                        {
                            int r_z = Convert.ToInt32(text_z);
                            r_orb.Race_Z = r_z;
                        }
                    }

                    for (int i = 1; i < 11; i++)
                    {
                        TextRelay m_hue_body    = info.GetTextEntry(i);
                        string    text_hue_body = (m_hue_body == null ? "" : m_hue_body.Text.Trim());

                        if (text_hue_body.Length == 0)
                        {
                            if (r_orb.AmountBodyHues == 0)
                            {
                                from.SendMessage(0x35, "You must enter at least one Body Hue");
                                if (!is_void)
                                {
                                    m_From.SendGump(new AddRaceGump(from, r_orb));
                                    is_void = true;
                                }
                                break;
                            }
                        }
                        else
                        {
                            isInt = true;
                            try
                            {
                                int ihue = Convert.ToInt32(text_hue_body);
                            }
                            catch
                            {
                                from.SendMessage(0x35, "Hues must be numbers!");
                                if (!is_void)
                                {
                                    m_From.SendGump(new AddRaceGump(from, r_orb));
                                    is_void = true;
                                }
                                isInt = false;
                            }
                            if (isInt)
                            {
                                int r_hue = Convert.ToInt32(text_hue_body);
                                r_orb.BodyHues[i - 1] = r_hue;
                                r_orb.AmountBodyHues += 1;
                            }
                        }
                    }

                    for (int i = 11; i < 21; i++)
                    {
                        TextRelay m_hue_hair    = info.GetTextEntry(i);
                        string    text_hue_hair = (m_hue_hair == null ? "" : m_hue_hair.Text.Trim());

                        if (text_hue_hair.Length == 0)
                        {
                            if (r_orb.AmountHairHues == 0)
                            {
                                from.SendMessage(0x35, "You must enter at least one Hair Hue");
                                if (!is_void)
                                {
                                    m_From.SendGump(new AddRaceGump(from, r_orb));
                                    is_void = true;
                                }
                                break;
                            }
                        }
                        else
                        {
                            isInt = true;
                            try
                            {
                                int ihue2 = Convert.ToInt32(text_hue_hair);
                            }
                            catch
                            {
                                from.SendMessage(0x35, "Hues must be numbers!");
                                if (!is_void)
                                {
                                    m_From.SendGump(new AddRaceGump(from, r_orb));
                                    is_void = true;
                                }
                                isInt = false;
                            }
                            if (isInt)
                            {
                                int r_hue2 = Convert.ToInt32(text_hue_hair);
                                r_orb.HairHues[i - 11] = r_hue2;
                                r_orb.AmountHairHues  += 1;
                            }
                        }
                    }

                    if (!is_void)
                    {
                        Bag r_bag = new Bag();
                        Bag i_bag = new Bag();

                        r_bag.Name = r_orb.RaceName + " Race";
                        i_bag.Name = r_orb.RaceName + " Items";

                        r_bag.AddItem(i_bag);
                        r_bag.AddItem(r_orb);

                        foreach (Item i in World.Items.Values)
                        {
                            if (i is Bag && i.Name == "RACES")
                            {
                                i.AddItem(r_bag);
                            }
                        }

                        r_orb.Race_Map     = map;
                        r_orb.Name         = r_orb.RaceName + " Race Orb";
                        r_control.A_Races += 1;
                        r_orb.Activated    = true;
                        from.SendMessage(6, "Race has been Generated!");
                    }
                }
            }
        }
Ejemplo n.º 13
0
        private void DataHandler(object sender, SerialDataReceivedEventArgs args)
        {
            SerialPort sp = (SerialPort)sender;
            string input = backlog + sp.ReadExisting();

            string[] times = input.Split(new char[] { '\r', '\n' }, StringSplitOptions.RemoveEmptyEntries);

            for (int i = 0; i < times.Length; i++)
            {
                var time = times[i];
                if (timeStopped == time[0])
                {
                    Dispatcher disp = panel.Dispatcher;

                    disp.Invoke(new Action(() =>
                    {
                        var raceC = new RaceControl(list);
                        raceC.Focus();
                        panel.Children.Insert(0, raceC);

                    }));

                    list = new ObservableCollection<TimeSpan>();

                    Trace.WriteLine("Race finished");
                }
                else
                {
                    if (time[1] == ':')
                    {
                        // add leading zero
                        time = "0" + time;
                    }
                    TimeSpan ts;
                    bool valid = TimeSpan.TryParseExact(time, "mm\\:ss\\,ff", null, out ts);

                    if (valid)
                    {
                        list.Add(ts);
                        Trace.WriteLine(ts.ToString("mm\\:ss\\.ff"));
                    }
                    else
                    {
                        Trace.WriteLine("time not valid " + time);
                        backlog = time;
                    }
                }
            }
        }
Ejemplo n.º 14
0
        public override void OnResponse(NetState sender, RelayInfo info)
        {
            Mobile       from      = sender.Mobile;
            RaceOrb      r_orb     = null;
            RaceControl  r_control = null;
            ClassOrb     c_orb     = null;
            ClassControl c_control = null;

            foreach (Item h in World.Items.Values)
            {
                if (h is RaceControl)
                {
                    r_control = h as RaceControl;
                }
            }

            foreach (Item h in World.Items.Values)
            {
                if (h is ClassControl)
                {
                    c_control = h as ClassControl;
                }
            }

            foreach (Item i in World.Items.Values)
            {
                if (i is RaceOrb)
                {
                    r_orb = i as RaceOrb;
                    if (r_orb.RaceNumber == r_control.R_Current)
                    {
                        break;
                    }
                }
            }

            foreach (Item i in World.Items.Values)
            {
                if (i is ClassOrb)
                {
                    c_orb = i as ClassOrb;
                    if (info.ButtonID == c_orb.ClassNumber)
                    {
                        if (r_orb.Res_Class_Num != 5)
                        {
                            for (int j = 0; j < 5; j++)
                            {
                                if (r_orb.Restricted_C[j] == null)
                                {
                                    r_orb.Restricted_C[j] = c_orb.ClassName;
                                    r_orb.Res_Class_Num  += 1;
                                    break;
                                }
                            }
                        }
                        else
                        {
                            m_From.SendMessage(0x35, "You have reached the Maximum Restricted Classes");
                        }
                    }
                }
            }

            for (int i = 0; i < 5; i++)
            {
                if (info.ButtonID == i + 100)
                {
                    r_orb.Restricted_C[i] = null;
                    r_orb.Res_Class_Num  -= 1;
                }
            }


            if (info.ButtonID == 0)
            {
                from.SendGump(new RestrictClassGump(from));
            }
        }
Ejemplo n.º 15
0
        public RestrictClassGump2(Mobile from, RaceOrb orb)
            : base(20, 30)
        {
            m_From = from;
            RaceControl  r_control    = null;
            ClassControl c_control    = null;
            ClassOrb     c_orb        = null;
            int          h            = 60;
            bool         isRestricted = false;

            foreach (Item i in World.Items.Values)
            {
                if (i is RaceControl)
                {
                    r_control = i as RaceControl;
                }
            }

            foreach (Item i in World.Items.Values)
            {
                if (i is ClassControl)
                {
                    c_control = i as ClassControl;
                }
            }

            AddPage(0);
            AddBackground(0, 0, 340, (c_control.A_Classes * 25) + 160, 5054);

            AddImageTiled(10, 10, 320, 23, 0x52);
            AddImageTiled(11, 11, 318, 23, 0xBBC);

            AddLabel(100, 11, 0, "Race/Class System");

            AddLabel(30, 34, 0, "Remove Restricted Classes:");

            for (int i = 0; i < 5; i++)
            {
                if (orb.Restricted_C[i] != null)
                {
                    AddButton(11, h, 0x15E3, 0x15E7, i + 100, GumpButtonType.Reply, 1);
                    AddLabel(30, h - 1, 0, orb.Restricted_C[i]);
                    h += 25;
                }
            }

            h += 30;

            AddLabel(30, h, 0, "Add Restricted Class:");

            h += 25;

            foreach (Item k in World.Items.Values)
            {
                if (k is ClassOrb)
                {
                    c_orb = k as ClassOrb;
                    if (c_orb.Activated)
                    {
                        isRestricted = false;

                        for (int j = 0; j < 5; j++)
                        {
                            if (c_orb.ClassName == orb.Restricted_C[j])
                            {
                                isRestricted = true;
                            }
                        }

                        if (!isRestricted)
                        {
                            AddButton(11, h, 0x15E3, 0x15E7, c_orb.ClassNumber, GumpButtonType.Reply, 1);
                            AddLabel(30, h - 1, 0, c_orb.ClassName);
                            h += 25;
                        }
                    }
                }
            }
        }