Quick Jewel(Diamond) Set

Results 1 to 15 of 15
  1. #1
    RE:ℓσα∂є∂ Fenris is offline
    True MemberRank
    Sep 2011 Join Date
    RE:ℓσα∂Location
    490Posts

    Quick Jewel(Diamond) Set


    Tested to an extent. Aka: my main work project is much different.
    Also,it does all the jewels not just diamonds. Also those who want could add tooltip for the items if they want.

    WndFastJewel.cpp -> https://pastebin.com/0P0wwuy7
    WndFastJewel.h -> https://pastebin.com/18CMm2yk
    ^ add both to interface or wherever in neuz project.

    dpClient.cpp
    Spoiler:
    Code:
    #ifdef __FastJewelSelect
    void CDPClient::sendFastJewelSelect(unsigned char itemLoc, unsigned char gemLoc, int ability)
    {
    	BEFORESENDSOLE(ar, PACKETTYPE_FASTJEWEL, DPID_UNKNOWN);
    	ar << itemLoc;
    	ar << gemLoc;
    	ar << ability;
    	SEND(ar, this, DPID_SERVERPLAYER);
    }
    #endif


    dpclient.h
    Spoiler:
    Code:
    #ifdef __FastJewelSelect
    	void sendFastJewelSelect(unsigned char itemLoc, unsigned char gemLoc, int ability);
    #endif



    dpsrvr.cpp
    Spoiler:
    Code:
    #ifdef __FastJewelSelect
    	ON_MSG(PACKETTYPE_FASTJEWEL, &CDPSrvr::onFastJewel);
    #endif
    Code:
    #ifdef __FastJewelSelect
    void CDPSrvr::onFastJewel(CAr& ar, const DPID dpidCache, const DPID dpidUser, LPBYTE, u_long)
    {
    	CUser* pUser = g_UserMng.GetUser(dpidCache, dpidUser);
    	if (IsInvalidObj(pUser))
    		return;
    
    	unsigned char itemObjid, gemObjid;
    	int ability;
    	ar >> itemObjid >> gemObjid >> ability;
    
    	CItemElem* pItemElem = pUser->m_Inventory.GetAtId(itemObjid);
    	CItemElem* pGemItemElem = pUser->m_Inventory.GetAtId(gemObjid);
    	if (!IsUsableItem(pItemElem) || !IsUsableItem(pGemItemElem) || pUser->m_Inventory.IsEquip(itemObjid))
    	{
    		pUser->AddText("Incorrect Item");
    		return;
    	}
    
    	ItemProp* iProp = pItemElem->GetProp();	
    	if (iProp && iProp->dwReferStat1 != WEAPON_ULTIMATE)
    	{
    		pUser->AddText("Not ultimate item!");
    		return;
    	}
    
    	if (prj.m_UltimateWeapon.m_vecGemAbilityKind.empty())
    		return;
    
    	int nCount = 0;
    	for ( ; nCount < pItemElem->GetUltimatePiercingSize(); nCount++)
    	{
    		if (pItemElem->GetUltimatePiercingItem(nCount) == 0)
    			break;
    	}
    
    	if (nCount == pItemElem->GetUltimatePiercingSize())
    	{
    		pUser->AddDefinedText(TID_GAME_ULTIMATE_GEMSPACE, "");
    		return;
    	}
    
    	std::vector<CUltimateWeapon::__GEMABILITYKIND>::iterator iter = std::find_if(prj.m_UltimateWeapon.m_vecGemAbilityKind.begin(), prj.m_UltimateWeapon.m_vecGemAbilityKind.end(),
    		[ability](const CUltimateWeapon::__GEMABILITYKIND& right) -> bool {
    			if (right.nAbility == ability)
    				return true;
    			return false;
    		});
    
    	if (iter == prj.m_UltimateWeapon.m_vecGemAbilityKind.end())
    		return;
    
    	unsigned long gemId = pGemItemElem->m_dwItemId;
    	const std::vector<CUltimateWeapon::__GEMABILITY>::iterator iter2 = std::find_if(iter->vecAbilityKind.begin(), iter->vecAbilityKind.end(), [gemId](const CUltimateWeapon::__GEMABILITY& gemAp)->bool
    		{
    			if (gemId == gemAp.dwGemItemId)
    				return true;
    			return false;
    		});
    
    	if (iter2 == iter->vecAbilityKind.end())
    		return;
    
    	const DWORD dwSetItemId = iter2->dwAbilityItemId;
    	if (dwSetItemId == NULL_ID)
    		return;
    
    	LogItemInfo aLogItem;
    	aLogItem.Action = "-";
    	aLogItem.SendName = pUser->GetName();
    	aLogItem.RecvName = "ULTIMATE_PIERCING";
    	aLogItem.WorldId = pUser->GetWorld()->GetID();
    	aLogItem.Gold = aLogItem.Gold2 = pUser->GetGold();
    	g_DPSrvr.OnLogItem(aLogItem, pGemItemElem, 1);
    	
    	pUser->RemoveItem(static_cast<BYTE>(gemObjid), 1);
    	const int nRandom = xRandom(1000000);
    	if (nRandom < prj.m_UltimateWeapon.m_nSetGemProb)
    	{
    		pUser->UpdateItem(static_cast<BYTE>(pItemElem->m_dwObjId), UI_ULTIMATE_PIERCING, MAKELONG(nCount, dwSetItemId));
    		pUser->AddText("You've successfully added a gem into you're item!");
    		aLogItem.RecvName = "ULTIMATE_PIERCING_SUCCESS";
    		g_DPSrvr.OnLogItem(aLogItem, pItemElem, 1);
    		return;
    	}
    	pUser->AddText("Failed adding Jewel to Weapon and the Jewel was destroyed");
    	aLogItem.RecvName = "ULTIMATE_PIERCING_FAILED";
    	g_DPSrvr.OnLogItem(aLogItem, pItemElem);
    }
    #endif



    dpsrvr.h
    Spoiler:
    Code:
    #ifdef __FastJewelSelect
    	void onFastJewel(CAr&, DPID, DPID, LPBYTE, u_long);
    #endif



    WndManager.cpp
    Spoiler:
    Code:
    //below FindDstString
    #ifdef __FastJewelSelect
    char* CWndMgr::findDstString(const int param)
    {
    	return FindDstString(param);
    }
    #endif
    Just like most apps, but side note, you could do this part differently and more effectively xd
    Code:
    #ifdef __FastJewelSelect
    	wndFastJewel = nullptr;
    #endif
    Code:
    #ifdef __FastJewelSelect
    	SAFE_DELETE(wndFastJewel);
    #endif
    Code:
    #ifdef __FastJewelSelect
    	if (wndFastJewel == pWndChild)
    	{
    		SAFE_DELETE(wndFastJewel);
    		pWndChild = nullptr;
    	}
    #endif


    wndManager.h -> Add below to anywhere under a public in the CWndMgr class.
    Spoiler:
    Code:
    #include "WndFastJewelSelect.h"
    Code:
    #ifdef __FastJewelSelect
    	char* findDstString(const int param);
    	CWndFastJewelSelect* wndFastJewel;
    #endif


    WndWorld.cpp -> CWndWorld::OnCommand
    Spoiler:
    Code:
    #ifdef __FastJewelSelect
    		case MMI_FASTJEWEL:
    			if (g_WndMng.wndFastJewel)
    			{
    				delete g_WndMng.wndFastJewel;
    				g_WndMng.wndFastJewel = nullptr;
    			}
    			g_WndMng.wndFastJewel = new CWndFastJewelSelect;
    			g_WndMng.wndFastJewel->Initialize();
    			break;
    #endif


    msghdr.h
    Spoiler:
    Code:
    #ifdef __FastJewelSelect
    #define PACKETTYPE_FASTJEWEL static_cast<unsigned long>(0x88691669)
    #endif



    Resdata.inc temporary
    Spoiler:
    Code:
    APP_FASTJEWEL "WndTile00.tga" "" 1 288 176 0x2410000 26
    {
    	IDS_RESDATA_INC_009800
    }
    {
    	IDS_RESDATA_INC_009800
    }
    {
        WTYPE_STATIC WIDC_STATIC1 "WndChgElemItem.bmp" 0 72 26 103 57 0x2220002 0 0 0 0 46 112 169
        {
    		IDS_RESDATA_INC_000001
        }
        {
    		IDS_RESDATA_INC_009803
        }
        WTYPE_STATIC WIDC_STATIC2 "WndChgElemItem.bmp" 0 178 26 209 57 0x2220002 0 0 0 0 46 112 169
        {
    		IDS_RESDATA_INC_000001
        }
        {
    		IDS_RESDATA_INC_009802
        }
        WTYPE_COMBOBOX WIDC_COMBOBOX1 "WndEditTile00.tga" 1 46 78 235 97 0x20000 0 0 0 0 46 112 169
        {
    		IDS_RESDATA_INC_000001
        }
        {
    		IDS_RESDATA_INC_009801
        }
        WTYPE_BUTTON WIDC_BUTTON10 "ButtOk.tga" 0 58 113 129 132 0x220010 0 0 0 0 0 0 0
        {
    		IDS_RESDATA_INC_000001
        }
        {
    		IDS_RESDATA_INC_000001
        }
        WTYPE_BUTTON WIDC_BUTTON11 "ButtCancel.tga" 0 152 113 223 132 0x220010 0 0 0 0 0 0 0
        {
    		IDS_RESDATA_INC_000001
        }
        {
    		IDS_RESDATA_INC_000001
        }
    }


    Define APP_FASTJEWEL(resdata.h), MMI_FASTJEWEL(defineneuz.h), TID_MMI_FASTJEWEL ( 7000 + MMI Define in DefineText) and do the rest of the resource. Otherwise, enjoy.

    Mission Accomplished
    Spoiler:
    Quote Originally Posted by MentaL
    Quote Originally Posted by Fenris
    Jessi Mental Slaughter, y u pop a glock and make brain slushie
    you made me want to commit e-suicide.


  2. #2
    Member naxzy is offline
    MemberRank
    Dec 2019 Join Date
    Norway XDLocation
    56Posts

    Re: Quick Jewel(Diamond) Set

    Nice release! Will try it out :D
    Im fresh, so dont judge! but im a quick learner!

  3. #3
    Member Percuflex is offline
    MemberRank
    Jan 2020 Join Date
    IsraelLocation
    81Posts

    Re: Quick Jewel(Diamond) Set

    Great release ! Im gonna try this thank you :)
    Not a dev but always trying to help

  4. #4
    Ultimate Member jayjei14 is offline
    MemberRank
    Dec 2011 Join Date
    150Posts

    Re: Quick Jewel(Diamond) Set

    replace
    [ability]
    into this
    [xRandom(0, prj.m_UltimateWeapon.m_vecGemAbilityKind.size() - 1)] if you don't want a specific status

    also to the thread creator a person without knowledge about c++ cant make their own .h of your .cpp


    .h Pastebin is private
    Last edited by jayjei14; 24-10-20 at 04:07 PM.

  5. #5
    RE:ℓσα∂є∂ Fenris is offline
    True MemberRank
    Sep 2011 Join Date
    RE:ℓσα∂Location
    490Posts

    Re: Quick Jewel(Diamond) Set

    Quote Originally Posted by jayjei14 View Post
    replace
    [ability]
    into this
    [xRandom(0, prj.m_UltimateWeapon.m_vecGemAbilityKind.size() - 1)] if you don't want a specific status

    also to the thread creator a person without knowledge about c++ cant make their own .h of your .cpp
    Both .h and .cpp are there.

    Also, its a lambda function so you wouldn't be able to do that in the capture clause / list. If you want it to be randomized, might as well remove the selector on the app as well and then only pass two values to the server rather than three. Then you'd also be able to skip using lambda expression in the find_if and grab the iterator with begin() + offset or just grab via .at().

    Mission Accomplished
    Spoiler:
    Quote Originally Posted by MentaL
    Quote Originally Posted by Fenris
    Jessi Mental Slaughter, y u pop a glock and make brain slushie
    you made me want to commit e-suicide.

  6. #6
    Registered Virusatwar is offline
    MemberRank
    Apr 2018 Join Date
    17Posts

    Re: Quick Jewel(Diamond) Set

    @Fenris
    WndFastJewel.h is set to Private it seems (Error, this is a private paste. If this is your private paste, please login to Pastebin first.)

    Awesome release but knowing people, lot's of them won't be able to implement it properly, without a Source to copy it out of it from.
    Last edited by Virusatwar; 25-10-20 at 05:11 AM.

  7. #7
    RE:ℓσα∂є∂ Fenris is offline
    True MemberRank
    Sep 2011 Join Date
    RE:ℓσα∂Location
    490Posts

    Re: Quick Jewel(Diamond) Set

    Pastebin is not private anymore. Thanks for letting me know @Virusatwar

    Mission Accomplished
    Spoiler:
    Quote Originally Posted by MentaL
    Quote Originally Posted by Fenris
    Jessi Mental Slaughter, y u pop a glock and make brain slushie
    you made me want to commit e-suicide.

  8. #8
    Registered TheSoySauce is offline
    MemberRank
    Nov 2020 Join Date
    10Posts

    Re: Quick Jewel(Diamond) Set

    this is a good guide and all, but I think it would be really better if you told us where to put those snippets to - Example :Below this. and so on. hehe. for dummies like me

  9. #9
    Account Upgraded | Title Enabled! mehoh23 is offline
    True MemberRank
    Jan 2014 Join Date
    204Posts

    Re: Quick Jewel(Diamond) Set

    Quote Originally Posted by TheSoySauce View Post
    this is a good guide and all, but I think it would be really better if you told us where to put those snippets to - Example :Below this. and so on. hehe. for dummies like me
    understand the code vs sourcefile were they belong..

  10. #10
    Newbie noobdevie is offline
    MemberRank
    Oct 2021 Join Date
    3Posts

    Re: Quick Jewel(Diamond) Set

    Just tried it out and followed all the instructions, however, Fast Jewel Select is not in the npc (Peach). I'm wondering what could possibly go wrong, any idea would be highly appreciated. Thanks!

  11. #11
    ‎‎‎‎ Ketchup is offline
    ModeratorRank
    Jan 2009 Join Date
    LocalhostLocation
    1,905Posts

    Re: Quick Jewel(Diamond) Set

    Quote Originally Posted by noobdevie View Post
    Just tried it out and followed all the instructions, however, Fast Jewel Select is not in the npc (Peach). I'm wondering what could possibly go wrong, any idea would be highly appreciated. Thanks!
    You need to add MMI_FASTJEWEL to Mafl_Peach in character.inc, be sure to merge all your resource and carry it over to the client.
    Forum Contact: Click Here | Community Rules & Guidelines: Click Here

  12. #12
    Member Siono01 is offline
    MemberRank
    May 2020 Join Date
    66Posts

    Re: Quick Jewel(Diamond) Set

    thanks for sharingI would like to ask the following. This is how any gem can be put together. Cancel one and the other two will keep showing in the box so it’s useless

    https://prnt.sc/1w3we5v

  13. #13
    Newbie noobdevie is offline
    MemberRank
    Oct 2021 Join Date
    3Posts

    Re: Quick Jewel(Diamond) Set

    Quote Originally Posted by Ketchup View Post
    You need to add MMI_FASTJEWEL to Mafl_Peach in character.inc, be sure to merge all your resource and carry it over to the client.
    Thank you Ketchup, however, this is what I have https://ibb.co/DtqQvs5 and I already re-run the process and still the same. I also made a rebuild and merge, but still like that and it's unclickable, Just an additional line when Peach is clicked. If you can enlighten me what I made wrong, I will be more than thankful.

  14. #14
    ‎‎‎‎ Ketchup is offline
    ModeratorRank
    Jan 2009 Join Date
    LocalhostLocation
    1,905Posts

    Re: Quick Jewel(Diamond) Set

    Quote Originally Posted by noobdevie View Post
    Thank you Ketchup, however, this is what I have https://ibb.co/DtqQvs5 and I already re-run the process and still the same. I also made a rebuild and merge, but still like that and it's unclickable, Just an additional line when Peach is clicked. If you can enlighten me what I made wrong, I will be more than thankful.
    Make sure you have copied over all of the resource.
    • defineNeuz.h
    • ResData.inc
    • ResData.txt

    You can do this to get it to load with Peach
    Character.inc:
    Code:
    MaFl_Peach
    {
    	setting
    	{
    		AddMenu( MMI_DIALOG );
    		AddMenu( MMI_SMELT_EXTRACTION );
    		AddMenu( MMI_SMELT_MIXJEWEL );
    		AddMenu( MMI_SMELT_JEWEL );
    		AddMenu( MMI_LVREQDOWN_CANCEL );
    		AddMenu( MMI_BLESSING_CANCEL );
    		AddMenu( MMI_FASTJEWEL );
    		AddMenu( MMI_TRADE );
    		AddVendorItem( 0, IK3_GENERAL_RANDOMOPTION_GEN, -1, 190, 190, 100 );
    		AddVendorItem( 0, IK3_SYSTEMPET_RANDOMOPTION_GEN, -1, 190, 190, 100 );
    		SetImage
    		(
    			IDS_CHARACTER_INC_000741
    		);
    		m_szDialog= "MaFl_Peach.txt";
    	}
    	SetName
    	(
    		IDS_CHARACTER_INC_000742
    	);
    	AddVendorSlot( 0,
    	IDS_CHARACTER_INC_000743
    	);
    }
    Text will be blank but you can do this quick fix to fix that
    WndWorld.cpp
    Code:
    #ifdef __JEFF_11_4
    							else if( i == MMI_ARENA_ENTER )
    							{
    								if( g_pPlayer && !g_pPlayer->IsBaseJob() )
    									m_wndMenuMover.AppendMenu( 0, i, prj.GetText( TID_MMI_DIALOG + i ) );
    								bView = TRUE;
    							}
    #endif	// __JEFF_11_4
    #ifdef __FastJewelSelect
    										else if (i == MMI_FASTJEWEL)
    										{
    											m_wndMenuMover.AppendMenu(0, i, "Fast Jewel Select");
    											bView = TRUE;
    										}
    #endif
    Make sure after you apply all of this your using Merge to create new resData's, then copy them from ResClient to your actual client.
    Forum Contact: Click Here | Community Rules & Guidelines: Click Here

  15. #15
    Registered Sand is offline
    MemberRank
    Sep 2021 Join Date
    SandLocation
    12Posts

    Re: Quick Jewel(Diamond) Set

    Quote Originally Posted by Siono01 View Post
    thanks for sharingI would like to ask the following. This is how any gem can be put together. Cancel one and the other two will keep showing in the box so it’s useless

    https://prnt.sc/1w3we5v
    Code:
    if (itemElem)        
    {
                itemElem->SetExtra(itemElem.GetExtra());
                itemElem = nullptr;
                itemTexture = nullptr;
    }
            itemElem = pItemElem;
            itemElem->SetExtra(itemElem->m_nItemNum);
            itemTexture = CWndBase::m_textureMng.AddTexture(g_Neuz.m_pd3dDevice, MakePath(DIR_ITEM, iProp->szIcon), 0xffff00ff);
        }
        else if (iProp->dwItemKind3 == IK3_ULTIMATE)
        {
            if (gemItem)
            {
                gemItem->SetExtra(itemElem.GetExtra());
                gemItem = nullptr;
                gemTexture = nullptr;
            }
            gemItem = pItemElem;
            gemItem->SetExtra(gemItem->m_nItemNum);
            gemTexture = CWndBase::m_textureMng.AddTexture(g_Neuz.m_pd3dDevice, MakePath(DIR_ITEM, iProp->szIcon), 0xffff00ff);
        }
    One second fix. Should be more explorative with flyff and C++ and maybe you would have been the one posting this fix rather than complaining about not needing to spend 20$.

    @noobdevie
    It not opening would be missing/incorrect WndWorld implementation or resdata. Make sure to disable the other wndworld edit just in case of conflict if you use Ketchups edit. Also, for the original WndWorld edit, mmi text defines need to be the correct define number or else text will not appear.
    I went outside to touch sand. where the sand meets the sand.



Advertisement