Beispiel #1
0
        /// <summary>
        /// Verifies the player inventory has required items to purchase house
        /// </summary>
        public bool VerifyPurchase(SlumLord slumlord, List <uint> item_ids)
        {
            Console.WriteLine($"{slumlord.Name} ({slumlord.Guid})");
            var buyItems = slumlord.GetBuyItems();

            Console.WriteLine("Required items:");
            foreach (var buyItem in buyItems)
            {
                var stackStr = buyItem.StackSize != null && buyItem.StackSize > 1 ? buyItem.StackSize.ToString() + " " : "";
                Console.WriteLine($"{stackStr}{buyItem.Name}");
            }

            Console.WriteLine("\nSent items:");
            var sentItems = new List <WorldObject>();

            foreach (var item_id in item_ids)
            {
                var item = GetInventoryItem(new ObjectGuid(item_id));
                if (item == null)
                {
                    Console.WriteLine($"Couldn't find inventory item {item_id:X8}");
                    continue;
                }
                var stackStr = item.StackSize != null && item.StackSize > 1 ? item.StackSize.ToString() + " " : "";
                Console.WriteLine($"{stackStr}{item.Name} ({item.Guid})");
                sentItems.Add(item);
            }
            Console.WriteLine();

            // compare list of input items
            // to required items for purchase
            return(HasItems(sentItems, buyItems));
        }
Beispiel #2
0
        /// <summary>
        /// Sets this player as the owner of a house
        /// </summary>
        public void SetHouseOwner(SlumLord slumlord)
        {
            var house = slumlord.House;

            Console.WriteLine($"Setting {Name} as owner of {house.Name}");

            // set player properties
            HouseId                = house.HouseId;
            HouseInstance          = house.Guid.Full;
            HousePurchaseTimestamp = (int)Time.GetUnixTime();

            // set house properties
            house.HouseOwner = Guid.Full;
            house.SaveBiotaToDatabase();

            // relink
            house.UpdateLinks();

            // notify client w/ HouseID
            Session.Network.EnqueueSend(new GameMessageSystemChat("Congratulations!  You now own this dwelling.", ChatMessageType.Broadcast));

            // player slumlord 'on' animation
            slumlord.EnqueueBroadcastMotion(new Motion(MotionStance.Invalid, MotionCommand.On));

            // set house name
            slumlord.Name = $"{Name}'s {slumlord.Name}";
            slumlord.EnqueueBroadcast(new GameMessagePublicUpdatePropertyString(slumlord, PropertyString.Name, slumlord.Name));

            // set house data
            //var house = new HouseData();
            HandleActionQueryHouse();
        }
Beispiel #3
0
        /// <summary>
        /// Sets this player as the owner of a house
        /// </summary>
        public void SetHouseOwner(SlumLord slumlord)
        {
            // set this player as house owner
            Console.WriteLine($"Setting {Name} as owner of {slumlord.Name}");

            HouseId = slumlord.Guid.Full;
            HousePurchaseTimestamp = (int)Time.GetUnixTime();

            // notify client w/ HouseID

            // set house data
            //var house = new HouseData();
            HandleActionQueryHouse();
        }
Beispiel #4
0
        /// <summary>
        /// Sets this player as the owner of a house
        /// </summary>
        public void SetHouseOwner(SlumLord slumlord)
        {
            var house = slumlord.House;

            Console.WriteLine($"Setting {Name} as owner of {house.Name}");

            // set player properties
            HouseId                = house.HouseId;
            HouseInstance          = house.Guid.Full;
            HousePurchaseTimestamp = (int)Time.GetUnixTime();

            // set house properties
            house.HouseOwner = Guid.Full;
            house.SaveBiotaToDatabase();

            // notify client w/ HouseID

            // set house data
            //var house = new HouseData();
            HandleActionQueryHouse();
        }