Esempio n. 1
0
        // generates a random item from given type category.
        // we can also set a difficulty mode parameter here, but it seems current db doesnt have nightmare or hell-mode items with valid snoId's /raist.
        public static Item GenerateRandom(Player player, ItemType type)
        {
            var validDefinitions = ItemDefinitions[type].Where(definition => definition.SNOId != 0).ToList(); // only find item definitions with snoId!=0 for given itemtype.
            var itemDefinition = GetRandom(validDefinitions);

            return CreateItem(player, itemDefinition);
        }
Esempio n. 2
0
         /// <summary>
        /// Refreshes the visual appearance of the hero
        /// </summary>
        public void SendVisualInvetory(Player player)
         {
             var message = new VisualInventoryMessage()
                               {
                                   ActorID = this._owner.DynamicID,
                                   EquipmentList = new VisualEquipment()
                                                       {
                                                           Equipment = this._equipment.GetVisualEquipment()
                                                       },
                               };

             player.InGameClient.SendMessage(message);             
         }
Esempio n. 3
0
        private uint[] _equipment;      // array of equiped items_id  (not item)

        public Equipment(Player owner){
            this._equipment = new uint[16];
            this._inventoryGold = null;           
            this._owner = owner;
        }
Esempio n. 4
0
        // Creates an item based on supplied definition.
        public static Item CreateItem(Player player, ItemDefinition definition)
        {
            Logger.Trace("Creating item: {0} [type: {1}, mode: {2}, sno:{3}, gbid {4}]", definition.Name,
                         definition.Type, definition.DifficultyMode, definition.SNOId, definition.GBId);

            var item = new Item(player.World, definition.SNOId, definition.GBId, definition.Type);
            player.GroundItems[item.DynamicID] = item;

            var attributeCreators = new AttributeCreatorFactory().Create(definition.Type);
            foreach (IItemAttributeCreator creator in attributeCreators)
            {
                creator.CreateAttributes(item);
            }

            return item;
        }
Esempio n. 5
0
 // generates a random item from given type category.
 // we can also set a difficulty mode parameter here, but it seems current db doesnt have nightmare or hell-mode items with valid snoId's /raist.
 public static Item GenerateRandom(Player player, ItemType type)
 {
     var validDefinitions = ItemDefinitions[type].Where(definition => definition.SNOId != 0).ToList(); // only find item definitions with snoId!=0.
     var itemDefinition = validDefinitions[RandomHelper.Next(0, validDefinitions.Count() - 1)];
     return CreateItem(player, itemDefinition);
 }
Esempio n. 6
0
 // generates a random item.
 public static Item GenerateRandom(Player player)
 {
     var itemDefinition = ValidDefinitions[RandomHelper.Next(0, ValidDefinitions.Count() - 1)];
     return CreateItem(player, itemDefinition);
 }
Esempio n. 7
0
        public static Item CreateGold(Player player, int amount)
        {
            var item = Cook(player, "Gold1", 0x00000178, ItemType.Gold);
            item.Attributes[GameAttribute.Gold] = amount;

            GameAttributeMap map = new GameAttributeMap();
            map[GameAttribute.Gold] = amount;
            map.SendMessage(player.InGameClient, item.DynamicID);
            return item;
        }
Esempio n. 8
0
        // Allows cooking a custom item.
        public static Item Cook(Player player, string name, int snoId, ItemType type)
        {
            var item = new Item(player.World, snoId, StringHashHelper.HashItemName(name), type);
            player.GroundItems[item.DynamicID] = item;

            var attributeCreators = new AttributeCreatorFactory().Create(type);
            foreach (IItemAttributeCreator creator in attributeCreators)
            {
                creator.CreateAttributes(item);
            }

            return item;
        }
Esempio n. 9
0
 // generates a random item.
 public static Item GenerateRandom(Player player)
 {
     var itemDefinition = GetRandom(ValidDefinitions);
     return CreateItem(player, itemDefinition);
 }
Esempio n. 10
0
 public Stash(Player owner, int rows, int columns)
 {
     this._backpack = new uint[rows, columns];
     this._owner = owner;
 }
Esempio n. 11
0
        public static Item CreateGlobe(Player player, int amount)
        {
            int snoid;

            if (amount > 10)
                amount = 10 + ((amount - 10) * 5);

            if (amount < 50)
                snoid = 4267;
            else
                snoid = 85798;

            var item = Cook(player, "HealthGlobe" + amount, snoid, ItemType.HealthGlobe);
            item.Attributes[GameAttribute.Health_Globe_Bonus_Health] = amount;

            return item;
        }