Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public void AddXP(string channel, string user)
- {
- XElement XP = XElement.Load(@"Data\XP.xml");
- string NewXP = null;
- string NewLvl = null;
- string Lvl = null;
- foreach (XElement ele in XP.Descendants(GetTopic(channel, user)))
- {
- NewXP = Convert.ToString(Convert.ToInt32(ele.Attribute("XP").Value) + 2);
- NewLvl = Convert.ToString(Math.Floor(0.18 * (Math.Sqrt(Convert.ToInt32(NewXP))) + 1));
- Lvl = ele.Attribute("Lvl").Value.ToString();
- }
- XDocument AddXP = XDocument.Load(@"Data\XP.xml");
- XElement users = AddXP.Element("users").Element(GetTopic(channel, user));
- users.SetAttributeValue("XP", NewXP);
- if (Convert.ToInt32(NewLvl) > Convert.ToInt32(Lvl))
- {
- users.SetAttributeValue("Lvl", NewLvl);
- }
- AddXP.Save(@"Data\XP.xml");
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement