Jump to content
×
×
  • Create New...
  • Please do not post a message for the purpose of insulting, incitement to hatred, sexual remarks and any other which does not respect our terms of use !

 résolu Problème PlusEmu (Item)


Go to solution Solved by Pouney,

Recommended Posts

Bonjour,

 

J'ai un soucis avec plusemu, j'ai essayé de le retélécharger au moins 4 fois mais rien du tout (téléchargement sur le site officiel)

 

Voici l'erreur que j'ai en lançant le serveur:

1498496115-capture.jpg

 

Si ça vous est déjà arrivé, comment l'avez-vous réglé ? Première fois que j'ai ce soucis.

 

Voici le fichier ItemData.cs:

using System;
using System.Collections.Generic;

using Plus.HabboHotel.Items.Wired;

namespace Plus.HabboHotel.Items
{
    public class ItemData
    {
        public int Id { get; set; }
        public int SpriteId { get; set; }
        public string ItemName { get; set; }
        public string PublicName { get; set; }
        public char Type { get; set; }
        public int Width { get; set; }
        public int Length { get; set; }
        public double Height { get; set; }
        public bool Stackable { get; set; }
        public bool Walkable { get; set; }
        public bool IsSeat { get; set; }
        public bool AllowEcotronRecycle { get; set; }
        public bool AllowTrade { get; set; }
        public bool AllowMarketplaceSell { get; set; }
        public bool AllowGift { get; set; }
        public bool AllowInventoryStack { get; set; }
        public InteractionType InteractionType { get; set; }
        public int BehaviourData { get; set; }
        public int Modes { get; set; }
        public List<int> VendingIds { get; set; }
        public List<double> AdjustableHeights { get; set; }
        public int EffectId { get; set; }
        public WiredBoxType WiredType { get; set; }
        public bool IsRare { get; set; }
        public bool ExtraRot { get; set; }

        public ItemData(int Id, int Sprite, string Name, string PublicName, string Type, int Width, int Length, double Height, bool Stackable, bool Walkable, bool IsSeat,
            bool AllowRecycle, bool AllowTrade, bool AllowMarketplaceSell, bool AllowGift, bool AllowInventoryStack, InteractionType InteractionType, int behaviourData, int Modes,
            string VendingIds, string AdjustableHeights, int EffectId, bool IsRare, bool ExtraRot)
        {
            this.Id = Id;
            this.SpriteId = Sprite;
            this.ItemName = Name;
            this.PublicName = PublicName;
            this.Type = char.Parse(Type);
            this.Width = Width;
            this.Length = Length;
            this.Height = Height;
            this.Stackable = Stackable;
            this.Walkable = Walkable;
            this.IsSeat = IsSeat;
            this.AllowEcotronRecycle = AllowRecycle;
            this.AllowTrade = AllowTrade;
            this.AllowMarketplaceSell = AllowMarketplaceSell;
            this.AllowGift = AllowGift;
            this.AllowInventoryStack = AllowInventoryStack;
            this.InteractionType = InteractionType;
            this.BehaviourData = behaviourData;
            this.Modes = Modes;
            this.VendingIds = new List<int>();
            if (VendingIds.Contains(","))
            {
                foreach (string VendingId in VendingIds.Split(','))
                {
                    try
                    {
                        this.VendingIds.Add(int.Parse(VendingId));
                    }
                    catch
                    {
                        Console.WriteLine("Error with Item " + ItemName + " - Vending Ids");
                        continue;
                    }
                }
            }
            else if (!String.IsNullOrEmpty(VendingIds) && (int.Parse(VendingIds)) > 0)
                this.VendingIds.Add(int.Parse(VendingIds));

            this.AdjustableHeights = new List<double>();
            if (AdjustableHeights.Contains(","))
            {
                foreach (string H in AdjustableHeights.Split(','))
                {
                    this.AdjustableHeights.Add(double.Parse(H));
                }
            }
            else if (!String.IsNullOrEmpty(AdjustableHeights) && (double.Parse(AdjustableHeights)) > 0)
                this.AdjustableHeights.Add(double.Parse(AdjustableHeights));

            this.EffectId = EffectId;

            int wiredId = 0;
            if (this.InteractionType == InteractionType.WIRED_CONDITION || this.InteractionType == InteractionType.WIRED_TRIGGER || this.InteractionType == InteractionType.WIRED_EFFECT)
                wiredId = this.BehaviourData;

            this.WiredType = WiredBoxTypeUtility.FromWiredId(wiredId);

            this.IsRare = IsRare;
            this.ExtraRot = ExtraRot;
        }
    }
}

 

Voici le fichier ItemDataManager.cs:

using System;
using System.Data;
using System.Collections.Generic;

using log4net;
using Plus.Core;

using Plus.Database.Interfaces;


namespace Plus.HabboHotel.Items
{
    public class ItemDataManager
    {
        private static readonly ILog log = LogManager.GetLogger("Plus.HabboHotel.Items.ItemDataManager");

        public Dictionary<int, ItemData> _items;
        public Dictionary<int, ItemData> _gifts;//<SpriteId, Item>

        public ItemDataManager()
        {
            this._items = new Dictionary<int, ItemData>();
            this._gifts = new Dictionary<int, ItemData>();
        }

