//显示强化信息 void ShowEnhanceInfo(int index) { EnchanceItem = pItem[index]; Enchancebutton.UpdateItem(EnchanceItem.GetID()); int j = EnhancePage[nTheIndex] * 10; for (int i = 0; i < 10; i++) { if (i + j >= pItem.Count) { EnhanceNames[i].Text = ""; EnchanceLevels[i].Text = ""; EnchanceRadios[i].Hide(true); } else { EnhanceNames[i].Text = pItem[i + j].GetName(); EnchanceLevels[i].Text = CDataPool.Instance.GetStrengthLevelDesc(pItem[i + j].GetStrengthLevel()); EnchanceRadios[i].Hide(false); } } EnchancePreLevel.Text = "强化等级:" + CDataPool.Instance.GetStrengthLevelDesc(EnchanceItem.GetStrengthLevel()); EnchanceCurrentLevel.Text = CDataPool.Instance.GetStrengthLevelDesc(EnchanceItem.GetStrengthLevel()); EnchanceNextLevel.Text = CDataPool.Instance.GetStrengthNextLevelDesc(EnchanceItem.GetStrengthLevel()); int selectIndex = (int)EnchanceSelect[nTheIndex]; if (EnhancePage[nTheIndex] == EnhancePageRadio[nTheIndex]) { EnchanceRadios[selectIndex].Value = true; } else { EnchanceRadios[selectIndex].Value = false; } EnchancePageNum.Text = (EnhancePage[nTheIndex] + 1) + "/" + GetPageNum(); Item_Enhance itemEnhance = LifeAbility.Instance.Get_Equip_EnhanceLevel((CObject_Item)EnchanceItem); int NeedMoney = itemEnhance.needMoney; int Property = itemEnhance.addProperty; if (NeedMoney <= 0 || Property < 0) { if (EnchanceItem != null) { EnhanceMoney.Text = "0"; //QiangHuaButton.Disable(); } else { LogManager.LogError("此装备无法强化。"); return; } } else { QiangHuaButton.Enable(); } }
private void DoAction_PetEquip() { CObject_Item_Equip pItemEquip = (CObject_Item_Equip)ItemImpl; if (pItemEquip.GetItemClass() != ITEM_CLASS.ICLASS_EQUIP) { return; } int emptyPlace = CDataPool.Instance.UserBag_FindFirstEmptyPlace(); if (emptyPlace == -1) { CEventSystem.Instance.PushEvent(GAME_EVENT_ID.GE_INFO_SELF, "背包已满,清整理背包后再尝试 ^0^!"); } else { // 发送卸下宠物装备消息. GameObject roleTip = UIWindowMng.Instance.GetWindowGo("RoleTipWindow"); UISelfEquip selfEquip = roleTip.GetComponent <UISelfEquip>(); SDATA_PET curPet = CDataPool.Instance.Pet_GetValidPet(selfEquip.ActivePet);//CDataPool.Instance.Pet_GetPet(selfEquip.ActivePet); if (curPet != null) { CGOperatePetEquip msg = new CGOperatePetEquip(); msg.OperatorType = 1; msg.GUID = curPet.GUID; msg.DestBagIndex = (byte)pItemEquip.GetItemType(); msg.SourecBagIndex = (byte)emptyPlace; NetManager.GetNetManager().SendPacket(msg); } } }
void OnGemEnchanseActionClicked(ref POINTER_INFO ptr) { if (ptr.evt == POINTER_INFO.INPUT_EVENT.TAP) { string parentName = ptr.targetObj.gameObject.name; if (mGemIndexs.ContainsKey(parentName)) { int nIndex = mGemIndexs[parentName]; CObject_Item_Equip equip = mSelectedItem as CObject_Item_Equip; if (equip != null) { //if (equip.GetCurrentGemCount() >= equip.GetGemMaxCount()) // return; CObject_Item_Gem gem = mGemContainer[nIndex].CurrActionItem.GetImpl() as CObject_Item_Gem; if (gem != null) { if (InsertGem(gem, equip)) { gem.isLocked = true; } UpdateEnchanseGemStates(); } } } } }
bool InsertGem(CObject_Item_Gem gem, CObject_Item_Equip equip) { for (int i = 0; i < GAMEDEFINE.MAX_ITEM_GEM; i++) { if (mEnchanseGemInfo[i].bFlag == 1) { CObject_Item_Gem gemold = CDataPool.Instance.UserBag_GetItemById(mEnchanseGemInfo[i].nGemType) as CObject_Item_Gem; if (gemold != null && gem.GetItemTableType() == gemold.GetItemTableType()) { return(false); } } if (mEnchanseGemInfo[i].bFlag == 0) { //当前没有宝石 if (equip.GetGemTableId(i) == 0) { byte oldFlag = 2; int index = equip.IsGemmy(gem.GetItemTableType()); if (index >= 0) { oldFlag = mEnchanseGemInfo[index].bFlag; } if (oldFlag == 2) { mEnchanseGemInfo[i].nGemType = gem.GetID(); mEnchanseGemInfo[i].bFlag = 1; return(true); } } } } return(false); }
void UpdateEnchanseSelectedEquip() { ClearEnchanseSelected(); if (mSelectedItem != null) { mEnchanseSelectedAction.SetActionItem(mSelectedItem.GetID()); CObject_Item_Equip equip = mSelectedItem as CObject_Item_Equip; if (equip != null) { int gemCount = equip.GetGemCount(); for (int i = 0; i < gemCount; i++) { int nIdTable = equip.GetGemTableId(i); if (nIdTable != 0) { CObject_Item gemItem = ObjectSystem.Instance.NewItem((uint)nIdTable); CActionItem action = CActionSystem.Instance.GetAction_ItemID(gemItem.GetID(), false); mEnchanseGemInfo[i].enchanseGem.SetActionItemByActionId(action.GetID()); } } } } UpdateEnchanseGemStates(); }
// // 强化需求 [7/19/2011 ivan edit] //public Item_Enhance Get_Equip_EnhanceLevel( int nIndexPacket) public Item_Enhance Get_Equip_EnhanceLevel(CObject_Item My_Equip) { Item_Enhance itemEnhance = new Item_Enhance(); if (My_Equip == null || My_Equip.GetItemClass() != ITEM_CLASS.ICLASS_EQUIP) { return(itemEnhance); } CObject_Item_Equip equip = My_Equip as CObject_Item_Equip; if (equip == null) { return(itemEnhance); } int enhanceID = equip.GetStrengthIndex(); _DBC_ITEM_ENHANCE pItemEnhance = ObjectSystem.EquipEnchanceDBC.Search_Index_EQU((int)enhanceID); if (pItemEnhance == null) { return(itemEnhance); } _DBC_ITEM_ENCHANCE_RATE pItemEnchanceRate = ObjectSystem.EquipEnchanceRateDBC.Search_Index_EQU(equip.GetCurrentDangCi()); float fRatio = pItemEnchanceRate.nDangCiRatio / 100.0f; pItemEnchanceRate = ObjectSystem.EquipEnchanceRateDBC.Search_Index_EQU((int)equip.GetItemType()); fRatio *= pItemEnchanceRate.nEquipPointRatio / 100.0f; itemEnhance.needMoney = (int)(fRatio * pItemEnhance.needMoney + 0.5f); itemEnhance.addProperty = pItemEnhance.attribute[0];// 因为增加属性的百分比都一样,所以只获取一个就够了[7/19/2011 ivan edit] return(itemEnhance); }
//镶嵌 public void OnEnchaseBtnClicked() { CObject_Item_Equip equipTarget = mSelectedItem as CObject_Item_Equip; if (equipTarget != null) { short[] gemIndexs = new short[GAMEDEFINE.MAX_ITEM_GEM]; for (int i = 0; i < mEnchanseGemInfo.Length; i++) { if (mEnchanseGemInfo[i].bFlag == 0) { gemIndexs[i] = -2; } else if (mEnchanseGemInfo[i].bFlag == 2) { gemIndexs[i] = -1; } else if (mEnchanseGemInfo[i].bFlag == 1) { CObject_Item gem = CDataPool.Instance.UserBag_GetItemById(mEnchanseGemInfo[i].nGemType); if (gem != null) { gemIndexs[i] = gem.PosIndex; } else { gemIndexs[i] = -2; } } } LifeAbility.Instance.setOperaterRole((int)mCurrentRoleType); LifeAbility.Instance.Do_Enchase(equipTarget, gemIndexs); } }
void Update_EnchanceEquip() //更新强化界面 { if (!gameObject.active) { return; } pItem = new List <CObject_Item_Equip>(); if (EnhanceMode == MODE.TAB_Role) { int index = 0; for (int i = 0; i < 10; i++) { if (index >= EnhanceNames.Count) { break; } CObject_Item_Equip equipItem = CDataPool.Instance.UserEquip_GetItem((HUMAN_EQUIP)i) as CObject_Item_Equip; if (equipItem != null) { int EquipPoint = (int)equipItem.GetItemType(); if (EquipPoint == 8 || EquipPoint == 9 || EquipPoint == 10) { continue; } else { pItem.Add(equipItem); index++; } } } } else if (EnhanceMode == MODE.TAB_Bag) { int index = 0; for (int i = 0; i < 60; i++) { CObject_Item_Equip packItem = CDataPool.Instance.UserBag_GetItemByIndex(i) as CObject_Item_Equip; if (packItem != null) { int EquipPoint = (int)packItem.GetItemType(); if (EquipPoint == 8 || EquipPoint == 9 || EquipPoint == 10) { continue; } else { pItem.Add(packItem); index++; } } } } nTheIndex = (int)EnhanceMode; IsShow(EnchanceIndex[nTheIndex]); }
public int GetNeedJob() { CObject_Item_Equip pItem = GetImpl() as CObject_Item_Equip; if (pItem != null) { return(pItem.GetNeedJob()); } return(-1); }
//显示镶嵌信息 void ShowEnchaseInfo(int index) { EnchaseItem = eItem[index]; EnchaseEquipIcon.UpdateItem(EnchaseItem.GetID()); int count = EnchaseItem.GetGemCount(); int i = 0; //ShowStoneInfo(count); int j = EnchasePage[nTheIndex] * 10; for (i = 0; i < 10; i++) { if (i + j >= eItem.Count) { EnchaseNames[i].Text = ""; EnchaseNums[i].Text = ""; EnchaseRadios[i].Hide(true); } else { EnchaseNames[i].Text = eItem[i + j].GetName(); EnchaseNums[i].Text = eItem[i + j].GetGemCount().ToString(); EnchaseRadios[i].Hide(false); } } int selectIndex = (int)EnchaseSelect[nTheIndex]; if (EnchasePage[nTheIndex] == EnchasePageRadio[nTheIndex]) { EnchaseRadios[selectIndex].Value = true; } else { EnchaseRadios[selectIndex].Value = false; } EnchasePageNum.Text = (EnchasePage[nTheIndex] + 1) + "/" + GetPageNum(); int k = 0; for (k = 0; k < 3; k++) { if (StoneItem[k] == null) { StoneIcons[k].SetActionItem(-1); StoneInfo[k].Text = "未镶嵌"; SelectStonesBtn[k].Hide(false); RemoveBtns[k].Hide(true); } } }
/// <summary> /// 强化 /// </summary> void UpdateEnchance() { ClearEnchanceContext(); mIsEnableEnchance = false; if (mSelectedItem != null) { //属性 mEnchanceSelectedAction.SetActionItem(mSelectedItem.GetID()); string text = mSelectedItem.GetWhiteAttribute(0); mEnchanceSelectedAttri1.Text = UIString.Instance.ParserString_Runtime(text); text = mSelectedItem.GetWhiteAttribute(1); if (text == "") { mEnchanceSelectedAttri2.Hide(true); } else { mEnchanceSelectedAttri2.Hide(false); mEnchanceSelectedAttri2.Text = UIString.Instance.ParserString_Runtime(text); } //效果 int nEnchanceLevel = mSelectedItem.GetStrengthLevel() + 1; CObject_Item_Equip equip = mSelectedItem as CObject_Item_Equip; if (equip != null) { text = equip.GetStrengthAttributeValue(nEnchanceLevel, 0); mEnchanceResultAttri1.Text = UIString.Instance.ParserString_Runtime(text); text = equip.GetStrengthAttributeValue(nEnchanceLevel, 1); if (text == "") { mEnchanceResultAttri2.Hide(true); } else { mEnchanceResultAttri2.Hide(false); mEnchanceResultAttri2.Text = UIString.Instance.ParserString_Runtime(text); } } Item_Enhance itemEnhance = LifeAbility.Instance.Get_Equip_EnhanceLevel(mSelectedItem); mEnchanceMoney.Text = itemEnhance.needMoney + " 金钱"; //是否可强化 if (mSelectedItem.GetStrengthLevel() < CObjectManager.Instance.getPlayerMySelf().GetCharacterData().Get_Level() && itemEnhance.needMoney <= CObjectManager.Instance.getPlayerMySelf().GetCharacterData().Get_Money()) { mEnchanceOK.controlIsEnabled = true; } } }
//重新设置物品属性 public void SetItemInfo(int nBagIndex, bool bEmpty, ref _ITEM pItem) { if (nBagIndex >= GAMEDEFINE.MAX_BAG_SIZE) { return; } //物品消失 if (bEmpty) { if (mItems[nBagIndex] != null) { ObjectSystem.Instance.DestroyItem(mItems[nBagIndex]); mItems[nBagIndex] = null; } } else//设置物品详细信息 { if (mItems[nBagIndex] != null) { if (mItems[nBagIndex].TypeOwner == ITEM_OWNER.IO_MYSELF_PACKET) { CObject_Item Item = mItems[nBagIndex]; Item.ItemSaveStatus = SAVE_ITEM_STATUS.GET_MORE_INFO; } // 判断是否增加item [9/20/2011 Sun] if (pItem.GetItemCount() > mItems[nBagIndex].GetNumber()) { CObject_Item_Equip item = mItems[nBagIndex] as CObject_Item_Equip; if (item != null) { int point = (int)item.GetItemType(); if (point == 8) { CEventSystem.Instance.PushEvent(GAME_EVENT_ID.GE_NEW_ITEM, mItems[nBagIndex].GetID()); } } if (mItems[nBagIndex].GetIdTable() == 30001001) { CEventSystem.Instance.PushEvent(GAME_EVENT_ID.GE_NEW_ITEM, mItems[nBagIndex].GetID()); } } mItems[nBagIndex].SetExtraInfo(ref pItem); } mSetAskExtra.Remove(nBagIndex); } }
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); } }
// 增加一个是否新获得物品的标志 [8/31/2011 Sun] public void SetItem(short nBagIndex, CObject_Item pItem, bool bClearOld, bool bNew) { if (nBagIndex < 0 || nBagIndex >= GAMEDEFINE.MAX_BAG_SIZE) { return; } //销毁原有数据 if (mItems[nBagIndex] != null && bClearOld) { ObjectSystem.Instance.DestroyItem(mItems[nBagIndex]); mItems[nBagIndex] = null; } if (pItem != null) { pItem.TypeOwner = ITEM_OWNER.IO_MYSELF_PACKET; pItem.PosIndex = nBagIndex; CObject_Item pItemLog = mItems[nBagIndex]; if (pItemLog != null) { // 设置物品的保存状态为无详细信息。2006-3-24 pItemLog.ItemSaveStatus = SAVE_ITEM_STATUS.NO_MORE_INFO; } } else {//原来有物品,移走 } mItems[nBagIndex] = pItem; // 产生一个新道具的事件 [8/31/2011 Sun] if (bNew == true && pItem != null) { CObject_Item_Equip item = pItem as CObject_Item_Equip; if (item != null) { int point = (int)item.GetItemType(); if (point == 8) { CEventSystem.Instance.PushEvent(GAME_EVENT_ID.GE_NEW_ITEM, item.GetID()); } } } }
//克隆详细信息 public void ClonetExtraInfo(CObject_Item_Equip pItemSource) { if (m_pExtraDefine != null) { m_pExtraDefine = new EXTRA_DEFINE(); } EXTRA_DEFINE pNewExtraDefine = pItemSource.GetExtraInfo(); m_pExtraDefine.m_CurDurPoint = pNewExtraDefine.m_CurDurPoint; m_pExtraDefine.m_MaxDurPoint = pNewExtraDefine.m_MaxDurPoint; m_pExtraDefine.m_nLevelNeed = pNewExtraDefine.m_nLevelNeed; // m_pExtraDefine.m_nFrogLevel = pItemInfo.GetEquipData().m_Level; m_pExtraDefine.m_nRepairFailureTimes = pNewExtraDefine.m_nRepairFailureTimes; m_pExtraDefine.m_nSellPrice = pNewExtraDefine.m_nSellPrice; m_pExtraDefine.M_nEquipBindInfo = pNewExtraDefine.M_nEquipBindInfo; // 增加克隆时候的可以镶嵌的宝石个数、强化等级 [9/14/2011 edit by ZL] m_pExtraDefine.m_EnableGemCount = pNewExtraDefine.m_EnableGemCount; m_pExtraDefine.m_EquipEnhanceLevel = pNewExtraDefine.m_EquipEnhanceLevel; m_pExtraDefine.m_vEquipAttachGem.Clear(); m_pExtraDefine.m_vBlueEquipAttributes.Clear(); m_pExtraDefine.m_vEquipAttributes.Clear(); for (int i = 0; i < pNewExtraDefine.m_vEquipAttachGem.Count; i++) { m_pExtraDefine.m_vEquipAttachGem.Add(pNewExtraDefine.m_vEquipAttachGem[i]); } for (int i = 0; i < pNewExtraDefine.m_vBlueEquipAttributes.Count; i++) { m_pExtraDefine.m_vBlueEquipAttributes.Add(pNewExtraDefine.m_vBlueEquipAttributes[i]); } // 增加基础属性克隆 [9/14/2011 edit by ZL] for (int i = 0; i < pNewExtraDefine.m_vEquipAttributes.Count; i++) { m_pExtraDefine.m_vEquipAttributes.Add(pNewExtraDefine.m_vEquipAttributes[i]); } SetNumber(pItemSource.GetNumber()); m_Quality = pItemSource.GetEquipQuantity(); m_theBaseDef = pItemSource.GetEquipBaseDefine(); // 装备是否鉴定过属性。2006-4-10。 m_EquipAttrib = pItemSource.m_EquipAttrib; }
// // 通过编号去查该配方,共需要几个材料 // INT GetPrescr_Material_Number(INT nPrescrID); // INT GetPrescrMaterialNumberNew(INT nPrescrID); // // 通过材料的编号,查询材料的详细信息,返回图标和名称。 // Lua_ICON_INFO GetPrescr_Material(INT nItemID); // // 通过序号去查第几个配方的编号 // INT GetPrescrList_Item_FromNum(INT nIndex); // INT GetPrescrList_Item_FromNum(INT nIndex, INT nLifeAbility); // // 计算身上原料总共可以合成多少个这个配方。 // INT GetPrescr_Item_Maximum(INT nIndex); // INT GetPrescrItemMaximumNew(INT nIndex, INT nMaterial);// [10/8/2011 Sun] // string GetPrescription_Kind(INT nPrescrKind); // // 计算原料数量。 // INT GetPrescr_Material_Hold_Count(INT nIndex,INT nMaterial); // INT GetPrescrMaterialCountInPackage(INT nIndex, INT nMaterial);// 根据新需求 [10/8/2011 Sun] // // 刷新合成界面 // INT Update_Synthesize( INT nAbility ); // // 打开宝石合成/镶嵌界面 // INT Open_Compose_Gem_Page( INT nPage ); // // 开始镶嵌 // INT Do_Enchase( INT nIndexEquip, INT nIndexGem, INT nIndexMat1 = -1, INT nIndexMat2 = -1 ); // // 开始合成 // INT Do_Combine(INT nIndexGem1, INT nIndexGem2, INT nIndexGem3, INT nIndexGem4, INT nIndexGem5, INT nIndexGem6 ); // // 宝石摘除 [7/16/2011 ivan edit] // INT Do_SeparateGem(INT nIndexEquip, INT nIndexGem, INT nIndexMat); // // 返回装备上,第i颗宝石的图标信息 // string GetEquip_Gem( INT nIndexEquip , UINT nIndexGem ); // 获取装备上的宝石数据 [7/16/2011 ivan edit] public string GetEquipGemInfo(CObject_Item_Equip equip, int nIndexGem, string dataType) { if (equip == null) { return(""); } int nGemType = equip.GetGemTableId(nIndexGem); _DBC_ITEM_GEM pGem = ObjectSystem.GemDBC.Search_Index_EQU(nGemType); if (pGem == null) { return(""); } string gemData = ""; if (dataType == "icon") { gemData = pGem.szIcon; } else if (dataType == "level") { gemData = pGem.nQuality.ToString(); } else if (dataType == "type") { gemData = pGem.nType.ToString(); } else if (dataType == "id") { gemData = pGem.nID.ToString(); } else if (dataType == "name") { gemData = pGem.szName; } else if (dataType == "attribute") { equip.GetGemExtAttr(nIndexGem, ref gemData); } return(gemData); }
// // 装备镶嵌消息 [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); } }
private void DoAction_MyEquip() { // 如果action item在装备栏上. // if(!CDataPool.Instance.Booth_IsClose()) // { // //在修理状态 // if(CActionSystem::GetMe()->GetDefaultAction() == CActionItem_MouseCmd_Repair::GetMe()) // { // //判以下是不是装备,只有装备可以修理 // if(pItem->GetItemClass() == ICLASS_EQUIP) // { // if( pItem->GetItemDur() < pItem->GetItemMaxDur() ) // { // CGameProcedure::s_pGameInterface->Booth_Repair(0, pItem->GetPosIndex(), FALSE); // } // else // { // CEventSystem::GetMe()->PushEvent(GE_INFO_SELF,"此物品不需要修理"); // } // } // } // } // else { CObject_Item_Equip pItemEquip = (CObject_Item_Equip)ItemImpl; if (pItemEquip.GetItemClass() != ITEM_CLASS.ICLASS_EQUIP) { return; } // 发送卸下装备消息. CGUnEquip msg = new CGUnEquip(); msg.EquipPoint = (byte)pItemEquip.GetItemType(); NetManager.GetNetManager().SendPacket(msg); } }
void NotifyPacketDrag(string sName, string tName) { int srcIndex = Convert.ToInt32(sName.Substring(1, sName.Length - 1)) - 1; int tarIndex = Convert.ToInt32(tName.Substring(1, tName.Length - 1)) - 1; ITEM_OWNER nTypeOwner = ItemImpl.TypeOwner; switch (nTypeOwner) { //Package -> Package case ITEM_OWNER.IO_MYSELF_PACKET: { //同一格 if (srcIndex == tarIndex) { break; } //不同格 CGPackage_SwapItem msg = new CGPackage_SwapItem(); msg.PIndex1 = (byte)srcIndex; msg.PIndex2 = (byte)tarIndex; NetManager.GetNetManager().SendPacket(msg); } break; case ITEM_OWNER.IO_PET_EQUIPT: { // 发送卸下宠物装备消息. CObject_Item_Equip curEquipt = ItemImpl as CObject_Item_Equip; if (GameProcedure.s_pUISystem != null && UISystem.Instance.IsWindowShow("RoleTipWindow") && curEquipt != null) { GameObject roleTip = UIWindowMng.Instance.GetWindowGo("RoleTipWindow"); UISelfEquip selfEquip = roleTip.GetComponent <UISelfEquip>(); SDATA_PET curPet = CDataPool.Instance.Pet_GetValidPet(selfEquip.ActivePet); //CDataPool.Instance.Pet_GetPet(selfEquip.ActivePet); if (curPet != null) { CGOperatePetEquip msg = new CGOperatePetEquip(); msg.OperatorType = 1; msg.GUID = curPet.GUID; msg.DestBagIndex = (byte)curEquipt.GetItemType(); msg.SourecBagIndex = (byte)tarIndex; NetManager.GetNetManager().SendPacket(msg); } } } break; default: break; } // switch(nTypeOwner) // { // //jiaoyikuang->Package // case tObject_Item::IO_MYEXBOX: // { // //发送拖动物品的消息 // CGExchangeSynchItemII msg; // msg.SetOpt(EXCHANGE_MSG::OPT_REMOVEITEM); // msg.SetFromIndex(this->GetPosIndex()); // msg.SetToType(EXCHANGE_MSG::POS_BAG); // msg.SetToIndex(nTargetIndex); // CNetManager::GetMe()->SendPacket(&msg); // } // break; // //Bank -> Package // case tObject_Item::IO_MYSELF_BANK: // { // CGBankRemoveItem msg; // msg.SetToType(CGBankRemoveItem::BAG_POS); // msg.SetIndexFrom(this->GetPosIndex()); // msg.SetIndexTo(nTargetIndex); // // CNetManager::GetMe()->SendPacket(&msg); // } // break; // //Package -> Package // case tObject_Item::IO_MYSELF_PACKET: // { // //同一格 // if(this->GetPosIndex() == nTargetIndex) break; // // //不同格 // CGPackage_SwapItem msg; // msg.SetPackageIndex1(GetPosIndex()); // msg.SetPackageIndex2(nTargetIndex); // // CNetManager::GetMe()->SendPacket(&msg); // } // break; // //SelfEquip -> package // case tObject_Item::IO_MYSELF_EQUIP: // { // //发送卸下装备的消息 // CGUnEquip msg; // msg.setEquipPoint(this->GetPosIndex()); // msg.setBagIndex((BYTE)nTargetIndex); // // CNetManager::GetMe()->SendPacket(&msg); // break; // } // //playerShop -> package // case tObject_Item::IO_PS_SELFBOX: // { // _ITEM_GUID Guid; // tObject_Item::ITEM_GUID temp; // temp.m_idUnion = 0; // // tObject_Item* pSelectItem = this->GetItemImpl(); // if(NULL == pSelectItem) // { // return; // } // // //需要先判定这个物品是否满足移动的条件 // //查询这个物品是不是处于上架的状态 // INT nIndex = pSelectItem->GetPosIndex(); // INT nConIndex = nIndex/20; // INT nPosition = nIndex%20; // if(CDataPool::GetMe()->PlayerShop_GetItemOnSale(TRUE, nConIndex, nPosition)) // { // //已经上架,不能取回 // return; // } // // pSelectItem->GetGUID(temp.m_idOrg.m_idWorld, temp.m_idOrg.m_idServer, temp.m_idOrg.m_uSerial); // Guid.m_World = (BYTE)temp.m_idOrg.m_idWorld; // Guid.m_Server = (BYTE)temp.m_idOrg.m_idServer; // Guid.m_Serial = (INT)temp.m_idOrg.m_uSerial; // // CGItemSynch msg; // msg.SetOpt(CGItemSynch::OPT_MOVE_ITEM_MANU); // msg.SetFromType(CGItemSynch::POS_PLAYERSHOP); // msg.SetToIndex(nTargetIndex); // msg.SetToType(CGItemSynch::POS_BAG); // msg.SetItemGUID(Guid); // // INT nPage = CDataPool::GetMe()->PlayerShop_GetMySelectConTa(); // CGManuMoveItemFromPlayerShopToBag_t ExtraDataInfo; // ExtraDataInfo.m_ShopGuid = CDataPool::GetMe()->PlayerShop_GetShopID(TRUE); // ExtraDataInfo.m_nStallIndex = (BYTE)nPage; // ExtraDataInfo.m_uSerial = CDataPool::GetMe()->PlayerShop_GetItemSerial(TRUE,nPage,this->GetPosIndex()%20); // msg.SetExtraInfoLength(ExtraDataInfo.GetSize()); // msg.SetExtraInfoData((BYTE*)&ExtraDataInfo); // // CNetManager::GetMe()->SendPacket(&msg); // } // break; // default: // break; // } }
////////////////////////////////////////////////////////////////////////// // 所有标记 [7/14/2011 ivan edit] // case 'S': //摆摊界面 // case 'Q': //任务提交界面(MissionReply) // case 'B': //银行 // case 'P': //背包 // case 'E': //交易界面,只能拖动到自己的(右边的)格子里头(1~6) // case 'R': //银行的界面上的租赁箱格子 // case 'G': //宝石合成/镶嵌界面 // case 'C': //装备打孔 [7/14/2011 ivan edit] // case 'T': //宠物技能学习/还童/延长寿命/宠物驯养/宠物征友 // case 'Z': //人物装备界面 // case 'A': //玩家商店 // case 'M': //主菜单 // case 'Y': //对象头像 // case 'L': //自己头像 // case 'I': // 装备强化 [7/18/2011 ivan edit] // case 'E': // 宠物装备 ////////////////////////////////////////////////////////////////////////// public override void NotifyDragDropDragged(bool bDestory, string szTargetName, string szSourceName) { //LogManager.LogWarning("Drag From:" + szSourceName + " to:" + szTargetName); //拖动到表示销毁的地方 if (bDestory) { DestoryItem(szSourceName); return; } //拖动到空白地方 if (szTargetName == "") { return; } char cSourceName = szSourceName[0]; char cTargetType = szTargetName[0]; //如果是快捷栏,不能往其他地方拖,除了自己本身。 if (cSourceName == 'M' && cTargetType != 'M') { return; } switch (cTargetType) { case 'P': NotifyPacketDrag(szSourceName, szTargetName); break; case 'E': { ITEM_OWNER typeOwner = ItemImpl.TypeOwner; switch (typeOwner) { case ITEM_OWNER.IO_MYSELF_PACKET: { // 发送装备宠物装备消息. CObject_Item_Equip curEquipt = ItemImpl as CObject_Item_Equip; if (GameProcedure.s_pUISystem != null && UISystem.Instance.IsWindowShow("RoleTipWindow") && curEquipt != null) { GameObject roleTip = UIWindowMng.Instance.GetWindowGo("RoleTipWindow"); UISelfEquip selfEquip = roleTip.GetComponent <UISelfEquip>(); SDATA_PET curPet = CDataPool.Instance.Pet_GetValidPet(selfEquip.ActivePet); //CDataPool.Instance.Pet_GetPet(selfEquip.ActivePet); int tarIndex = Convert.ToInt32(szTargetName.Substring(1, szTargetName.Length - 1)) - 1; if ((int)curEquipt.GetItemType() != tarIndex) { CEventSystem.Instance.PushEvent(GAME_EVENT_ID.GE_INFO_SELF, "该装备不能装备到目标位置"); } else if (!curEquipt.IsPetEquipt()) { CEventSystem.Instance.PushEvent(GAME_EVENT_ID.GE_INFO_SELF, "该装备不能装备到宠物上"); } else if (curPet != null && curEquipt != null) { CGOperatePetEquip msg = new CGOperatePetEquip(); msg.OperatorType = 0; msg.GUID = curPet.GUID; msg.DestBagIndex = (byte)curEquipt.GetItemType(); msg.SourecBagIndex = (byte)GetPosIndex(); NetManager.GetNetManager().SendPacket(msg); } } } break; } } break; case 'B': //bank { int tarIndex = Convert.ToInt32(szTargetName.Substring(1, szTargetName.Length - 1)) - 1; if (!CDataPool.Instance.UserBank_IsValid(tarIndex)) { CEventSystem.Instance.PushEvent(GAME_EVENT_ID.GE_INFO_SELF, "格子未解封"); return; } //根据物品的来源决定发送什么消息 ITEM_OWNER typeOwner = ItemImpl.TypeOwner; //任务物品不能放入银行 if (ItemImpl.GetItemClass() == ITEM_CLASS.ICLASS_TASKITEM) { CEventSystem.Instance.PushEvent(GAME_EVENT_ID.GE_INFO_SELF, "任务物品不能放入"); return; } switch (typeOwner) { case ITEM_OWNER.IO_MYSELF_PACKET: //来自玩家的背包 { CGBankAddItem msg = new CGBankAddItem(); msg.FromType = (byte)(CGBankAddItem.AddType.BAG_POS); msg.IndexFrom = (byte)GetPosIndex(); msg.IndexTo = (byte)tarIndex; NetManager.GetNetManager().SendPacket(msg); } break; case ITEM_OWNER.IO_MYSELF_BANK: //来自银行内部 { CGBankSwapItem msg = new CGBankSwapItem(); msg.FromType = (byte)CGBankSwapItem.AddType.BANK_POS; msg.IndexFrom = (byte)GetPosIndex(); msg.IndexTo = (byte)tarIndex; msg.ToType = (byte)(CGBankSwapItem.AddType.BANK_POS); if (msg.IndexFrom == msg.IndexTo) { break; } NetManager.GetNetManager().SendPacket(msg); } break; default: break; } } break; } //switch(cSourceName) //{ //case 'M': // { // INT nIndex = szSourceName[1]-'0'; // nIndex = szSourceName[2]-'0' + nIndex*10 ; // CActionSystem::GetMe()->MainMenuBar_Set(nIndex, nOldTargetId); // } // break; //default: // break; //} //CEventSystem.Instance.PushEvent(GAME_EVENT_ID.GE_SUPERTOOLTIP); }
public void CloneForUpLevel(CObject_Item_Equip pItemSource) { //克隆额外属性 if (m_pExtraDefine != null) { m_pExtraDefine = new EXTRA_DEFINE(); } EXTRA_DEFINE pNewExtraDefine = pItemSource.GetExtraInfo(); m_pExtraDefine.m_CurDurPoint = pNewExtraDefine.m_CurDurPoint; m_pExtraDefine.m_MaxDurPoint = pNewExtraDefine.m_MaxDurPoint; m_pExtraDefine.m_nLevelNeed = pNewExtraDefine.m_nLevelNeed; // m_pExtraDefine.m_nFrogLevel = pItemInfo.GetEquipData().m_Level; m_pExtraDefine.m_nRepairFailureTimes = pNewExtraDefine.m_nRepairFailureTimes; m_pExtraDefine.m_nSellPrice = pNewExtraDefine.m_nSellPrice; m_pExtraDefine.M_nEquipBindInfo = pNewExtraDefine.M_nEquipBindInfo; // 增加克隆时候的可以镶嵌的宝石个数、强化等级 [9/14/2011 edit by ZL] m_pExtraDefine.m_EnableGemCount = pNewExtraDefine.m_EnableGemCount; m_pExtraDefine.m_EquipEnhanceLevel = pNewExtraDefine.m_EquipEnhanceLevel; m_pExtraDefine.m_vEquipAttachGem.Clear(); m_pExtraDefine.m_vBlueEquipAttributes.Clear(); for (int i = 0; i < pNewExtraDefine.m_vEquipAttachGem.Count; i++) { m_pExtraDefine.m_vEquipAttachGem.Add(pNewExtraDefine.m_vEquipAttachGem[i]); } for (int i = 0; i < pNewExtraDefine.m_vBlueEquipAttributes.Count; i++) { m_pExtraDefine.m_vBlueEquipAttributes.Add(pNewExtraDefine.m_vBlueEquipAttributes[i]); } //升档回退强化 if (m_pExtraDefine.m_EquipEnhanceLevel >= 5) { m_pExtraDefine.m_EquipEnhanceLevel -= 5; } //基础属性根据新的强化等级计算 int nEnchanceIndex = m_theBaseDef.nEquipPoint * 110 + m_pExtraDefine.m_EquipEnhanceLevel; for (int i = 0; i < pNewExtraDefine.m_vEquipAttributes.Count; i++) { _ITEM_ATTR value = pNewExtraDefine.m_vEquipAttributes[i]; if (value.m_Value.m_Value > 0) { value.m_Value.m_Value = (short)(m_theBaseDef.nBaseAttr[value.m_AttrType] * CaclStrendthValue(value.m_AttrType, m_theBaseDef.nEquipPoint, m_pExtraDefine.m_EquipEnhanceLevel) + 0.5f); } m_pExtraDefine.m_vEquipAttributes.Add(value); } SetNumber(pItemSource.GetNumber()); m_Quality = pItemSource.GetEquipQuantity(); m_EquipAttrib = pItemSource.m_EquipAttrib; base.Clone(pItemSource); }
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(); }
public CObject_Item NewItem(uint idTable) { CObject_Item newItem = null; if (IsWhiteEquip(idTable)) { //搜索纪录 _DBC_ITEM_EQUIP_BASE pEquip = EquipDBC.Search_Index_EQU((int)idTable); if (pEquip == null) { return(null); } newItem = new CObject_Item_Equip(CreateID()); ((CObject_Item_Equip)newItem).AsWhiteEquip(ref pEquip); //物品规则 itemRule(pEquip, newItem); } else if (IsGreenEquip(idTable)) { //搜索纪录 _DBC_ITEM_EQUIP_BASE pEquip = EquipDBC.Search_Index_EQU((int)idTable); if (pEquip == null) { return(null); } newItem = new CObject_Item_Equip(CreateID()); ((CObject_Item_Equip)newItem).AsGreenEquip(ref pEquip); //物品规则 itemRule(pEquip, newItem); } else if (IsBlueEquip(idTable)) { //搜索纪录 _DBC_ITEM_EQUIP_BASE pEquip = EquipDBC.Search_Index_EQU((int)idTable); if (pEquip == null) { return(null); } newItem = new CObject_Item_Equip(CreateID()); ((CObject_Item_Equip)newItem).AsBlueEquip(ref pEquip); //物品规则 itemRule(pEquip, newItem); } else if (IsPurpleEquip(idTable)) { //搜索纪录 _DBC_ITEM_EQUIP_BASE pEquip = EquipDBC.Search_Index_EQU((int)idTable); if (pEquip == null) { return(null); } newItem = new CObject_Item_Equip(CreateID()); ((CObject_Item_Equip)newItem).AsPurpleEquip(ref pEquip); //物品规则 itemRule(pEquip, newItem); } else if (IsMedicItem(idTable)) { COMMON_DBC <_DBC_ITEM_MEDIC> allMedic = CDataBaseSystem.Instance.GetDataBase <_DBC_ITEM_MEDIC>((int)DataBaseStruct.DBC_ITEM_MEDIC); if (allMedic != null) { _DBC_ITEM_MEDIC pMedic = allMedic.Search_Index_EQU((int)idTable); newItem = new CObject_Item_Medicine(CreateID()); ((CObject_Item_Medicine)newItem).AsMedicine(pMedic); itemRule(pMedic, newItem); } else { throw new Exception("_DBC_ITEM_MEDIC database not found"); } } else if (IsGemItem((int)idTable)) { //搜索纪录 _DBC_ITEM_GEM pGem = GemDBC.Search_Index_EQU((int)idTable); if (pGem == null) { return(null); } newItem = new CObject_Item_Gem(CreateID()); ((CObject_Item_Gem)newItem).AsGem(pGem); //物品规则 itemRule(pGem, newItem); } else if (isSymbolItem(idTable)) //是符印 { _DBC_ITEM_SYMBOL pSymbol = SymbolDBC.Search_Index_EQU((int)idTable); if (pSymbol == null) { return(null); } newItem = new CObject_Item_Symbol(CreateID()); ((CObject_Item_Symbol)newItem).AsSymbol(pSymbol); //物品规则 itemRule(pSymbol, newItem); } else if (isTalismanItem(idTable)) //是法宝 { _DBC_ITEM_TALISMAN dbItem = CDataBaseSystem.Instance.GetDataBase <_DBC_ITEM_TALISMAN>((int)DataBaseStruct.DBC_ITEM_TALISMAN).Search_Index_EQU((int)idTable); if (dbItem == null) { return(null); } newItem = new CTalisman_Item(CreateID()); CTalisman_Item curItem = newItem as CTalisman_Item; curItem.Define = dbItem; //物品规则 itemRule(dbItem, newItem); } if (newItem == null) { LogManager.LogError("物品编号填写错误!,ID:" + idTable); } else { newItem.m_idTable = (int)idTable; allItems[newItem.GetID()] = newItem; } return(newItem); }
private void DoAction_Packet() { // 判断商店是否开启 [2/20/2012 Ivan] if (UISystem.Instance.IsWindowShow("ShopWindow")) { // //是否在修理状态 //if(CActionSystem::GetMe()->GetDefaultAction() == CActionItem_MouseCmd_Repair::GetMe()) //{ // //取消修理 // CGameProcedure::s_pGameInterface->Skill_CancelAction(); //} ////执行销售 //else { //任务物品不可以卖 if (ItemImpl.GetItemClass() == ITEM_CLASS.ICLASS_TASKITEM) { //任务物品不能卖的信息提示 //if(bLog) //{ // STRING strTemp = "这件物品不能出售";//NOCOLORMSGFUNC("stall_sold_failure"); // ADDNEWDEBUGMSG(strTemp); //} } else { GameProcedure.s_pGameInterface.Booth_SellItem(ItemImpl); } } return; } //银行开启 else if (GameProcedure.s_pUISystem != null && UISystem.Instance.IsWindowShow("StoreWindow")) { //需要先判定是不是能够存入银行的物品 if (ItemImpl != null && ItemImpl.GetItemClass() == ITEM_CLASS.ICLASS_TASKITEM) //if(pItem->GetPosIndex() >= TASK_CONTAINER_OFFSET ) { //任务物品不能放入银行 CEventSystem.Instance.PushEvent(GAME_EVENT_ID.GE_INFO_SELF, "任务物品不能存入银行"); return; } CGBankAddItem msg = new CGBankAddItem(); msg.FromType = (byte)(CGBankAddItem.AddType.BAG_POS); msg.IndexFrom = (byte)(GetPosIndex()); msg.IndexTo = (byte)CGBankAddItem.AutoPosBox.AUTO_POS_BOX1; //检测这个租赁箱是不是有空位 if (!CDataPool.Instance.UserBank_IsEmpty(1)) { CEventSystem.Instance.PushEvent(GAME_EVENT_ID.GE_INFO_SELF, "仓库已经满了"); return; } NetManager.GetNetManager().SendPacket(msg); return; } else// 没有打开任何其他窗口的时候 [2/20/2012 Ivan] { switch (ItemImpl.GetItemClass()) { case ITEM_CLASS.ICLASS_EQUIP: //装备 { //使用 CObject_Item_Equip curEquipt = ItemImpl as CObject_Item_Equip; //装备宠物 if (GameProcedure.s_pUISystem != null && UISystem.Instance.IsWindowShow("RoleTipWindow") && curEquipt != null) { if (!curEquipt.IsPetEquipt()) { GameInterface.Instance.PacketItem_UserEquip(ItemImpl); // CEventSystem.Instance.PushEvent(GAME_EVENT_ID.GE_INFO_SELF, "该装备不是宠物装备"); } else { GameObject roleTip = UIWindowMng.Instance.GetWindowGo("RoleTipWindow"); UISelfEquip selfEquip = roleTip.GetComponent <UISelfEquip>(); SDATA_PET curPet = CDataPool.Instance.Pet_GetValidPet(selfEquip.ActivePet); //CDataPool.Instance.Pet_GetPet(selfEquip.ActivePet); if (curPet != null) { CGOperatePetEquip msg = new CGOperatePetEquip(); msg.OperatorType = 0; msg.GUID = curPet.GUID; msg.SourecBagIndex = (byte)GetPosIndex(); msg.DestBagIndex = (byte)curEquipt.GetItemType(); NetManager.GetNetManager().SendPacket(msg); } } } else { if (curEquipt != null) { if (!curEquipt.IsPetEquipt()) { GameInterface.Instance.PacketItem_UserEquip(ItemImpl); } else { CEventSystem.Instance.PushEvent(GAME_EVENT_ID.GE_INFO_SELF, "该装备只能给宠物使用"); } } else { CEventSystem.Instance.PushEvent(GAME_EVENT_ID.GE_INFO_SELF, "该物品不是装备"); } } } break; case ITEM_CLASS.ICLASS_MATERIAL: break; case ITEM_CLASS.ICLASS_COMITEM: case ITEM_CLASS.ICLASS_TASKITEM: case ITEM_CLASS.ICLASS_STOREMAP: { int iType = ItemImpl.GetItemTableType(); //摆摊时不可以随便使用物品 // if(TRUE == CObjectManager::GetMe()->GetMySelf()->GetCharacterData()->Get_IsInStall()) // { // CEventSystem::GetMe()->PushEvent(GE_INFO_SELF,"你正在摆摊……"); // break; // } //验证是否可以使用 if (!ItemImpl.Rule(ITEM_RULE.RULE_USE)) { CEventSystem.Instance.PushEvent(GAME_EVENT_ID.GE_INFO_SELF, ItemImpl.RuleFailMessage(ITEM_RULE.RULE_USE)); return; } //检查冷却是否结束 if (!CoolDownIsOver()) { CActionSystem.Instance.SetoutAction = this; CEventSystem.Instance.PushEvent(GAME_EVENT_ID.GE_INFO_SELF, GameDefineResult.Instance.GetOResultText(OPERATE_RESULT.OR_COOL_DOWNING)); break; } CObject pMainTarget = CObjectManager.Instance.GetMainTarget(); //使用物品时自动下坐骑 [3/14/2012 ZZY] bool result = CObjectManager.Instance.getPlayerMySelf().UnRideUseItem(this, (pMainTarget != null ? pMainTarget.ServerID : -1), new Vector2(-1, -1)); if (!result) { GameInterface.Instance.PacketItem_UserItem(this, (pMainTarget != null? pMainTarget.ServerID:-1), new Vector2(-1, -1)); } } break; case ITEM_CLASS.ICLASS_GEM: break; case ITEM_CLASS.ICLASS_SYMBOLITEM: // [3/22/2012 ZZY] //请求使用符印 GameInterface.Instance.PacketItem_UserSymbol(this); break; case ITEM_CLASS.ICLASS_TALISMAN: break; case ITEM_CLASS.ICLASS_GUILDITEM: break; case ITEM_CLASS.ICLASS_NUMBER: break; default: break; } } }
void OnChangedRoleType(RoleType rt) { Clear(); bool bResetSelectIndex = true; switch (rt) { case RoleType.ROLE_SELF: { // 装备点的最大个数. int nBeginIndex = mCurrentEquipIndex * MAX_EQUIPGRID; int nCount = 0; //总装备数量 for (int i = 0; i < (int)HUMAN_EQUIP.HEQUIP_NUMBER; i++) { if (i == (int)HUMAN_EQUIP.HEQUIP_RIDER) { continue; } //取得玩家身上的装备 CObject_Item pItem = CDataPool.Instance.UserEquip_GetItem((HUMAN_EQUIP)i); if (pItem != null) { if (nCount < nBeginIndex || nCount - nBeginIndex >= MAX_EQUIPGRID) { nCount++; continue; } //不重置当前选择的索引 if (nCount - nBeginIndex >= mCurrentSelectedEquip) { bResetSelectIndex = false; } mEquips[nCount - nBeginIndex].SetActionItem(pItem.GetID()); mEquipsText[nCount - nBeginIndex].Text = pItem.GetName() + "\n" + "强化 " + pItem.GetStrengthLevel() + "级"; nCount++; } } mMaxPage = nCount / MAX_EQUIPGRID; if (nCount % MAX_EQUIPGRID != 0) { mMaxPage++; } UpatePageNum(); } break; case RoleType.ROLE_PACKET: { int nCount = 0; int nBeginIndex = mCurrentEquipIndex * MAX_EQUIPGRID; for (int i = GAMEDEFINE.EQUIP_BAG_BEGIN; i < GAMEDEFINE.EQUIP_BAG_END; i++) { CObject_Item_Equip item = CDataPool.Instance.UserBag_GetItem(i) as CObject_Item_Equip; if (item != null && item.GetItemType() != HUMAN_EQUIP.HEQUIP_RIDER) { if (nCount < nBeginIndex || nCount - nBeginIndex >= MAX_EQUIPGRID) { nCount++; continue; } //不重置当前选择的索引 if (nCount - nBeginIndex >= mCurrentSelectedEquip) { bResetSelectIndex = false; } mEquips[nCount - nBeginIndex].SetActionItem(item.GetID()); mEquipsText[nCount - nBeginIndex].Text = item.GetName() + "\n" + "强化 " + item.GetStrengthLevel() + "级"; nCount++; } } mMaxPage = nCount / MAX_EQUIPGRID; if (nCount % MAX_EQUIPGRID != 0) { mMaxPage++; } UpatePageNum(); } break; case RoleType.ROLE_PET1: { RefreshRolePetPage(0, ref bResetSelectIndex); } break; case RoleType.ROLE_PET2: { RefreshRolePetPage(1, ref bResetSelectIndex); } break; case RoleType.ROLE_PET3: { RefreshRolePetPage(2, ref bResetSelectIndex); } break; case RoleType.ROLE_PET4: { RefreshRolePetPage(3, ref bResetSelectIndex); } break; case RoleType.ROLE_PET5: { RefreshRolePetPage(4, ref bResetSelectIndex); } break; case RoleType.ROLE_PET6: { RefreshRolePetPage(5, ref bResetSelectIndex); } break; default: break; } //切换回归第一件装备 if (bResetSelectIndex) { mCurrentSelectedEquip = 0; mEquipMenus[mCurrentSelectedEquip].Value = true; } SelectedEquipChanged(mCurrentSelectedEquip); }
public string GetEquipType() { CObject_Item_Equip pItem = GetImpl() as CObject_Item_Equip; if (pItem != null) { switch (pItem.GetItemType()) { case HUMAN_EQUIP.HEQUIP_WEAPON: return("武器"); //break; case HUMAN_EQUIP.HEQUIP_CAP: return("头盔"); //break; case HUMAN_EQUIP.HEQUIP_ARMOR: return("盔甲"); // break; case HUMAN_EQUIP.HEQUIP_CUFF: return("手套"); //break; case HUMAN_EQUIP.HEQUIP_BOOT: return("鞋子"); //break; case HUMAN_EQUIP.HEQUIP_SASH: return("腰带"); //break; case HUMAN_EQUIP.HEQUIP_RING: return("戒指"); //break; case HUMAN_EQUIP.HEQUIP_NECKLACE: return("项链"); //break; case HUMAN_EQUIP.HEQUIP_BACK: return("背饰"); //break; case HUMAN_EQUIP.HEQUIP_FABAO: return("法宝"); //break; case HUMAN_EQUIP.HEQUIP_RING2: return("戒指"); //break; case HUMAN_EQUIP.HEQUIP_CHARM: return("护符"); //break; case HUMAN_EQUIP.HEQUIP_JADE: return("玉佩"); //break; case HUMAN_EQUIP.HEQUIP_WRIST: return("护腕"); //break; case HUMAN_EQUIP.HEQUIP_SHOULDER: return("护肩"); //break; default: break; } } return(""); }