Esempio n. 1
0
 public EditCustomActions(Area area, List<CustomAction> actions)
 {
     _area = area;
     InitializeComponent();
     Type types = typeof(CustomAction.ActionTriggerType);
     CustomAction.ActionTriggerType[] vals = (CustomAction.ActionTriggerType[])Enum.GetValues(types);
     foreach (CustomAction.ActionTriggerType i in vals)
     {
         this.cbTriggers.Items.Add(CustomAction.WhenString(i));
     }
     cbTriggers.SelectedIndex = 0;
     types = typeof(CustomAction.ActionType);
     CustomAction.ActionType[] vals2 = (CustomAction.ActionType[])Enum.GetValues(types);
     foreach (CustomAction.ActionType i in vals2)
     {
         this.cbActions.Items.Add(CustomAction.ActionString(i));
     }
     cbActions.SelectedIndex = 0;
     if (actions != null)
     {
         foreach (CustomAction action in actions)
         {
             lstCustomActions.Items.Add(action);
         }
     }
 }
Esempio n. 2
0
 public EditValues(ObjTemplate.ObjectType type, int[] values, String text, Area area)
 {
     _area = area;
     InitializeComponent();
     _values = values;
     _type = type;
     lblObjectName.Text = text;
     RefreshWindowContents();
 }
Esempio n. 3
0
 public SelectMob(Area area)
 {
     InitializeComponent();
     foreach (MobTemplate mob in area.Mobs)
     {
         cbType.Items.Add(ModernMUD.Color.RemoveColorCodes(mob.ShortDescription));
     }
     _area = area;
 }
Esempio n. 4
0
 public SelectRoom(Area area)
 {
     InitializeComponent();
     foreach( RoomTemplate room in area.Rooms )
     {
         cbType.Items.Add(ModernMUD.Color.RemoveColorCodes(room.Title));
     }
     _area = area;
 }
Esempio n. 5
0
 public SelectObject(Area area)
 {
     InitializeComponent();
     foreach (ObjTemplate obj in area.Objects)
     {
         cbType.Items.Add(ModernMUD.Color.RemoveColorCodes(obj.ShortDescription));
     }
     _area = area;
 }
Esempio n. 6
0
 public void UpdateData(ModernMUD.Area area)
 {
     questList.Items.Clear();
     _area = area;
     if (area != null)
     {
         UpdateQuestList();
     }
     SetControlAvailability();
 }
Esempio n. 7
0
 public void UpdateData(Area area)
 {
     shopList.Items.Clear();
     _area = area;
     if (area != null)
     {
         UpdateShopList();
     }
     SetControlAvailability();
 }
Esempio n. 8
0
 public void UpdateData(ModernMUD.Area area)
 {
     questList.Items.Clear();
     _area = area;
     if (area != null)
     {
         UpdateQuestList();
     }
     SetControlAvailability();
 }
Esempio n. 9
0
 /// <summary>
 /// Sets the current area and updates the window contents.
 /// </summary>
 /// <param name="area"></param>
 public void UpdateData(ModernMUD.Area area)
 {
     _area = area;
     lstRepops.Items.Clear();
     if (_area != null)
     {
         foreach (RepopulationPoint repop in _area.Repops)
         {
             lstRepops.Items.Add(repop);
         }
     }
 }
Esempio n. 10
0
 /// <summary>
 /// Sets the current area and updates the window contents.
 /// </summary>
 /// <param name="area"></param>
 public void UpdateData(ModernMUD.Area area)
 {
     _area = area;
     lstRepops.Items.Clear();
     if (_area != null)
     {
         foreach (RepopulationPoint repop in _area.Repops)
         {
             lstRepops.Items.Add(repop);
         }
     }
 }
