コード例 #1
0
        public override void OnDestroyed()
        {
            //get the object that it is attached to
            Item             building = AttachedTo as Item;                              //<---Building
            Point3D          p        = new Point3D(building.X, building.Y, building.Z); //<---location
            Region           r        = Region.Find(p, building.Map);                    //<---region
            PlayerCityRegion cityreg  = r as PlayerCityRegion;                           //<---region

            if (r.IsPartOf(typeof(PlayerCityRegion)))                                    //<---building is in city region
            {
                ArrayList deletelist = new ArrayList();
                foreach (Item i in World.Items.Values)
                {
                    if (i is CivicSign)
                    {
                        CivicSign z = (CivicSign)i;                              //<--- line 44 from error
                        if (z.toDelete != null && z.toDelete.Contains(building)) //<---look for the Building/Addon in the arraylist
                        {
                            deletelist.Add(z);
                        }
                    }
                }

                foreach (Item d in deletelist)
                {
                    d.Delete();
                }

                //}
                ArrayList deletelist1 = new ArrayList();
                foreach (Item t in World.Items.Values)
                {
                    if (t is CityManagementStone)
                    {
                        CityManagementStone y = (CityManagementStone)t;
                        if (y.toDelete != null && y.toDelete.Contains(building))
                        {
                            deletelist1.Add(y);
                        }
                    }
                    foreach (Item c in deletelist1)
                    {
                        c.Delete();
                        return;
                    }
                }
            }
            // add code to find all of the items associated with the building and delete them
            // and to remove the building from the city system

            // the base method will destroy the target building itself
            base.OnDestroyed();  //EDITED THIS OUT AS THERE WONT BE ANY ID TO CHANGE ANYMORE
        }
コード例 #2
0
        public override void OnDelete()
        {
            BaseHouse        house   = BaseHouse.FindHouseAt((PelopsItem)this);
            Point3D          p       = new Point3D(this.X, this.Y, this.Z);
            Region           r       = Region.Find(p, this.Map);
            PlayerCityRegion cityreg = r as PlayerCityRegion;

            if (r.IsPartOf(typeof(HouseRegion)))
            {
                Point3D     v        = new Point3D(this.X, this.Y, this.Z);
                Region      u        = Region.Find(v, this.Map);
                HouseRegion housereg = u as HouseRegion;
                //house.SetLockdown( this, true );
            }
            else if (r.IsPartOf(typeof(PlayerCityRegion)))
            {
                foreach (Item i in World.Items.Values)
                {
                    if (i is CityManagementStone)
                    {
                        CityManagementStone s     = (CityManagementStone)i;
                        Point3D             q     = new Point3D(s.X, s.Y, s.Z);
                        Region           t        = Region.Find(q, s.Map);
                        PlayerCityRegion stonereg = t as PlayerCityRegion;
                        if (cityreg == stonereg)
                        {
                            ArrayList decore = s.isLockedDown;
                            if (decore == null)
                            {
                                s.isLockedDown = new ArrayList();
                                decore         = s.isLockedDown;
                            }
                            decore.Remove(this);
                            s.CurrentDecore -= 1;
                        }
                    }
                }
            }
            else
            {
                return;
            }
            base.OnDelete();
        }
コード例 #3
0
        public override void OnResponse(NetState state, RelayInfo info)
        {
            if (info.ButtonID == 0)               // Cancel
            {
                return;
            }
            else if (m_Mobile.Deleted || m_Moongate.Deleted || m_Mobile.Map == null)
            {
                return;
            }

            if (info.ButtonID == 2)               //City
            {
                ArrayList a = new ArrayList();

                foreach (Item i in World.Items.Values)
                {
                    if (i is CityManagementStone)
                    {
                        CityManagementStone s = (CityManagementStone)i;

                        if (s.HasMoongate == true && s.IsRegistered == true)
                        {
                            a.Add(i);
                        }
                    }
                }

                if (a.Count == 0)
                {
                    m_Mobile.SendGump(new NoCitiesGump());
                }
                else
                {
                    m_Mobile.SendGump(new PCMoongateGump(m_Moongate, 0, null, null));
                }
            }

            int[] switches = info.Switches;

            if (switches.Length == 0)
            {
                return;
            }

            int switchID  = switches[0];
            int listIndex = switchID / 100;
            int listEntry = switchID % 100;

            if (listIndex < 0 || listIndex >= m_Lists.Length)
            {
                return;
            }

            PMList list = m_Lists[listIndex];

            if (listEntry < 0 || listEntry >= list.Entries.Length)
            {
                return;
            }

            PMEntry entry = list.Entries[listEntry];

            if (!m_Mobile.InRange(m_Moongate.GetWorldLocation(), 1) || m_Mobile.Map != m_Moongate.Map)
            {
                m_Mobile.SendLocalizedMessage(1019002);                   // You are too far away to use the gate.
            }
            else if (m_Mobile.Player && m_Mobile.Kills >= 5 && list.Map != Map.Felucca)
            {
                m_Mobile.SendLocalizedMessage(1019004);                   // You are not allowed to travel there.
            }
            else if (Factions.Sigil.ExistsOn(m_Mobile) && list.Map != Factions.Faction.Facet)
            {
                m_Mobile.SendLocalizedMessage(1019004);                   // You are not allowed to travel there.
            }
            else if (m_Mobile.Criminal)
            {
                m_Mobile.SendLocalizedMessage(1005561, "", 0x22);                   // Thou'rt a criminal and cannot escape so easily.
            }
            else if (Server.Spells.SpellHelper.CheckCombat(m_Mobile))
            {
                m_Mobile.SendLocalizedMessage(1005564, "", 0x22);                   // Wouldst thou flee during the heat of battle??
            }
            else if (m_Mobile.Spell != null)
            {
                m_Mobile.SendLocalizedMessage(1049616);                   // You are too busy to do that at the moment.
            }
            else if (m_Mobile.Map == list.Map && m_Mobile.InRange(entry.Location, 1))
            {
                m_Mobile.SendLocalizedMessage(1019003);                   // You are already there.
            }
            else
            {
                CityManagementStone outgoingCity = null;
                Region currentRegion             = Region.Find(m_Mobile.Location, m_Mobile.Map);

                if (currentRegion != null)
                {
                    if (currentRegion is PlayerCityRegion)
                    {
                        PlayerCityRegion pcr = (PlayerCityRegion)currentRegion;

                        outgoingCity = pcr.Stone;
                    }
                }

                if (outgoingCity != null && outgoingCity.TravelTax >= 1)
                {
                    m_Mobile.SendGump(new PCMoongateToll2Gump(m_Moongate, outgoingCity, entry.Location, list.Map));
                }
                else
                {
                    BaseCreature.TeleportPets(m_Mobile, entry.Location, list.Map);

                    m_Mobile.Combatant = null;
                    m_Mobile.Warmode   = false;
                    m_Mobile.Hidden    = true;

                    m_Mobile.MoveToWorld(entry.Location, list.Map);

                    Effects.PlaySound(entry.Location, list.Map, 0x1FE);
                }
            }
        }
コード例 #4
0
        public override void OnResponse(NetState state, RelayInfo info)
        {
            Mobile from = state.Mobile;

            if (from == null)
            {
                return;
            }

            if (info.ButtonID == 1)               // Previous page
            {
                if (m_ListPage > 0)
                {
                    from.SendGump(new PCMoongateGump(m_Gate, m_ListPage - 1, m_List, m_CountList));
                }
            }

            if (info.ButtonID == 2)               // Next page
            {
                if ((m_ListPage + 1) * 7 < m_List.Count)
                {
                    from.SendGump(new PCMoongateGump(m_Gate, m_ListPage + 1, m_List, m_CountList));
                }
            }

            if (info.ButtonID >= 100)               // Travel
            {
                if (from.InRange(m_Gate.GetWorldLocation(), 3))
                {
                    CityManagementStone incomingCity = m_List[info.ButtonID - 100] as CityManagementStone;
                    CityManagementStone outgoingCity = null;
                    Region currentRegion             = Region.Find(from.Location, from.Map);

                    if (currentRegion != null)
                    {
                        if (currentRegion is PlayerCityRegion)
                        {
                            PlayerCityRegion pcr = (PlayerCityRegion)currentRegion;

                            outgoingCity = pcr.Stone;
                        }
                    }



                    if (incomingCity.MoongateLocation == m_Gate.Location)
                    {
                        from.SendMessage("You are already there.");
                    }
                    else if (incomingCity.TravelTax >= 1 && !IsCitizen(from, incomingCity))
                    {
                        from.SendGump(new PCMoongateTollGump(m_Gate, incomingCity, outgoingCity));
                    }
                    else if (outgoingCity != null && outgoingCity.TravelTax >= 1 && !IsCitizen(from, outgoingCity))
                    {
                        from.SendGump(new PCMoongateTollGump(m_Gate, incomingCity, outgoingCity));
                    }
                    else
                    {
                        BaseCreature.TeleportPets(from, incomingCity.MoongateLocation, incomingCity.Map);
                        from.Combatant = null;
                        from.Warmode   = false;
                        from.Hidden    = true;
                        from.MoveToWorld(incomingCity.MoongateLocation, incomingCity.Map);
                        Effects.PlaySound(incomingCity.MoongateLocation, incomingCity.Map, 0x1FE);
                    }
                }
                else
                {
                    from.SendMessage("You are to far away from the moongate.");
                }
            }
        }