Ejemplo n.º 1
0
        public override void OnDoubleClick(Mobile from)
        {
            Faction faction = Faction.Find(from);

            if (faction == null)
            {
                from.SendLocalizedMessage(1010353, "", 0x23);                   // Only faction members may place faction traps
            }
            else if (faction != m_Faction)
            {
                from.SendLocalizedMessage(1010354, "", 0x23);                   // You may only place faction traps created by your faction
            }
            else if (faction.Traps.Count >= faction.MaximumTraps)
            {
                from.SendLocalizedMessage(1010358, "", 0x23);                   // Your faction already has the maximum number of traps placed
            }
            else
            {
                BaseFactionTrap trap = Construct(from);

                if (trap == null)
                {
                    return;
                }

                int message = trap.IsValidLocation(from.Location, from.Map);

                if (message > 0)
                {
                    from.SendLocalizedMessage(message, "", 0x23);
                    trap.Delete();
                }
                else
                {
                    //addon begin
                    bool nearbytraps          = false;
                    IPooledEnumerable inRange = from.Map.GetItemsInRange(from.Location, 1);
                    foreach (Item trg in inRange)
                    {
                        if (trg is BaseFactionTrap)
                        {
                            from.SendMessage("You cannot place a trap this close to another trap.");
                            trap.Delete();
                            nearbytraps = true;
                            break;
                        }
                    }
                    inRange.Free();
                    //addon end
                    if (!nearbytraps)
                    {
                        from.SendLocalizedMessage(1010360);                           // You arm the trap and carefully hide it from view
                        trap.MoveToWorld(from.Location, from.Map);
                        faction.Traps.Add(trap);
                        Delete();
                    }
                }
            }
        }
Ejemplo n.º 2
0
        public override void OnDoubleClick(Mobile from)
        {
            Faction faction = Faction.Find(from);

            if (faction == null)
            {
                from.SendLocalizedMessage(1010353, "", 0x23); // Only faction members may place faction traps
            }
            else if (faction != this.m_Faction)
            {
                from.SendLocalizedMessage(1010354, "", 0x23); // You may only place faction traps created by your faction
            }
            else if (faction.Traps.Count >= faction.MaximumTraps)
            {
                from.SendLocalizedMessage(1010358, "", 0x23); // Your faction already has the maximum number of traps placed
            }
            else
            {
                BaseFactionTrap trap = this.Construct(from);

                if (trap == null)
                {
                    return;
                }

                int message = trap.IsValidLocation(from.Location, from.Map);

                if (message > 0)
                {
                    from.SendLocalizedMessage(message, "", 0x23);
                    trap.Delete();
                }
                else
                {
                    from.SendLocalizedMessage(1010360); // You arm the trap and carefully hide it from view
                    trap.MoveToWorld(from.Location, from.Map);
                    faction.Traps.Add(trap);
                    this.Delete();
                }
            }
        }
        public override void OnDoubleClick(Mobile from)
        {
            Faction faction = Faction.Find(from);

            if (faction == null)
            {
                from.SendAsciiMessage(0x23, "Only faction members may place faction traps.");
            }
            else if (faction != m_Faction)
            {
                from.SendAsciiMessage(0x23, "You may only place faction traps created by your faction.");
            }
            else if (faction.Traps.Count >= faction.MaximumTraps)
            {
                from.SendAsciiMessage(0x23, "Your faction already has the maximum number of traps placed.");
            }
            else
            {
                BaseFactionTrap trap = Construct(from);

                if (trap == null)
                {
                    return;
                }

                string message = trap.IsValidLocation(from.Location, from.Map);

                if (message != "")
                {
                    from.SendAsciiMessage(0x23, message);
                    trap.Delete();
                }
                else
                {
                    from.SendAsciiMessage("You arm the trap and carefully hide it from view.");
                    trap.MoveToWorld(from.Location, from.Map);
                    faction.Traps.Add(trap);
                    Delete();
                }
            }
        }
        public override void OnDoubleClick(Mobile from)
        {
            BaseFactionTrap trap = Construct(from);

            if (trap == null)
            {
                return;
            }

            int message = trap.IsValidLocation(from.Location, from.Map);

            if (message > 0)
            {
                from.SendLocalizedMessage(message, "", 0x23);
                trap.Delete();
            }
            else
            {
                from.SendLocalizedMessage(1010360);                   // You arm the trap and carefully hide it from view
                trap.MoveToWorld(from.Location, from.Map);
                Delete();
            }
        }