Advertisement
bombillo

Case System

Dec 12th, 2015
570
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 4.64 KB | None | 0 0
  1. void  FrontendWarZ::OnBuyLootBoxSuccess()
  2. {  
  3.     if(gUserProfile.ProfileData.lastWinID > 0)
  4.     {
  5.         char winmsg[600];
  6.  
  7.         const WeaponConfig* wc = g_pWeaponArmory->getWeaponConfig(gUserProfile.ProfileData.lastWinID);
  8.         const GearConfig* gc = g_pWeaponArmory->getGearConfig(gUserProfile.ProfileData.lastWinID);
  9.         const FoodConfig* fc = g_pWeaponArmory->getFoodConfig(gUserProfile.ProfileData.lastWinID);
  10.         const BaseItemConfig* ic = g_pWeaponArmory->getFoodConfig(gUserProfile.ProfileData.lastWinID);
  11.  
  12.         SoundSys.PlayAndForget(SoundSys.GetEventIDByPath("Sounds/PandemicZ/Crate/lever8"), r3dPoint3D(0,0,0));
  13.         SoundSys.PlayAndForget(SoundSys.GetEventIDByPath("Sounds/PandemicZ/Crate/csgo_ui_crate_open"), r3dPoint3D(0,0,0));
  14.         if(wc)
  15.         {
  16.             sprintf(winmsg, "CONGRATULATIONS\n YOU FOUND A <font color=\"#6496FF\">%s</font>\n IT CAN BE FOUND IN YOUR GLOBAL INVENTORY", wc->m_StoreName);
  17.             SoundSys.PlayAndForget(SoundSys.GetEventIDByPath("Sounds/PandemicZ/Crate/item_drop2_uncommon"), r3dPoint3D(0,0,0));
  18.         }
  19.         else if(gc)
  20.         {
  21.             sprintf(winmsg, "CONGRATULATIONS\n YOU FOUND A <font color=\"#6496FF\">%s</font>\n IT CAN BE FOUND IN YOUR GLOBAL INVENTORY", gc->m_StoreName);
  22.             SoundSys.PlayAndForget(SoundSys.GetEventIDByPath("Sounds/PandemicZ/Crate/item_drop2_uncommon"), r3dPoint3D(0,0,0));
  23.         }
  24.         else if(fc)
  25.         {
  26.             sprintf(winmsg, "CONGRATULATIONS\n YOU FOUND A <font color=\"#6496FF\">%s</font>\n IT CAN BE FOUND IN YOUR GLOBAL INVENTORY", fc->m_StoreName);
  27.             SoundSys.PlayAndForget(SoundSys.GetEventIDByPath("Sounds/PandemicZ/Crate/item_drop2_uncommon"), r3dPoint3D(0,0,0));
  28.         }      
  29.         else if(ic)
  30.         {
  31.             sprintf(winmsg, "CONGRATULATIONS\n YOU FOUND A <font color=\"#6496FF\">%s</font>\n IT CAN BE FOUND IN YOUR GLOBAL INVENTORY", ic->m_StoreName);
  32.             SoundSys.PlayAndForget(SoundSys.GetEventIDByPath("Sounds/PandemicZ/Crate/item_drop2_uncommon"), r3dPoint3D(0,0,0));
  33.         }
  34.         else
  35.         {
  36.             sprintf(winmsg, "OH FIDDLESTICKS\n YOU FOUND <font color=\"#FF6464\">NOTHING</font> IN THAT CASE\n I BETTER LUCK NEXT TIME");
  37.             SoundSys.PlayAndForget(SoundSys.GetEventIDByPath("Sounds/PandemicZ/Crate/item_drop2_uncommon"), r3dPoint3D(0,0,0));
  38.         }
  39.  
  40.         gfxMovie.Invoke("_root.api.Main.Marketplace.showTransactionsPopup", "");
  41.         gfxMovie.Invoke("_root.api.Main.Marketplace.Marketplace.openCase", "");
  42.  
  43.         //setCurrency();
  44.  
  45.  
  46.         gUserProfile.GetProfile();
  47.  
  48.         Scaleform::GFx::Value var3[1];
  49.  
  50.         var3[0].SetInt(gUserProfile.ProfileData.GamePoints);
  51.         gfxMovie.Invoke("_root.api.setGC", var3, 1);
  52.  
  53.         var3[0].SetInt(gUserProfile.ProfileData.GameDollars);
  54.         gfxMovie.Invoke("_root.api.setDollars", var3, 1);
  55.  
  56.         /*var3[0].SetInt(gUserProfile.ProfileData.GameCells);
  57.         gfxMovie.Invoke("_root.api.setCells", var3, 1);*/
  58.  
  59.        
  60.  
  61.         Scaleform::GFx::Value var2[7];
  62.         // clear inventory DB
  63.         gfxMovie.Invoke("_root.api.clearInventory", NULL, 0);
  64.  
  65.         // add all items
  66.         for(uint32_t i=0; i<gUserProfile.ProfileData.NumItems; ++i)
  67.         {
  68.             var2[0].SetUInt(uint32_t(gUserProfile.ProfileData.Inventory[i].InventoryID));
  69.             var2[1].SetUInt(gUserProfile.ProfileData.Inventory[i].itemID);
  70.             var2[2].SetNumber(gUserProfile.ProfileData.Inventory[i].quantity);
  71.             var2[3].SetNumber(gUserProfile.ProfileData.Inventory[i].Var1);
  72.             var2[4].SetNumber(gUserProfile.ProfileData.Inventory[i].Var2);
  73.             bool isConsumable = false;
  74.             {
  75.                 const WeaponConfig* wc = g_pWeaponArmory->getWeaponConfig(gUserProfile.ProfileData.Inventory[i].itemID);
  76.                 if(wc && wc->category == storecat_UsableItem && wc->m_isConsumable)
  77.                     isConsumable = true;
  78.             }
  79.             var2[5].SetBoolean(isConsumable);
  80.             var2[6].SetString(getAdditionalDescForItem(gUserProfile.ProfileData.Inventory[i].itemID, gUserProfile.ProfileData.Inventory[i].Var1, gUserProfile.ProfileData.Inventory[i].Var2, gUserProfile.ProfileData.Inventory[i].Var3));
  81.             gfxMovie.Invoke("_root.api.addInventoryItem", var2, 7);
  82.         }
  83.  
  84.         gfxMovie.Invoke("_root.api.buyItemSuccessful", "");
  85.         gfxMovie.Invoke("_root.api.hideInfoMsg", "");
  86.  
  87.         /*Scaleform::GFx::Value var[2];
  88.         var[0].SetString(winmsg);
  89.         var[1].SetBoolean(true);
  90.         gfxMovie.Invoke("_root.api.showInfoMsg", var, 2);
  91.  
  92.         /*Scaleform::GFx::Value var[3];
  93.         var[0].SetString(winmsg);
  94.         var[1].SetString(winmsg);
  95.         var[2].SetString(winmsg);
  96.         gfxMovie.Invoke("_root.api.Main.Marketplace.setCaseData", var, 3);
  97.  
  98.         gfxMovie.Invoke("_root.api.Main.Marketplace.Marketplace.OpenCase.visible", true);*/
  99.    
  100.     }
  101.     else
  102.     {
  103.         gfxMovie.Invoke("_root.api.buyItemSuccessful", "");
  104.         gfxMovie.Invoke("_root.api.hideInfoMsg", "");
  105.  
  106.         Scaleform::GFx::Value var[2];
  107.         var[0].SetString("Failed to open case");
  108.         var[1].SetBoolean(true);
  109.         gfxMovie.Invoke("_root.api.showInfoMsg", var, 2);
  110.     }
  111.  
  112.     mStore_BuyItemID  = 0;
  113.     return;
  114. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement