cgshoprequestsellhandler.cpp

来自「天之炼狱1服务器端源文件游戏服务端不完整」· C++ 代码 · 共 593 行 · 第 1/2 页

CPP
593
字号
								if (pNearPlayer == NULL) continue;								pNearPlayer->sendPacket(&boughtpkt);							}						}					} // end of for (ZoneCoord_t zy=CenterY-5; zy<=CenterY+5; zy++)				} // end of for (ZoneCoord_t zx=CenterX-5; zx<=CenterX+5; zx++)			}			catch (Throwable & t)			{				filelog("shopbug_packet.log", "%s", t.toString().c_str());			}		} // if (index < SHOP_RACK_INDEX_MAX)		else		{			SAFE_DELETE(pItem);		}	} // if (pItem->getOptionType() != 0)	else	{		bSpecialItem = false;		SAFE_DELETE(pItem);	}	// 拱扒阑 魂 敲饭捞绢俊霸 GCShopSellOK甫...焊辰促.	GCShopSellOK okpkt;	okpkt.setObjectID(NPCID);	if (bSpecialItem) okpkt.setShopVersion(pNPC->getShopVersion(SHOP_RACK_SPECIAL));	else              okpkt.setShopVersion(pNPC->getShopVersion(SHOP_RACK_NORMAL));	okpkt.setItemObjectID(ITEMOID);	//okpkt.setPrice(playerMoney+itemPrice);	// playerMoney + itemPrice 啊 MAX_MONEY甫 逞绢哎 荐 乐促.	// 2003.1.8 by bezz	okpkt.setPrice(pPC->getGold());	pPlayer->sendPacket(&okpkt);	#endif	__END_DEBUG_EX __END_CATCH}////////////////////////////////////////////////////////////////////////////////// 葛磐 荤捞努阑 贸府茄促.////////////////////////////////////////////////////////////////////////////////void CGShopRequestSellHandler::executeMotorcycle (CGShopRequestSell* pPacket , Player* pPlayer)	 throw (ProtocolException , Error){	__BEGIN_TRY __BEGIN_DEBUG_EX#ifdef __GAME_SERVER__	// 菩哦 沥焊甫 惶酒辰促.	ObjectID_t      NPCID       = pPacket->getObjectID();	ObjectID_t      ITEMOID     = pPacket->getItemObjectID();	GamePlayer*     pGamePlayer = dynamic_cast<GamePlayer*>(pPlayer);	Creature*       pCreature   = pGamePlayer->getCreature();	PlayerCreature* pPC         = dynamic_cast<PlayerCreature*>(pCreature);	Zone* pZone = pPC->getZone();	if (pZone == NULL) return sendFailPacket(pPacket, pPlayer);	Creature* pNPCBase = NULL;	/*	try 	{ 		pNPCBase = pZone->getCreature(NPCID); 	} 	catch (NoSuchElementException & nsee) 	{ 		pNPCBase = NULL; 	}	*/	// NoSuch力芭. by sigi. 2002.5.2	pNPCBase = pZone->getCreature(NPCID); 	if (pNPCBase == NULL || !pNPCBase->isNPC()) return sendFailPacket(pPacket, pPlayer);	NPC*        pNPC    = dynamic_cast<NPC*>(pNPCBase);	int         CenterX = pNPC->getX();	int         CenterY = pNPC->getY();		// 敲饭捞绢啊 迫妨绊 窍绰 酒捞袍阑 啊瘤绊 乐绰瘤 八荤	Inventory* pInventory  = pPC->getInventory();	Gold_t     playerMoney = pPC->getGold();	Item*      pItem       = pInventory->getItemWithObjectID(ITEMOID);	if (pItem == NULL) return sendFailPacket(pPacket, pPlayer);	// 林困 老沥 裹困甫 八祸秦辑, 葛磐 荤捞努捞 乐绰瘤 犬牢茄促.	try	{		for (int zx=CenterX-5; zx<=CenterX+5; zx++)		{			for (int zy=CenterY-5; zy<=CenterY+5; zy++)			{				// 官款靛甫 逞绢啊瘤 臼绰啊甫 眉农				if (!isValidZoneCoord(pZone, zx, zy)) continue;				Tile & tile = pZone->getTile(zx, zy);				if (tile.hasItem())				{					Item* pItemOnTile = tile.getItem();					if (pItemOnTile == NULL) continue;					// 父老 酒捞袍捞 鸥老 困俊 乐阑 版快, 葛磐 荤捞努牢瘤 犬牢茄促.					if (pItemOnTile->getItemClass() == Item::ITEM_CLASS_MOTORCYCLE)					{						DWORD    targetID     = dynamic_cast<Key*>(pItem)->getTarget();						ItemID_t motorcycleID = pItemOnTile->getItemID();						if (targetID == motorcycleID)						{							// 葛磐荤捞努阑 DB俊辑 昏力茄促.							pItemOnTile->destroy();							// 敲饭捞绢狼 牢亥配府俊辑 凯艰甫 力芭茄促.							pInventory->deleteItem(ITEMOID);							pItem->destroy();							SAFE_DELETE(pItem);														// 凯艰 蔼捞 酒聪扼, 坷配官捞 蔼阑 拎具 茄促.							Price_t itemPrice = g_pPriceManager->getPrice(pItemOnTile, pNPC->getMarketCondBuy(), SHOP_RACK_NORMAL, pPC);							// 敲饭捞绢狼 捣阑 疵赴促.							//pPC->setGoldEx(playerMoney+itemPrice);							// by sigi. 2002.9.4							pPC->increaseGoldEx(itemPrice);							// 拱扒阑 魄 敲饭捞绢俊霸 GCShopSellOK甫...焊辰促.							GCShopSellOK okpkt;							okpkt.setObjectID(NPCID);							if (!pItemOnTile->getOptionTypeList().empty()) okpkt.setShopVersion(pNPC->getShopVersion(SHOP_RACK_SPECIAL));							else                                   okpkt.setShopVersion(pNPC->getShopVersion(SHOP_RACK_NORMAL));							okpkt.setItemObjectID(ITEMOID);							okpkt.setPrice(playerMoney+itemPrice);							pPlayer->sendPacket(&okpkt);							// 欢欧 季磐俊辑 冠胶甫 昏力秦 霖促.							if (g_pParkingCenter->hasMotorcycleBox(motorcycleID)) 								g_pParkingCenter->deleteMotorcycleBox(motorcycleID);							// NPC俊霸 磊府啊 面盒窍促搁 敲饭捞绢啊 魄 酒捞袍阑 焊包茄促.							// 窜 胶其既 酒捞袍父阑 焊包茄促. 畴富 酒捞袍篮 弊成 滚覆.							//if (pItemOnTile->getOptionType() != 0)							//{							//	index = pNPC->getFirstEmptySlot(SHOP_RACK_SPECIAL);							//	if (index < SHOP_RACK_INDEX_MAX)							//	{							//		pNPC->insertShopItem(SHOP_RACK_SPECIAL, index, pItemOnTile);							//		// 胶其既 酒捞袍阑 NPC啊 柳凯厘俊 眠啊沁栏骨肺, 惑痢 滚傈捞 棵扼埃促.							//		pNPC->increaseShopVersion(SHOP_RACK_SPECIAL);							//	}							//}							//else							//{							//	SAFE_DELETE(pItemOnTile);							//}							// 葛磐 荤捞努阑 茫疽栏骨肺, 且 老捞 场车促. 							return;						}					}				}			} // end of for (ZoneCoord_t zy=CenterY-5; zy<=CenterY+5; zy++)		} // end of for (ZoneCoord_t zx=CenterX-5; zx<=CenterX+5; zx++)	}	catch (Throwable & t)	{		filelog("shopbug_packet.log", "%s", t.toString().c_str());	}	// FOR 风橇甫 促 倒绊, 捞鳖瘤 吭促绰 巴篮 辟贸俊 坷配官捞啊 绝促绰 富捞寸...	// 弊矾骨肺 葛磐 荤捞努 迫扁啊 角菩沁促绰 巴阑 舅赴促.	GCShopSellFail failpkt;	failpkt.setObjectID(NPCID);	pPlayer->sendPacket(&failpkt);	#endif	__END_DEBUG_EX __END_CATCH}//////////////////////////////////////////////////////////////////////////////// // 秦榜 茄波锅俊 迫扁甫 角青茄促.////////////////////////////////////////////////////////////////////////////////void CGShopRequestSellHandler::executeOpAllSkull (CGShopRequestSell* pPacket , Player* pPlayer)	 throw (ProtocolException , Error){	__BEGIN_TRY __BEGIN_DEBUG_EX#ifdef __GAME_SERVER__	ObjectID_t      NPCID        = pPacket->getObjectID();	GamePlayer*     pGamePlayer  = dynamic_cast<GamePlayer*>(pPlayer);	Creature*       pCreature    = pGamePlayer->getCreature();	PlayerCreature* pPC          = dynamic_cast<PlayerCreature*>(pCreature);	Zone* pZone = pPC->getZone();	if (pZone == NULL) return sendFailPacket(pPacket, pPlayer);	Creature* pNPCBase = NULL;	/*	try 	{ 		pNPCBase = pZone->getCreature(NPCID); 	}	catch (NoSuchElementException & nsee) 	{ 		pNPCBase = NULL; 	}	*/	// NoSuch力芭. by sigi. 2002.5.2	pNPCBase = pZone->getCreature(NPCID); 		if (pNPCBase == NULL || !pNPCBase->isNPC()) return sendFailPacket(pPacket, pPlayer);	NPC*       pNPC        = dynamic_cast<NPC*>(pNPCBase);	Inventory* pInventory  = pPC->getInventory();	// by sigi. 2002.9.4	//Gold_t     playerMoney = pPC->getGold(); 	Price_t    itemPrice   = 0;	Item*      pItem       = NULL;	for (uint y=0; y<pInventory->getHeight(); y++)	{		for (uint x=0; x<pInventory->getWidth(); x++)		{			pItem = pInventory->getItem(x, y);			// 酒捞袍捞 粮犁窍绊, 秦榜捞扼搁...			if (pItem != NULL && pItem->getItemClass() == Item::ITEM_CLASS_SKULL)			{				// 酒捞袍 啊拜阑 拌魂秦辑 敲饭捞绢狼 捣俊促 歹茄促.				//itemPrice = g_pPriceManager->getPrice(pItem, pNPC->getMarketCondBuy(), SHOP_RACK_NORMAL, pPC) * pItem->getNum();				//playerMoney += itemPrice;				// by sigi. 2002.9.4				itemPrice += g_pPriceManager->getPrice(pItem, pNPC->getMarketCondBuy(), SHOP_RACK_NORMAL, pPC) * pItem->getNum();								// 牢亥配府 棺 DB俊辑 酒捞袍阑 昏力茄促.				pInventory->deleteItem(x, y);				pItem->destroy();				SAFE_DELETE(pItem);			}		}	}	itemPrice = itemPrice * (g_pVariableManager->getHeadPriceBonus() / 100);	// 敲饭捞绢俊霸 拱扒蔼阑 瘤阂茄促.	//pPC->setGoldEx(playerMoney);	// by sigi. 2002.9.4	pPC->increaseGoldEx(itemPrice);	// 拱扒阑 魂 敲饭捞绢俊霸 GCShopSellOK甫...焊辰促.	GCShopSellOK okpkt;	okpkt.setObjectID(NPCID);	okpkt.setShopVersion(pNPC->getShopVersion(SHOP_RACK_NORMAL));	okpkt.setItemObjectID(0);	okpkt.setPrice(pPC->getGold());	pPlayer->sendPacket(&okpkt);	#endif	__END_DEBUG_EX __END_CATCH}////////////////////////////////////////////////////////////////////////////////// 拱扒 迫扁啊 角菩沁促绰 沥焊甫 朝妨霖呆.////////////////////////////////////////////////////////////////////////////////void CGShopRequestSellHandler::sendFailPacket (CGShopRequestSell* pPacket , Player* pPlayer)	 throw (ProtocolException , Error){	__BEGIN_TRY __BEGIN_DEBUG_EX#ifdef __GAME_SERVER__	GCShopSellFail failpkt;	failpkt.setObjectID(pPacket->getObjectID());	pPlayer->sendPacket(&failpkt);	#endif	__END_DEBUG_EX __END_CATCH}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?