Advertisement
conan513

Untitled

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