TUTORIAL - UnloadClip for DNC!

Results 1 to 4 of 4
  1. #1
    Apprentice sintaxbr is offline
    MemberRank
    Nov 2004 Join Date
    BRASILLocation
    22Posts

    TUTORIAL - UnloadClip for DNC!

    in src\EclipseStudio\Sources\UI\HUDPause.cpp]

    Search for
    Code:
    void HUDPause::eventBackpackDrop(r3dScaleformMovie* pMovie, const Scaleform::GFx::Value* args, unsigned argCount)
    {
    	r3d_assert(argCount==1);
    	int slotID = args[0].GetInt();
    
    	obj_Player* plr = gClientLogic().localPlayer_;
    	r3d_assert(plr);
    
    	plr->DropItem(slotID);
    
    	updateSurvivorTotalWeight();
    
    	gfxMovie.Invoke("_root.api.backpackGridSwapSuccess", "");
    }
    add above

    Code:
    void HUDPause::eventBackpackUnloadClip(r3dScaleformMovie* pMovie, const Scaleform::GFx::Value* args, unsigned argCount)
    {			   
    	obj_Player* plr = gClientLogic().localPlayer_;
    	
    	int slotID = args[0].GetInt();
    	uint32_t itemID = args[0].GetUInt();
    	
    	wiInventoryItem& wi = plr->CurLoadout.Items[slotID];	
    	const WeaponConfig* wc = g_pWeaponArmory->getWeaponConfig(itemID);
    	r3d_assert(argCount==1);
    	r3d_assert(plr);
    	r3d_assert(wi.itemID && wi.quantity > 0);
    	{
    	const WeaponConfig* wc = g_pWeaponArmory->getWeaponConfig(wi.itemID);
    		if(wc)
    		{
    			// UNLOAD CLIP
    			if(wc->category >= storecat_ASR && wc->category <= storecat_SMG)
    			{
    					if(wi.Var1 > 0)
    					{
    						PKT_C2S_UnloadClipReq_s n;
    						n.slotID = slotID;
    						p2pSendToHost(gClientLogic().localPlayer_, &n, sizeof(n), true);
    						wi.Var1 = 0;
    						plr->CurLoadout.Items[slotID] = wi;
    						
    						plr->OnBackpackChanged(slotID);
    						updateSurvivorTotalWeight();		
    					}
    					Scaleform::GFx::Value var[2];
    					var[0].SetString("Erro ao descarregar");
    					var[1].SetInt(2);
    					gfxMovie.Invoke("_root.api.Main.Inventory.addContextMenuOption", var, 2);
    					return;
    			}	
    		}
    	}
    }
    search for
    Code:
    gfxMovie.RegisterEventHandler("eventBackpackDrop", MAKE_CALLBACK(eventBackpackDrop));
    add above
    Code:
    gfxMovie.RegisterEventHandler("eventBackpackUnloadClip", MAKE_CALLBACK(eventBackpackUnloadClip));
    in src\EclipseStudio\Sources\UI\HUDPause.h
    seach for
    Code:
    void	eventBackpackDrop(r3dScaleformMovie* pMovie, const Scaleform::GFx::Value* args, unsigned argCount);
    add above
    Code:
    void	eventBackpackUnloadClip(r3dScaleformMovie* pMovie, const Scaleform::GFx::Value* args, unsigned argCount);
    in src\EclipseStudio\Sources\multiplayer\P2PMessages.h

    search for
    Code:
    PKT_C2S_DisconnectReq,
    add above
    Code:
    PKT_C2S_UnloadClipReq,
    search for
    Code:
    struct PKT_C2S_DisconnectReq_s : public DefaultPacketMixin<PKT_C2S_DisconnectReq>
    {
    };
    add above
    Code:
    struct PKT_C2S_UnloadClipReq_s : public DefaultPacketMixin<PKT_C2S_UnloadClipReq>
    {
    	int slotID;
    };
    in server\WO_GameServer\Sources\ObjectsCode\obj_ServerPlayer.cpp
    search for
    Code:
    void obj_ServerPlayer::OnNetPacket(const PKT_C2S_InventoryOp_s& n)
    {
    }
    add above
    Code:
    void obj_ServerPlayer::OnNetPacket(const PKT_C2S_UnloadClipReq_s& n)
    {
    	if(loadout_->Alive == 0)
    		return;
    
    	wiInventoryItem item = loadout_->Items[n.slotID];
    
    	const WeaponConfig* wc = g_pWeaponArmory->getWeaponConfig(item.itemID);
    	//m_WeaponArray[n.slotID]
    	if(wc)
    	{
    		if(wc->category >= storecat_ASR && wc->category <= storecat_SMG)
    		{
    			if(item.Var1 > 0 && item.Var2 > 0)
    			{
    				wiInventoryItem wi;
    				wi.itemID   = item.Var2;
    				wi.quantity = 1;
    				wi.Var1 = item.Var1;
    
    				item.Var1 = 0;
    				item.Var2 = wi.itemID;
    				
    				if(BackpackAddItem(wi))
    					loadout_->Items[n.slotID] = item;
    				
    				OnBackpackChanged(n.slotID);
    
    			}else{
    				gServerLogic.LogCheat(peerId_, PKT_S2C_CheatWarning_s::CHEAT_Protocol, false, "Clip is serverside empty",
    				"slot%d %d - %d", n.slotID, item.itemID, item.Var1);
    			}
    		}
    	}
    }
    search for
    Code:
    DEFINE_GAMEOBJ_PACKET_HANDLER(PKT_C2C_PlayerUseItem);
    add above
    Code:
    DEFINE_GAMEOBJ_PACKET_HANDLER(PKT_C2S_UnloadClipReq);
    in server\WO_GameServer\Sources\ObjectsCode\obj_ServerPlayer.h
    search for
    Code:
    void		OnNetPacket(const PKT_C2S_DisconnectReq_s& n);
    add above
    Code:
    void		OnNetPacket(const PKT_C2S_UnloadClipReq_s& n);
    Recompile the Server and Client..
    Last edited by sintaxbr; 20-10-13 at 08:20 AM.


  2. #2
    Breshit bara Elohim loveomg is offline
    MemberRank
    Mar 2007 Join Date
    642Posts

    Re: TUTORIAL - UnloadClip for DNC!

    Thank you syntexbr
    You are so good guy ^^ I will try your guide now
    It so different from DNC's

  3. #3
    Breshit bara Elohim loveomg is offline
    MemberRank
    Mar 2007 Join Date
    642Posts

    Re: TUTORIAL - UnloadClip for DNC!

    it dosen't works...
    no Api calls eventBackpackUnloadClip function.. what's up?
    what codes are this?

  4. #4
    Apprentice sintaxbr is offline
    MemberRank
    Nov 2004 Join Date
    BRASILLocation
    22Posts

    Re: TUTORIAL - UnloadClip for DNC!

    Quote Originally Posted by loveomg View Post
    it dosen't works...
    no Api calls eventBackpackUnloadClip function.. what's up?
    what codes are this?

    its work no need API for this becouse is server side sync packet

    You have a DNC version with HUD of dnc?

    In DNC HUD calls function eventBackpackUnloadClip



Advertisement