Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- int count = 0;
- DataNode eq = MyPlayer.equipment;
- for (int i = 0; i < eq.children.size; ++i)
- {
- PlayerItem item = eq.children[i].Get<PlayerItem>();
- if (item != null)
- {
- int off = item.GetStat(GameTools.specOffense);
- int sup = item.GetStat(GameTools.specSupport);
- int def = item.GetStat(GameTools.specDefense);
- if (off + sup + def != 0 ||
- Mathf.Abs(off) > 1 ||
- Mathf.Abs(sup) > 1 ||
- Mathf.Abs(def) > 1)
- {
- item.SetStat(GameTools.specOffense, 0);
- item.SetStat(GameTools.specSupport, 0);
- item.SetStat(GameTools.specDefense, 0);
- MyPlayer.syncNeeded = true;
- MyPlayer.saveNeeded = true;
- ++count;
- }
- else if (item.quest != null && item.quest.value is TNet.List<PlayerItem>)
- {
- TNet.List<PlayerItem> items = item.quest.Get<TNet.List<PlayerItem>>();
- foreach (PlayerItem pi in items)
- {
- off = pi.GetStat(GameTools.specOffense);
- sup = pi.GetStat(GameTools.specSupport);
- def = pi.GetStat(GameTools.specDefense);
- if (off + sup + def != 0 ||
- Mathf.Abs(off) > 1 ||
- Mathf.Abs(sup) > 1 ||
- Mathf.Abs(def) > 1)
- {
- pi.SetStat(GameTools.specOffense, 0);
- pi.SetStat(GameTools.specSupport, 0);
- pi.SetStat(GameTools.specDefense, 0);
- MyPlayer.syncNeeded = true;
- MyPlayer.saveNeeded = true;
- ++count;
- }
- }
- }
- }
- }
- eq = MyPlayer.inventory;
- for (int i = 0; i < eq.children.size; ++i)
- {
- PlayerItem item = eq.children[i].Get<PlayerItem>();
- if (item != null)
- {
- int off = item.GetStat(GameTools.specOffense);
- int sup = item.GetStat(GameTools.specSupport);
- int def = item.GetStat(GameTools.specDefense);
- if (off + sup + def != 0 ||
- Mathf.Abs(off) > 1 ||
- Mathf.Abs(sup) > 1 ||
- Mathf.Abs(def) > 1)
- {
- item.SetStat(GameTools.specOffense, 0);
- item.SetStat(GameTools.specSupport, 0);
- item.SetStat(GameTools.specDefense, 0);
- MyPlayer.syncNeeded = true;
- MyPlayer.saveNeeded = true;
- ++count;
- }
- else if (item.quest != null && item.quest.value is TNet.List<PlayerItem>)
- {
- TNet.List<PlayerItem> items = item.quest.Get<TNet.List<PlayerItem>>();
- foreach (PlayerItem pi in items)
- {
- off = pi.GetStat(GameTools.specOffense);
- sup = pi.GetStat(GameTools.specSupport);
- def = pi.GetStat(GameTools.specDefense);
- if (off + sup + def != 0 ||
- Mathf.Abs(off) > 1 ||
- Mathf.Abs(sup) > 1 ||
- Mathf.Abs(def) > 1)
- {
- pi.SetStat(GameTools.specOffense, 0);
- pi.SetStat(GameTools.specSupport, 0);
- pi.SetStat(GameTools.specDefense, 0);
- MyPlayer.syncNeeded = true;
- MyPlayer.saveNeeded = true;
- ++count;
- }
- }
- }
- }
- }
- eq = MyPlayer.vault;
- for (int i = 0; i < eq.children.size; ++i)
- {
- DataNode n = eq.children[i];
- if (n.value is PlayerItem)
- {
- PlayerItem item = n.Get<PlayerItem>();
- if (item != null)
- {
- int off = item.GetStat(GameTools.specOffense);
- int sup = item.GetStat(GameTools.specSupport);
- int def = item.GetStat(GameTools.specDefense);
- if (off + sup + def != 0 ||
- Mathf.Abs(off) > 1 ||
- Mathf.Abs(sup) > 1 ||
- Mathf.Abs(def) > 1)
- {
- item.SetStat(GameTools.specOffense, 0);
- item.SetStat(GameTools.specSupport, 0);
- item.SetStat(GameTools.specDefense, 0);
- MyPlayer.syncNeeded = true;
- MyPlayer.saveNeeded = true;
- ++count;
- }
- else if (item.quest != null && item.quest.value is TNet.List<PlayerItem>)
- {
- TNet.List<PlayerItem> items = item.quest.Get<TNet.List<PlayerItem>>();
- foreach (PlayerItem pi in items)
- {
- off = pi.GetStat(GameTools.specOffense);
- sup = pi.GetStat(GameTools.specSupport);
- def = pi.GetStat(GameTools.specDefense);
- if (off + sup + def != 0 ||
- Mathf.Abs(off) > 1 ||
- Mathf.Abs(sup) > 1 ||
- Mathf.Abs(def) > 1)
- {
- pi.SetStat(GameTools.specOffense, 0);
- pi.SetStat(GameTools.specSupport, 0);
- pi.SetStat(GameTools.specDefense, 0);
- MyPlayer.syncNeeded = true;
- MyPlayer.saveNeeded = true;
- ++count;
- }
- }
- }
- }
- }
- }
- if (count != 0)
- {
- GameChat.SendPM("Aren Mook", "Invalid items: " + count);
- UIGameChat.AddCurrent("Found " + count + " non-legit items. Fixing...", Color.red);
- }
Advertisement
Add Comment
Please, Sign In to add comment