Пример #1
0
        public override Item Construct(Type type, Mobile from, Item tool, HarvestDefinition def, HarvestBank bank, HarvestResource resource)
        {
            if (UseLumberjackingCaptcha)
            {
                Item item = base.Construct(type, from, tool, def, bank, resource);

                if (item == null)
                {
                    return(null);
                }

                Server.Mobiles.PlayerMobile pm = from as Server.Mobiles.PlayerMobile;

                if (pm != null && !pm.HarvestLockedout)
                {
                    pm.TempStashedHarvestDef = def;
                    pm.TempStashedHarvest    = item;

                    item.Amount = bank.Current;
                    bank.Consume(bank.Current, from);
                    HarvestSystem.WearTool(from, tool, def);
                }

                return(null);
            }

            else
            {
                return(base.Construct(type, from, tool, def, bank, resource));
            }
        }
Пример #2
0
        public override void OnDoubleClick(Mobile from)
        {
            Server.Mobiles.PlayerMobile pm = from as Server.Mobiles.PlayerMobile;

            if (from.InRange(GetWorldLocation(), 1))
            {
                pm.CloseGump(typeof(RunebookGump));
                from.SendGump(new RunebookGump(from, this));
            }
        }
Пример #3
0
        public override void OnDoubleClick(Mobile from)
        {
            Server.Mobiles.PlayerMobile pm = from as Server.Mobiles.PlayerMobile;

            if (IsChildOf(from.Backpack))
            {
                pm.CloseGump(typeof(LargeBODGump));
                from.SendGump(new LargeBODGump(from, this));
            }
            else
            {
                from.SendLocalizedMessage(1045156);                   // You must have the deed in your backpack to use it.
            }
        }
Пример #4
0
        public static ArrayList BuildList(Mobile owner, string filter)
        {
            ArrayList list = new ArrayList();
            //ArrayList states = NetState.Instances;
            List <NetState> states = NetState.Instances;

            // reset jump table
            Server.Mobiles.PlayerMobile pm = owner as Server.Mobiles.PlayerMobile;
            if (pm != null)
            {
                pm.JumpIndex = 0;
                pm.JumpList  = new ArrayList();
            }

            for (int i = 0; i < states.Count; ++i)
            {
                Mobile m = states[i].Mobile;

                if (m != null && (m == owner || !m.Hidden || owner.AccessLevel > m.AccessLevel))
                {
                    // wea: added check against filter string
                    if (filter != "")
                    {
                        if (m.Name.ToLower().IndexOf(filter.ToLower()) != -1)
                        {
                            list.Add(m);
                            pm.JumpList.Add(m);
                        }
                    }
                    else
                    {
                        list.Add(m);
                        pm.JumpList.Add(m);
                    }
                }
            }

            list.Sort(InternalComparer.Instance);

            return(list);
        }
Пример #5
0
        /// <summary>
        /// Performs a search for players
        /// </summary>
        /// <param name="name">The name to match</param>
        /// <returns>An ArrayList of matching players</returns>
        public static ArrayList SearchForPlayers(string name)
        {
            name = name.ToLower();
            ArrayList matches = new ArrayList();

            foreach (Mobile m in World.Mobiles.Values)
            {
                Server.Mobiles.PlayerMobile pm = m as Server.Mobiles.PlayerMobile;

                if (pm != null && pm.Name.ToLower().IndexOf(name) > -1 && pm.AccessLevel == AccessLevel.Player)
                {
                    //Al: Only results are returned that are twice as long as the searchstring at maximum
                    if (pm.Name.Length <= name.Length * 2)
                    {
                        matches.Add(pm);
                    }
                }
            }

            return(matches);
        }
