Ejemplo n.º 1
0
        // 把装备栏某位置的物品置灰 [7/15/2011 ivan edit]
        public void Lock_Equip_Item(int nIndex, bool isLock)
        {
            if (nIndex >= 0)
            {
                CObject_Item pObj = CDataPool.Instance.UserEquip_GetItem((HUMAN_EQUIP)nIndex);
                if (pObj != null)
                {
                    // 设置装备栏物品状态,是否锁定 [7/15/2011 ivan edit]
                    CActionItem_Item pItemAction = CActionSystem.Instance.GetAction_ItemID(pObj.GetID());

                    if (isLock)
                    {
                        pObj.SetLock(true);
                        if (pItemAction != null)
                        {
                            pItemAction.Disable();
                        }
                    }
                    else
                    {
                        pObj.SetLock(false);
                        if (pItemAction != null)
                        {
                            pItemAction.Enable();
                        }
                    }
                }
            }
        }
        // 向服务器请求item的详细信息
        //
        //
        public void SendAskItemInfoMsg()
        {
            CActionItem_Item actionItem = currAction as CActionItem_Item;

            if (actionItem != null)
            {
                actionItem.SendAskItemInfoMsg();
            }
        }
Ejemplo n.º 3
0
 internal void PacketItem_UserSymbol(CActionItem_Item pActionItem)
 {
     if (pActionItem.ItemImpl != null)
     {
         CGUseSymbol useSymbolMsg = new CGUseSymbol();
         useSymbolMsg.BagIndex = (byte)pActionItem.ItemImpl.PosIndex;
         NetManager.GetNetManager().SendPacket(useSymbolMsg);
     }
 }
Ejemplo n.º 4
0
    void UpdateItemInfo()
    {
        CActionItem_Item item = SuperTooltips.Instance.GetActionItem() as CActionItem_Item;

        if (item != null)
        {
            itemAction.SetTexture(IconManager.Instance.GetIcon(item.GetIconName()));
            itemName.Text     = item.GetName();
            itemReqLevel.Text = item.GetItemLevel().ToString();
            itemDesc.Text     = UIString.Instance.ParserString_Runtime(item.GetDesc());

            itemGo.SetActiveRecursively(true);
        }
    }
Ejemplo n.º 5
0
    void UpdateEquipInfo()
    {
        CActionItem_Item equip = SuperTooltips.Instance.GetActionItem() as CActionItem_Item;

        if (equip != null)
        {
            equipAction.SetTexture(IconManager.Instance.GetIcon(equip.GetIconName()));

            equipName.Text     = equip.GetName();
            equipStrongLv.Text = "强化等级:" + equip.GetStrengthLevel();
            equipReqLv.Text    = equip.GetItemLevel().ToString();
            if (equip.GetNeedJob() >= 0 && equip.GetNeedJob() <= 3)
            {
                equipReqJob.Text = jobNames[equip.GetNeedJob()];
            }
            else
            {
                equipReqJob.Text = "无限制";
            }
            equipType.Text    = equip.GetEquipType();
            equipAttInfo.Text = UIString.Instance.ParserString_Runtime(equip.GetAttributeValue(ITEMATTRIBUTE.ITEMATTRIBUTE_WHITE_ATT));

            // 获得宝石属性 [3/29/2012 Ivan]
            CObject_Item_Equip itemEquip = equip.GetImpl() as CObject_Item_Equip;
            if (itemEquip != null)
            {
                int i = 0;
                for (; i < itemEquip.GetGemCount(); i++)
                {
                    string info = "";
                    itemEquip.GetGemExtAttr(i, ref info);
                    if (string.IsNullOrEmpty(info))
                    {
                        equipGemInfos[i].Text = "RGBA(0.56, 0.56, 0.56, 1.000)未镶嵌";
                    }
                    else
                    {
                        equipGemInfos[i].Text = "RGBA(0.48, 0.917, 0.34, 1.000)" + UIString.Instance.ParserString_Runtime(info);
                    }
                }
            }

            equipSelPrice.Text = equip.GetAttributeValue(ITEMATTRIBUTE.ITEMATTRIBUTE_PRICE);

            equipGo.SetActiveRecursively(true);
        }
    }
Ejemplo n.º 6
0
 //下坐骑使用物品
 public bool UnRideUseItem(CActionItem_Item ActionItemm, int targetServerID, UnityEngine.Vector2 fvPos)
 {
     if (isUnRiding)
     {
         return(true);
     }
     if (Ride)
     {
         mActionItem      = ActionItemm;
         mTargetServerID  = targetServerID;
         mFvPos           = fvPos;
         Ride             = false;
         mContinueUseItem = true;//下坐骑后使用物品
         return(true);
     }
     return(false);
 }
