return worldserver info to client

Results 1 to 6 of 6
  1. #1
    Enthusiast Int16 is online now
    MemberRank
    Oct 2022 Join Date
    33Posts

    return worldserver info to client

    Hello its me once again ..
    Im still working on my little teleporter system that i mentioned before to learn some stuff about the flyff source.
    (Thanks to Fenris and Ketchup for giving me tips for the server/client sided security and explanations)

    so the last feature that is missing in the teleporter is do display the drops in the interface by the mover id defined in the resource

    And yeah i understand how it "should" work and that i need to call the items in the world server and return it back to the client since dropitems are server sided

    but... after trying to understand it from looking at stuff like Drop log or drop info (DC files) im just left with confusion
    (not the code itself for the drop items, the part where you get the info from the world back to the client)


    it would help me alot if someone could break it down how to send data between world and client

    Thanks in advance


  2. #2
    Apprentice ThatGuyJay is offline
    MemberRank
    Dec 2022 Join Date
    24Posts
    While I was checking resources folder on another flyff files, I noticed there was a Teleporter.txt
    create one and list the items. Then merge. See if it works
    Last edited by ThatGuyJay; 1 Week Ago at 10:15 AM. Reason: Inputed too much

  3. #3
    Enthusiast Int16 is online now
    MemberRank
    Oct 2022 Join Date
    33Posts
    That's not the issue i made my own resource file that hass the monster id of the boss
    my goal is to send the monster id to the world server and return a array of item indexes

    but that is not the part i need help with

  4. #4
    RE:ℓσα∂є∂ Fenris is offline
    MemberRank
    Sep 2011 Join Date
    RE:ℓσα∂Location
    588Posts
    So, Ill go over some options you have here after going over the communication between the worldserver and the user.

    Every 200ms, a list of buffers stored of actions / responses is sent from the server to the client. This is found within CUser::Process(). There is a function called, CUser::Notify.

    Code:
    int	CUser::Notify()
    {
    	if (!IsValid())
    		return 0;
    
    	if (m_dwDestroyTime)
    		return 0;
    
    	static unsigned int uOffset = sizeof(DPID) + sizeof(unsigned long) + sizeof(unsigned long) + sizeof(short);
    	int nBufSize;
    	if (m_Snapshot.cb > 0)
    	{
    		unsigned char* lpBuf = m_Snapshot.ar.GetBuffer(&nBufSize);
    		*reinterpret_cast<__unaligned unsigned short*>(lpBuf + sizeof(DPID) + sizeof(unsigned long) + sizeof(unsigned long)) = m_Snapshot.cb;
    
    		g_DPSrvr.Send(lpBuf, nBufSize, m_Snapshot.dpidCache);
    		*reinterpret_cast<__unaligned unsigned long*>(lpBuf + sizeof(DPID)) = PACKETTYPE_SNAPSHOT;
    
    		m_Snapshot.cb = 0;
    		m_Snapshot.ar.ReelIn(uOffset);
    		return nBufSize;
    	}
    	return 0;
    }
    Those snapshots are made by a lot of CUser function calls which continually serializes more and more data to a buffer till eventually it is sent out.

    The following sends the buffer to the cacheserver with the users cache id:
    Code:
    g_DPSrvr.Send(lpBuf, nBufSize, m_Snapshot.dpidCache);
    The worldserver is connected to the Cacheserver and the cacheserver is connected to the clients. Because the packet header isn't a system header it would be getting routed to the UserMessageHandler.
    PHP Code:
    CDPCacheSrvr::UserMessageHandler 
    A free fix from v21.2 is stored here as well:
    PHP Code:
        CPlayerpPlayer CPlayerMng::Instance()->GetPlayer(idFrom);
        if (!
    pPlayer
            return;

        
    PACKET_HANDLER_FUNC pfn GetHandler(dw); 
    but down below there is:
    PHP Code:
                default:
                    
    g_DPClientArray.SendToServeridFromlpMsgdwMsgSize );
                    break; 
    So, if the function isn't found in the std::map of function pointers and it isn't a set of packets (for the coreserver), they get routed to the client.

    Then sent to the clients UserMessageHandler and then to the OnSnapShot function. Where it will loop over the network buffer and apply the list of "snapshotted" network buffers.

    PHP Code:
    unsigned char g_hdrg_Prev;
    void CDPClient::OnSnapshot(CArar
    Meaning, if there is one error within a 200ms network buffer, and the buffer for that specific individual snapshot isn't extracted fully, data can be mismatched for the next loops until that specific round of execution.



    Now, you can send a packet from the client to request the drop information for a monster when required, and then the worldserver can respond. You can even change it to make it work faster too for that individual packet if you wanted. Another alternative is, you can send the drop list whenever from the server to the client. Lastly, there's the alternative of just loading the drop table locally but that will expose all the drops visually but most are already exposed, no?

    My personal preference would either be the first or the last. If you're having a dynamic drop table where you're reloading the drops on the server without rebooting the server, (Ie: editing the drop system a bit) then the first. Otherwise, the last. If you're not changing the drops, might as well trade off a little load time compared to the other alternatives.
    Last edited by Fenris; 1 Week Ago at 04:34 PM.

  5. #5
    Enthusiast Int16 is online now
    MemberRank
    Oct 2022 Join Date
    33Posts
    Thanks again :)
    This helped me alot even tho i used the last option kinda

    i compared the mover id with my tpdata mover id and added the items id while loading the propmoverex.inc

    Code:
                if( script.Token == "DropItem" )
                {
                    DROPITEM di;
                    memset( &di, 0, sizeof(DROPITEM) );
                    di.dtType = DROPTYPE_NORMAL;
                    script.GetToken();  // (
                    di.dwIndex  = script.GetNumber();   // specific item index
                    if( di.dwIndex == 0 )
                        Error( "%s : %s�� defineItem.h�� ���ǵ��� �ʾ���", szFileName, script.token );
                    ASSERT( di.dwIndex != 0 );
                    script.GetToken();  // ,
                    di.dwProbability    = script.GetNumber();   // probability
                    script.GetToken();  // ,
                    di.dwLevel  = script.GetNumber();   // level
                    script.GetToken();  // ,
                    di.dwNumber = script.GetNumber();   // number
                    script.GetToken();  // )
    #ifdef __WORLDSERVER
                    pProp->m_DropItemGenerator.AddTail( di, pProp->szName );    // copy
    #endif
                    di.dwNumber2 = 0;
    
    #ifdef __SYS_TELE16
    #ifdef __CLIENT
                for(int i = 0; i < prj.TPData.size(); i++)
                {
                    if(nVal == prj.TPData[i].dwBossID)
                    {
                        if(ItemProp * pProp = prj.GetItemProp(di.dwIndex))
                        {
                            if(pProp->dwItemKind3 == IK3_EGG //eggers
                            || pProp->dwItemKind3 == IK3_SMELT_GENERAL_MATERIAL //sunstone
                            || pProp->dwItemKind3 == IK3_SMELT_ULTIMATE_MATERIAL //shini
                            || pProp->dwItemKind3 == IK3_SMELT_ACCESSORY_MATERIAL //moonstone
                            || pProp->dwItemKind3 == IK3_ULTIMATE //dias
                            || pProp->dwItemKind3 == IK3_GEM //quest items
                            )
                                continue;
    
                            if(pProp->dwItemKind1 == IK1_ARMOR && pProp->dwItemLV <= 105)
                                continue;
    
                            if(pProp->dwItemKind1 == IK1_WEAPON )
                            {
                                bool bValidWeapon = ( pProp->dwReferStat1 == WEAPON_UNIQUE || pProp->dwReferStat1 == WEAPON_ULTIMATE );
    
                                if(!bValidWeapon)
                                    continue;
                            }
                            prj.TPData[i].vec_Drops.push_back(di.dwIndex);
                        }
                    }
                }
    #endif //__CLIENT
    #endif //__SYS_TELE16
    
    works like a charm

  6. #6
    ‎‎‎‎ Ketchup is offline
    ModeratorRank
    Jan 2009 Join Date
    New YorkLocation
    2,833Posts
    Jeez u again, nowai lol just messin!



Advertisement