Пример #6
0
        protected override void OnTarget(Mobile from, object targeted)
        {
            Server.Mobiles.PlayerMobile pm = targeted as Server.Mobiles.PlayerMobile;

            if (pm != null)
            {
                if (pm.AccessLevel == AccessLevel.Player)
                {
                    try
                    {
                        m_Callback.DynamicInvoke(new object[] { from, pm });
                    }
                    catch {}
                }
                else
                {
                    from.SendMessage("The jail system isn't supposed to be used on staff");
                }
            }
            else
            {
                from.SendMessage("The jail system only works on players");
            }
        }
Пример #7
0
        private static void EventSink_DeleteRequest(DeleteRequestEventArgs e)
        {
            NetState state = e.State;
            int      index = e.Index;

            Account acct = state.Account as Account;

            if (acct == null)
            {
                state.Dispose();
            }
            else if (index < 0 || index >= 5)
            {
                state.Send(new DeleteResult(DeleteResultType.BadRequest));
                state.Send(new CharacterListUpdate(acct));
            }
            else
            {
                Mobile m = acct[index];

                if (m == null)
                {
                    state.Send(new DeleteResult(DeleteResultType.CharNotExist));
                    state.Send(new CharacterListUpdate(acct));
                }
                else if (m.NetState != null)
                {
                    state.Send(new DeleteResult(DeleteResultType.CharBeingPlayed));
                    state.Send(new CharacterListUpdate(acct));
                }
                else if (RestrictDeletion && DateTime.Now < (m.CreationTime + DeleteDelay))
                {
                    state.Send(new DeleteResult(DeleteResultType.CharTooYoung));
                    state.Send(new CharacterListUpdate(acct));
                }
                else
                {
                    bool bDelete = true;

                    if (m is Server.Mobiles.PlayerMobile)
                    {
                        Server.Mobiles.PlayerMobile  pm     = (Server.Mobiles.PlayerMobile)m;
                        System.Collections.ArrayList houses = Multis.BaseHouse.GetHouses(pm);
                        if (houses.Count > 0)
                        {
                            if (acct.Count > 1)
                            {
                                Mobile newOwner = null;
                                //find a non-deleted, non-null character on the account
                                for (int i = 0; i < acct.Count; i++)
                                {
                                    if (index != i)
                                    {
                                        if (acct[i] != null)
                                        {
                                            if (!acct[i].Deleted)
                                            {
                                                newOwner = acct[i];
                                            }
                                        }
                                    }
                                }

                                if (newOwner == null)                                 //sanity check, should never happen
                                {
                                    System.Console.WriteLine("Sanity check failed: newOwner == null!");
                                    bDelete = false;
                                    state.Send(new DeleteResult(DeleteResultType.BadRequest));
                                }
                                else
                                {
                                    for (int i = 0; i < houses.Count; ++i)
                                    {
                                        if (houses[i] is Server.Multis.BaseHouse)
                                        {
                                            Server.Multis.BaseHouse house = (Server.Multis.BaseHouse)houses[i];
                                            if (house != null)
                                            {
                                                if (house.Owner == m)                                                 //another sanity check - house.Owner should always be m at this point!
                                                {
                                                    //swap to new owner
                                                    house.Owner = newOwner;
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                            else
                            {
                                //If account only has one character, then refuse to delete the houseowner
                                bDelete = false;
                                state.Send(new DeleteResult(DeleteResultType.BadRequest));
                            }
                        }
                    }

                    if (bDelete)
                    {
                        Console.WriteLine("Client: {0}: Deleting character {1} (name:{3}) (0x{2:X})", state, index, m.Serial.Value, m.Name);
                        m.Delete();
                    }

                    state.Send(new CharacterListUpdate(acct));
                }
            }
        }
Пример #8
0
 public void GuildChat(string message, Server.Mobiles.PlayerMobile pm)
 {
     GuildChat(pm, 0x3B2, message);
 }
Пример #9
0
 public void AlliedChat(string message, Server.Mobiles.PlayerMobile pm)
 {
     AlliedChat(pm, 0x3B2, message);
 }