Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- void CUserProfile::ParseLoadouts(pugi::xml_node& xmlItem)
- {
- // reset current backpacks
- for(int i=0; i<ProfileData.NumSlots; i++) {
- for(int j=0; j<ProfileData.ArmorySlots[i].BackpackSize; j++) {
- ProfileData.ArmorySlots[i].Items[j].Reset();
- }
- }
- ProfileData.NumSlots = 0;
- // parse all slots
- xmlItem = xmlItem.first_child();
- while(!xmlItem.empty())
- {
- wiCharDataFull& w = ProfileData.ArmorySlots[ProfileData.NumSlots++];
- wiStats& st = w.Stats;
- if(ProfileData.NumSlots > wiUserProfile::MAX_LOADOUT_SLOTS)
- r3dError("more that 6 profiles!");
- w.LoadoutID = xmlItem.attribute("CharID").as_uint();
- r3dscpy(w.Gamertag, xmlItem.attribute("Gamertag").value());
- w.Alive = xmlItem.attribute("Alive").as_int();
- w.Hardcore = xmlItem.attribute("Hardcore").as_int();
- st.XP = xmlItem.attribute("XP").as_int();
- st.TimePlayed = xmlItem.attribute("TimePlayed").as_int();
- w.Health = xmlItem.attribute("Health").as_float();
- w.Hunger = xmlItem.attribute("Hunger").as_float();
- w.Thirst = xmlItem.attribute("Thirst").as_float();
- w.Toxic = xmlItem.attribute("Toxic").as_float();
- st.Reputation = xmlItem.attribute("Reputation").as_int();
- w.DeathUtcTime= xmlItem.attribute("DeathTime").as_int64();
- w.SecToRevive = xmlItem.attribute("SecToRevive").as_int();
- w.GameMapId = xmlItem.attribute("GameMapId").as_int();
- w.GameServerId= xmlItem.attribute("GameServerId").as_int();
- w.GamePos = r3dPoint3D(0, 0, 0);
- r3dOutToLog("Hunz MapID: %i\n", w.GameMapId);
- if (w.GameMapId == 3)//for Cliffside
- sscanf(xmlItem.attribute("GamePos2").value(), "%f %f %f %f", &w.GamePos.x, &w.GamePos.y, &w.GamePos.z, &w.GameDir);
- else if (w.GameMapId == 4)//for ServerTest
- sscanf(xmlItem.attribute("GamePos3").value(), "%f %f %f %f", &w.GamePos.x, &w.GamePos.y, &w.GamePos.z, &w.GameDir);
- else if (w.GameMapId == 5)//HunZ Colorado2
- sscanf(xmlItem.attribute("GamePos4").value(), "%f %f %f %f", &w.GamePos.x, &w.GamePos.y, &w.GamePos.z, &w.GameDir);
- else
- sscanf(xmlItem.attribute("GamePos").value(), "%f %f %f %f", &w.GamePos.x, &w.GamePos.y, &w.GamePos.z, &w.GameDir);
- w.GameFlags = xmlItem.attribute("GameFlags").as_int();
- w.HeroItemID = xmlItem.attribute("HeroItemID").as_int();
- w.HeadIdx = xmlItem.attribute("HeadIdx").as_int();
- w.BodyIdx = xmlItem.attribute("BodyIdx").as_int();
- w.LegsIdx = xmlItem.attribute("LegsIdx").as_int();
- w.ClanID = xmlItem.attribute("ClanID").as_int();
- w.ClanRank = xmlItem.attribute("ClanRank").as_int();
- r3dscpy(w.ClanTag, xmlItem.attribute("ClanTag").value());
- w.ClanTagColor= xmlItem.attribute("ClanTagColor").as_int();
- const char* attm1 = xmlItem.attribute("attm1").value();
- const char* attm2 = xmlItem.attribute("attm2").value();
- parseCharAttachments(attm1, w.Attachment[0]);
- parseCharAttachments(attm2, w.Attachment[1]);
- w.BackpackID = xmlItem.attribute("BackpackID").as_uint();
- w.BackpackSize = xmlItem.attribute("BackpackSize").as_int();
- // trackable stats
- st.KilledZombies = xmlItem.attribute("ts00").as_int();
- st.KilledSurvivors = xmlItem.attribute("ts01").as_int();
- st.KilledBandits = xmlItem.attribute("ts02").as_int();
- // skill xp
- st.SkillXPPool = xmlItem.attribute("XP").as_int();
- xmlItem = xmlItem.next_sibling();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement