⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 vampirecouplering.cpp

📁 天之炼狱1服务器端源文件游戏服务端不完整
💻 CPP
📖 第 1 页 / 共 2 页
字号:
			pVampireCoupleRingInfo->setVolumeType(pResult->getInt(++i));			pVampireCoupleRingInfo->setWeight(pResult->getInt(++i));			pVampireCoupleRingInfo->setRatio(pResult->getInt(++i));			addItemInfo(pVampireCoupleRingInfo);		}				SAFE_DELETE(pStmt);	}	END_DB(pStmt)		__END_CATCH}//////////////////////////////////////////////////////////////////////////////// class VampireCoupleRingLoader member methods//////////////////////////////////////////////////////////////////////////////void VampireCoupleRingLoader::load(Creature* pCreature) 	throw(Error){	__BEGIN_TRY	Assert(pCreature != NULL);	Statement* pStmt;	BEGIN_DB 	{		pStmt = g_pDatabaseManager->getConnection("DARKEDEN")->createStatement();		/*		StringStream sql;		sql << "SELECT ItemID, ObjectID, ItemType, Storage, StorageID, X, Y FROM VampireCoupleRingObject"			<< " WHERE OwnerID = '" << pCreature->getName() << "' AND Storage IN("			<<(int)STORAGE_INVENTORY << ", " <<(int)STORAGE_GEAR << ", " <<(int)STORAGE_BELT << ", " 			<<(int)STORAGE_EXTRASLOT << ", " <<(int)STORAGE_MOTORCYCLE << ", " <<(int)STORAGE_STASH << ", " 			<<(int)STORAGE_GARBAGE << ")";		Result* pResult = pStmt->executeQuery(sql.toString());		*/		Result* pResult = pStmt->executeQuery( "SELECT ItemID, ObjectID, ItemType, Storage, StorageID, X, Y, OptionType, Name, PartnerItemID FROM VampireCoupleRingObject WHERE OwnerID = '%s' AND Storage IN(0, 1, 2, 3, 4, 9)",												pCreature->getName().c_str() );		PlayerCreature* pPC = dynamic_cast<PlayerCreature*>( pCreature );		if ( pResult->getRowCount() == 0 && pPC->getFlagSet()->isOn( FLAGSET_IS_COUPLE ) )		{			pPC->getFlagSet()->turnOff( FLAGSET_IS_COUPLE );			pPC->getFlagSet()->save( pPC->getName() );			g_pCoupleManager->removeCoupleForce( pPC );		}		while (pResult->next())		{			try {				uint i = 0;				VampireCoupleRing* pVampireCoupleRing = new VampireCoupleRing();				pVampireCoupleRing->setItemID(pResult->getDWORD(++i));				pVampireCoupleRing->setObjectID(pResult->getDWORD(++i));				pVampireCoupleRing->setItemType(pResult->getDWORD(++i));				Storage storage =(Storage)pResult->getInt(++i);				StorageID_t storageID = pResult->getDWORD(++i);				BYTE x = pResult->getBYTE(++i);				BYTE y = pResult->getBYTE(++i);				string optionField = pResult->getString(++i);				list<OptionType_t> optionTypes;				setOptionTypeFromField( optionTypes, optionField );				pVampireCoupleRing->setOptionType( optionTypes );				pVampireCoupleRing->setName( pResult->getString(++i) );				pVampireCoupleRing->setPartnerItemID( pResult->getDWORD(++i) );				// 颇飘呈 酒捞袍捞 绝芭唱 歹 捞惑 目敲捞 酒聪搁 酒捞袍阑 瘤况霖促.				PlayerCreature* pPC = dynamic_cast<PlayerCreature*>(pCreature);//				if ( !pVampireCoupleRing->hasPartnerItem() )//				if ( pPC != NULL && !g_pCoupleManager->isCouple( pPC, pVampireCoupleRing->getName() ) )				if ( pPC != NULL && ( !g_pCoupleManager->isCouple( pPC, pVampireCoupleRing->getName() ) || !pVampireCoupleRing->hasPartnerItem() ) ) 				{					g_pCoupleManager->removeCoupleForce( pPC, pVampireCoupleRing->getName() );					//pVampireCoupleRing->destroy();					char sql[30];					sprintf( sql, "Storage = 10" );					pVampireCoupleRing->tinysave( sql );					SAFE_DELETE( pVampireCoupleRing );					// FlagSet 档 朝妨霖促.					pPC->getFlagSet()->turnOff( FLAGSET_IS_COUPLE );					pPC->getFlagSet()->save( pPC->getName() );					continue;				}				Inventory*  pInventory      = NULL;				Slayer*     pSlayer         = NULL;				Vampire*    pVampire        = NULL;				Motorcycle* pMotorcycle     = NULL;				Inventory*  pMotorInventory = NULL;				//Item*       pItem           = NULL;				Stash*      pStash          = NULL;				//Belt*       pBelt           = NULL;				//Inventory*  pBeltInventory  = NULL;				if (pCreature->isSlayer())				{					pSlayer     = dynamic_cast<Slayer*>(pCreature);					pInventory  = pSlayer->getInventory();					pStash      = pSlayer->getStash();					pMotorcycle = pSlayer->getMotorcycle();					if (pMotorcycle) pMotorInventory = pMotorcycle->getInventory();				}				else if (pCreature->isVampire()) 				{					pVampire   = dynamic_cast<Vampire*>(pCreature);					pInventory = pVampire->getInventory();					pStash     = pVampire->getStash();				}				else throw UnsupportedError("Monster,NPC 牢亥配府狼 历厘篮 酒流 瘤盔登瘤 臼嚼聪促.");				switch(storage)				{					case STORAGE_INVENTORY:						if (pInventory->canAddingEx(x, y, pVampireCoupleRing))						{							pInventory->addItemEx(x, y, pVampireCoupleRing);						}						else						{							processItemBugEx(pCreature, pVampireCoupleRing);						}						break;					case STORAGE_GEAR:						if (pCreature->isSlayer())						{							if (!pSlayer->isWear((Slayer::WearPart)x))							{								pSlayer->wearItem((Slayer::WearPart)x, pVampireCoupleRing);							}							else							{								processItemBugEx(pCreature, pVampireCoupleRing);							}						}						else if ( pCreature->isVampire() )						{							if (!pVampire->isWear((Vampire::WearPart)x))							{								pVampire->wearItem((Vampire::WearPart)x, pVampireCoupleRing);							}							else							{								processItemBugEx(pCreature, pVampireCoupleRing);							}						}						break;					case STORAGE_BELT :						processItemBugEx(pCreature, pVampireCoupleRing);						break;					case STORAGE_EXTRASLOT :						if (pCreature->isSlayer())       pSlayer->addItemToExtraInventorySlot(pVampireCoupleRing);						else if (pCreature->isVampire()) pVampire->addItemToExtraInventorySlot(pVampireCoupleRing);						break;					case STORAGE_MOTORCYCLE:						processItemBugEx(pCreature, pVampireCoupleRing);						break;					case STORAGE_STASH:						processItemBugEx(pCreature, pVampireCoupleRing);				/*		if (pStash->isExist(x, y))						{							processItemBugEx(pCreature, pVampireCoupleRing);						}						else pStash->insert(x, y, pVampireCoupleRing); */						break;					case STORAGE_GARBAGE:						processItemBug(pCreature, pVampireCoupleRing);						break;					default :						SAFE_DELETE(pStmt);	// by sigi						throw Error("invalid storage or OwnerID must be NULL");				}			} catch (Error& error) {				filelog("itemLoadError.txt", "[%s] %s", getItemClassName().c_str(), error.toString().c_str());				throw;			} catch (Throwable& t) {				filelog("itemLoadError.txt", "[%s] %s", getItemClassName().c_str(), t.toString().c_str());			}		}		SAFE_DELETE(pStmt);	}	END_DB(pStmt)		__END_CATCH}void VampireCoupleRingLoader::load(Zone* pZone) 	throw(Error){	__BEGIN_TRY	cout << "粮俊 冻绢柳 酒捞袍 肺靛绰 瘤盔窍瘤 臼嚼聪促." << endl;	Assert( false );	Assert(pZone != NULL);	Statement* pStmt;	BEGIN_DB 	{		pStmt = g_pDatabaseManager->getConnection("DARKEDEN")->createStatement();		StringStream sql;		sql << "SELECT ItemID, ObjectID, ItemType, Storage, StorageID, X, Y FROM VampireCoupleRingObject"			<< " WHERE Storage = " <<(int)STORAGE_ZONE << " AND StorageID = " << pZone->getZoneID();		Result* pResult = pStmt->executeQuery(sql.toString());		while (pResult->next())		{			uint i = 0;			VampireCoupleRing* pVampireCoupleRing = new VampireCoupleRing();			pVampireCoupleRing->setItemID(pResult->getInt(++i));			pVampireCoupleRing->setObjectID(pResult->getInt(++i));			pVampireCoupleRing->setItemType(pResult->getInt(++i));			Storage storage =(Storage)pResult->getInt(++i);			StorageID_t storageID = pResult->getInt(++i);			BYTE x = pResult->getInt(++i);			BYTE y = pResult->getInt(++i);			switch(storage)			{				case STORAGE_ZONE :						{						Tile & pTile = pZone->getTile(x,y);						Assert(!pTile.hasItem());						pTile.addItem(pVampireCoupleRing);					}					break;				case STORAGE_STASH :				case STORAGE_CORPSE :					throw UnsupportedError("惑磊 棺 矫眉救狼 酒捞袍狼 历厘篮 酒流 瘤盔登瘤 臼嚼聪促.");				default :					throw Error("Storage must be STORAGE_ZONE");			}		}		SAFE_DELETE(pStmt);	}	END_DB(pStmt)	__END_CATCH}void VampireCoupleRingLoader::load(StorageID_t storageID, Inventory* pInventory) 	throw(Error){	__BEGIN_TRY	Statement* pStmt;	BEGIN_DB 	{	}	END_DB(pStmt)		__END_CATCH}VampireCoupleRingLoader* g_pVampireCoupleRingLoader = NULL;

⌨️ 快捷键说明

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