Exemplo n.º 1
0
        //一次购买多个物品
        public int BulkBuyItem(int nIndex, int nNumber)
        {
            CObject_Item pBoothItem = CDataPool.Instance.Booth_GetItem(nIndex);

            if (pBoothItem != null)
            {
                nNumber = (nNumber <1 || nNumber> pBoothItem.GetMaxOverLay())?1:nNumber;

                if (CObjectManager.Instance.getPlayerMySelf().GetCharacterData().Get_Money() >=
                    (int)(CDataPool.Instance.Booth_GetItemPrice(nIndex) * nNumber))
                {
                    CGShopBuy msg = new CGShopBuy();

                    msg.UniqueID  = CDataPool.Instance.Booth_GetShopUniqueId();
                    msg.Index     = (byte)pBoothItem.GetPosIndex();
                    msg.SerialNum = (byte)CDataPool.Instance.Booth_GetSerialNum();
                    msg.BuyNum    = (uint)nNumber;

                    NetManager.GetNetManager().SendPacket(msg);
                    return(0);
                }
            }

            CEventSystem.Instance.PushEvent(GAME_EVENT_ID.GE_INFO_INTERCOURSE, "#{LowMoney}");

            return(0);
        }
Exemplo n.º 2
0
    public void SendAskItemInfoMsg()
    {
        //  [10/21/2011 Sun]
        CObject_Item pItem = (CObject_Item)GetImpl();

        if (pItem == null)
        {
            return;
        }
        if (pItem.TypeOwner == ITEM_OWNER.IO_MYSELF_PACKET)
        {
            if (pItem.IsItemHasDetailInfo())
            {
                CGAskItemInfo msg = new CGAskItemInfo();
                msg.BagIndex = pItem.GetPosIndex();
                NetManager.GetNetManager().SendPacket(msg);
            }
        }
    }
Exemplo n.º 3
0
        internal void PacketItem_UserItem(CActionItem_Item pActionItem, int targetServerID, Vector2 fvPos)
        {
            //空物品
            if (pActionItem == null || pActionItem.GetType() != ACTION_OPTYPE.AOT_ITEM)
            {
                return;
            }
            CObject_Item pItem = pActionItem.ItemImpl;

            if (pItem == null)
            {
                return;
            }
            //必须是能够使用的物品
            if (pItem.GetItemClass() != ITEM_CLASS.ICLASS_COMITEM && pItem.GetItemClass() != ITEM_CLASS.ICLASS_TASKITEM)
            {
                return;
            }

            //特殊物品不能在背包中直接使用,例如,宠物技能书
//          STRING strTemp;
//          if(!CObject_Item::CheckUseInPackage(pItem, strTemp))
//          {
//              if(!strTemp.empty()) CGameProcedure::s_pEventSystem->PushEvent(GE_INFO_SELF, strTemp.c_str());
//              return;
//          }
            //组队跟随中...
            //if(CObjectManager::GetMe()->GetMySelf()->GetCharacterData()->Get_TeamFollowFlag()) return;

            //检查目前选中的目标
            CObject pObj = CObjectManager.Instance.FindServerObject(targetServerID);

            //检查物品是否能够直接使用
            int        objID = 0;
            PET_GUID_t petID = new PET_GUID_t();
            fVector2   pos;

            pos.x = fvPos.x;
            pos.y = fvPos.y;
            bool bCanuseDir = ((CObject_Item_Medicine)pItem).IsValidTarget(pObj, ref pos, ref objID, ref petID);

            if (bCanuseDir)
            {
                WORLD_POS posTarget;
                posTarget.m_fX = pos.x;
                posTarget.m_fZ = pos.y;

                //能够直接使用
                CGUseItem msg = new CGUseItem();
                msg.BagIndex      = (byte)pItem.GetPosIndex();
                msg.Target        = (uint)objID;
                msg.TargetPetGUID = petID;
                msg.PosTarget     = posTarget;
                NetManager.GetNetManager().SendPacket(msg);
                return;
            }

            //如果已经选中目标,说明目标不合适,如果是用在自己宠物上的物品,说明宠物没有释放
            if (pObj != null || ((CObject_Item_Medicine)pItem).IsTargetOne())
            {
                CEventSystem.Instance.PushEvent(GAME_EVENT_ID.GE_INFO_SELF, "无效目标");
                return;
            }

            //需要选中目标,在鼠标上挂上物品
            CActionSystem.Instance.SetDefaultAction(pActionItem);
        }