View difference between Paste ID: EZTNHTXX and 7dZBNGgv
SHOW: | | - or go back to the newest paste.
1
In FrontEndWarZ.CPP
2
AFTER THIS
3
gfxMovie.RegisterEventHandler("eventMarketplaceActive", MAKE_CALLBACK(eventMarketplaceActive));	
4
5
ADD THIS	
6
gfxMovie.RegisterEventHandler("eventMoveAllItems", MAKE_CALLBACK(eventMoveAllItems));
7
8
AFTER THIS FUNCTION
9
void FrontendWarZ::OnDonateToServerSuccess()
10
11
ADD THIS ENTERY ONE
12
void FrontendWarZ::eventMoveAllItems(r3dScaleformMovie* pMovie, const Scaleform::GFx::Value* args, unsigned argCount)
13
{
14
	//Simple logic for buttons, move all items from backpack to inventory
15
	const wiCharDataFull& slot = gUserProfile.ProfileData.ArmorySlots[gUserProfile.SelectedCharID];
16
	if(!(slot.GameFlags & wiCharDataFull::GAMEFLAG_NearPostBox))
17
		return;
18
19
	int itemsToMove = 0;
20
	for(int i=8; i < slot.BackpackSize; ++i)
21
	{
22
		const wiInventoryItem& wi = slot.Items[i];
23
		if(wi.itemID > 0)
24
		{
25
			itemsToMove++;
26
		}
27
	}
28
29
	if(itemsToMove)
30
	{
31
		if((gUserProfile.ProfileData.NumItems + itemsToMove) > wiUserProfile::INVENTORY_SIZE_LIMIT)
32
		{
33
			Scaleform::GFx::Value vars[3];
34
			vars[0].SetString(gLangMngr.getString("InGameUI_ErrorMsg_NoInventorySpace"));
35
			vars[1].SetBoolean(true);
36
			vars[2].SetString("$ERROR");
37
			gfxMovie.Invoke("_root.api.showInfoMsg", vars, 3);
38
			return;
39
		}
40
	}
41
	else
42
	{
43
		//If we don't find any item, don't do anything.
44
		return;
45
	}
46
47
	Scaleform::GFx::Value var[2];
48
	var[0].SetString(gLangMngr.getString("OneMomentPlease"));
49
	var[1].SetBoolean(false);
50
	gfxMovie.Invoke("_root.api.showInfoMsg", var, 2);
51
52
	StartAsyncOperation(&FrontendWarZ::as_MoveAllItemsThread, &FrontendWarZ::OnMoveAllItemsSucessfully);
53
}
54
55
unsigned int WINAPI FrontendWarZ::as_MoveAllItemsThread(void* in_data)
56
{
57
	r3dThreadAutoInstallCrashHelper crashHelper;
58
	FrontendWarZ* This = (FrontendWarZ*)in_data;
59
	
60
	This->DelayServerRequest();
61
62
	int BackpackSlot = 0;
63
	int Quantity = 0;
64
	int apiCode = 0;
65
	const wiCharDataFull& slot = gUserProfile.ProfileData.ArmorySlots[gUserProfile.SelectedCharID];
66
	for(int i=8; i < slot.BackpackSize; ++i)
67
	{
68
		const wiInventoryItem& wi = slot.Items[i];
69
		if(wi.itemID > 0)
70
		{
71
			BackpackSlot = i;
72
			Quantity = wi.quantity;
73
			apiCode = gUserProfile.ApiBackpackToInventory(BackpackSlot, Quantity);
74
		}
75
	}
76
77
	if(apiCode != 0)
78
	{
79
		if(apiCode == 7)
80
		{
81
			This->SetAsyncError(0, gLangMngr.getString("GameSessionHasNotClosedYet"));
82
		}
83
		else if(apiCode == 9)
84
		{
85
			This->SetAsyncError(0, gLangMngr.getString("InGameUI_ErrorMsg_NoInventorySpace"));
86
		}
87
		else if(apiCode == 6)
88
		{
89
			return 1; //This function was made for 1 by 1 item to inventory, we're trying something different here, so, skip this error, it will make no difference, item will be moved to inventory anyway.
90
		}
91
		else
92
		{
93
			This->SetAsyncError(apiCode, gLangMngr.getString("BackpackToInventoryFail"));
94
		}
95
		return 0;
96
	}
97
98
	return 1;
99
}
100
101
void FrontendWarZ::OnMoveAllItemsSucessfully()
102
{
103
	Scaleform::GFx::Value var[8];
104
	gfxMovie.Invoke("_root.api.clearBackpack", "");
105
	int	slot = gUserProfile.SelectedCharID;
106
107
	addBackpackItems(gUserProfile.ProfileData.ArmorySlots[slot], slot);
108
109
	updateInventoryAndSkillItems();
110
111
	updateSurvivorTotalWeight(slot);
112
113
	gfxMovie.Invoke("_root.api.hideInfoMsg", "");
114
	gfxMovie.Invoke("_root.api.backpackToInventorySuccess", "");
115
	return;
116
}
117
118
IN FrontEndWarZ.h
119
AFTER THIS
120
void eventOpenURL(r3dScaleformMovie* pMovie, const Scaleform::GFx::Value* args, unsigned argCount);
121
122
ADD THIS
123
void eventMoveAllItems(r3dScaleformMovie* pMovie, const Scaleform::GFx::Value* args, unsigned argCount);
124
125
AFTER THIS
126
void		OnRequestGCTransactionSuccess();
127
128
ADD THIS
129
static unsigned int WINAPI as_MoveAllItemsThread(void* in_data);
130
void		OnMoveAllItemsSucessfully();