Example #1
0
        public bool Create(uint idNewMapItem, Map map, Point pos, Item pInfo, uint idOwner)
        {
            if (map == null || pInfo == null)
            {
                return(false);
            }

            int nAliveSecs = _MAPITEM_USERMAX_ALIVESECS;

            if (pInfo.Itemtype != null)
            {
                nAliveSecs = (int)(pInfo.Itemtype.Price / _MAPITEM_ALIVESECS_PERPRICE + _MAPITEM_USERMIN_ALIVESECS);
            }
            if (nAliveSecs > _MAPITEM_USERMAX_ALIVESECS)
            {
                nAliveSecs = _MAPITEM_USERMAX_ALIVESECS;
            }

            m_tAlive = new TimeOut(nAliveSecs);
            m_tAlive.Update();

            Map         = map;
            MapIdentity = map.Identity;
            MapX        = (ushort)pos.X;
            MapY        = (ushort)pos.Y;

            m_pItem                = pInfo;
            m_dwIdentity           = idNewMapItem;
            m_pPacket.Identity     = idNewMapItem;
            m_pItemtype            = pInfo.Itemtype;
            m_pItem.OwnerIdentity  = 0;
            m_pItem.PlayerIdentity = idOwner;

            m_pItem.Position = (ItemPosition)254;

            m_pPacket.ItemColor = 3;
            m_pPacket.DropType  = 1;
            m_pPacket.Itemtype  = Type = pInfo.Type;
            Map.AddItem(this);

            return(true);
        }
Example #2
0
        public bool Create(uint idNewMapItem, Map map, Point pos, DbItemtype idType, uint idOwner, byte nPlus, byte nDmg,
                           short nDura)
        {
            if (map == null || idType == null)
            {
                return(false);
            }

            m_tAlive = new TimeOut(_DISAPPEAR_TIME);
            m_tAlive.Startup(_DISAPPEAR_TIME);

            Map         = map;
            MapIdentity = map.Identity;
            MapX        = (ushort)pos.X;
            MapY        = (ushort)pos.Y;

            m_nPlus = nPlus;
            m_nDmg  = nDmg;
            m_nDura = nDura;

            m_pItemtype        = idType;
            Type               = m_pItemtype.Type;
            m_dwIdentity       = idNewMapItem;
            m_pPacket.Identity = idNewMapItem;

            if (idOwner != 0)
            {
                m_idOwner = idOwner;
                m_tPriv   = new TimeOut(_MAPITEM_PRIV_SECS);
                m_tPriv.Startup(_MAPITEM_PRIV_SECS);
                m_tPriv.Update();
            }

            m_pPacket.DropType  = 1;
            m_pPacket.ItemColor = 3;
            Map.AddItem(this);

            return(true);
        }