📄 gcshoplistmysterious.cpp
字号:
//////////////////////////////////////////////////////////////////////////////// Filename : GCShopListMysterious.cpp // Written By : 辫己刮// Description :// 敲饭捞绢啊 啊柳 惑痢 滚傈捞 辑滚俊 乐绰 巴苞 促甫 版快,// 敲饭捞绢绰 辑滚俊 惑痢俊 乐绰 惑前 格废阑 夸备窍霸 等促.// 捞 菩哦篮 弊 锭 敲饭捞绢俊霸 傈崔窍霸 登绰 菩哦捞促.//////////////////////////////////////////////////////////////////////////////#include "GCShopListMysterious.h"#include "Assert.h"#include "Item.h"//////////////////////////////////////////////////////////////////////////////// constructor//////////////////////////////////////////////////////////////////////////////GCShopListMysterious::GCShopListMysterious() throw (){ __BEGIN_TRY for (int i=0; i<SHOP_RACK_INDEX_MAX; i++) m_pBuffer[i].bExist = false; __END_CATCH}//////////////////////////////////////////////////////////////////////////////// destructor//////////////////////////////////////////////////////////////////////////////GCShopListMysterious::~GCShopListMysterious() throw (){ __BEGIN_TRY __END_CATCH}//////////////////////////////////////////////////////////////////////////////// 涝仿胶飘覆(滚欺)栏肺何磐 单捞鸥甫 佬绢辑 菩哦阑 檬扁拳茄促.//////////////////////////////////////////////////////////////////////////////void GCShopListMysterious::read ( SocketInputStream & iStream ) throw ( ProtocolException , Error ){ __BEGIN_TRY BYTE i = 0; BYTE nTotal = 0; BYTE index = 0; // read NPC id & version & rack type & number of item iStream.read(m_ObjectID); iStream.read(m_Version); iStream.read(m_RackType); iStream.read(nTotal); // read each item info for (i=0; i<nTotal; i++) { iStream.read(index); iStream.read(m_pBuffer[index].itemClass); iStream.read(m_pBuffer[index].itemType); m_pBuffer[index].bExist = true; } // read market condition iStream.read(m_MarketCondBuy); iStream.read(m_MarketCondSell); __END_CATCH} //////////////////////////////////////////////////////////////////////////////// 免仿胶飘覆(滚欺)栏肺 菩哦狼 官捞呈府 捞固瘤甫 焊辰促.//////////////////////////////////////////////////////////////////////////////void GCShopListMysterious::write ( SocketOutputStream & oStream ) const throw ( ProtocolException , Error ){ __BEGIN_TRY BYTE i = 0; BYTE nTotal = 0; // calculate total number of items for (i=0; i<SHOP_RACK_INDEX_MAX; i++) if (m_pBuffer[i].bExist) nTotal++; // write NPC id & version & rack type & number of item oStream.write(m_ObjectID); oStream.write(m_Version); oStream.write(m_RackType); oStream.write(nTotal); // write each item info for (i=0; i<SHOP_RACK_INDEX_MAX; i++) { if (m_pBuffer[i].bExist) { oStream.write(i); oStream.write(m_pBuffer[i].itemClass); oStream.write(m_pBuffer[i].itemType); } } oStream.write(m_MarketCondBuy); oStream.write(m_MarketCondSell); __END_CATCH}//////////////////////////////////////////////////////////////////////////////// execute packet's handler//////////////////////////////////////////////////////////////////////////////void GCShopListMysterious::execute ( Player * pPlayer ) throw ( ProtocolException , Error ){ __BEGIN_TRY GCShopListMysteriousHandler::execute( this , pPlayer ); __END_CATCH}////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////PacketSize_t GCShopListMysterious::getPacketSize () const throw (){ PacketSize_t unit_size = szBYTE + szItemType; PacketSize_t rValue = 0; rValue += szObjectID; // NPC id rValue += szShopVersion; // shop version rValue += szShopRackType; // rack type rValue += szBYTE; // total number of item for (int i=0; i<SHOP_RACK_INDEX_MAX; i++) { if (m_pBuffer[i].bExist) { rValue += szBYTE; // Item index in shop rack rValue += unit_size; // actual item info } } rValue += szMarketCond*2; // market condition return rValue;}//////////////////////////////////////////////////////////////////////////////// get packet's debug string//////////////////////////////////////////////////////////////////////////////string GCShopListMysterious::toString () const throw (){ __BEGIN_TRY StringStream msg; msg << "GCShopListMysterious(" << "ObjectID:" << m_ObjectID << "," << "ShopVersion:" << m_Version << "," << "RackType:" << m_RackType << ","; for (int i=0; i<SHOP_RACK_INDEX_MAX; i++) { msg << "(Item" << i << ":"; if (m_pBuffer[i].bExist) { msg << "ItemClass:" << (int)(m_pBuffer[i].itemClass) << "ItemType:" << (int)(m_pBuffer[i].itemType); } msg << ")"; } msg << "MarketCondBuy:" << (int)m_MarketCondBuy << "MarketCondSell:" << (int)m_MarketCondSell; msg << ")"; return msg.toString(); __END_CATCH}////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////SHOPLISTITEM_MYSTERIOUS GCShopListMysterious::getShopItem(BYTE index) const throw(){ // check bound if (index >= SHOP_RACK_INDEX_MAX) throw ("GCShopListMysterious::getShopItem() : Out of Bound!"); // return shop item info return m_pBuffer[index];}////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////void GCShopListMysterious::setShopItem(BYTE index, const Item* pItem) throw(){ // check bound if (index >= SHOP_RACK_INDEX_MAX) throw ("GCShopListMysterious::setShopItem() : Out of Bound!"); // check pointer Assert(pItem != NULL); // set shop item info m_pBuffer[index].bExist = true; m_pBuffer[index].itemClass = pItem->getItemClass(); m_pBuffer[index].itemType = pItem->getItemType();}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -