Example #1
0
            protected override void OnTarget(Mobile from, object targeted)
            {
                if (m_Powder.Deleted)
                {
                    return;
                }

                if (!from.InRange(m_Powder.GetWorldLocation(), 2))
                {
                    from.LocalOverheadMessage(MessageType.Regular, 0x3B2, 1019045);                     // I can't reach that.
                }
                else if (targeted is ITranslocationItem)
                {
                    var transItem = (ITranslocationItem)targeted;

                    if (transItem.Charges >= transItem.MaxCharges)
                    {
                        MessageHelper.SendLocalizedMessageTo(m_Powder, from, 1054137, 0x59);
                        // This item cannot absorb any more powder of translocation.
                    }
                    else if (transItem.Recharges >= transItem.MaxRecharges)
                    {
                        MessageHelper.SendLocalizedMessageTo(m_Powder, from, 1054138, 0x59);
                        // This item has been oversaturated with powder of translocation and can no longer be recharged.
                    }
                    else
                    {
                        if (transItem.Charges + m_Powder.Amount > transItem.MaxCharges)
                        {
                            int delta = transItem.MaxCharges - transItem.Charges;

                            m_Powder.Amount     -= delta;
                            transItem.Charges    = transItem.MaxCharges;
                            transItem.Recharges += delta;
                        }
                        else
                        {
                            transItem.Charges   += m_Powder.Amount;
                            transItem.Recharges += m_Powder.Amount;
                            m_Powder.Delete();
                        }

                        if (transItem is Item)
                        {
                            // The ~1_translocationItem~ glows with green energy and absorbs magical power from the powder.
                            MessageHelper.SendLocalizedMessageTo((Item)transItem, from, 1054139, transItem.TranslocationItemName, 0x43);
                        }
                    }
                }
                else
                {
                    MessageHelper.SendLocalizedMessageTo(m_Powder, from, 1054140, 0x59);
                    // Powder of translocation has no effect on this item.
                }
            }
Example #2
0
            protected override void OnTarget(Mobile from, object targeted)
            {
                if (m_Powder.Deleted)
                {
                    return;
                }

                if (!from.InRange(m_Powder.GetWorldLocation(), 2))
                {
                    from.LocalOverheadMessage(MessageType.Regular, 0x3B2, 1019045);                     // I can't reach that.
                }
                else if (targeted is Moonstone)
                {
                    Moonstone stone = (Moonstone)targeted;
                    if (!from.CanSee(stone))
                    {
                        from.SendLocalizedMessage(500237);                         // Target can not be seen.
                    }
                    else if (!SpellHelper.CheckTravel(from, TravelCheckType.Mark))
                    {
                    }
                    else if (SpellHelper.CheckMulti(from.Location, from.Map, !Core.AOS))
                    {
                        from.SendLocalizedMessage(501942);                         // That location is blocked.
                    }
                    else if (!stone.IsChildOf(from.Backpack))
                    {
                        from.LocalOverheadMessage(MessageType.Regular, 0x3B2, true, "That must be in your pack");
                    }
                    else
                    {
                        stone.Mark(from);

                        from.PlaySound(0x1FA);
                        Effects.SendLocationEffect(from, from.Map, 14201, 16);
                        m_Powder.Amount = m_Powder.Amount - 1;
                        if (m_Powder.Amount <= 0)
                        {
                            m_Powder.Delete();
                        }
                    }
                }
                else
                {
                    from.SendMessage("Powder of translocation has no effect on this item");                     // Powder of translocation has no effect on this item.
                }
            }