Jump to content

Recommended Posts

  • 4 years later...

@ Mali
 

Great job!

After a long time, I was looking for some small additions for the game again, and I have to say these are exactly the kind of things I enjoy!

I just took the liberty of slightly modifying this function because it seemed unnecessary to use "Arrow->count".. For players and myself, the total number of a given type of arrow in the inventory is what really matters, since the next bundle activates automatically after the first one is depleted (as you noted).

Thank you so much! I hope in the future there will be more things like this and all the others (kill bar, UI hide, icon with glass, auto shop close after sol out, etc. and many more).

Thanks ❤️

Modifications:

Spoiler
PythonPlayerModule.cpp:

PyObject* playerGetArrowStatus(PyObject* poSelf, PyObject* poArgs)
{
	const auto player = CPythonPlayer::InstancePtr();
	if (player && RaceToJob(CPythonPlayer::Instance().GetRace()) == NRaceData::JOB_ASSASSIN)
	{
		const auto Weapon = player->GetItemData(TItemPos(EQUIPMENT, c_Equipment_Weapon));
		if (Weapon && Weapon->vnum)
		{
			CItemData* pItemData = nullptr;
			if (CItemManager::Instance().GetItemDataPointer(Weapon->vnum, &pItemData))
			{
				if (pItemData->GetSubType() == CItemData::EWeaponSubTypes::WEAPON_BOW)
				{
					const auto Arrow = player->GetItemData(TItemPos(EQUIPMENT, c_Equipment_Arrow));
					if (Arrow)
					{
#if defined(ENABLE_QUIVER_SYSTEM)
						CItemData* pArrowData = nullptr;
						if (Arrow->vnum && CItemManager::Instance().GetItemDataPointer(Arrow->vnum, &pArrowData))
						{
							if (pArrowData->GetSubType() == CItemData::EWeaponSubTypes::WEAPON_QUIVER)
								return Py_BuildValue("i", -2); // unlimited
						}
#endif
						return Py_BuildValue("i", player->GetItemCountByVnum(Arrow->vnum));
					}
				}
			}
		}
	}

	return Py_BuildValue("i", -1); // no bow: hide
}

 

Spoiler
UIGameButton.py:

		def CheckArrowCount(self):
			count = player.GetArrowStatus()
			if count == -1:
				self.ArrowIcon.Hide()
				return

			if count == -2:
				self.ArrowCount.SetText("Unlimited")
			else:
				self.ArrowCount.SetText(str(count))
			self.ArrowIcon.Show()

 

 

Edited by Filachilla
Link to comment
https://metin2.dev/topic/26207-arrow-count/#findComment-173608
Share on other sites

Don't use any images from : imgur, turkmmop, freakgamers, inforge, hizliresim... Or your content will be deleted without notice...
Use : https://metin2.download/media/add/

Please use https://metin2.download/ when uploading files smaller than 100MB, otherwise the approval will take longer due to manual upload.

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
×
×
  • Create New...

Important Information

Terms of Use / Privacy Policy / Guidelines / We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.