Exemplo n.º 1
0
        /// <summary>
        /// Kills the given Mobile
        /// </summary>
        /// <param name="m">Mobile to kill</param>
        /// <param name="packToBank">true to move the Mobile's items to the bank</param>
        /// <param name="createTimedCorpse">true to create a temporary corpse</param>
        /// <param name="deleteCorpse">true to delete the Mobile's corpse after death</param>
        public virtual void Kill(Mobile m, bool packToBank, bool createTimedCorpse, bool deleteCorpse)
        {
            if (m == null)
            {
                return;
            }

            if (packToBank)
            {
                PackToBank(m);
            }

            if (createTimedCorpse)
            {
                _timedCorpse = new TimedItem(120.0, Utility.Random(0xECA, 8));
                _timedCorpse.MoveToWorld(m.Location, m.Map);
            }

            m.Kill();

            if (deleteCorpse && m.Corpse != null)
            {
                m.Corpse.Delete();
            }
        }
            public override IEnumerator Consume(int partialCount, string type, object properties)
            {
                base.type      = type;
                item           = new TimedItem(timeToLive);
                item.Id        = new CPMMOItemId(client.generateMMOItemId(), CPMMOItemId.CPMMOItemParent.WORLD);
                item.CreatorId = client.clubPenguinClient.PlayerSessionId;
                item.Type      = type;
                ConsumableMMODeployedEvent data = default(ConsumableMMODeployedEvent);

                data.SessionId    = client.clubPenguinClient.PlayerSessionId;
                data.ExperienceId = item.Id.Id;
                Vector3 vecPosition = Vector3.zero;

                if (properties is Vector3)
                {
                    vecPosition = (Vector3)properties;
                }
                CPMMOItemPosition position = default(CPMMOItemPosition);

                position.Id       = item.Id;
                position.Position = vecPosition;
                yield return(null);

                client.processEvent(GameServerEvent.CONSUMABLE_MMO_DEPLOYED, data);
                yield return(base.Consume(partialCount, type, properties));

                yield return(null);

                client.processEvent(GameServerEvent.SERVER_ITEM_ADDED, item);
                yield return(null);

                client.processEvent(GameServerEvent.SERVER_ITEM_MOVED, position);
                client.activeConsumables.Add(this);
                yield return(countDown());
            }
Exemplo n.º 3
0
        /// <summary>
        /// Adds a start record for a task.
        /// </summary>
        /// <param name="tag">Task tag.</param>
        public void StartTask(string tag)
        {
            TimedItem ti = new TimedItem(tag, mIndentLevel);

            mItems.Insert(mInsertPoint, ti);
            mIndentLevel++;
        }
Exemplo n.º 4
0
        public void Disintegrate(Mobile m)
        {
            TimedItem dust = new TimedItem(300.0, 0xF91);

            dust.Hue  = 934;
            dust.Name = String.Format("the charred remains of {0}", m.RawName);
            dust.MoveToWorld(m.Location, m.Map);

            TimedItem scatterings = new TimedItem(300.0, 0xF35);

            scatterings.Hue  = 934;
            scatterings.Name = "burnt dust scatterings";
            scatterings.MoveToWorld(m.Location, m.Map);

            if (m.Body.IsHuman)
            {
                TimedItem gore = new TimedItem(300.0, Utility.Random(0x1D9F, 5));
                gore.Hue  = 1140;
                gore.Name = String.Format("a charred piece of {0}", m.RawName);
                gore.MoveToWorld(m.Location, m.Map);
            }

            Effects.PlaySound(m.Location, m.Map, 0x307);
            Effects.SendLocationEffect(m.Location, m.Map, 14000, 10, 934, 0);

            Kill(m, true, false, true);

            m.SendMessage("You have been disintegrated. All of your belongings have been placed in your bankbox.");
        }
Exemplo n.º 5
0
        /// <summary>
        /// Closes out a record.  The tag must match the most recently started task.
        /// </summary>
        /// <param name="tag">Task tag.</param>
        public void EndTask(string tag)
        {
            TimedItem lastItem = mItems[mInsertPoint];

            if (lastItem.mTag != tag)
            {
                Debug.WriteLine("ERROR: tag mismatch: " + tag + " vs. " + lastItem.mTag);
                Debug.Assert(false);
                return;
            }

            lastItem.mEndWhen = DateTime.Now;
            mIndentLevel--;
            mInsertPoint++;
            Debug.Assert(mIndentLevel >= 0);
        }
Exemplo n.º 6
0
        /// <summary>
        /// Formats the specified item, appending it to the StringBuilder.
        /// </summary>
        /// <param name="ti">Item to format.</param>
        /// <param name="lastIndent">Previous indentation level.</param>
        /// <param name="sb">StringBuilder to append to.</param>
        private void FormatItem(TimedItem ti, ref int lastIndent, StringBuilder sb)
        {
            for (int i = 0; i <= ti.mIndentLevel - 1; i++)
            {
                sb.Append("| ");
            }
            if (lastIndent < ti.mIndentLevel)
            {
                //sb.Append("/-");
                sb.Append("/ ");
            }
            else   /*if (lastIndent == ti.mIndentLevel)*/
            {
                sb.Append("| ");
            }
            sb.Append(ti.mTag);
            sb.Append(": ");
            sb.Append((ti.mEndWhen - ti.mStartWhen).TotalMilliseconds.ToString());
            sb.Append(" ms");

            lastIndent = ti.mIndentLevel;
        }
Exemplo n.º 7
0
    private static ConsumableItem createConsumableItem(IMMOItem sfsItem)
    {
        string         stringValue = sfsItem.GetVariable(SocketItemVars.TEMPLATE.GetKey()).GetStringValue();
        ConsumableItem consumableItem;

        switch (stringValue)
        {
        case "timed":
            consumableItem = new TimedItem(sfsItem);
            break;

        case "actioned":
            consumableItem = new ActionedItem(sfsItem);
            break;

        default:
            consumableItem = new ConsumableItem();
            Log.LogError(typeof(CPMMOItem), "Unknown consumable template: " + stringValue);
            break;
        }
        consumableItem.Type = sfsItem.GetVariable(SocketItemVars.TYPE.GetKey()).GetStringValue();
        return(consumableItem);
    }