当前位置: 首页>>代码示例>>C++>>正文


C++ CItemWeapon::getID方法代码示例

本文整理汇总了C++中CItemWeapon::getID方法的典型用法代码示例。如果您正苦于以下问题:C++ CItemWeapon::getID方法的具体用法?C++ CItemWeapon::getID怎么用?C++ CItemWeapon::getID使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在CItemWeapon的用法示例。


在下文中一共展示了CItemWeapon::getID方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: CheckFisherLuck

bool CheckFisherLuck(CCharEntity* PChar)
{
	if (PChar->UContainer->GetType() != UCONTAINER_EMPTY)
	{
		ShowDebug(CL_CYAN"Player cannot fish! UContainer is not empty\n" CL_RESET);
		return false;
	}

	CItemFish* PFish = nullptr;
	CItemWeapon* WeaponItem = nullptr;

	WeaponItem = (CItemWeapon*)PChar->getEquip(SLOT_RANGED);	

	DSP_DEBUG_BREAK_IF(WeaponItem == nullptr);
	DSP_DEBUG_BREAK_IF(WeaponItem->isType(ITEM_WEAPON) == false);
	DSP_DEBUG_BREAK_IF(WeaponItem->getSkillType() != SKILL_FSH);

	uint16 RodID = WeaponItem->getID();

	WeaponItem = (CItemWeapon*)PChar->getEquip(SLOT_AMMO);	
							
	DSP_DEBUG_BREAK_IF(WeaponItem == nullptr);
	DSP_DEBUG_BREAK_IF(WeaponItem->isType(ITEM_WEAPON) == false);
	DSP_DEBUG_BREAK_IF(WeaponItem->getSkillType() != SKILL_FSH);

	uint16 LureID = WeaponItem->getID();

	int32 FishingChance = WELL512::irand()%100;

	if (FishingChance <= 20)
	{
		const int8* Query = 
            "SELECT "
                "fish.fishid,"      // 0
                "fish.max,"         // 1
                "fish.watertype,"   // 2
                "fish.size,"        // 3
                "fish.stamina,"     // 4
                "fish.log,"         // 5
                "fish.quest,"       // 6
                "rod.flag "         // 7
            "FROM fishing_zone AS zone "
			"INNER JOIN fishing_rod  AS rod  USING (fishid) "
			"INNER JOIN fishing_lure AS lure USING (fishid) "
			"INNER JOIN fishing_fish AS fish USING (fishid) "
			"WHERE zone.zoneid = %u AND rod.rodid = %u AND lure.lureid = %u AND lure.luck = 0";

		int32 ret = Sql_Query(SqlHandle, Query, PChar->getZone(), RodID, LureID);

		if( ret != SQL_ERROR && Sql_NumRows(SqlHandle) != 0)
		{
            while(Sql_NextRow(SqlHandle) == SQL_SUCCESS)
			{
                // ловля предметов, необходимых для поисков

                uint8 logid = (uint8)Sql_GetIntData(SqlHandle,5);
                uint8 quest = (uint8)Sql_GetIntData(SqlHandle,6);

                if(logid < MAX_QUESTAREA && quest < MAX_QUESTID)
	            {
		            uint8 current  = PChar->m_questLog[logid].current [quest/8] & (1 << (quest % 8));
		            uint8 complete = PChar->m_questLog[logid].complete[quest/8] & (1 << (quest % 8));

                    if (complete == 0 && current != 0)
                    {
		                PFish = new CItemFish(*itemutils::GetItemPointer(Sql_GetIntData(SqlHandle,0)));

					    PChar->UContainer->SetType(UCONTAINER_FISHING);
					    PChar->UContainer->SetItem(0, PFish);
					    break;
                    }
	            }
                // TODO: ловля простых предметов
            }
		}						
	}
	else
	{
		const int8* Query = 
            "SELECT "
                "fish.fishid,"      // 0
                "fish.min,"         // 1
                "fish.max,"         // 2
                "fish.size,"        // 3
                "fish.stamina,"     // 4
                "fish.watertype,"   // 5
                "rod.flag, "         // 6
                "lure.luck "        // 7
            "FROM fishing_zone AS zone "
            "INNER JOIN fishing_rod  AS rod  USING (fishid) "
			"INNER JOIN fishing_lure AS lure USING (fishid) "
			"INNER JOIN fishing_fish AS fish USING (fishid) "
			"WHERE zone.zoneid = %u AND rod.rodid = %u AND lure.lureid = %u AND lure.luck != 0 "
			"ORDER BY luck"; 
		
		int32 ret = Sql_Query(SqlHandle, Query, PChar->getZone(), RodID, LureID);

		if( ret != SQL_ERROR && Sql_NumRows(SqlHandle) != 0)
		{
			int32 FisherLuck = 0;
//.........这里部分代码省略.........
开发者ID:Ex0r,项目名称:darkstar,代码行数:101,代码来源:fishingutils.cpp

示例2: CheckFisherLuck

	bool CheckFisherLuck(CCharEntity* PChar)
	{
		if (PChar->UContainer->GetType() != UCONTAINER_EMPTY)
		{
			ShowDebug(CL_CYAN"Player cannot fish! UContainer is not empty\n" CL_RESET);
			return false;
		}

		CItemFish* PFish = NULL;
		CItemWeapon* WeaponItem = NULL;

		WeaponItem = (CItemWeapon*)PChar->getStorage(LOC_INVENTORY)->GetItem(PChar->equip[SLOT_RANGED]);

		DSP_DEBUG_BREAK_IF(WeaponItem == NULL);
		DSP_DEBUG_BREAK_IF(WeaponItem->isType(ITEM_WEAPON) == false);
		DSP_DEBUG_BREAK_IF(WeaponItem->getSkillType() != SKILL_FSH);

		uint16 RodID = WeaponItem->getID();

		WeaponItem = (CItemWeapon*)PChar->getStorage(LOC_INVENTORY)->GetItem(PChar->equip[SLOT_AMMO]);

		DSP_DEBUG_BREAK_IF(WeaponItem == NULL);
		DSP_DEBUG_BREAK_IF(WeaponItem->isType(ITEM_WEAPON) == false);
		DSP_DEBUG_BREAK_IF(WeaponItem->getSkillType() != SKILL_FSH);

		uint16 LureID = WeaponItem->getID();

		int FishingChance = rand() % 100;

		int ListID = GridList(PChar);

		if (ListID == 0)
		{
			ShowDebug(CL_CYAN"Fish list not found for Zone: %u \n" CL_RESET, PChar->getZone());
		}

		if (ListID > 0 && FishingChance <= 50)
		{
			const int8* Query = "SELECT ListID, EntityID \
								FROM fishing_list \
								WHERE ListID = %u \
								ORDER BY ListID ASC";

			int32 ret = Sql_Query(SqlHandle, Query, ListID);

			int RC = 0;
			// this will pick a random  number from range 1 to max record count
			int RID = rand() % Sql_NumRows(SqlHandle) + 1;
			
			if (ret != SQL_ERROR && Sql_NumRows(SqlHandle) != 0)
			{
				while (Sql_NextRow(SqlHandle) == SQL_SUCCESS)
				{
					RC = RC + 1;
					uint32 EntityID = Sql_GetIntData(SqlHandle, 1);
					
					if (RC == RID)
					{
						// Gil
						if (EntityID == 0x0000FFFF)
						{   
							// do not change this item number this is a place holder ID for gil
							PFish = new CItemFish(*itemutils::GetItemPointer(14117));
							PChar->UContainer->SetType(UCONTAINER_FISHING);
							PChar->UContainer->SetItem(0, PFish);
							catchtype[0] = 2;
							break;
						}
						// Monster
						if (EntityID == 0x0001046A)
						{
							GetMobInfo(PChar);
							if (IsSpawned(mobid[0]) == false && mobid[0] > 0)
							{
								// do not change this item number this is a place holder ID for mobs
								PFish = new CItemFish(*itemutils::GetItemPointer(14117));
								PChar->UContainer->SetType(UCONTAINER_FISHING);
								PChar->UContainer->SetItem(0, PFish);
								break;
							}
						}
						if (EntityID != 0x0000FFFF || EntityID != 0x0001046A)
						{
							// get fish or item for returned record if its not a monster or gil
							GetOtherInfo(EntityID);
							// Fish
							if (catchtype[0] == 0)
							{
								// will create a fish entity if the bait can be used to catch the fish 
								if (BaitCheck(LureID, EntityID) == true)
								{
									PFish = new CItemFish(*itemutils::GetItemPointer(EntityID));
									PChar->UContainer->SetType(UCONTAINER_FISHING);
									PChar->UContainer->SetItem(0, PFish);
									break;
								}
							}
							// Item
							if (catchtype[0] == 1)
							{
//.........这里部分代码省略.........
开发者ID:EDGECOM666,项目名称:Fishing_RC1,代码行数:101,代码来源:fishingutils.cpp


注:本文中的CItemWeapon::getID方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。