        public void Init()
        {
            if (this._items.Count > 0)
                this._items.Clear();

            using (IQueryAdapter dbClient = PlusEnvironment.GetDatabaseManager().GetQueryReactor())
            {
                dbClient.SetQuery("SELECT * FROM `furniture`");
                DataTable ItemData = dbClient.GetTable();

                if (ItemData != null)
                {
                    foreach (DataRow Row in ItemData.Rows)
                    {
                        try
                        {
                            int id = Convert.ToInt32(Row["id"]);
                            int spriteID = Convert.ToInt32(Row["sprite_id"]);
                            string itemName = Convert.ToString(Row["item_name"]);
                            string PublicName = Convert.ToString(Row["public_name"]);
                            string type = Row["type"].ToString();
                            int width = Convert.ToInt32(Row["width"]);
                            int length = Convert.ToInt32(Row["length"]);
                            double height = Convert.ToDouble(Row["stack_height"]);
                            bool allowStack = PlusEnvironment.EnumToBool(Row["can_stack"].ToString());
                            bool allowWalk = PlusEnvironment.EnumToBool(Row["is_walkable"].ToString());
                            bool allowSit = PlusEnvironment.EnumToBool(Row["can_sit"].ToString());
                            bool allowRecycle = PlusEnvironment.EnumToBool(Row["allow_recycle"].ToString());
                            bool allowTrade = PlusEnvironment.EnumToBool(Row["allow_trade"].ToString());
                            bool allowMarketplace = Convert.ToInt32(Row["allow_marketplace_sell"]) == 1;
                            bool allowGift = Convert.ToInt32(Row["allow_gift"]) == 1;
                            bool allowInventoryStack = PlusEnvironment.EnumToBool(Row["allow_inventory_stack"].ToString());
                            InteractionType interactionType = InteractionTypes.GetTypeFromString(Convert.ToString(Row["interaction_type"]));
                            int behaviourData = Convert.ToInt32(Row["behaviour_data"]);
                            int cycleCount = Convert.ToInt32(Row["interaction_modes_count"]);
                            string vendingIDS = Convert.ToString(Row["vending_ids"]);
                            string heightAdjustable = Convert.ToString(Row["height_adjustable"]);
                            int EffectId = Convert.ToInt32(Row["effect_id"]);
                            bool IsRare = PlusEnvironment.EnumToBool(Row["is_rare"].ToString());
                            bool ExtraRot = PlusEnvironment.EnumToBool(Row["extra_rot"].ToString());

                            if (!this._gifts.ContainsKey(spriteID))
                                this._gifts.Add(spriteID, new ItemData(id, spriteID, itemName, PublicName, type, width, length, height, allowStack, allowWalk, allowSit, allowRecycle, allowTrade, allowMarketplace, allowGift, allowInventoryStack, interactionType, behaviourData, cycleCount, vendingIDS, heightAdjustable, EffectId, IsRare, ExtraRot));

                            if (!this._items.ContainsKey(id))
                                this._items.Add(id, new ItemData(id, spriteID, itemName, PublicName, type, width, length, height, allowStack, allowWalk, allowSit, allowRecycle, allowTrade, allowMarketplace, allowGift, allowInventoryStack, interactionType, behaviourData, cycleCount, vendingIDS, heightAdjustable, EffectId, IsRare, ExtraRot));
                        }
                        catch (Exception e)
                        {
                            Console.WriteLine(e.ToString());
                            Console.ReadKey();
                            //Logging.WriteLine("Could not load item #" + Convert.ToInt32(Row[0]) + ", please verify the data is okay.");
                        }
                    }
                }
            }

            log.Info("Item Manager -> LOADED");
        }

        public bool GetItem(int Id, out ItemData Item)
        {
            if (this._items.TryGetValue(Id, out Item))
                return true;
            return false;
        }

        public ItemData GetItemByName(string name)
        {
            foreach (var entry in _items)
            {
                ItemData item = entry.Value;
                if (item.ItemName == name)
                    return item;
            }
            return null;
        }

        public bool GetGift(int SpriteId, out ItemData Item)
        {
            if (this._gifts.TryGetValue(SpriteId, out Item))
                return true;
            return false;
        }
    }
}

 

Merci à vous :)

Link to post
Share on other sites
il y a 5 minutes, Pouney a dit :

Bonjour,

 

As-tu changé le , en . ?

Ainsi que désactivé les pare-feu par la même occasion ?

 

Pouney.

 

Je viens de voir le topic dans tutoriel... Etant donné que je suis en local pour le moment en attendant de recevoir le VPS, j'ai totalement oublié de changer la virgule x) Mais il me semblait que l'erreur de la virgule était un autre message haha

Link to post
Share on other sites
à l’instant, Drax a dit :

 

Je viens de voir le topic dans tutoriel... Etant donné que je suis en local pour le moment en attendant de recevoir le VPS, j'ai totalement oublié de changer la virgule x) Mais il me semblait que l'erreur de la virgule était un autre message haha

Du coup je peux passer en résolu ? Je n'ai pas tout compris :p 

Link to post
Share on other sites

Salut,

 

Ton sujet qui se trouvait dans 

Please login or register to see this link.

>

Please login or register to see this link.

a été déplacé dans  

Please login or register to see this link.

>

Please login or register to see this link.

>

Please login or register to see this link.

 

 

Ceci est un message automatique.

Link to post
Share on other sites
Guest
This topic is now closed to further replies.