Example #1
0
        public Light(Light light)
            : base(light)
        {
            //this.name = light.name;
            //this.description = light.description;

            //this.weight = light.weight;

            //this.spawnX = light.spawnX;
            //this.spawnY = light.spawnY;
            //this.spawnZ = light.spawnZ;

            //this.spawntime = light.spawntime;
            //this.respawnCounter = light.respawnCounter;

            //this.expireCounter = 0;

            //this.spawnable = light.spawnable;
            //this.expirable = light.expirable;
            //this.spawned = light.spawned;

            //this.refNames = light.refNames;
            //this.expirableItemList = light.expirableItemList;

            this.totalFuel = light.totalFuel;
            this.currentFuel = light.currentFuel;

            this.isLit = false;
            //this.fuelTimer = new Timer();

            //this.fuelTimer.Elapsed += new ElapsedEventHandler(fuelTimer_Elapsed);
        }
Example #2
0
        public void initialize(object e)
        {
            this.clientStream = tcpClient.GetStream();
            this.encoder = new ASCIIEncoding();

            this.enteringName = true;
            this.writeToClient(colorizer.Colorize("Welcome to my MUD\r\nWhat is your name, traveller? ", "yellow"));

            while (!this.mainGame)
            {
                string tempName = readFromClient();

                if (tempName != null && tempName != "")
                {

                    var playerQuery =
                        (from playercharacter in db.PlayerCharacters
                        where playercharacter.PlayerName.ToString().ToLower() == tempName.ToLower()
                        select playercharacter).ToList();

                    if (playerQuery.Count == 1) //player exists, we should request password
                    {
                        //make sure the player isn't already connected
                        bool alreadyConnected = false;
                        Monitor.TryEnter(playerlock, 3000);
                        try
                        {
                            var playerAlreadyConnectedQuery = (from player in players
                                                              where player.name.ToLower() == tempName.ToLower()
                                                              select player).FirstOrDefault();
                            if (playerAlreadyConnectedQuery != null)
                            {
                                alreadyConnected = true;
                            }
                        }
                        catch (Exception ex)
                        {
                            Debug.Print(ex.Message);
                            Debug.Print(ex.StackTrace);
                        }
                        finally
                        {
                            Monitor.Exit(playerlock);
                        }

                        if (alreadyConnected)
                        {
                            this.writeToClient(colorizer.Colorize("Sorry, this character is already connected to the game.\r\n", "red") + colorizer.Colorize("If you own this character and believe that it shouldn't be connected or may have been stolen, please contact game administrators.\r\n", "reset"));
                            this.Disconnect();
                        }
                        else
                        {
                            this.enteringName = false;

                            int passwordAttempts = 0;
                            bool successfullogin = false;

                            this.enteringPassword = true;
                            do
                            {
                                this.writeToClient("Please enter your password: "******"INCORRECT PASSWORD", "red") + colorizer.Colorize("Please re-enter your password", "reset"));
                                    passwordAttempts++;

                                }
                            }
                            while (passwordAttempts < 4 && successfullogin == false);

                            if (successfullogin)
                            {
                                //TODO: add the rest of the init logic
                                this.enteringPassword = false;

                                this.name = playerQuery[0].PlayerName.ToString();
                                this.connected = true;
                                this.OnPlayerConnected(new PlayerConnectedEventArgs(this.name));

                                Monitor.TryEnter(playerlock, 3000);
                                try
                                {
                                    this.players.CollectionChanged += playerListUpdated;
                                }
                                catch (Exception ex)
                                {
                                    Console.WriteLine(this.name);
                                    Console.WriteLine("Error: " + ex.Message);
                                    Console.WriteLine("Trace: " + ex.StackTrace);
                                }
                                finally
                                {
                                    Monitor.Exit(playerlock);
                                }

                                //subscribing to events for players that are already logged in
                                foreach (Player player in players)
                                {
                                    Monitor.TryEnter(playerlock, 5000);
                                    try
                                    {
                                        if (player != this) //don't need to subscribe to events about ourselves, do we?
                                        {
                                            player.PlayerConnected += this.HandlePlayerConnected;
                                            player.PlayerMoved += this.HandlePlayerMoved;
                                            player.PlayerDisconnected += this.HandlePlayerDisconnected;
                                            player.PlayerFled += this.HandlePlayerFled;
                                            player.PlayerFleeFail += this.HandlePlayerFleeFail;
                                            player.AttackedAndHit += this.HandleAttackedAndHit;
                                            player.AttackedAndDodge += this.HandleAttackedAndDodge;
                                            player.Died += this.HandlePlayerDied;
                                            player.Attack += this.HandlePlayerAttack;
                                        }
                                    }
                                    catch (Exception ex)
                                    {
                                        writeToClient("Error: " + ex.Message);
                                        writeToClient("Trace: " + ex.StackTrace);
                                    }
                                    finally
                                    {
                                        Monitor.Exit(playerlock);
                                    }
                                }

                                //subscribing to events for NPCs
                                foreach (NPC npc in npcs)
                                {
                                    Monitor.TryEnter(npclock, 5000);
                                    try
                                    {
                                        npc.NPCFled += this.HandleNPCFled;
                                        npc.NPCMoved += this.HandleNPCMoved;
                                        npc.NPCFleeFail += this.HandleNPCFleeFail;
                                        npc.AttackedAndHit += this.HandleAttackedAndHit;
                                        npc.Died += this.HandleNPCDied;
                                        npc.NPCSpawned += this.HandleNPCSpawned;
                                        npc.AttackedAndDodge += this.HandleAttackedAndDodge;
                                    }
                                    catch (Exception ex)
                                    {
                                        writeToClient("Error: " + ex.Message);
                                        writeToClient("Trace: " + ex.StackTrace);
                                    }
                                    finally
                                    {
                                        Monitor.Exit(npclock);
                                    }
                                }

                                this.mainGame = true;

                                this.x = playerQuery[0].X;
                                this.y = playerQuery[0].Y;
                                this.z = playerQuery[0].Z;

                                this.level = playerQuery[0].Level;

                                this.strength = playerQuery[0].Strength;
                                this.agility = playerQuery[0].Agility;
                                this.constitution = playerQuery[0].Constitution;
                                this.intelligence = playerQuery[0].Intelligence;
                                this.learning = playerQuery[0].Learning;

                                this.totalExperience = playerQuery[0].TotalExperience;
                                this.currentLevelExp = playerQuery[0].ExpThisLevel;

                                this.maxCarryWeight = this.strength * 11.5;

                                var itemsQuery = (from item in db.InventoryItems
                                                  where item.PlayerName.ToLower() == this.name.ToLower()
                                                  select item).ToList();

                                foreach (InventoryItem item in itemsQuery)
                                {
                                    dynamic tempitem = null;

                                    //adding all the general inventory items from the database back into a player's general inventory
                                    switch (item.InventoryItemStatus.InventoryItemStatusName)
                                    {
                                        //the case for items that are coded for "general inventory".  This must contain **ALL** created item types
                                        case "generalinventory":
                                            switch (item.ItemType)
                                            {
                                                case "MUDAdventure.Items.Weapons.Dagger":
                                                    //Dagger tempdag = new Dagger(item.ItemName, item.ItemDescription, item.ItemWeight, 0, 0, 0, 0, false, new List<string>(item.ItemRefNames.Split(',')), this.expirableItemList, item.ItemDamage, item.ItemSpeed);
                                                    tempitem = new Dagger();

                                                    if (item.ItemDamage.HasValue)
                                                    {
                                                        tempitem.Damage = Convert.ToInt32(item.ItemDamage);
                                                    }

                                                    if (item.ItemSpeed.HasValue)
                                                    {
                                                        tempitem.Speed = Convert.ToInt32(item.ItemSpeed);
                                                    }
                                                    break;
                                                case "MUDAdventure.Items.Light":
                                                    tempitem = new Light();

                                                    if (item.ItemCurrentFuel.HasValue)
                                                    {
                                                        tempitem.CurrentFuel = Convert.ToInt32(item.ItemCurrentFuel);
                                                    }

                                                    if (item.ItemTotalFuel.HasValue)
                                                    {
                                                        tempitem.TotalFuel = Convert.ToInt32(item.ItemTotalFuel);
                                                    }
                                                    break;
                                                case "MUDAdventure.Items.Apparel.Headwear":
                                                    tempitem = new Headwear();

                                                    if (item.ItemArmorValue.HasValue)
                                                    {
                                                        tempitem.ArmorValue = Convert.ToInt32(item.ItemArmorValue);
                                                    }
                                                    break;
                                                case "MUDAdventure.Items.Apparel.Shirt":
                                                    tempitem = new Shirt();

                                                    if (item.ItemArmorValue.HasValue)
                                                    {
                                                        tempitem.ArmorValue = Convert.ToInt32(item.ItemArmorValue);
                                                    }
                                                    break;
                                                case "MUDAdventure.Items.Apparel.Gloves":
                                                    tempitem = new Gloves();

                                                    if (item.ItemArmorValue.HasValue)
                                                    {
                                                        tempitem.ArmorValue = Convert.ToInt32(item.ItemArmorValue);
                                                    }
                                                    break;
                                                case "MUDAdventure.Items.Apparel.Pants":
                                                    tempitem = new Pants();

                                                    if (item.ItemArmorValue.HasValue)
                                                    {
                                                        tempitem.ArmorValue = Convert.ToInt32(item.ItemArmorValue);
                                                    }
                                                    break;
                                                case "MUDAdventure.Items.Apparel.Boots":
                                                    tempitem = new Boots();

                                                    if (item.ItemArmorValue.HasValue)
                                                    {
                                                        tempitem.ArmorValue = Convert.ToInt32(item.ItemArmorValue);
                                                    }
                                                    break;
                                            }

                                            tempitem.Name = item.ItemName;
                                            tempitem.Description = item.ItemDescription;
                                            tempitem.Weight = item.ItemWeight;
                                            tempitem.Expirable = true;
                                            tempitem.RefNames = new List<string>(item.ItemRefNames.Split(','));

                                            this.inventory.AddItem(tempitem);

                                            break;

                                        //case for items that are coded "wielded".  This only needs to contain logic for descendants of class Weapon
                                        case "wielded":
                                            switch (item.ItemType)
                                            {
                                                case "MUDAdventure.Items.Weapons.Dagger":
                                                    tempitem = new Dagger();

                                                    if (item.ItemDamage.HasValue)
                                                    {
                                                        tempitem.Damage = Convert.ToInt32(item.ItemDamage);
                                                    }

                                                    if (item.ItemSpeed.HasValue)
                                                    {
                                                        tempitem.Speed = Convert.ToInt32(item.ItemSpeed);
                                                    }

                                                    break;
                                                case "MUDAdventure.Items.Weapons.Sword":
                                                    tempitem = new Sword();

                                                    if (item.ItemDamage.HasValue)
                                                    {
                                                        tempitem.Damage = Convert.ToInt32(item.ItemDamage);
                                                    }

                                                    if (item.ItemSpeed.HasValue)
                                                    {
                                                        tempitem.Speed = Convert.ToInt32(item.ItemSpeed);
                                                    }

                                                    break;
                                                case "MUDAdventure.Items.Weapons.Axe":
                                                    tempitem = new Axe();

                                                    if (item.ItemDamage.HasValue)
                                                    {
                                                        tempitem.Damage = Convert.ToInt32(item.ItemDamage);
                                                    }

                                                    if (item.ItemSpeed.HasValue)
                                                    {
                                                        tempitem.Speed = Convert.ToInt32(item.ItemSpeed);
                                                    }

                                                    break;

                                            }

                                            tempitem.Name = item.ItemName;
                                            tempitem.Description = item.ItemDescription;
                                            tempitem.Weight = item.ItemWeight;
                                            tempitem.Expirable = true;
                                            tempitem.RefNames = new List<string>(item.ItemRefNames.Split(','));

                                            this.inventory.Wielded = tempitem;

                                            break;
                                        case "light":
                                            Light templight = new Light();
                                            templight.Name = item.ItemName;
                                            templight.Description = item.ItemDescription;
                                            templight.Weight = item.ItemWeight;
                                            templight.Expirable = true;
                                            templight.RefNames = new List<string>(item.ItemRefNames.Split(','));
                                            if (item.ItemTotalFuel.HasValue)
                                            {
                                                templight.TotalFuel = Convert.ToInt32(item.ItemTotalFuel);
                                            }

                                            if (item.ItemCurrentFuel.HasValue)
                                            {
                                                templight.CurrentFuel = Convert.ToInt32(item.ItemCurrentFuel);
                                            }

                                            this.inventory.Light = templight;
                                            break;
                                        case "head":
                                            tempitem = new Headwear();
                                            tempitem.Name = item.ItemName;
                                            tempitem.Description = item.ItemDescription;
                                            tempitem.Weight = item.ItemWeight;
                                            tempitem.Expirable = true;
                                            tempitem.RefNames = new List<string>(item.ItemRefNames.Split(','));
                                            if (item.ItemArmorValue.HasValue)
                                            {
                                                tempitem.ArmorValue = Convert.ToInt32(item.ItemArmorValue);
                                            }

                                            this.inventory.Head = tempitem;

                                            break;
                                        case "torso":
                                            tempitem = new Shirt();
                                            tempitem.Name = item.ItemName;
                                            tempitem.Description = item.ItemDescription;
                                            tempitem.Weight = item.ItemWeight;
                                            tempitem.Expirable = true;
                                            tempitem.RefNames = new List<string>(item.ItemRefNames.Split(','));
                                            if (item.ItemArmorValue.HasValue)
                                            {
                                                tempitem.ArmorValue = Convert.ToInt32(item.ItemArmorValue);
                                            }

                                            this.inventory.Shirt = tempitem;

                                            break;
                                        case "hands":
                                            tempitem = new Gloves();
                                            tempitem.Name = item.ItemName;
                                            tempitem.Description = item.ItemDescription;
                                            tempitem.Weight = item.ItemWeight;
                                            tempitem.Expirable = true;
                                            tempitem.RefNames = new List<string>(item.ItemRefNames.Split(','));
                                            if (item.ItemArmorValue.HasValue)
                                            {
                                                tempitem.ArmorValue = Convert.ToInt32(item.ItemArmorValue);
                                            }

                                            this.inventory.Gloves = tempitem;

                                            break;
                                        case "legs":
                                            tempitem = new Pants();
                                            tempitem.Name = item.ItemName;
                                            tempitem.Description = item.ItemDescription;
                                            tempitem.Weight = item.ItemWeight;
                                            tempitem.Expirable = true;
                                            tempitem.RefNames = new List<string>(item.ItemRefNames.Split(','));
                                            if (item.ItemArmorValue.HasValue)
                                            {
                                                tempitem.ArmorValue = Convert.ToInt32(item.ItemArmorValue);
                                            }

                                            this.inventory.Pants = tempitem;

                                            break;
                                        case "feet":
                                            tempitem = new Boots();
                                            tempitem.Name = item.ItemName;
                                            tempitem.Description = item.ItemDescription;
                                            tempitem.Weight = item.ItemWeight;
                                            tempitem.Expirable = true;
                                            tempitem.RefNames = new List<string>(item.ItemRefNames.Split(','));
                                            if (item.ItemArmorValue.HasValue)
                                            {
                                                tempitem.ArmorValue = Convert.ToInt32(item.ItemArmorValue);
                                            }

                                            this.inventory.Boots = tempitem;

                                            break;

                                    }
                                }
                            }
                            else if (passwordAttempts > 3)
                            {
                                this.writeToClient("Password authentication failed too many times.");
                                this.Disconnect();
                            }
                            else
                            {
                                this.writeToClient("Unspecified login failure.");
                                this.Disconnect();
                            }
                        }
                    }
                    else if (playerQuery.Count > 1)
                    {
                        //UHHH, this shouldn't ever happen and is probably a bad thing.
                        this.writeToClient("An error occured from duplicate entries in our character database.\r\nAdministrators have been notified.  Please be patient as we correct this.");
                        string errormessage = "Possible duplicate entries in character database: ";
                        foreach (var player in playerQuery)
                        {
                            errormessage += player.PlayerName.ToString() + "\r\n";
                        }

                        this.Disconnect();
                    }
                    else
                    {
                        tempName = tempName[0].ToString().ToUpper() + tempName.Substring(1).ToLower();
                        //TODO: filter unsuitable names with profanity, numbers, etc.

                        this.writeToClient("This character does not seem to exist.  Would you like to create a character with the name " + tempName + "? (Y/N)");

                        if (this.readFromClient().ToLower() == "y")
                        {
                            //we'll create a new character then
                            PlayerCharacter newPlayer = new PlayerCharacter();
                            newPlayer.PlayerName = tempName;

                            bool match = false;

                            do
                            {
                                this.writeToClient("Please enter your desired password:"******"Please re-enter your desired password:"******"Your password and password confirmation did not match. Please try again.");
                                }
                            } while (!match);

                            int tempStrength, tempAgility, tempIntelligence, tempLearning, tempConstitution;

                            do
                            {
                                tempStrength = rand.Next(10, 25);
                                tempAgility = rand.Next(10, 25);
                                tempIntelligence = rand.Next(10, 25);
                                tempLearning = rand.Next(10, 25);
                                tempConstitution = rand.Next(10, 25);

                                this.writeToClient("Your stats are STR:" + tempStrength.ToString() + "AGI:" + tempAgility.ToString() + "INT:" + tempIntelligence.ToString() + "LEA:" + tempLearning.ToString() + "CON:" + tempConstitution.ToString());
                                this.writeToClient("Are these stats acceptable? (Y/N)");

                            } while (this.readFromClient().ToLower() != "y");

                            newPlayer.Strength = tempStrength;
                            newPlayer.Agility = tempAgility;
                            newPlayer.Intelligence = tempIntelligence;
                            newPlayer.Learning = tempLearning;
                            newPlayer.Constitution = tempConstitution;

                            newPlayer.X = 0;
                            newPlayer.Y = 0;
                            newPlayer.Z = 0;

                            newPlayer.Level = 1;

                            //TODO: insert real EXP til next value here once i calculate the experience progression
                            newPlayer.ExpThisLevel = 0;
                            newPlayer.TotalExperience = 0;

                            try
                            {
                                this.db.PlayerCharacters.InsertOnSubmit(newPlayer);
                                this.db.SubmitChanges();

                                this.writeToClient("Character created and saved to database.");

                                this.name = tempName;

                                this.connected = true;
                                this.mainGame = true;

                                this.x = newPlayer.X;
                                this.y = newPlayer.Y;
                                this.z = newPlayer.Z;

                                this.level = newPlayer.Level;
                                //this.expUntilNext = newPlayer.ExpUntilNext;

                                this.strength = newPlayer.Strength;
                                this.agility = newPlayer.Agility;
                                this.constitution = newPlayer.Constitution;
                                this.intelligence = newPlayer.Intelligence;
                                this.learning = newPlayer.Learning;

                                currentRoom = rooms[this.x.ToString() + "," + this.y.ToString() + "," + this.z.ToString()];
                            }
                            catch (Exception ex)
                            {
                                Console.WriteLine("Error: " + ex.Message);
                                Console.WriteLine("Trace: " + ex.StackTrace);
                            }
                        }
                        else
                        {
                            this.writeToClient("Very well.  By what name would you like to be known then?");
                        }
                    }
                }
            }

            currentRoom = rooms[this.x.ToString() + "," + this.y.ToString() + "," + this.z.ToString()];

            //TODO: replace with loading player's stats from db
            //stats = stats;
            this.totalMoves = 10;
            this.currentMoves = this.totalMoves;
            this.totalHitpoints = 10;
            this.currentHitpoints = this.totalHitpoints;

            //TODO: add some logic to check if the authoer has created any learnable skills that may affect maxcarryweight
            this.maxCarryWeight = this.strength * 11.5;

            //timer stuff for regen-ing player health based on
            this.healthRegen = new System.Timers.Timer();
            this.healthRegen.Elapsed += new ElapsedEventHandler(healthRegen_Elapsed);

            //TODO: insert code here to check if the author has created any learnable skills that may affect the regen rate
            this.healthRegen.Interval = Math.Round(60000.0 / (double)this.constitution);
            this.healthRegen.Enabled = true;
            this.healthRegen.Start();

            this.Look();

            this.InputLoop();
        }
Example #3
0
        private void Take(string args)
        {
            if (!this.isNight || this.currentRoom.LightedRoom || this.inventory.Light != null)
            {
                var itemQuery = (from item in this.itemList
                                 //from expitem in this.expirableItemList
                                 where item.RefNames.Contains(args) && item.X == this.x && item.Y == this.y && item.Z == this.z //|| (expitem.RefNames.Contains(args) && expitem.X == this.x && expitem.Y == this.y && expitem.Z == this.z)
                                 select item).ToList();
                itemQuery.AddRange((from expitem in this.expirableItemList
                              where expitem.RefNames.Contains(args) && expitem.X == this.x && expitem.Y == this.y && expitem.Z == this.z
                              select expitem).ToList());

                if (itemQuery.Any())
                {
                    dynamic tempitem = null;

                    if ((itemQuery.First().Weight + this.inventory.Weight) <= this.maxCarryWeight)
                    {
                        switch (itemQuery.First().GetType().ToString())
                        {
                            case "MUDAdventure.Items.Dagger":
                                tempitem = new Dagger(itemQuery.First().Name, itemQuery.First().Description, itemQuery.First().Weight, this.x, this.y, this.z, true, itemQuery.First().RefNames, ref this.expirableItemList, itemQuery.First().ToDagger().Damage, itemQuery.First().ToDagger().Speed);
                                break;
                            case "MUDAdventure.Items.Light":
                                tempitem = new Light(itemQuery.First().Name, itemQuery.First().Description, itemQuery.First().Weight, this.x, this.y, this.z, true, itemQuery.First().RefNames, ref this.expirableItemList, itemQuery.First().ToLight().CurrentFuel, itemQuery.First().ToLight().TotalFuel);
                                break;
                            case "MUDAdventure.Items.Headwear":
                                tempitem = new Headwear(itemQuery.First().Name, itemQuery.First().Description, itemQuery.First().Weight, this.x, this.y, this.z, true, itemQuery.First().RefNames, ref this.expirableItemList, itemQuery.First().ToHeadwear().ArmorValue);
                                break;
                            case "MUDAdventure.Items.Shirt":
                                tempitem = new Shirt(itemQuery.First().Name, itemQuery.First().Description, itemQuery.First().Weight, this.x, this.y, this.z, true, itemQuery.First().RefNames, ref this.expirableItemList, itemQuery.First().ToShirt().ArmorValue);
                                break;
                            case "MUDAdventure.Items.Gloves":
                                tempitem = new Gloves(itemQuery.First().Name, itemQuery.First().Description, itemQuery.First().Weight, this.x, this.y, this.z, true, itemQuery.First().RefNames, ref this.expirableItemList, itemQuery.First().ToGloves().ArmorValue);
                                break;
                            case "MUDAdventure.Items.Pants":
                                tempitem = new Pants(itemQuery.First().Name, itemQuery.First().Description, itemQuery.First().Weight, this.x, this.y, this.z, true, itemQuery.First().RefNames, ref this.expirableItemList, itemQuery.First().ToPants().ArmorValue);
                                break;
                            case "MUDAdventure.Items.Boots":
                                tempitem = new Boots(itemQuery.First().Name, itemQuery.First().Description, itemQuery.First().Weight, this.x, this.y, this.z, true, itemQuery.First().RefNames, ref this.expirableItemList, itemQuery.First().ToBoots().ArmorValue);
                                break;
                        }

                        this.inventory.AddItem(tempitem);

                        if (itemQuery.First().Expirable)
                        {
                            expirableItemList.Remove(itemQuery.First());
                        }

                        this.writeToClient("You pick up " + itemQuery.First().Name + ".\r\n");
                        itemQuery.First().PickedUp();
                    }
                    else
                    {
                        this.writeToClient("That item is too heavy for you to carry.\r\n");
                    }
                }
                else
                {
                    this.writeToClient("That item isn't here.\r\n");
                }
            }
            else
            {
                this.writeToClient("It's too dark to see.\r\n");
            }
        }