Esempio n. 11
0
 /// <summary>
 /// Sets the current area and updates the window contents.
 /// </summary>
 /// <param name="area"></param>
 public void UpdateData(Area area)
 {
     _area = area;
     if (_area != null)
     {
         txtAuthor.Text = area.Author;
         txtBuilders.Text = area.Builders;
         txtName.Text = area.Name;
         if (area.MinRecommendedLevel < cbMinLevel.Items.Count)
         {
             cbMinLevel.SelectedIndex = area.MinRecommendedLevel;
         }
         else
         {
             cbMinLevel.SelectedIndex = cbMinLevel.Items.Count - 1;
         }
         txtResetMsg.Text = area.ResetMessage;
         txtVersion.Text = area.Version.ToString();
         txtRecall.Text = area.Recall.ToString();
         txtSquadSize.Text = area.DefendersPerSquad.ToString();
         txtNumSquads.Text = area.DefenderSquads.ToString();
         cbJusticeType.Text = area.JusticeType.ToString();
         txtJudgeRoom.Text = area.JudgeRoom.ToString();
         txtJailRoom.Text = area.JailRoom.ToString();
         txtGuardIndexNumber.Text = area.DefenderTemplateNumber.ToString();
         txtBarracks.Text = area.BarracksRoom.ToString();
         txtMinutesBetweenResets.Text = area.MinutesBetweenResets.ToString();
         txtHeight.Text = area.Height.ToString();
         txtWidth.Text = area.Width.ToString();
         txtAreaFlags.Text = area.AreaFlags[0].ToString();
         if (area.MaxRecommendedLevel < cbMaxLevel.Items.Count)
         {
             cbMaxLevel.SelectedIndex = area.MaxRecommendedLevel;
         }
         if ((int)area.AreaResetMode < cbResetMode.Items.Count)
         {
             cbResetMode.SelectedIndex = (int)area.AreaResetMode;
         }
     }
 }
Esempio n. 12
0
 /// <summary>
 /// Copy constructor.
 /// </summary>
 /// <param name="obj"></param>
 public ObjTemplate(ObjTemplate obj)
 {
     this._affected = new List<Affect>(obj._affected);
     this._affectedBy = new int[obj._affectedBy.Length];
     obj._affectedBy.CopyTo(_affectedBy, 0);
     this._antiFlags = new int[obj._antiFlags.Length];
     obj._antiFlags.CopyTo(_antiFlags, 0);
     this._area = obj._area;
     this._condition = obj._condition;
     this._cost = obj._cost;
     this._count = 0;
     this._craftsmanshipLevel = obj._craftsmanshipLevel;
     this._customActions = new List<CustomAction>(obj._customActions);
     this._extraDescriptions = new List<ExtendedDescription>(obj._extraDescriptions);
     this._extraFlags = new int[obj._extraFlags.Length];
     obj._extraFlags.CopyTo(_extraFlags, 0);
     this._fullDescription = obj._fullDescription;
     this._indexNumber = obj._area.HighObjIndexNumber + 1;
     this._itemType = obj._itemType;
     this._level = obj._level;
     this._material = obj._material;
     this._maxNumber = obj._maxNumber;
     this._name = obj._name;
     this._scarcity = obj._scarcity;
     this._shortDescription = obj._shortDescription;
     this._size = obj._size;
     this._specFun = new List<ObjSpecial>(obj._specFun);
     this._specFunName = obj._specFunName;
     this._spellEffects = new List<SpellEntry>(obj._spellEffects);
     this._trap = obj._trap;
     this._values = new int[obj._values.Length];
     obj._values.CopyTo(_values, 0);
     this._volume = obj._volume;
     this._wearFlags = new int[obj._wearFlags.Length];
     obj._wearFlags.CopyTo(_wearFlags, 0);
     this._weight = obj._weight;
     ++_numObjIndex;
 }
Esempio n. 13
0
        /// <summary>
        /// Translate area range values to ranges.
        /// </summary>
        /// <param name="area"></param>
        /// <returns></returns>
        public static string RangeString( Area area )
        {
            string text;

            if (area == null)
            {
                return "none";
            }

            if (area.MinRecommendedLevel == 0 && area.MaxRecommendedLevel == Limits.MAX_LEVEL)
            {
                text = " All ";
            }
            else
            {
                if (area.MinRecommendedLevel == 0 && area.MaxRecommendedLevel == 0)
                {
                    text = "None ";
                }
                else
                {
                    text = String.Format("{0} {1}", MUDString.PadInt(area.MinRecommendedLevel, 2),
                        MUDString.PadInt(area.MaxRecommendedLevel, 2));
                }
            }
            return text;
        }
Esempio n. 14
0
        /// <summary>
        /// Returns a random room on one of the maps.
        /// Argument: 0 = any map
        ///           1 = Surface map 1
        ///           2 = Surface map 2
        ///           3 = Underdark map 1
        ///           4 = Underdark map 2
        ///           5 = Underdark map 3
        /// </summary>
        /// <param name="map"></param>
        /// <returns></returns>
        public static Room GetRandomMapRoom( Area map )
        {
            if (Room.Count < 1)
            {
                throw new IndexOutOfRangeException("No rooms loaded, cannot get a random map room.");
            }

            if (map == null)
            {
                List<Area> zones = new List<Area>();
                foreach( Area area in Database.AreaList )
                {
                    if (area.HasFlag(Area.AREA_WORLDMAP) && area.Rooms.Count > 0)
                    {
                        zones.Add(area);
                    }
                }
                if (zones.Count < 1)
                {
                    throw new IndexOutOfRangeException("GetRandomMapRoom(): No zones found with AREA_WORLDMAP flag set.");
                }
                int val = MUDMath.NumberRange(0, (zones.Count - 1));
                map = zones[val];
            }

            int max = map.Rooms.Count;
            if (max < 1)
            {
                throw new IndexOutOfRangeException("GetRandomMapRoom(): No rooms found in target zone.");
            }

            int target = MUDMath.NumberRange(0, (map.Rooms.Count - 1));
            Room room = Room.GetRoom( target );
            if (!room ||
                    room.WorldmapTerrainType == 92 ||
                    room.WorldmapTerrainType == 101 ||
                    room.WorldmapTerrainType == 102 ||
                    room.WorldmapTerrainType == 116 ||
                    room.WorldmapTerrainType == 130 ||
                    room.WorldmapTerrainType == 131 ||
                    room.WorldmapTerrainType == 132 ||
                    room.WorldmapTerrainType == 136 ||
                    room.WorldmapTerrainType == 137 ||
                    room.HasFlag(RoomTemplate.ROOM_PRIVATE) ||
                    room.HasFlag(RoomTemplate.ROOM_SOLITARY) ||
                    room.HasFlag(RoomTemplate.ROOM_NO_TELEPORT) ||
                    room.TerrainType == TerrainType.underground_impassable)
            {
                room = GetRandomMapRoom(map);
            }
            return room;
        }
Esempio n. 15
0
        /// <summary>
        /// Print an area's flags as a string.
        /// </summary>
        /// <param name="area"></param>
        /// <returns></returns>
        public static string AreaString(Area area)
        {
            string text = String.Empty;
            int count;

            for (count = 0; count < AreaFlags.Length; count++)
            {
                if (area.HasFlag(AreaFlags[count]._bitvector))
                {
                    text += " ";
                    text += AreaFlags[count]._name;
                }
            }

            return (!String.IsNullOrEmpty(text)) ? text.Substring(1) : "none";
        }
Esempio n. 16
0
 /// <summary>
 /// Resets a single area.
 /// </summary>
 public static void ResetArea( Area area )
 {
     if (area == null)
     {
         return;
     }
     Room room;
     int indexNumber;
     area.DefenderSquads = 0;
     area.NumDefendersDispatched = 0;
     for( indexNumber = area.LowRoomIndexNumber; indexNumber <= area.HighRoomIndexNumber; indexNumber++ )
     {
         if (indexNumber == 0)
             continue;
         room = Room.GetRoom( indexNumber );
         if( room && room.Area == area )
         {
             room.ResetRoom( area.TimesReset );
         }
     }
     area.AgeInSeconds = MUDMath.NumberRange(-Event.AREA_RESET_VARIABILITY, Event.AREA_RESET_VARIABILITY);
     area.TimesReset++;
     return;
 }
Esempio n. 17
0
 public EditExit(MainForm parent, Area area)
 {
     _parent = parent;
     InitializeComponent();
     _area = area;
 }
Esempio n. 18
0
 /// <summary>
 /// Generates a zone file.
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void generateZoneToolStripMenuItem_Click(object sender, EventArgs e)
 {
     SaveFileDialog dialog = new SaveFileDialog();
     dialog.Filter = "xml files (*.xml)|*.xml";
     if (dialog.ShowDialog() == DialogResult.OK)
     {
         int vnum = Int32.Parse(txtStartVnum.Text);
         Area area = new Area();
         area.AreaFlags[Area.AREA_WORLDMAP.Group] = Area.AREA_WORLDMAP.Vector;
         area.Width = _bitmap.Width;
         area.Height = _bitmap.Height;
         area.Author = txtAuthor.Text;
         area.Builders = txtAuthor.Text;
         area.Name = txtZoneName.Text;
         for (int y = 0; y < _bitmap.Height; y++)
         {
             for (int x = 0; x < _bitmap.Width; x++)
             {
                 Color col = _bitmap.GetPixel(x, y);
                 MiniRoomTemplate temp = GetTemplate(col);
                 RoomTemplate room = new RoomTemplate();
                 room.Title = temp.Title;
                 room.Description = temp.Description;
                 room.TerrainType = temp.Terrain;
                 room.IndexNumber = vnum + x + (y * _bitmap.Width);
                 // Only add exits and add the room to the zone if the room is not impassable.
                 //
                 // TODO: Don't create exits that point to impassable rooms.
                 Color pixel;
                 MiniRoomTemplate target;
                 if (room.TerrainType != TerrainType.underground_impassable || (x == 0 && y == 0))
                 {
                     if (x > 0)
                     {
                         pixel = _bitmap.GetPixel(x-1, y);
                         target = GetTemplate(pixel);
                         if (target.Terrain != TerrainType.underground_impassable)
                         {
                             Exit exit = new Exit();
                             exit.IndexNumber = vnum + x + (y * _bitmap.Width) - 1;
                             room.ExitData[(int)Exit.Direction.west] = exit;
                         }
                     }
                     if (x < (_bitmap.Width - 1))
                     {
                         pixel = _bitmap.GetPixel(x+1, y);
                         target = GetTemplate(pixel);
                         if (target.Terrain != TerrainType.underground_impassable)
                         {
                             Exit exit = new Exit();
                             exit.IndexNumber = vnum + x + (y * _bitmap.Width) + 1;
                             room.ExitData[(int)Exit.Direction.east] = exit;
                         }
                     }
                     if (y > 0)
                     {
                         pixel = _bitmap.GetPixel(x, y-1);
                         target = GetTemplate(pixel);
                         if (target.Terrain != TerrainType.underground_impassable)
                         {
                             Exit exit = new Exit();
                             exit.IndexNumber = vnum + x + ((y - 1) * _bitmap.Width);
                             room.ExitData[(int)Exit.Direction.north] = exit;
                         }
                     }
                     if( y < (_bitmap.Height - 1 ))
                     {
                         pixel = _bitmap.GetPixel(x, y+1);
                         target = GetTemplate(pixel);
                         if (target.Terrain != TerrainType.underground_impassable)
                         {
                             Exit exit = new Exit();
                             exit.IndexNumber = vnum + x + ((y + 1) * _bitmap.Width);
                             room.ExitData[(int)Exit.Direction.south] = exit;
                         }
                     }
                     area.Rooms.Add(room);
                 }
             }
         }
         area.Save(dialog.FileName);
     }
 }