Ejemplo n.º 7
0
        //    // 装备镶嵌消息 [9/16/2011 edit by ZL]
        //    void Send_EnchaseMsg(int type);
        //    // 返回装备上,总共有多少颗宝石。
        //    INT GetEquip_GemCount(INT nIndexEquip );
        //    // 返回装备上,总共可以镶嵌多少个宝石
        ////	INT GetEquip_GemCount( );
        //    // 返回宝石的级别。
        ////	INT Compound_Preparation(  );
        //    // 是否可以镶嵌
        //    INT	Can_Enchase( INT nIndexEquip, INT nIndexGem );
        //    // 是否可以合成
        //    bool Can_Combine( INT nIndexGem1, INT nIndexGem2 );
        //    // 物品可以放到镶嵌界面这个位置。
        //    bool Enchase_Preparation( INT nIndexInterface, INT nIndexPacket );
        //    // 物品可以放到合成界面这个位置。
        //    bool Compound_Preparation( INT nIndexPacket );
        //    //////////////////////////////////////////////////////////////////////////
        //    INT	Stiletto_GetEquipOwner();
        //    // 装备打孔检测,必须先将装备拖到目标位置上 [7/14/2011 ivan edit]
        //    Lua_SLOT_COST Stiletto_Preparation(INT nEquipIndex, INT equipOwner);
        //    // 装备打孔 [7/15/2011 ivan edit]
        //    INT	Do_Stilietto(int equipOwner = -1, int equipPos = -1);

        //    // 装备强化预览 [9/14/2011 edit by ZL]
        //    CActionItem*	GetStrengthenPreView(INT actionId);
        //    // 装备强化预览 [9/14/2011 edit by ZL]

        // 升档预览 [4/11/2012 SUN]
        public CActionItem      GetEquipUpdatePreView(int actionId)
        {
            CActionItem_Item action = CActionSystem.Instance.GetActionByActionId(actionId) as CActionItem_Item;

            if (action == null)
            {
                throw new NullReferenceException("Can not find actionitem: " + actionId);
            }
            CObject_Item_Equip equip = action.GetImpl() as CObject_Item_Equip;

            if (equip == null)
            {
                return(null);
            }

            CObject_Item_Equip resEquip = CDataPool.Instance.PreviewEquip;
            int nNextTableId            = equip.GetEquipBaseDefine().nNextDangCiItemSN;

            if (resEquip != null && resEquip.GetIdTable() != nNextTableId)
            {
                CDataPool.Instance.PreviewEquip = null;
            }

            resEquip = ObjectSystem.Instance.NewItem((uint)nNextTableId) as CObject_Item_Equip;
            resEquip.CloneForUpLevel(equip);

            resEquip.TypeOwner = ITEM_OWNER.IO_QUESTVIRTUALITEM;
            // 必须保存回去 [10/25/2011 Ivan edit]
            CDataPool.Instance.PreviewEquip = resEquip;

            CActionItem pActionItem = CActionSystem.Instance.GetAction_ItemID(resEquip.GetID(), false);

            if (pActionItem != null)
            {
                return(pActionItem);
            }
            else
            {
                return(CActionItem.s_InvalidAction);
            }
        }
Ejemplo n.º 8
0
    void ShowShengDangInfo(int index)
    {
        ShengDangItem = sItem[index];
        ShengDangImageButton[0].UpdateItem(ShengDangItem.GetID());

        int j = ShengDangPage[nTheIndex] * 10;

        for (int i = 0; i < 10; i++)
        {
            if (i + j >= sItem.Count)
            {
                ShengDangNames[i].Text  = "";
                ShengDangLevels[i].Text = "";
                ShengDangRadios[i].Hide(true);
            }
            else
            {
                ShengDangNames[i].Text  = sItem[i + j].GetName();
                ShengDangLevels[i].Text = "档次:" + sItem[i + j].GetCurrentDangCi();
                ShengDangRadios[i].Hide(false);
            }
        }

        int selectIndex = (int)ShengDangSelect[nTheIndex];

        if (ShengDangPage[nTheIndex] == ShengDangPageRadio[nTheIndex])
        {
            ShengDangRadios[selectIndex].Value = true;
        }

        else
        {
            ShengDangRadios[selectIndex].Value = false;
        }

        ShengDangPageNum.Text = (ShengDangPage[nTheIndex] + 1) + "/" + GetPageNum();

        ShengDangPreEnchanceLevel.Text = "强化等级:" + CDataPool.Instance.GetStrengthLevelDesc(ShengDangItem.GetStrengthLevel());
        if (ShengDangItem.GetCurrentDangCi() == -1)
        {
            ShengDangCurrentDangCi.Text = "";
            ShengDangNextDangCi.Text    = "档次1";
        }
        else
        {
            ShengDangCurrentDangCi.Text = "档次:" + ShengDangItem.GetCurrentDangCi();
            ShengDangNextDangCi.Text    = "档次:" + (ShengDangItem.GetCurrentDangCi() + 1);
        }

        Lua_Item_LevelUp item      = LifeAbility.Instance.Get_Equip_LevelUpMaterial(ShengDangItem.GetCurrentDangCi());
        CObject_Item     pItemObj1 = ObjectSystem.Instance.NewItem((uint)item.needItemID);
        CObject_Item     pItemObj2 = ObjectSystem.Instance.NewItem((uint)item.needItemID2);

        CActionItem_Item actionItem1 = CActionSystem.Instance.GetAction_ItemID(pItemObj1.GetID());
        CActionItem_Item actionItem2 = CActionSystem.Instance.GetAction_ItemID(pItemObj2.GetID());

        MaterialName[0].Text = actionItem1.GetName();
        MaterialName[1].Text = actionItem2.GetName();
        MaterialButton[0].SetActionItemByActionId(actionItem1.GetID());
        MaterialButton[1].SetActionItemByActionId(actionItem2.GetID());

        int count1 = CDataPool.Instance.UserBag_CountItemByIDTable(item.needItemID);
        int count2 = CDataPool.Instance.UserBag_CountItemByIDTable(item.needItemID2);

        if (count1 >= item.needItemNum)
        {
            count1 = item.needItemNum;
        }
        else if (count1 == -1)
        {
            count1 = 0;
        }

        if (count2 >= item.needItem2Num)
        {
            count2 = item.needItem2Num;
        }
        else if (count2 == -1)
        {
            count2 = 0;
        }

        MaterialNum[0].Text = count1 + "/" + item.needItemNum;
        MaterialNum[1].Text = count2 + "/" + item.needItem2Num;
        ShengDangMoney.Text = item.money.ToString();
    }