Example #4
0
        private void Drop(string args)
        {
            var itemQuery = (from item in this.inventory.ListInventory()
                             where item.RefNames.Contains(args)
                             select item).ToList();

            if (itemQuery.Any())
            {
                dynamic tempitem = null;

                switch (itemQuery.First().GetType().ToString())
                {
                    case "MUDAdventure.Items.Dagger":
                        tempitem = new Dagger(itemQuery.First().Name, itemQuery.First().Description, itemQuery.First().Weight, this.x, this.y, this.z, true, itemQuery.First().RefNames, ref this.expirableItemList, itemQuery.First().ToDagger().Damage, itemQuery.First().ToDagger().Speed);
                        break;
                    case "MUDAdventure.Items.Light":
                        tempitem = new Light(itemQuery.First().Name, itemQuery.First().Description, itemQuery.First().Weight, this.x, this.y, this.z, true, itemQuery.First().RefNames, ref this.expirableItemList, itemQuery.First().ToLight().CurrentFuel, itemQuery.First().ToLight().TotalFuel);
                        break;
                    case "MUDAdventure.Items.Headwear":
                        tempitem = new Headwear(itemQuery.First().Name, itemQuery.First().Description, itemQuery.First().Weight, this.x, this.y, this.z, true, itemQuery.First().RefNames, ref this.expirableItemList, itemQuery.First().ToHeadwear().ArmorValue);
                        break;
                    case "MUDAdventure.Items.Shirt":
                        tempitem = new Shirt(itemQuery.First().Name, itemQuery.First().Description, itemQuery.First().Weight, this.x, this.y, this.z, true, itemQuery.First().RefNames, ref this.expirableItemList, itemQuery.First().ToShirt().ArmorValue);
                        break;
                    case "MUDAdventure.Items.Gloves":
                        tempitem = new Gloves(itemQuery.First().Name, itemQuery.First().Description, itemQuery.First().Weight, this.x, this.y, this.z, true, itemQuery.First().RefNames, ref this.expirableItemList, itemQuery.First().ToGloves().ArmorValue);
                        break;
                    case "MUDAdventure.Items.Pants":
                        tempitem = new Pants(itemQuery.First().Name, itemQuery.First().Description, itemQuery.First().Weight, this.x, this.y, this.z, true, itemQuery.First().RefNames, ref this.expirableItemList, itemQuery.First().ToPants().ArmorValue);
                        break;
                    case "MUDAdventure.Items.Boots":
                        tempitem = new Boots(itemQuery.First().Name, itemQuery.First().Description, itemQuery.First().Weight, this.x, this.y, this.z, true, itemQuery.First().RefNames, ref this.expirableItemList, itemQuery.First().ToBoots().ArmorValue);
                        break;
                    default:
                        break;
                }

                Monitor.TryEnter(expirableitemlock, 3000);
                try
                {
                    this.expirableItemList.Add(tempitem);
                }
                catch (Exception ex)
                {
                    Debug.Print(ex.Message);
                    Debug.Print(ex.StackTrace);
                }

                writeToClient("You drop " + itemQuery.First().Name);
                this.inventory.RemoveItem(itemQuery.First());
            }
            else
            {
                this.writeToClient("You're not carrying any such item.\r\n");
            }
        }