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); } } }
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 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); }