Exemple #1
0
        public void SetGroundItemsToActionPanel()
        {
            // get the items from the ground grid, and create a new item
            if (groundItems != null &&
                groundItems.Count > 0)
            {
                // create a new item drop object
                RPGDrop newDrop = new RPGDrop();
                int     X       = thisActor.Location.X;
                int     Y       = thisActor.Location.Y + 40; // +40 to look like ground.
                newDrop.Location = new Point(X, Y);

                for (int i = groundItems.Count - 1; i >= 0; i--)
                {
                    // get each item from the ground collection
                    RPGObject obj = groundItems[i] as RPGObject;

                    // set its location to the current actor
                    obj.Location = newDrop.Location;

                    // add it to the drop item
                    newDrop.AddItem(obj);

                    // and remove this item from the groundItems collection
                    groundItems.Remove(obj);
                }
                // add the item to the actionPanel's items.
                Session.thisSession.thisArea.AddObject(newDrop);
            }
        }
        public void LoadDrop(RPGDrop d)
        {
            //Labels
            lblName.Text = "Item bag";
            lblHP.Text   = "contains " + d.GetItems().Length + " item";
            if (d.GetItems().Length > 1)
            {
                lblHP.Text += "s";
            }
            lblMP.Text     = "";
            lblAttDef.Text = "";

            // Buttons
        }
Exemple #3
0
        private void ApplyDeath()
        {
            // die.
            Session.Print(this.Name + " has died.");

            this.currentState = ActionState.Dying;

            // drop actor's items to ground.
            RPGDrop drop = new RPGDrop();

            drop.X = this.X + this.Width / 2 - drop.Width / 2;
            drop.Y = this.Y + this.Height / 2;

            for (int i = 0; i < Enum.GetValues(typeof(Inventory.BodySlot)).Length; i++)
            {
                if (inventory.GetBodyItem(i) != null)
                {
                    drop.AddItem(inventory.GetBodyItem(i));
                }
            }
            for (int i = 0; i < Inventory.PACK_SIZE; i++)
            {
                if (inventory.GetPackItem(i) != null)
                {
                    drop.AddItem(inventory.GetPackItem(i));
                }
            }

            Session.thisSession.thisArea.AddObject(drop);

            // now give exp points to killer.
            if (this.AI.lastAttacker != null)
            {
                this.AI.lastAttacker.ExpAdjust(this.ExpForKill);
            }
        }