Ejemplo n.º 9
0
    /// <summary>
    /// 升档
    /// </summary>
    void UpdateShengDang()
    {
        ClearShengDangContext();
        mIsEnableSD = false;
        if (mSelectedItem != null)
        {
            mSDSelectedAction.SetActionItem(mSelectedItem.GetID());
            string text = mSelectedItem.GetWhiteAttribute(0);
            mSDSelectedAttriDesc.Text = UIString.Instance.ParserString_Runtime(text);
            text = mSelectedItem.GetWhiteAttribute(1);
            if (text == "")
            {
                mSDSelectedAttriDesc2.Hide(true);
            }
            else
            {
                mSDSelectedAttriDesc2.Hide(false);
                mSDSelectedAttriDesc2.Text = UIString.Instance.ParserString_Runtime(text);
            }


            CActionItem actionItem = LifeAbility.Instance.GetEquipUpdatePreView(mSDSelectedAction.CurrActionItem.GetID());
            if (actionItem != null)
            {
                mSDPreviewAction.SetActionItemByActionId(actionItem.GetID());

                CObject_Item previewItem = mSDPreviewAction.CurrActionItem.GetImpl() as CObject_Item;
                if (previewItem != null)
                {
                    text = previewItem.GetWhiteAttribute(0);
                    mSDPreviewAttriDesc.Text = UIString.Instance.ParserString_Runtime(text);
                    text = previewItem.GetWhiteAttribute(1);
                    if (text == "")
                    {
                        mSDPreviewAttriDesc2.Hide(true);
                    }
                    else
                    {
                        mSDPreviewAttriDesc2.Text = UIString.Instance.ParserString_Runtime(text);
                        mSDPreviewAttriDesc2.Hide(false);
                    }
                }
            }

            int nPrescrId = LifeAbility.Instance.GetPrescrID(mSelectedItem.GetIdTable());
            if (nPrescrId == -1)
            {
                NoPrescrHandler(mSelectedItem.GetIdTable());
                mSDOK.controlIsEnabled = false;
                return;
            }
            NoPrescrHandler(-1);
            //材料
            int nCount = LifeAbility.Instance.GetPrescrStuffCount(nPrescrId);
            //int nMaterial = -1;
            for (int i = 1; i < nCount; i++) //第一个材料为当前装备,跳过不显示
            {
                Stuff stuff = LifeAbility.Instance.GetPrescrStuff(i, nPrescrId);
                if (stuff.nID == -1)
                {
                    mSDMaterials[i - 1].SetActionItem(-1);
                    mSDMaterialTexts[i - 1].Text = "";
                    continue;
                }
                bool bCreateNew = true;
                if (mSDMaterials[i - 1].CurrActionItem != null)
                {
                    if (mSDMaterials[i - 1].CurrActionItem.GetIDTable() == stuff.nID)
                    {
                        bCreateNew = false;
                    }
                    else
                    {
                        mSDMaterials[i - 1].CurrActionItem.DestroyImpl();
                    }
                }
                if (bCreateNew)
                {
                    CObject_Item     pItemObj1   = ObjectSystem.Instance.NewItem((uint)stuff.nID);
                    CActionItem_Item actionItem1 = CActionSystem.Instance.GetAction_ItemID(pItemObj1.GetID(), false);

                    mSDMaterials[i - 1].SetActionItemByActionId(actionItem1.GetID());
                }

                int count = CDataPool.Instance.UserBag_CountItemByIDTable(stuff.nID);
                if (count >= stuff.nNum)
                {
                    count       = stuff.nNum;
                    mIsEnableSD = true;
                }
                else
                {
                    mIsEnableSD = false;
                }
                mSDMaterialTexts[i - 1].Text = count + "/" + stuff.nNum;
            }

            mSDOK.controlIsEnabled = mIsEnableSD;
        }
    }
Ejemplo n.º 10
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);
        }