Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- In FrontEndWarZ.CPP
- AFTER THIS
- gfxMovie.RegisterEventHandler("eventMarketplaceActive", MAKE_CALLBACK(eventMarketplaceActive));
- ADD THIS
- gfxMovie.RegisterEventHandler("eventMoveAllItems", MAKE_CALLBACK(eventMoveAllItems));
- AFTER THIS FUNCTION
- void FrontendWarZ::OnDonateToServerSuccess()
- ADD THIS ENTERY ONE
- void FrontendWarZ::eventMoveAllItems(r3dScaleformMovie* pMovie, const Scaleform::GFx::Value* args, unsigned argCount)
- {
- //Simple logic for buttons, move all items from backpack to inventory
- const wiCharDataFull& slot = gUserProfile.ProfileData.ArmorySlots[gUserProfile.SelectedCharID];
- if(!(slot.GameFlags & wiCharDataFull::GAMEFLAG_NearPostBox))
- return;
- int itemsToMove = 0;
- for(int i=8; i < slot.BackpackSize; ++i)
- {
- const wiInventoryItem& wi = slot.Items[i];
- if(wi.itemID > 0)
- {
- itemsToMove++;
- }
- }
- if(itemsToMove)
- {
- if((gUserProfile.ProfileData.NumItems + itemsToMove) > wiUserProfile::INVENTORY_SIZE_LIMIT)
- {
- Scaleform::GFx::Value vars[3];
- vars[0].SetString(gLangMngr.getString("InGameUI_ErrorMsg_NoInventorySpace"));
- vars[1].SetBoolean(true);
- vars[2].SetString("$ERROR");
- gfxMovie.Invoke("_root.api.showInfoMsg", vars, 3);
- return;
- }
- }
- else
- {
- //If we don't find any item, don't do anything.
- return;
- }
- Scaleform::GFx::Value var[2];
- var[0].SetString(gLangMngr.getString("OneMomentPlease"));
- var[1].SetBoolean(false);
- gfxMovie.Invoke("_root.api.showInfoMsg", var, 2);
- StartAsyncOperation(&FrontendWarZ::as_MoveAllItemsThread, &FrontendWarZ::OnMoveAllItemsSucessfully);
- }
- unsigned int WINAPI FrontendWarZ::as_MoveAllItemsThread(void* in_data)
- {
- r3dThreadAutoInstallCrashHelper crashHelper;
- FrontendWarZ* This = (FrontendWarZ*)in_data;
- This->DelayServerRequest();
- int BackpackSlot = 0;
- int Quantity = 0;
- int apiCode = 0;
- const wiCharDataFull& slot = gUserProfile.ProfileData.ArmorySlots[gUserProfile.SelectedCharID];
- for(int i=8; i < slot.BackpackSize; ++i)
- {
- const wiInventoryItem& wi = slot.Items[i];
- if(wi.itemID > 0)
- {
- BackpackSlot = i;
- Quantity = wi.quantity;
- apiCode = gUserProfile.ApiBackpackToInventory(BackpackSlot, Quantity);
- }
- }
- if(apiCode != 0)
- {
- if(apiCode == 7)
- {
- This->SetAsyncError(0, gLangMngr.getString("GameSessionHasNotClosedYet"));
- }
- else if(apiCode == 9)
- {
- This->SetAsyncError(0, gLangMngr.getString("InGameUI_ErrorMsg_NoInventorySpace"));
- }
- else if(apiCode == 6)
- {
- 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.
- }
- else
- {
- This->SetAsyncError(apiCode, gLangMngr.getString("BackpackToInventoryFail"));
- }
- return 0;
- }
- return 1;
- }
- void FrontendWarZ::OnMoveAllItemsSucessfully()
- {
- Scaleform::GFx::Value var[8];
- gfxMovie.Invoke("_root.api.clearBackpack", "");
- int slot = gUserProfile.SelectedCharID;
- addBackpackItems(gUserProfile.ProfileData.ArmorySlots[slot], slot);
- updateInventoryAndSkillItems();
- updateSurvivorTotalWeight(slot);
- gfxMovie.Invoke("_root.api.hideInfoMsg", "");
- gfxMovie.Invoke("_root.api.backpackToInventorySuccess", "");
- return;
- }
- IN FrontEndWarZ.h
- AFTER THIS
- void eventOpenURL(r3dScaleformMovie* pMovie, const Scaleform::GFx::Value* args, unsigned argCount);
- ADD THIS
- void eventMoveAllItems(r3dScaleformMovie* pMovie, const Scaleform::GFx::Value* args, unsigned argCount);
- AFTER THIS
- void OnRequestGCTransactionSuccess();
- ADD THIS
- static unsigned int WINAPI as_MoveAllItemsThread(void* in_data);
- void OnMoveAllItemsSucessfully();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement