📄 gcstashlist.cpp
字号:
//////////////////////////////////////////////////////////////////////////////// Filename : GCStashList.cpp // Written By : 辫己刮// Description : //////////////////////////////////////////////////////////////////////////////#include "GCStashList.h"#include "Assert.h"#ifdef __GAME_SERVER__ #include "Item.h" #include "ItemInfoManager.h" #include "Inventory.h" #include "AR.h" #include "SR.h" #include "SG.h" #include "SMG.h" #include "Belt.h" #include "OustersArmsband.h" #include "PetItem.h"#endif//////////////////////////////////////////////////////////////////////////////// constructor//////////////////////////////////////////////////////////////////////////////GCStashList::GCStashList() throw (){ __BEGIN_TRY for (int r=0; r<STASH_RACK_MAX; r++) { for (int i=0; i<STASH_INDEX_MAX; i++) { m_bExist[r][i] = false; m_SubItemsCount[r][i] = 0; } } __END_CATCH}//////////////////////////////////////////////////////////////////////////////// destructor//////////////////////////////////////////////////////////////////////////////GCStashList::~GCStashList() throw (){ __BEGIN_TRY for (int r=0; r<STASH_RACK_MAX; r++) { for (int i=0; i<STASH_INDEX_MAX; i++) { list<SubItemInfo*>::iterator itr = m_pSubItems[r][i].begin(); for (; itr != m_pSubItems[r][i].end(); itr++) { SubItemInfo* pItemInfo = *itr; SAFE_DELETE(pItemInfo); } } } __END_CATCH}//////////////////////////////////////////////////////////////////////////////// 涝仿胶飘覆(滚欺)栏肺何磐 单捞鸥甫 佬绢辑 菩哦阑 檬扁拳茄促.//////////////////////////////////////////////////////////////////////////////void GCStashList::read ( SocketInputStream & iStream ) throw ( ProtocolException , Error ){ __BEGIN_TRY BYTE i = 0; BYTE nTotal = 0; BYTE rack = 0; BYTE index = 0; // 焊包窃狼 肮荐甫 佬绢甸牢促. iStream.read(m_StashNum); // 醚 酒捞袍狼 箭磊甫 佬绢甸牢促. iStream.read(nTotal); // 阿 酒捞袍狼 沥焊甫 佬绢甸牢促. for (i=0; i<nTotal; i++) { iStream.read(rack); iStream.read(index); _STASHITEM& item = m_pItems[rack][index]; iStream.read(item.objectID); iStream.read(item.itemClass); iStream.read(item.itemType); BYTE optionSize; iStream.read(optionSize); for (int j=0; j<optionSize; j++) { OptionType_t optionType; iStream.read(optionType); item.optionType.push_back( optionType ); } iStream.read(item.durability); iStream.read(item.num); iStream.read(item.silver); iStream.read(item.grade); iStream.read(item.enchantLevel); // sub 酒捞袍 沥焊甫 佬绢甸牢促. iStream.read( m_SubItemsCount[rack][index] ); for (int s=0; s < m_SubItemsCount[rack][index]; s++) { SubItemInfo* pSubItemInfo = new SubItemInfo(); pSubItemInfo->read(iStream); m_pSubItems[rack][index].push_back(pSubItemInfo); } m_bExist[rack][index] = true; } // 捣狼 剧阑 佬绢甸牢促. iStream.read(m_StashGold); __END_CATCH} //////////////////////////////////////////////////////////////////////////////// 免仿胶飘覆(滚欺)栏肺 菩哦狼 官捞呈府 捞固瘤甫 焊辰促.//////////////////////////////////////////////////////////////////////////////void GCStashList::write ( SocketOutputStream & oStream ) const throw ( ProtocolException , Error ){ __BEGIN_TRY __BEGIN_DEBUG BYTE r = 0; BYTE i = 0; BYTE nTotal = 0; // 醚 酒捞袍狼 箭磊甫 拌魂茄促. for (r=0; r<STASH_RACK_MAX; r++) for (i=0; i<STASH_INDEX_MAX; i++) if (m_bExist[r][i]) nTotal++; // 焊包窃狼 肮荐甫 朝妨霖促. oStream.write(m_StashNum); // 醚 酒捞袍狼 箭磊甫 朝妨霖促 oStream.write(nTotal); // write each item info for (r=0; r<STASH_RACK_MAX; r++) { for (i=0; i<STASH_INDEX_MAX; i++) { if (m_bExist[r][i]) { const _STASHITEM& item = m_pItems[r][i]; oStream.write(r); oStream.write(i); oStream.write(item.objectID); oStream.write(item.itemClass); oStream.write(item.itemType); BYTE optionSize = item.optionType.size(); oStream.write(optionSize); list<OptionType_t>::const_iterator iOption; for (iOption=item.optionType.begin(); iOption!=item.optionType.end(); iOption++) { OptionType_t optionType = *iOption; oStream.write(optionType); } oStream.write(item.durability); oStream.write(item.num); oStream.write(item.silver); oStream.write(item.grade); oStream.write(item.enchantLevel); // sub 酒捞袍 沥焊甫 敬促. oStream.write(m_SubItemsCount[r][i]); list<SubItemInfo*>::const_iterator itr = m_pSubItems[r][i].begin(); for (; itr != m_pSubItems[r][i].end(); itr++) { if (*itr) (*itr)->write(oStream); } } } } // 捣狼 剧阑 结霖促. oStream.write(m_StashGold); __END_DEBUG __END_CATCH}//////////////////////////////////////////////////////////////////////////////// execute packet's handler//////////////////////////////////////////////////////////////////////////////void GCStashList::execute ( Player * pPlayer ) throw ( ProtocolException , Error ){ __BEGIN_TRY __BEGIN_DEBUG GCStashListHandler::execute( this , pPlayer ); __END_DEBUG __END_CATCH}////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////PacketSize_t GCStashList::getPacketSize () const throw (){ __BEGIN_TRY __BEGIN_DEBUG PacketSize_t size = szBYTE; // 焊包窃狼 肮荐 size += szBYTE; // 醚 酒捞袍 箭磊 for (int r=0; r<STASH_RACK_MAX; r++) { for (int i=0; i<STASH_INDEX_MAX; i++) { if (m_bExist[r][i]) { // rack苞 牢郸胶 size += szBYTE*2; // 角力 沥焊 /* size += szObjectID; size += szBYTE; size += szItemType; size += szBYTE + optionType.size(); size += szDurability; size += szItemNum; size += szSilver; size += szEnchantLevel; */ size += m_pItems[r][i].getPacketSize(); // 骇飘俊 甸绢乐绰 酒捞袍狼 箭磊 size += szBYTE; // 骇飘俊 甸绢 乐绰 酒捞袍狼 农扁 size += SubItemInfo::getSize() * m_SubItemsCount[r][i]; } } } size += szGold; // 焊包窃俊 甸绢乐绰 捣 return size; __END_DEBUG __END_CATCH}//////////////////////////////////////////////////////////////////////////////// get packet's debug string//////////////////////////////////////////////////////////////////////////////string GCStashList::toString () const throw (){ __BEGIN_TRY StringStream msg; msg << "GCStashList("; for (int r=0; r<STASH_RACK_MAX; r++) { for (int i=0; i<STASH_INDEX_MAX; i++)
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -