Advertisement
conan513

Untitled

Aug 6th, 2013
126
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. mazsola
  2.  
  3. void CUserProfile::ParseLoadouts(pugi::xml_node& xmlItem)
  4. {
  5. // reset current backpacks
  6. for(int i=0; i<ProfileData.NumSlots; i++) {
  7. for(int j=0; j<ProfileData.ArmorySlots[i].BackpackSize; j++) {
  8. ProfileData.ArmorySlots[i].Items[j].Reset();
  9. }
  10. }
  11.  
  12. ProfileData.NumSlots = 0;
  13.  
  14. // parse all slots
  15. xmlItem = xmlItem.first_child();
  16. while(!xmlItem.empty())
  17. {
  18. wiCharDataFull& w = ProfileData.ArmorySlots[ProfileData.NumSlots++];
  19. wiStats& st = w.Stats;
  20. if(ProfileData.NumSlots > wiUserProfile::MAX_LOADOUT_SLOTS)
  21. r3dError("more that 6 profiles!");
  22.  
  23. w.LoadoutID = xmlItem.attribute("CharID").as_uint();
  24. r3dscpy(w.Gamertag, xmlItem.attribute("Gamertag").value());
  25. w.Alive = xmlItem.attribute("Alive").as_int();
  26. w.Hardcore = xmlItem.attribute("Hardcore").as_int();
  27. st.XP = xmlItem.attribute("XP").as_int();
  28. st.TimePlayed = xmlItem.attribute("TimePlayed").as_int();
  29. w.Health = xmlItem.attribute("Health").as_float();
  30. w.Hunger = xmlItem.attribute("Hunger").as_float();
  31. w.Thirst = xmlItem.attribute("Thirst").as_float();
  32. w.Toxic = xmlItem.attribute("Toxic").as_float();
  33. st.Reputation = xmlItem.attribute("Reputation").as_int();
  34. w.DeathUtcTime= xmlItem.attribute("DeathTime").as_int64();
  35. w.SecToRevive = xmlItem.attribute("SecToRevive").as_int();
  36.  
  37. w.GameMapId = xmlItem.attribute("GameMapId").as_int();
  38. w.GameServerId= xmlItem.attribute("GameServerId").as_int();
  39. w.GamePos = r3dPoint3D(0, 0, 0);
  40. r3dOutToLog("Hunz MapID: %i\n", w.GameMapId);
  41. if (w.GameMapId == 3)//for Cliffside
  42. sscanf(xmlItem.attribute("GamePos2").value(), "%f %f %f %f", &w.GamePos.x, &w.GamePos.y, &w.GamePos.z, &w.GameDir);
  43. else if (w.GameMapId == 4)//for ServerTest
  44. sscanf(xmlItem.attribute("GamePos3").value(), "%f %f %f %f", &w.GamePos.x, &w.GamePos.y, &w.GamePos.z, &w.GameDir);
  45. else if (w.GameMapId == 5)//HunZ Colorado2
  46. sscanf(xmlItem.attribute("GamePos4").value(), "%f %f %f %f", &w.GamePos.x, &w.GamePos.y, &w.GamePos.z, &w.GameDir);
  47. else
  48. sscanf(xmlItem.attribute("GamePos").value(), "%f %f %f %f", &w.GamePos.x, &w.GamePos.y, &w.GamePos.z, &w.GameDir);
  49. w.GameFlags = xmlItem.attribute("GameFlags").as_int();
  50.  
  51. w.HeroItemID = xmlItem.attribute("HeroItemID").as_int();
  52. w.HeadIdx = xmlItem.attribute("HeadIdx").as_int();
  53. w.BodyIdx = xmlItem.attribute("BodyIdx").as_int();
  54. w.LegsIdx = xmlItem.attribute("LegsIdx").as_int();
  55.  
  56. w.ClanID = xmlItem.attribute("ClanID").as_int();
  57. w.ClanRank = xmlItem.attribute("ClanRank").as_int();
  58. r3dscpy(w.ClanTag, xmlItem.attribute("ClanTag").value());
  59. w.ClanTagColor= xmlItem.attribute("ClanTagColor").as_int();
  60.  
  61. const char* attm1 = xmlItem.attribute("attm1").value();
  62. const char* attm2 = xmlItem.attribute("attm2").value();
  63. parseCharAttachments(attm1, w.Attachment[0]);
  64. parseCharAttachments(attm2, w.Attachment[1]);
  65.  
  66. w.BackpackID = xmlItem.attribute("BackpackID").as_uint();
  67. w.BackpackSize = xmlItem.attribute("BackpackSize").as_int();
  68.  
  69. // trackable stats
  70. st.KilledZombies = xmlItem.attribute("ts00").as_int();
  71. st.KilledSurvivors = xmlItem.attribute("ts01").as_int();
  72. st.KilledBandits = xmlItem.attribute("ts02").as_int();
  73.  
  74. // skill xp
  75. st.SkillXPPool = xmlItem.attribute("XP").as_int();
  76. xmlItem = xmlItem.next_sibling();
  77. }
  78. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement