Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //card data
- namespace GwentHook
- {
- [Serializable]
- internal class CardData
- {
- public class AbilityDefinition
- {
- public AbilityType type;
- public string name;
- public int priority;
- public int timesApplied;
- }
- public ulong id;
- public int templateId;
- public FactionId factionId;
- public int strength;
- public CardGroup group;
- public Rarity rarity;
- public string type;
- public CardIcon icon;
- public Availability availability;
- public Dictionary<string, string> name;
- public Dictionary<string, string> tooltip;
- public List<CardData.AbilityDefinition> abilities;
- public CardData()
- {
- this.name = new Dictionary<string, string>();
- this.tooltip = new Dictionary<string, string>();
- this.abilities = new List<CardData.AbilityDefinition>();
- }
- }
- }
- //deck statistics
- namespace GwentHook
- {
- [Serializable]
- internal static class DeckStatistics
- {
- private static List<TrackedDeck> trackedDecks = new List<TrackedDeck>();
- private static string filePath;
- private static BaseCollectionController collectionManager;
- public static void Initialize()
- {
- DeckStatistics.collectionManager = Singleton<CardsCollectionsAndDecksManager>.get_Instance().GetCollectionController(0);
- DeckStatistics.collectionManager.OnDeckSavingFinished.AddListener(new Action<DeckSavingResult>(DeckStatistics.OnDeckSaved), false);
- DeckStatistics.collectionManager.OnDeckDeletingFinished.AddListener(new Action<DeckSavingResult>(DeckStatistics.OnDeckDeleted), false);
- ulong currentUserID = Singleton<UnityGwentWSFasade>.get_Instance().get_CurrentUserID();
- string text = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + "\\GwentTracker";
- Directory.CreateDirectory(text);
- DeckStatistics.filePath = string.Concat(new object[]
- {
- text,
- "\\",
- currentUserID,
- ".json"
- });
- bool flag = false;
- if (File.Exists(DeckStatistics.filePath))
- {
- try
- {
- DeckStatistics.trackedDecks = (GwentUtil.Deserialize(typeof(List<TrackedDeck>), File.ReadAllText(DeckStatistics.filePath)) as List<TrackedDeck>);
- DeckStatistics.HandleDeckDiff();
- }
- catch (Exception)
- {
- flag = true;
- }
- Hook.WriteConsole("Decks loaded");
- }
- else
- {
- flag = true;
- }
- if (flag)
- {
- Hook.WriteConsole("Reading decks");
- DeckStatistics.trackedDecks.Clear();
- using (List<EditableDeck>.Enumerator enumerator = DeckStatistics.collectionManager.get_ControlledCollection().GetAllDecks().GetEnumerator())
- {
- while (enumerator.MoveNext())
- {
- TrackedDeck item = new TrackedDeck(enumerator.Current.get_EditableDeckId());
- DeckStatistics.trackedDecks.Add(item);
- }
- }
- DeckStatistics.SaveFile();
- }
- }
- public static void HandleDeckDiff()
- {
- List<EditableDeck> allDecks = DeckStatistics.collectionManager.get_ControlledCollection().GetAllDecks();
- foreach (EditableDeck current in allDecks)
- {
- bool flag = false;
- using (List<TrackedDeck>.Enumerator enumerator2 = DeckStatistics.trackedDecks.GetEnumerator())
- {
- while (enumerator2.MoveNext())
- {
- if (enumerator2.Current.GetId() == current.get_EditableDeckId())
- {
- flag = true;
- break;
- }
- }
- }
- if (!flag)
- {
- DeckStatistics.trackedDecks.Add(new TrackedDeck(current.get_EditableDeckId()));
- }
- }
- List<TrackedDeck> list = new List<TrackedDeck>();
- foreach (TrackedDeck current2 in DeckStatistics.trackedDecks)
- {
- bool flag2 = false;
- using (List<EditableDeck>.Enumerator enumerator = allDecks.GetEnumerator())
- {
- while (enumerator.MoveNext())
- {
- if (enumerator.Current.get_EditableDeckId() == current2.GetId())
- {
- flag2 = true;
- break;
- }
- }
- }
- if (!flag2)
- {
- list.Add(current2);
- }
- }
- foreach (TrackedDeck current3 in list)
- {
- DeckStatistics.trackedDecks.Remove(current3);
- }
- }
- public static bool IsInitialized()
- {
- return DeckStatistics.collectionManager != null;
- }
- public static void SaveFile()
- {
- File.WriteAllText(DeckStatistics.filePath, GwentUtil.Serialize(typeof(List<TrackedDeck>), DeckStatistics.trackedDecks));
- UserConfig.Save();
- }
- public static void OnDeckSaved(DeckSavingResult result)
- {
- if (result == null)
- {
- Hook.WriteConsole("Deck saved");
- }
- }
- public static void OnDeckDeleted(DeckSavingResult result)
- {
- if (result == null)
- {
- Hook.WriteConsole("Deck deleted");
- }
- }
- public static void OnDeckCreated(EditableDeck deck)
- {
- DeckStatistics.trackedDecks.Add(new TrackedDeck(deck.get_EditableDeckId()));
- DeckStatistics.SaveFile();
- }
- public static void OnDeckDeleted(EditableDeck deck)
- {
- foreach (TrackedDeck current in DeckStatistics.trackedDecks)
- {
- if (current.GetId() == deck.get_EditableDeckId())
- {
- DeckStatistics.trackedDecks.Remove(current);
- break;
- }
- }
- DeckStatistics.SaveFile();
- }
- public static void HandleCombatResult(CombatResult result)
- {
- Hook.WriteConsole("Handling combat result");
- if (GwentGlobalObjectsRegistry.get_GwentInstance().get_GameMode() != 1)
- {
- return;
- }
- PlayerBase topPlayer = GwentGlobalObjectsRegistry.get_GwentInstance().GameController.get_PlayerManager().GetTopPlayer();
- FactionId factionId = topPlayer.get_FactionId();
- ulong activeDeckId = DeckStatistics.collectionManager.get_ControlledCollection().GetActiveDeckId();
- foreach (TrackedDeck current in DeckStatistics.trackedDecks)
- {
- if (current.GetId() == activeDeckId)
- {
- GwentInstance.OnlineMode onlineMatchMode = GwentGlobalObjectsRegistry.get_GwentInstance().OnlineMatchMode;
- if ((current.trackRanked && onlineMatchMode == 1) || (current.trackCasual && onlineMatchMode == null))
- {
- if (result.WinningPlayerID == GwentGlobalObjectsRegistry.get_BottomPlayerID())
- {
- current.AddWin(factionId);
- }
- if (result.WinningPlayerID == topPlayer.UniqueId)
- {
- current.AddLose(factionId);
- }
- DeckStatistics.SaveFile();
- }
- }
- }
- }
- public static TrackedDeck GetActiveDeck()
- {
- ulong activeDeckId = DeckStatistics.collectionManager.get_ControlledCollection().GetActiveDeckId();
- foreach (TrackedDeck current in DeckStatistics.trackedDecks)
- {
- if (current.GetId() == activeDeckId)
- {
- return current;
- }
- }
- return null;
- }
- public static List<TrackedDeck> GetAllDecks()
- {
- ulong currentDeckId = DeckStatistics.collectionManager.get_ControlledCollection().GetActiveDeckId();
- return (from a in DeckStatistics.trackedDecks
- orderby a.GetId() != currentDeckId
- select a).ToList<TrackedDeck>();
- }
- }
- }
- //gwent util
- namespace GwentHook
- {
- internal static class GwentUtil
- {
- private static readonly fsSerializer _serializer = new fsSerializer();
- public static void CreateCardDatabase()
- {
- List<CardData> list = new List<CardData>();
- Dictionary<int, CardTemplate> cardTemplates = GwentSharedData.get_Instance().get_CardTemplates().CardTemplates;
- BaseEntityManager cardManager = GwentGlobalObjectsRegistry.get_GwentInstance().GameController.get_CardManager();
- TooltipDefinitions tooltips = GwentSharedData.get_Instance().get_Tooltips();
- LocalizationManager instance = LocalizationManager.get_Instance();
- CardTypeIconsRegistry cardTypeIconsRegistry = GwentGlobalObjectsRegistry.get_CardTypeIconsRegistry();
- foreach (KeyValuePair<int, CardTemplate> current in cardTemplates)
- {
- foreach (CardDefinition current2 in current.Value.cardDefinitions.DefinitionList)
- {
- CardData cardData = new CardData();
- cardData.templateId = current.Value.templateId;
- cardData.factionId = current.Value.factionId;
- cardData.strength = current.Value.power;
- cardData.group = current.Value.group;
- cardData.rarity = current2.RarityWrapper.get_Value();
- cardData.id = current2.Id;
- cardData.icon = current.Value.CardIcon;
- cardData.availability = current2.AvailabilityWrapper.get_Value();
- foreach (BaseAbility current3 in current.Value.get_Abilities())
- {
- CardData.AbilityDefinition abilityDefinition = new CardData.AbilityDefinition();
- abilityDefinition.name = current3.get_ID().ToString();
- abilityDefinition.priority = current3.get_Priority();
- abilityDefinition.timesApplied = current3.ApplyNumOfTimes.ConstValue;
- abilityDefinition.type = current3.get_Type();
- cardData.abilities.Add(abilityDefinition);
- }
- Texture texture = cardTypeIconsRegistry.FindIconForAttackType(current.Value.typeArray & 7, current.Value.IsType(256));
- cardData.type = "default";
- if (texture != null)
- {
- cardData.type = texture.get_name().Substring(5);
- }
- if (current.Value.power == 0)
- {
- cardData.type = "special";
- }
- list.Add(cardData);
- }
- }
- foreach (string current4 in instance.m_languages)
- {
- if (!current4.Equals("de-de") && !current4.Equals("pl-pl") && !current4.Equals("en-us") && !current4.Equals("ru-ru") && !current4.Equals("debug"))
- {
- for (int i = 0; i < list.Count; i++)
- {
- CardTemplate cardTemplate = cardTemplates[list[i].templateId];
- list[i].name[current4] = instance.GetTranslationText(cardTemplate.GetCardNameTextKey());
- try
- {
- CardTooltip cardTooltip = tooltips.get_CardTooltips()[cardTemplate.TooltipID];
- CardInstanceDefinition cardInstanceDefinition = default(CardInstanceDefinition);
- cardInstanceDefinition.templateId = cardTemplate.templateId;
- cardInstanceDefinition.premium = false;
- cardInstanceDefinition.artId = cardTemplate.cardDefinitions.DefinitionList[0].ArtIDWrapper.ConstValue;
- CardInstance cardInstance = new CardInstance(cardManager, cardManager.GetNextCardInstanceID(), cardInstanceDefinition, 0, 3);
- cardTooltip.FillVariables(instance.GetTranslationText(cardTooltip.GetDescriptionKey()), cardInstance);
- Hook.WriteConsole(cardTooltip.GetDescriptionKey());
- list[i].tooltip[current4] = LocalizationHelper.GetTooltipDescription(cardTooltip, cardInstance);
- }
- catch (Exception)
- {
- list[i].tooltip[current4] = "No description available";
- }
- }
- }
- }
- File.WriteAllText(Environment.GetFolderPath(Environment.SpecialFolder.Desktop) + "\\gwent_data\\CardDatabase.json", GwentUtil.Serialize(typeof(List<CardData>), list));
- }
- public static void ShowCardPreview(CardTemplate template)
- {
- if (Singleton<UIManager>.get_Instance().GetPanel<UICardSelection>(5011).IsPanelVisible())
- {
- return;
- }
- BaseEntityManager arg_4B_0 = GwentGlobalObjectsRegistry.get_GwentInstance().GameController.get_CardManager();
- CardInstanceDefinition cardInstanceDefinition = default(CardInstanceDefinition);
- cardInstanceDefinition.premium = false;
- cardInstanceDefinition.templateId = template.templateId;
- cardInstanceDefinition.artId = 0;
- CardInstance cardInstance = new CardInstance(arg_4B_0, arg_4B_0.GetNextCardInstanceID(), cardInstanceDefinition, 0, 3);
- UICardPreview panel = Singleton<UIManager>.get_Instance().GetPanel<UICardPreview>(12);
- if (!panel.IsPanelVisible())
- {
- panel.Load();
- try
- {
- panel.ShowCardPreview(cardInstance, false);
- }
- catch (Exception)
- {
- }
- }
- }
- public static string GetDeckName(ulong id)
- {
- BaseCollectionController collectionController = Singleton<CardsCollectionsAndDecksManager>.get_Instance().GetCollectionController(0);
- CardTemplateDefinitions cardTemplates = GwentSharedData.get_Instance().get_CardTemplates();
- EditableDeck deck = collectionController.get_ControlledCollection().GetDeck(id);
- if (deck != null)
- {
- DeckInfo deckInfoFromEditableDeck = collectionController.GetDeckInfoFromEditableDeck(deck);
- if (!deck.get_Name().StartsWith("###"))
- {
- return deck.get_Name();
- }
- CardTemplate templateWithID = cardTemplates.GetTemplateWithID(deckInfoFromEditableDeck.LeaderCard.templateId);
- if (templateWithID != null)
- {
- string str = deck.get_Name().Substring(2);
- return LocalizationManager.get_Instance().GetTranslationText(templateWithID.GetCardNameTextKey()) + "'s Deck " + str;
- }
- }
- return "";
- }
- public static CardTemplate GetTemplateByDefinitionId(ulong id)
- {
- foreach (CardTemplate current in GwentSharedData.get_Instance().get_CardTemplates().GetCardTemplates())
- {
- using (List<CardDefinition>.Enumerator enumerator2 = current.cardDefinitions.DefinitionList.GetEnumerator())
- {
- while (enumerator2.MoveNext())
- {
- if (enumerator2.Current.Id == id)
- {
- return current;
- }
- }
- }
- }
- return null;
- }
- public static void ImportDeck(SaveCardsDTO dto)
- {
- CardTemplateDefinitions cardTemplates = GwentSharedData.get_Instance().get_CardTemplates();
- List<CardTemplate> list = new List<CardTemplate>();
- foreach (SaveCardsDTO.CardInfo current in dto.cards)
- {
- list.Add(GwentUtil.GetTemplateByDefinitionId(current.id));
- }
- CardTemplate templateByDefinitionId = GwentUtil.GetTemplateByDefinitionId(dto.leader.id);
- BaseCollectionController collectionController = Singleton<CardsCollectionsAndDecksManager>.get_Instance().GetCollectionController(0);
- List<UniversalCard> cards = collectionController.get_ControlledCollection().GetCards();
- EditableDeck newDeck = collectionController.GetNewDeck();
- newDeck.set_Name("GTImport_" + dto.name);
- newDeck.LeaderCardInstanceId = 0uL;
- foreach (UniversalCard current2 in cards)
- {
- CardTemplate templateWithID = cardTemplates.GetTemplateWithID(current2.CardInstanceDefinition.templateId);
- if (newDeck.LeaderCardInstanceId == 0uL && templateWithID.templateId == templateByDefinitionId.templateId)
- {
- newDeck.LeaderCardInstanceId = current2.InstanceId;
- newDeck.set_Faction(templateWithID.factionId);
- }
- else
- {
- CardTemplate cardTemplate = null;
- foreach (CardTemplate current3 in list)
- {
- if (templateWithID.templateId == current3.templateId)
- {
- newDeck.CardInstancesIds.Add(current2.InstanceId);
- cardTemplate = current3;
- break;
- }
- }
- if (cardTemplate != null)
- {
- list.Remove(cardTemplate);
- }
- }
- }
- if (newDeck.LeaderCardInstanceId == 0uL)
- {
- Singleton<UIManager>.get_Instance().SpawnMessagePopup("Import error", "Missing leader, can't create deck\n\n" + LocalizationManager.get_Instance().GetTranslationText(templateByDefinitionId.GetCardNameTextKey()), 1, true, 0, null, null, 1, true, 0);
- Hook.importingDeck = false;
- return;
- }
- collectionController.SaveDeck(newDeck);
- if (list.Count > 0)
- {
- string text = "";
- foreach (CardTemplate current4 in list)
- {
- text = text + LocalizationManager.get_Instance().GetTranslationText(current4.GetCardNameTextKey()) + "\n";
- }
- Singleton<UIManager>.get_Instance().SpawnMessagePopup("Import complete", "Deck successfully imported!\nYou are missing some cards :(\n\n" + text, 1, true, 0, null, null, 12, true, 0);
- }
- else
- {
- Singleton<UIManager>.get_Instance().SpawnMessagePopup("Import complete", "Deck successfully imported!", 1, true, 0, null, null, 1, true, 0);
- }
- Hook.importingDeck = false;
- }
- public static string Serialize(Type type, object value)
- {
- fsData fsData;
- GwentUtil._serializer.TrySerialize(type, value, ref fsData).AssertSuccessWithoutWarnings();
- return fsJsonPrinter.PrettyJson(fsData);
- }
- public static object Deserialize(Type type, string serializedState)
- {
- fsData fsData = fsJsonParser.Parse(serializedState);
- object result = null;
- GwentUtil._serializer.TryDeserialize(fsData, type, ref result).AssertSuccessWithoutWarnings();
- return result;
- }
- }
- }
- //hook
- namespace GwentHook
- {
- internal class Hook : MonoBehaviour
- {
- [CompilerGenerated]
- [Serializable]
- private sealed class <>c
- {
- public static readonly Hook.<>c <>9 = new Hook.<>c();
- public static Func<bool> <>9__12_0;
- internal bool <ContinueAwakeAfterDecision>b__12_0()
- {
- return UserConfig.Vars.AutoUpdateDecision;
- }
- }
- public static Version version;
- public static bool loggedIn;
- private static Hook self;
- public static bool importingDeck;
- private float deltaTime;
- public static string AssemblyDirectory
- {
- get
- {
- return Path.GetDirectoryName(Uri.UnescapeDataString(new UriBuilder(Assembly.GetExecutingAssembly().CodeBase).Path));
- }
- }
- private void TryStateListening()
- {
- try
- {
- StateHandler.Listen();
- }
- catch (Exception)
- {
- this.TryStateListening();
- }
- }
- public static void WriteConsole(string s)
- {
- }
- private void OnTooEarly(BaseInputActionData action)
- {
- Process.GetCurrentProcess().Kill();
- }
- public static void LoadEverything()
- {
- DeckStatistics.Initialize();
- Hook.loggedIn = true;
- }
- private void Awake()
- {
- Hook.version = Assembly.GetExecutingAssembly().GetName().Version;
- Hook.self = this;
- UserConfig.Load();
- if (!UserConfig.Vars.AutoUpdateDecision)
- {
- Singleton<UIManager>.get_Instance().SpawnMessagePopup("Gwent Tracker Info", "Would you like to enable automatic updates?\n\nWe won't ask you again, but you toggle it in the Gwent Tracker options.", 2, true, 0, new Action<BaseInputActionData>(this.OnAutoUpdatesDecisionY), new Action<BaseInputActionData>(this.OnAutoUpdatesDecisionN), 1, true, 0);
- }
- base.StartCoroutine(this.ContinueAwakeAfterDecision());
- }
- private IEnumerator ContinueAwakeAfterDecision()
- {
- Func<bool> arg_37_0;
- if ((arg_37_0 = Hook.<>c.<>9__12_0) == null)
- {
- arg_37_0 = (Hook.<>c.<>9__12_0 = new Func<bool>(Hook.<>c.<>9.<ContinueAwakeAfterDecision>b__12_0));
- }
- yield return new WaitUntil(arg_37_0);
- this.CheckForUpdate();
- this.TryStateListening();
- if (Singleton<UnityGwentWSFasade>.get_Instance().get_CurrentUserID() != 0uL)
- {
- Hook.LoadEverything();
- }
- yield break;
- }
- public void CheckForPatchnotes(Version serverVersion)
- {
- if (serverVersion.CompareTo(new Version(UserConfig.Vars.InstalledVersion)) != 0)
- {
- UserConfig.Vars.InstalledVersion = serverVersion.ToString();
- UserConfig.Save();
- WWW www = new WWW("http://www.gwent-tracker.com/api_patchnotes");
- base.StartCoroutine(this.WaitForPatchnotes(www));
- }
- }
- public void CheckForUpdate()
- {
- WWW www = new WWW("http://www.gwent-tracker.com/api_version");
- base.StartCoroutine(this.WaitForServerVersion(www));
- }
- public void OnAutoUpdatesDecisionY(BaseInputActionData input)
- {
- UserConfig.Vars.AutoUpdateDecision = true;
- UserConfig.Vars.AutoUpdate = true;
- UserConfig.Save();
- }
- public void OnAutoUpdatesDecisionN(BaseInputActionData input)
- {
- UserConfig.Vars.AutoUpdateDecision = true;
- UserConfig.Vars.AutoUpdate = false;
- UserConfig.Save();
- }
- public void OnVersionManualUpdateConfirmed(BaseInputActionData input)
- {
- Process.Start("http://www.gwent-tracker.com/");
- }
- public IEnumerator WaitForPatchnotes(WWW www)
- {
- yield return www;
- Singleton<UIManager>.get_Instance().SpawnMessagePopup("Gwent Tracker Patchnotes", www.get_text(), 1, true, 0, null, null, 12, true, 0);
- yield break;
- }
- public IEnumerator WaitForServerVersion(WWW www)
- {
- yield return www;
- Version version = new Version(www.get_text());
- if (version.CompareTo(Hook.version) > 0)
- {
- if (UserConfig.Vars.AutoUpdate)
- {
- WWW www2 = new WWW("http://www.gwent-tracker.com/download/GwentHook.dll");
- this.StartCoroutine(this.WaitForUpdateAssembly(www2));
- }
- else
- {
- Singleton<UIManager>.get_Instance().SpawnMessagePopup("Gwent Tracker Update", "A new version for Gwent Tracker is available. Would you like to download it now?", 2, true, 0, new Action<BaseInputActionData>(this.OnVersionManualUpdateConfirmed), null, 1, true, 0);
- }
- }
- else
- {
- this.CheckForPatchnotes(version);
- }
- yield break;
- }
- public IEnumerator WaitForUpdateAssembly(WWW www)
- {
- yield return www;
- File.WriteAllBytes(Hook.AssemblyDirectory + "\\GwentHook.new", www.get_bytes());
- Singleton<UIManager>.get_Instance().SpawnMessagePopup("Gwent Tracker Automatic Update", "A new version has been downloaded!\nIt will automatically install itself on next restart.", 1, true, 0, null, null, 1, true, 0);
- yield break;
- }
- public void StartCollectionRoutine(WWW www)
- {
- base.StartCoroutine(this.WaitForCollectionURL(www));
- }
- public IEnumerator WaitForRankedRecordResponse(WWW www)
- {
- yield return www;
- yield break;
- }
- public static void PostRankedRecord(RankedLeaderboardRecord record)
- {
- WWWForm wWWForm = new WWWForm();
- wWWForm.AddField("data", record.ToJSON());
- WWW www = new WWW("http://www.gwent-tracker.com/api_put_rankedrecord", wWWForm);
- Hook.self.StartCoroutine(Hook.self.WaitForRankedRecordResponse(www));
- }
- public static void PostCollection(SaveCardsDTO dto)
- {
- WWWForm wWWForm = new WWWForm();
- string text = GwentUtil.Serialize(typeof(SaveCardsDTO), dto);
- wWWForm.AddField("data", text);
- WWW www = new WWW("http://www.gwent-tracker.com/api_save_cards", wWWForm);
- Hook.self.StartCollectionRoutine(www);
- }
- public IEnumerator WaitForCollectionURL(WWW www)
- {
- yield return www;
- string text = www.get_text();
- if (text != "ERROR")
- {
- Application.OpenURL("http://www.gwent-tracker.com/c?id=" + text);
- }
- yield break;
- }
- public IEnumerator WaitSeconds(float f, Action done)
- {
- yield return new WaitForSeconds(f);
- done();
- yield break;
- }
- private void OnImportIsPossible(SaveCardsDTO dto)
- {
- Action <>9__1;
- Singleton<UIManager>.get_Instance().SpawnMessagePopup("Deck import", string.Concat(new string[]
- {
- "Would you like to import this deck?\n\n",
- dto.name,
- " (",
- dto.cards.Count.ToString(),
- " Cards)"
- }), 2, true, 0, delegate(BaseInputActionData data)
- {
- MonoBehaviour arg_35_0 = this;
- Hook arg_30_0 = this;
- float arg_30_1 = 0.5f;
- Action arg_30_2;
- if ((arg_30_2 = <>9__1) == null)
- {
- arg_30_2 = (<>9__1 = delegate
- {
- GwentUtil.ImportDeck(dto);
- });
- }
- arg_35_0.StartCoroutine(arg_30_0.WaitSeconds(arg_30_1, arg_30_2));
- }, null, 1, true, 0);
- }
- private void OnMalformattedDeck()
- {
- Singleton<UIManager>.get_Instance().SpawnMessagePopup("Import error", "The deck you are trying to import is malformatted.\nGwent Tracker is unable to parse it", 1, true, 0, null, null, 1, true, 0);
- Hook.importingDeck = false;
- }
- private void OnCollectionImport()
- {
- Singleton<UIManager>.get_Instance().SpawnMessagePopup("Import error", "You can't import collections.", 1, true, 0, null, null, 1, true, 0);
- Hook.importingDeck = false;
- }
- public IEnumerator WaitForDeckToImport(WWW www)
- {
- yield return www;
- try
- {
- SaveCardsDTO dto = GwentUtil.Deserialize(typeof(SaveCardsDTO), www.get_text()) as SaveCardsDTO;
- if (dto.leader == null)
- {
- this.StartCoroutine(this.WaitSeconds(0.5f, new Action(this.OnCollectionImport)));
- }
- UserInterface.Hide();
- this.StartCoroutine(this.WaitSeconds(0.5f, delegate
- {
- this.OnImportIsPossible(dto);
- }));
- }
- catch (Exception)
- {
- UserInterface.Hide();
- this.StartCoroutine(this.WaitSeconds(0.5f, new Action(this.OnMalformattedDeck)));
- }
- yield break;
- }
- private void OnImportWrongUrl()
- {
- UserInterface.Hide();
- Singleton<UIManager>.get_Instance().SpawnMessagePopup("Import error", "You currently don't have a valid deck link in your clipboard.\nPlease copy a deck url and then click the import button again.", 1, true, 0, null, null, 1, true, 0);
- Hook.importingDeck = false;
- }
- public static void CurrentlyNotWorking()
- {
- Singleton<UIManager>.get_Instance().SpawnMessagePopup("Error", "This feature is currently not working.\nExpect it to be fixed very soon! :)", 1, true, 0, null, null, 1, true, 0);
- }
- public static void TryDeckImport()
- {
- Match match = Regex.Match(GUIUtility.get_systemCopyBuffer(), "http:\\/\\/www.gwent-tracker.com\\/c\\?id=(\\d{10}\\.\\d*)");
- if (!match.Success)
- {
- Hook.self.StartCoroutine(Hook.self.WaitSeconds(0.5f, new Action(Hook.self.OnImportWrongUrl)));
- return;
- }
- string value = match.Groups[1].Value;
- WWW www = new WWW("http://www.gwent-tracker.com/api_get_deck?id=" + value);
- Hook.self.StartCoroutine(Hook.self.WaitForDeckToImport(www));
- }
- private void Update()
- {
- Tracker.Update();
- if (Hook.loggedIn && Input.GetKeyDown(282))
- {
- UserInterface.Show();
- }
- }
- private void OnGUI()
- {
- if (Hook.loggedIn)
- {
- UserInterface.Draw();
- }
- if (!Tracker.OnGUI())
- {
- Rect rect = new Rect((float)(Screen.get_width() / 2 - 120), 0f, 240f, 40f);
- if (Hook.loggedIn)
- {
- rect.set_x(0f);
- }
- if (Hook.loggedIn)
- {
- if (GUI.Button(rect, "www.gwent-tracker.com\nPress F1 or click here to open Menu"))
- {
- UserInterface.Show();
- return;
- }
- }
- else
- {
- GUI.Button(rect, "Waiting for you to log in...");
- }
- }
- }
- }
- }
- //main
- namespace GwentHook
- {
- public class Main
- {
- public static GameObject loadObject;
- public static void Start()
- {
- Main.loadObject = new GameObject();
- Main.loadObject.AddComponent<SanitizeHook>();
- Object.DontDestroyOnLoad(Main.loadObject);
- }
- }
- }
- //movable
- namespace GwentHook
- {
- [Serializable]
- internal class Movable
- {
- [SerializeField]
- private Vector2 localPosition;
- private Vector2 localOffset;
- private bool moving;
- public Movable(Vector2 initialPosition)
- {
- this.localPosition = initialPosition;
- this.moving = false;
- }
- public void StartMoving(Vector2 mousePosition)
- {
- this.localOffset = this.localPosition - mousePosition;
- this.moving = true;
- }
- public void Update(Vector2 mousePosition)
- {
- if (this.moving)
- {
- this.localPosition = mousePosition + this.localOffset;
- }
- }
- public void StopMoving()
- {
- this.moving = false;
- }
- public Vector2 GetPosition()
- {
- return this.localPosition;
- }
- }
- }
- //player deck
- namespace GwentHook
- {
- internal class PlayerDeck
- {
- private static List<CardTemplate> deck = new List<CardTemplate>();
- private static BaseGwentController gameController;
- public static void Update()
- {
- PlayerDeck.deck.Clear();
- PlayerDeck.gameController = GwentGlobalObjectsRegistry.get_GwentInstance().GameController;
- foreach (CardInstanceDefinition current in Singleton<CardsCollectionsAndDecksManager>.get_Instance().GetCollectionController(0).GetActiveDeckInfo().Cards)
- {
- CardTemplate templateWithID = PlayerDeck.gameController.get_CardManager().GetTemplateDefinitions().GetTemplateWithID(current.templateId);
- PlayerDeck.deck.Add(templateWithID);
- }
- }
- public static string GetName()
- {
- BaseCollectionController expr_0B = Singleton<CardsCollectionsAndDecksManager>.get_Instance().GetCollectionController(0);
- DeckInfo activeDeckInfo = expr_0B.GetActiveDeckInfo();
- string name = expr_0B.get_ControlledCollection().GetActiveDeck().get_Name();
- if (name.StartsWith("###"))
- {
- CardTemplate templateWithID = PlayerDeck.gameController.get_CardManager().GetTemplateDefinitions().GetTemplateWithID(activeDeckInfo.LeaderCard.templateId);
- if (templateWithID != null)
- {
- string str = name.Substring(2);
- return LocalizationManager.get_Instance().GetTranslationText(templateWithID.GetCardNameTextKey()) + "'s Deck " + str;
- }
- }
- return name;
- }
- public static List<CardTemplate> Get()
- {
- return PlayerDeck.deck;
- }
- public static void Add(CardTemplate card, int count = 1)
- {
- for (int i = 0; i < count; i++)
- {
- PlayerDeck.deck.Add(card);
- }
- }
- }
- }
- //sanitize hook
- namespace GwentHook
- {
- internal class SanitizeHook : MonoBehaviour
- {
- private void FixedUpdate()
- {
- if (GwentGlobalObjectsRegistry.get_Instance() == null || !GwentGlobalObjectsRegistry.get_Instance())
- {
- return;
- }
- if (ApplicationFlowController.Singleton() == null)
- {
- return;
- }
- if (ApplicationFlowController.Singleton().get_StateMachine().GetCurrentState() == null)
- {
- return;
- }
- Object.FindObjectOfType<ApplicationFlowController>().get_gameObject().AddComponent<Hook>();
- Object.Destroy(Main.loadObject);
- }
- }
- }
- //save cards dto
- namespace GwentHook
- {
- [Serializable]
- public class SaveCardsDTO
- {
- [Serializable]
- public class CardInfo
- {
- public ulong id;
- public bool premium;
- public CardInfo(ulong i, bool p)
- {
- this.id = i;
- this.premium = p;
- }
- }
- public List<SaveCardsDTO.CardInfo> cards;
- public string name;
- public SaveCardsDTO.CardInfo leader;
- public SaveCardsDTO(string name)
- {
- this.name = name;
- this.cards = new List<SaveCardsDTO.CardInfo>();
- this.leader = null;
- }
- public void AddCard(ulong i, bool p)
- {
- this.cards.Add(new SaveCardsDTO.CardInfo(i, p));
- }
- public void SetLeader(ulong i, bool p)
- {
- this.leader = new SaveCardsDTO.CardInfo(i, p);
- }
- }
- }
- //state handler
- namespace GwentHook
- {
- internal class StateHandler
- {
- private static FiniteStateMachine fsm;
- private static Dictionary<string, Action<IBaseState, IBaseState>> map;
- private static List<RedPlayer> players = new List<RedPlayer>();
- public static void BindStateMachines(FiniteStateMachine fsm)
- {
- fsm.OnStateChanged.AddListener(new Action<IBaseState, IBaseState>(StateHandler.OnStateChangedMaster), false);
- foreach (IBaseState current in fsm.GetRegisteredStates())
- {
- if (current.get_SubStateMachine() != null)
- {
- StateHandler.BindStateMachines(current.get_SubStateMachine());
- }
- }
- }
- public static void Listen()
- {
- Hook.WriteConsole("Initialized");
- StateHandler.fsm = ApplicationFlowController.Singleton().get_StateMachine();
- StateHandler.map = new Dictionary<string, Action<IBaseState, IBaseState>>();
- StateHandler.BindStateMachines(StateHandler.fsm);
- StateHandler.AddListener("Game Intro State", new Action<IBaseState, IBaseState>(StateHandler.OnGameIntro));
- StateHandler.AddListener("Game Outcome", new Action<IBaseState, IBaseState>(StateHandler.OnGameOutcome));
- StateHandler.AddListener("Game Online State", new Action<IBaseState, IBaseState>(StateHandler.OnGameOnline));
- StateHandler.AddListener("Deck Create State", new Action<IBaseState, IBaseState>(StateHandler.OnDeckCreate));
- StateHandler.AddListener("Deck Selection State", new Action<IBaseState, IBaseState>(StateHandler.OnDeckSelection));
- StateHandler.AddListener("Welcome", new Action<IBaseState, IBaseState>(StateHandler.OnLoggedIn));
- }
- public static void Deafen()
- {
- StateHandler.map.Clear();
- }
- private static void OnSeasonDataSuccess(Season season)
- {
- foreach (RedPlayer current in StateHandler.players)
- {
- Singleton<UnityGwentWSFasade>.get_Instance().get_WSFasade().GetUsersInSeason(season.get_Id(), current.get_ServiceID(), new Action<RankedLeaderboardRecord>(StateHandler.OnLeaderboardRecordSuccess), new Action<Exception>(StateHandler.OnLeaderboardRecordFailure));
- }
- }
- private static void OnLeaderboardRecordSuccess(RankedLeaderboardRecord record)
- {
- Tracker.AddRecord(record);
- Hook.PostRankedRecord(record);
- }
- private static void OnLeaderboardRecordFailure(Exception e)
- {
- }
- private static void OnLoggedIn(IBaseState _old, IBaseState _new)
- {
- Hook.LoadEverything();
- }
- private static void OnDeckSelection(IBaseState _old, IBaseState _new)
- {
- AppDeckSelectionState expr_06 = _new as AppDeckSelectionState;
- expr_06.OnDeckMarkedForRemoval.RemoveListener(new Action<EditableDeck>(DeckStatistics.OnDeckDeleted));
- expr_06.OnDeckMarkedForRemoval.AddListener(new Action<EditableDeck>(DeckStatistics.OnDeckDeleted), false);
- }
- private static void OnDeckCreate(IBaseState _old, IBaseState _new)
- {
- AppDeckCreateState expr_06 = _new as AppDeckCreateState;
- expr_06.OnDeckCreated.RemoveListener(new Action<EditableDeck>(DeckStatistics.OnDeckCreated));
- expr_06.OnDeckCreated.AddListener(new Action<EditableDeck>(DeckStatistics.OnDeckCreated), false);
- }
- private static void OnGameOnline(IBaseState _old, IBaseState _new)
- {
- ILobbyManager lobbyManager = Reflector.FindProperty<ILobbyManager>(_new, "LobbyManager").Get();
- if (lobbyManager != null)
- {
- StateHandler.players.Clear();
- foreach (KeyValuePair<int, RedPlayer> current in lobbyManager.get_CurrentLobby().GetPlayers())
- {
- StateHandler.players.Add(current.Value);
- }
- Tracker.ResetRecords();
- Singleton<UnityGwentWSFasade>.get_Instance().get_WSFasade().GetCurrentSeason(new Action<Season>(StateHandler.OnSeasonDataSuccess), new Action<Exception>(StateHandler.OnLeaderboardRecordFailure));
- }
- }
- private static void OnGameIntro(IBaseState _old, IBaseState _new)
- {
- StatusEvents.Listen();
- }
- private static void OnGameOutcome(IBaseState _old, IBaseState _new)
- {
- StatusEvents.Deafen();
- DeckStatistics.HandleCombatResult((_new as AppGameOutcomeState).CombatResult);
- }
- public static void AddListener(string id, Action<IBaseState, IBaseState> handler)
- {
- StateHandler.map[id] = handler;
- }
- private static void OnStateChangedMaster(IBaseState _old, IBaseState _new)
- {
- try
- {
- Hook.WriteConsole("State: " + _new.ToString());
- Action<IBaseState, IBaseState> action;
- if (StateHandler.map.TryGetValue(_new.ToString(), out action))
- {
- action(_old, _new);
- }
- }
- catch (Exception)
- {
- }
- }
- }
- }
- //status events
- namespace GwentHook
- {
- internal class StatusEvents
- {
- public static void Listen()
- {
- BaseGwentController expr_0A = GwentGlobalObjectsRegistry.get_GwentInstance().GameController;
- expr_0A.get_StatusEvents().OnGameStarted.AddListener(new Action(StatusEvents.OnGameStarted), false);
- expr_0A.get_StatusEvents().OnGameEnded.AddListener(new Action<int, EndGameReason>(StatusEvents.OnGameEnded), false);
- expr_0A.get_StatusEvents().OnAbilityWillAffect.AddListener(new Action<AbilityEventInfo>(StatusEvents.OnAbilityWillAffect), false);
- expr_0A.get_StatusEvents().OnAbilityApplyEnded.AddListener(new Action<AbilityEventInfo>(StatusEvents.OnAbilityApplyEnded), false);
- expr_0A.get_StatusEvents().OnCardSpawnedCard.AddListener(new Action<CardInstance, CardInstance>(StatusEvents.OnCardSpawnedCard), false);
- expr_0A.get_StatusEvents().OnCardsBanished.AddListener(new Action<ulong[]>(StatusEvents.OnCardsBanished), false);
- }
- public static void Deafen()
- {
- BaseGwentController expr_0A = GwentGlobalObjectsRegistry.get_GwentInstance().GameController;
- expr_0A.get_StatusEvents().OnGameStarted.RemoveListener(new Action(StatusEvents.OnGameStarted));
- expr_0A.get_StatusEvents().OnGameEnded.RemoveListener(new Action<int, EndGameReason>(StatusEvents.OnGameEnded));
- expr_0A.get_StatusEvents().OnAbilityApplyStarted.RemoveListener(new Action<AbilityEventInfo>(StatusEvents.OnAbilityWillAffect));
- expr_0A.get_StatusEvents().OnAbilityApplyEnded.RemoveListener(new Action<AbilityEventInfo>(StatusEvents.OnAbilityApplyEnded));
- expr_0A.get_StatusEvents().OnCardSpawnedCard.RemoveListener(new Action<CardInstance, CardInstance>(StatusEvents.OnCardSpawnedCard));
- expr_0A.get_StatusEvents().OnCardsBanished.RemoveListener(new Action<ulong[]>(StatusEvents.OnCardsBanished));
- }
- public static void OnGameStarted()
- {
- PlayerDeck.Update();
- Tracker.Listen();
- }
- public static void OnGameEnded(int unk, EndGameReason reason)
- {
- Tracker.Deafen();
- }
- public static void OnAbilityApplyEnded(AbilityEventInfo info)
- {
- Tracker.OnAbilityApplyEnded(info);
- }
- public static void OnAbilityWillAffect(AbilityEventInfo info)
- {
- Tracker.OnAbilityWillAffect(info);
- }
- public static void OnCardSpawnedCard(CardInstance dst, CardInstance src)
- {
- }
- public static void OnCardsBanished(ulong[] instanceIds)
- {
- Tracker.OnCardBanished(instanceIds);
- }
- }
- }
- //tracked deck
- namespace GwentHook
- {
- [Serializable]
- public class TrackedDeck
- {
- [Serializable]
- public class WL
- {
- public int w;
- public int l;
- public WL(int w, int l)
- {
- this.w = w;
- this.l = l;
- }
- public float GetAsPercent()
- {
- if (this.w + this.l != 0)
- {
- return (float)Math.Round((double)((float)this.w / (float)(this.w + this.l) * 100f), 0);
- }
- return 0f;
- }
- }
- [SerializeField]
- private ulong id;
- [SerializeField]
- private Dictionary<FactionId, TrackedDeck.WL> stats;
- [SerializeField]
- public bool trackRanked;
- [SerializeField]
- public bool trackCasual;
- public TrackedDeck(ulong id)
- {
- this.stats = new Dictionary<FactionId, TrackedDeck.WL>();
- this.trackRanked = true;
- this.trackCasual = false;
- foreach (FactionId current in Enum.GetValues(typeof(FactionId)).Cast<FactionId>())
- {
- if (current != null && current != -1 && current != 6)
- {
- this.stats[current] = new TrackedDeck.WL(0, 0);
- }
- }
- this.id = id;
- }
- public void AddWin(FactionId faction)
- {
- this.stats[faction].w++;
- }
- public void AddLose(FactionId faction)
- {
- this.stats[faction].l++;
- }
- public TrackedDeck.WL GetWLForFaction(FactionId faction)
- {
- return this.stats[faction];
- }
- public ulong GetId()
- {
- return this.id;
- }
- public TrackedDeck.WL GetWLSum()
- {
- TrackedDeck.WL wL = new TrackedDeck.WL(0, 0);
- foreach (KeyValuePair<FactionId, TrackedDeck.WL> current in this.stats)
- {
- wL.w += current.Value.w;
- wL.l += current.Value.l;
- }
- return wL;
- }
- public Dictionary<FactionId, TrackedDeck.WL> GetStats()
- {
- return this.stats;
- }
- public void Reset()
- {
- foreach (KeyValuePair<FactionId, TrackedDeck.WL> current in this.stats)
- {
- current.Value.w = (current.Value.l = 0);
- }
- }
- }
- }
- //tracker
- namespace GwentHook
- {
- internal class Tracker
- {
- public class TrackerSkin
- {
- private static GUIStyle buttonStyle = new GUIStyle();
- private static GUIStyle boxStyle = new GUIStyle();
- private static bool initialized = false;
- public static Texture2D CreateBorderedButtonTexture(int w, int h, Color border, Color fill)
- {
- Texture2D texture2D = new Texture2D(w, h);
- for (int i = 0; i < w; i++)
- {
- for (int j = 0; j < h; j++)
- {
- if (i == 0 || i == w - 1 || j == 0 || j == h - 1)
- {
- texture2D.SetPixel(i, j, border);
- }
- else
- {
- texture2D.SetPixel(i, j, fill);
- }
- }
- }
- texture2D.Apply();
- return texture2D;
- }
- public static void Initialize()
- {
- if (!Tracker.TrackerSkin.initialized)
- {
- Tracker.TrackerSkin.buttonStyle = new GUIStyle(GUI.get_skin().get_button());
- Tracker.TrackerSkin.buttonStyle.set_alignment(3);
- Tracker.TrackerSkin.buttonStyle.get_padding().set_left(50);
- Tracker.TrackerSkin.buttonStyle.get_normal().set_background(Tracker.TrackerSkin.CreateBorderedButtonTexture(UserConfig.Vars.ScaleX, UserConfig.Vars.ScaleY, Color.get_black(), new Color(0f, 0f, 0f, 0.5f)));
- Tracker.TrackerSkin.buttonStyle.get_hover().set_background(Tracker.TrackerSkin.CreateBorderedButtonTexture(UserConfig.Vars.ScaleX, UserConfig.Vars.ScaleY, Color.get_black(), new Color(0f, 0f, 0f, 0.6f)));
- Tracker.TrackerSkin.buttonStyle.get_active().set_background(Tracker.TrackerSkin.CreateBorderedButtonTexture(UserConfig.Vars.ScaleX, UserConfig.Vars.ScaleY, Color.get_black(), new Color(0f, 0f, 0f, 0.7f)));
- Tracker.TrackerSkin.buttonStyle.get_focused().set_background(Tracker.TrackerSkin.CreateBorderedButtonTexture(UserConfig.Vars.ScaleX, UserConfig.Vars.ScaleY, Color.get_black(), new Color(0f, 0f, 0f, 0.8f)));
- Tracker.TrackerSkin.boxStyle = new GUIStyle(GUI.get_skin().get_box());
- Tracker.TrackerSkin.boxStyle.set_alignment(4);
- Tracker.TrackerSkin.boxStyle.get_normal().set_background(Tracker.TrackerSkin.CreateBorderedButtonTexture(UserConfig.Vars.ScaleX, UserConfig.Vars.ScaleY, Color.get_gray(), Color.get_black()));
- Tracker.TrackerSkin.initialized = true;
- Hook.WriteConsole("Tracker initialized");
- }
- }
- public static bool Button(Rect position, string text, int indent = 60)
- {
- Tracker.TrackerSkin.buttonStyle.get_padding().set_left(indent);
- Tracker.TrackerSkin.buttonStyle.set_fontSize(UserConfig.Vars.ScaleY / 2);
- return GUI.Button(position, text, Tracker.TrackerSkin.buttonStyle);
- }
- public static void Box(Rect position, string text)
- {
- Tracker.TrackerSkin.boxStyle.set_fontSize(UserConfig.Vars.ScaleY / 2);
- GUI.Box(position, text, Tracker.TrackerSkin.boxStyle);
- }
- public static bool RepeatButton(Rect position, string text, int indent = 60)
- {
- Tracker.TrackerSkin.buttonStyle.get_padding().set_left(indent);
- Tracker.TrackerSkin.buttonStyle.set_alignment(3);
- Tracker.TrackerSkin.buttonStyle.set_fontSize(UserConfig.Vars.ScaleY / 2);
- return GUI.RepeatButton(position, text, Tracker.TrackerSkin.buttonStyle);
- }
- public static bool StatisticButton(Rect position, string text)
- {
- Tracker.TrackerSkin.buttonStyle.get_padding().set_left(0);
- Tracker.TrackerSkin.buttonStyle.set_alignment(4);
- Tracker.TrackerSkin.buttonStyle.set_fontSize(UserConfig.Vars.ScaleY / 2);
- return GUI.RepeatButton(position, text, Tracker.TrackerSkin.buttonStyle);
- }
- }
- [CompilerGenerated]
- [Serializable]
- private sealed class <>c
- {
- public static readonly Tracker.<>c <>9 = new Tracker.<>c();
- public static Func<CardInstance, CardGroup> <>9__24_0;
- public static Func<CardInstance, int> <>9__24_1;
- public static Func<CardTemplate, CardGroup> <>9__25_0;
- public static Func<CardTemplate, int> <>9__25_1;
- public static Predicate<CardTemplate> <>9__25_2;
- internal CardGroup <GetOpponentCards>b__24_0(CardInstance a)
- {
- return a.get_CardGroup();
- }
- internal int <GetOpponentCards>b__24_1(CardInstance a)
- {
- return a.get_TemplateID();
- }
- internal CardGroup <GetDeckCards>b__25_0(CardTemplate a)
- {
- return a.group;
- }
- internal int <GetDeckCards>b__25_1(CardTemplate a)
- {
- return a.templateId;
- }
- internal bool <GetDeckCards>b__25_2(CardTemplate card)
- {
- return (card.group != 1 || !UserConfig.Vars.DeckBronze) && (card.group != 2 || !UserConfig.Vars.DeckSilver) && (card.group != 3 || !UserConfig.Vars.DeckGold);
- }
- }
- private static GwentGameController gameController;
- private static GameBoardManager boardManager;
- private static BasePlayerController playerController;
- private static CardTypeIconsRegistry iconRegistry;
- private static List<Sprite> raritySprites;
- private static Texture2D[] groupTextures = new Texture2D[4];
- private static Texture2D fallbackTexture = null;
- private static bool shouldTrack;
- private static float updateTime = 0.5f;
- private static List<RankedLeaderboardRecord> playerRecords = new List<RankedLeaderboardRecord>();
- private static List<CardTemplate> banishedCards = new List<CardTemplate>();
- private static List<CardTemplate> opponentCards = new List<CardTemplate>();
- private static List<CardTemplate> deckCards = new List<CardTemplate>();
- public static void Listen()
- {
- Tracker.gameController = (GwentGlobalObjectsRegistry.get_GwentInstance().GameController as GwentGameController);
- Tracker.boardManager = (Tracker.gameController.get_CardManager().get_Board() as GameBoardManager);
- Tracker.playerController = Tracker.gameController.get_PlayerManager().GetPlayerController(1);
- Tracker.iconRegistry = GwentGlobalObjectsRegistry.get_CardTypeIconsRegistry();
- CardRarityRenderer expr_51 = Object.FindObjectOfType<CardRarityRenderer>();
- if (expr_51 == null)
- {
- Hook.WriteConsole("cardIconsController is null");
- }
- else
- {
- Hook.WriteConsole("cardIconsController is not null");
- }
- Tracker.raritySprites = Reflector.FindField<List<Sprite>>(expr_51, "m_RaritySpriteList").Get();
- for (int i = 0; i < Tracker.groupTextures.Length; i++)
- {
- Tracker.groupTextures[i] = new Texture2D(1, 1);
- CardGroup group = i;
- Tracker.groupTextures[i].SetPixel(0, 0, Tracker.GetCardGroupColor(group));
- Tracker.groupTextures[i].Apply();
- }
- if (Tracker.fallbackTexture == null)
- {
- Tracker.fallbackTexture = new Texture2D(1, 1);
- Tracker.fallbackTexture.LoadImage(Convert.FromBase64String(Tracker.getB64Image()));
- }
- Tracker.shouldTrack = true;
- Hook.WriteConsole("Tracker is listening");
- }
- public static void Deafen()
- {
- Tracker.shouldTrack = false;
- Tracker.banishedCards.Clear();
- for (int i = 0; i < Tracker.groupTextures.Length; i++)
- {
- Object.Destroy(Tracker.groupTextures[i]);
- }
- }
- public static void ResetRecords()
- {
- Tracker.playerRecords.Clear();
- }
- public static void AddRecord(RankedLeaderboardRecord record)
- {
- Tracker.playerRecords.Add(record);
- }
- private static Color GetCardGroupColor(CardGroup group)
- {
- if (group == 1)
- {
- return new Color(0.7f, 0.5f, 0f);
- }
- if (group == 2)
- {
- return new Color(0.9f, 0.9f, 0.9f);
- }
- if (group == 3)
- {
- return new Color(0.9f, 0.8f, 0f);
- }
- return Color.get_white();
- }
- private static void DrawCard(Rect position, CardTemplate card, int count = -1)
- {
- GUI.set_color(Color.get_white());
- string text = LocalizationManager.get_Instance().GetTranslationText(card.GetCardNameTextKey());
- if (count != -1)
- {
- text = count + " " + text;
- }
- int num = UserConfig.Vars.ScaleY - 10;
- int num2 = UserConfig.Vars.ScaleY - 6;
- if (Tracker.TrackerSkin.Button(position, text, UserConfig.Vars.Rarity ? (num + num2 + 25) : (num2 + 20)))
- {
- GwentUtil.ShowCardPreview(card);
- }
- if (UserConfig.Vars.Rarity)
- {
- Rarity value = card.cardDefinitions.DefinitionList[0].RarityWrapper.get_Value();
- GUI.DrawTexture(new Rect(position.get_x() + 15f, position.get_y() + 5f, (float)num, (float)num), Tracker.raritySprites[UIHelper.GetIconIndexForRarity(value, 0)].get_texture());
- }
- GUIStyle gUIStyle = new GUIStyle();
- gUIStyle.get_normal().set_background(Tracker.groupTextures[card.group]);
- GUI.Box(new Rect(position.get_x() + 1f, position.get_y() + 1f, 5f, position.get_height() - 2f), "", gUIStyle);
- GUI.set_color(Tracker.GetCardGroupColor(card.group));
- Texture texture = Tracker.iconRegistry.FindIconForAttackType(card.typeArray & 7, card.IsType(256));
- bool flag = texture == null || card.power == 0;
- if (flag)
- {
- texture = Tracker.fallbackTexture;
- GUI.set_color(Color.get_white());
- num2 = UserConfig.Vars.ScaleY;
- }
- int num3 = UserConfig.Vars.Rarity ? (15 + num + 5) : 15;
- if (flag)
- {
- num3 -= 3;
- }
- GUI.DrawTexture(new Rect(position.get_x() + (float)num3, position.get_y() + (float)(flag ? 1 : 3), (float)num2, (float)num2), texture);
- }
- public static void UpdateMovables(Vector2 mousePos)
- {
- bool mouseButtonUp = Input.GetMouseButtonUp(0);
- FieldInfo[] fields = typeof(UserConfig.ConfigData.Movables).GetFields();
- for (int i = 0; i < fields.Length; i++)
- {
- Movable movable = fields[i].GetValue(UserConfig.Vars.Anchors) as Movable;
- movable.Update(mousePos);
- if (mouseButtonUp)
- {
- movable.StopMoving();
- }
- }
- }
- public static void DrawMovableCardList(Movable movable, string title, ref bool showToggle, bool group, List<CardTemplate> list)
- {
- Vector2 mousePosition = Event.get_current().get_mousePosition();
- GUI.set_color(Color.get_white());
- Vector2 position = movable.GetPosition();
- int num = 0;
- int num2 = 1;
- if (Tracker.TrackerSkin.RepeatButton(new Rect(position.x, position.y + (float)((UserConfig.Vars.ScaleY + num2) * num), (float)(UserConfig.Vars.ScaleX - (UserConfig.Vars.ScaleY + num2)), (float)UserConfig.Vars.ScaleY), title, 10))
- {
- movable.StartMoving(mousePosition);
- }
- if (GUI.Button(new Rect(position.x + (float)UserConfig.Vars.ScaleX - (float)UserConfig.Vars.ScaleY, position.y + (float)((UserConfig.Vars.ScaleY + num2) * num), (float)UserConfig.Vars.ScaleY, (float)UserConfig.Vars.ScaleY), showToggle ? "-" : "+"))
- {
- showToggle = !showToggle;
- }
- if (!showToggle)
- {
- return;
- }
- num++;
- Dictionary<int, int> dictionary = new Dictionary<int, int>();
- if (group)
- {
- foreach (CardTemplate current in list)
- {
- if (dictionary.Keys.Contains(current.templateId))
- {
- Dictionary<int, int> arg_129_0 = dictionary;
- int templateId = current.templateId;
- int num3 = arg_129_0[templateId];
- arg_129_0[templateId] = num3 + 1;
- }
- else
- {
- dictionary[current.templateId] = 1;
- }
- }
- }
- foreach (CardTemplate current2 in list)
- {
- int num4 = dictionary.Keys.Contains(current2.templateId) ? dictionary[current2.templateId] : -1;
- if ((group && num4 != -1) || !group)
- {
- Tracker.DrawCard(new Rect(position.x, position.y + (float)((UserConfig.Vars.ScaleY + num2) * num), (float)UserConfig.Vars.ScaleX, (float)UserConfig.Vars.ScaleY), current2, num4);
- }
- if (num4 != -1 & group)
- {
- dictionary.Remove(current2.templateId);
- num++;
- }
- if (!group)
- {
- num++;
- }
- }
- }
- public static bool Update()
- {
- if (!Tracker.shouldTrack)
- {
- return false;
- }
- Tracker.updateTime += Time.get_deltaTime();
- if (Tracker.updateTime > 0.5f)
- {
- List<CardInstance> allPlayerCards = Tracker.playerController.TargetPlayer.GetAllPlayerCards();
- List<CardInstance> allPlayerCards2 = Tracker.playerController.get_OtherPlayer().GetAllPlayerCards();
- if (UserConfig.Vars.OpponentOverlay)
- {
- Tracker.opponentCards = Tracker.GetOpponentCards(allPlayerCards, allPlayerCards2);
- }
- if (UserConfig.Vars.DeckOverlay)
- {
- Tracker.deckCards = Tracker.GetDeckCards(allPlayerCards, allPlayerCards2);
- }
- Tracker.updateTime = 0f;
- }
- Tracker.UpdateMovables(Event.get_current().get_mousePosition());
- return true;
- }
- public static bool OnGUI()
- {
- if (!Tracker.shouldTrack)
- {
- return false;
- }
- Tracker.TrackerSkin.Initialize();
- Vector2 mousePosition = Event.get_current().get_mousePosition();
- if (UserConfig.Vars.DeckOverlay)
- {
- Tracker.DrawMovableCardList(UserConfig.Vars.Anchors.Deck, PlayerDeck.GetName(), ref UserConfig.Vars.CollapseDeck, UserConfig.Vars.GroupCards, Tracker.deckCards);
- }
- if (UserConfig.Vars.OpponentOverlay)
- {
- Tracker.DrawMovableCardList(UserConfig.Vars.Anchors.Opponent, "Opponent", ref UserConfig.Vars.CollapseOpponent, UserConfig.Vars.GroupCards, Tracker.opponentCards);
- }
- if (UserConfig.Vars.BanishedOverlay)
- {
- Tracker.DrawMovableCardList(UserConfig.Vars.Anchors.Banished, "Banished", ref UserConfig.Vars.CollapseBanished, UserConfig.Vars.GroupCards, Tracker.banishedCards);
- }
- GUI.set_color(Color.get_white());
- foreach (RankedLeaderboardRecord current in Tracker.playerRecords)
- {
- Hook.WriteConsole(current.ToJSON());
- Movable movable = UserConfig.Vars.Anchors.Rank1;
- if (current.get_Username() == Singleton<ProfileManager>.get_Instance().get_NameToDisplay())
- {
- movable = UserConfig.Vars.Anchors.Rank2;
- }
- Vector2 position = movable.GetPosition();
- if (Tracker.TrackerSkin.RepeatButton(new Rect(position.x, position.y, (float)UserConfig.Vars.ScaleX, (float)UserConfig.Vars.ScaleY), string.Concat(new object[]
- {
- "#",
- current.get_Position(),
- " with ",
- current.get_Score(),
- " MMR"
- }), 10))
- {
- movable.StartMoving(mousePosition);
- }
- }
- if (UserConfig.Vars.BaseStrengthOverlay)
- {
- CardSelectableObject cardSelectableObject = GwentGlobalObjectsRegistry.get_SelectionHandler().get_CurrentHighlight() as CardSelectableObject;
- if (cardSelectableObject != null && cardSelectableObject.get_CardInstance() != null && !CardTypeHelper.GetContainedFlags(cardSelectableObject.get_CardInstance().get_CardType()).Contains(1024) && !Singleton<UIManager>.get_Instance().IsPanelVisible(5011))
- {
- int weatherSavedPower = cardSelectableObject.get_CardInstance().get_Tokens().get_PowerToken().WeatherSavedPower;
- string arg = (weatherSavedPower > 0) ? (" | Without Weather: " + weatherSavedPower) : "";
- Tracker.TrackerSkin.Box(new Rect((float)(Screen.get_width() / 2 - UserConfig.Vars.ScaleX / 2), (float)(Screen.get_height() / 2 - UserConfig.Vars.ScaleY / 2), (float)UserConfig.Vars.ScaleX, (float)UserConfig.Vars.ScaleY), "Base Strength: " + cardSelectableObject.get_CardInstance().GetBasePower() + arg);
- }
- }
- if (UserConfig.Vars.StatisticOverlay)
- {
- TrackedDeck expr_2F2 = DeckStatistics.GetActiveDeck();
- TrackedDeck.WL wLSum = expr_2F2.GetWLSum();
- TrackedDeck.WL wLForFaction = expr_2F2.GetWLForFaction(Tracker.playerController.get_OtherPlayer().get_FactionId());
- Vector2 position2 = UserConfig.Vars.Anchors.Statistic.GetPosition();
- if (Tracker.TrackerSkin.StatisticButton(new Rect(position2.x, position2.y, (float)UserConfig.Vars.ScaleX, (float)((UserConfig.Vars.ScaleY - 5) * 2)), string.Concat(new object[]
- {
- "All: ",
- wLSum.w,
- " - ",
- wLSum.l,
- " (",
- wLSum.GetAsPercent().ToString(),
- "%)\n",
- LocalizationHelper.GetFactionName(Tracker.playerController.get_OtherPlayer().get_FactionId()),
- ": ",
- wLForFaction.w,
- " - ",
- wLForFaction.l,
- " (",
- wLForFaction.GetAsPercent().ToString(),
- "%)"
- })))
- {
- UserConfig.Vars.Anchors.Statistic.StartMoving(mousePosition);
- }
- }
- return true;
- }
- private static List<CardTemplate> GetOpponentCards(List<CardInstance> l1, List<CardInstance> l2)
- {
- int uniqueId = Tracker.playerController.get_OtherPlayer().UniqueId;
- IEnumerable<CardInstance> arg_36_0 = l1.Concat(l2);
- Func<CardInstance, CardGroup> arg_36_1;
- if ((arg_36_1 = Tracker.<>c.<>9__24_0) == null)
- {
- arg_36_1 = (Tracker.<>c.<>9__24_0 = new Func<CardInstance, CardGroup>(Tracker.<>c.<>9.<GetOpponentCards>b__24_0));
- }
- IOrderedEnumerable<CardInstance> arg_5A_0 = arg_36_0.OrderBy(arg_36_1);
- Func<CardInstance, int> arg_5A_1;
- if ((arg_5A_1 = Tracker.<>c.<>9__24_1) == null)
- {
- arg_5A_1 = (Tracker.<>c.<>9__24_1 = new Func<CardInstance, int>(Tracker.<>c.<>9.<GetOpponentCards>b__24_1));
- }
- List<CardInstance> arg_6A_0 = arg_5A_0.ThenBy(arg_5A_1).ToList<CardInstance>();
- List<CardTemplate> list = new List<CardTemplate>();
- foreach (CardInstance current in arg_6A_0)
- {
- if (Tracker.OpponentCardFilter(current, uniqueId))
- {
- list.Add(current.get_TemplateRef());
- }
- }
- return list;
- }
- private static List<CardTemplate> GetDeckCards(List<CardInstance> l1, List<CardInstance> l2)
- {
- List<CardTemplate> list = new List<CardTemplate>();
- foreach (CardInstance current in Tracker.boardManager.GetCardsInLocation(GwentGlobalObjectsRegistry.get_BottomPlayerID(), 2))
- {
- list.Add(current.get_TemplateRef());
- }
- List<CardTemplate> list2 = new List<CardTemplate>(PlayerDeck.Get());
- IEnumerable<CardTemplate> arg_72_0 = list2;
- Func<CardTemplate, CardGroup> arg_72_1;
- if ((arg_72_1 = Tracker.<>c.<>9__25_0) == null)
- {
- arg_72_1 = (Tracker.<>c.<>9__25_0 = new Func<CardTemplate, CardGroup>(Tracker.<>c.<>9.<GetDeckCards>b__25_0));
- }
- IOrderedEnumerable<CardTemplate> arg_96_0 = arg_72_0.OrderBy(arg_72_1);
- Func<CardTemplate, int> arg_96_1;
- if ((arg_96_1 = Tracker.<>c.<>9__25_1) == null)
- {
- arg_96_1 = (Tracker.<>c.<>9__25_1 = new Func<CardTemplate, int>(Tracker.<>c.<>9.<GetDeckCards>b__25_1));
- }
- list2 = arg_96_0.ThenBy(arg_96_1).ToList<CardTemplate>();
- int bottomPlayerID = GwentGlobalObjectsRegistry.get_BottomPlayerID();
- foreach (CardInstance current2 in l1)
- {
- if (current2.get_Revealed() && (current2.get_PlayedBy() != Tracker.playerController.get_OtherPlayer().UniqueId || (current2.get_PlayedBy() == Tracker.playerController.get_OtherPlayer().UniqueId && current2.get_SpawningPlayer() == Tracker.playerController.TargetPlayer.UniqueId)))
- {
- int templateId = current2.get_OriginalDefinition().templateId;
- int i = 0;
- while (i < list2.Count)
- {
- if (list2[i].templateId == templateId)
- {
- if (list.Contains(current2.get_TemplateRef()))
- {
- list.Remove(current2.get_TemplateRef());
- break;
- }
- list2.RemoveAt(i);
- break;
- }
- else
- {
- i++;
- }
- }
- }
- }
- foreach (CardInstance current3 in l2)
- {
- if (current3.get_Revealed() && (current3.get_PlayedBy() == bottomPlayerID || current3.get_SpawningPlayer() == bottomPlayerID))
- {
- int templateId2 = current3.get_OriginalDefinition().templateId;
- int j = 0;
- while (j < list2.Count)
- {
- if (list2[j].templateId == templateId2)
- {
- if (list.Contains(current3.get_TemplateRef()))
- {
- list.Remove(current3.get_TemplateRef());
- break;
- }
- list2.RemoveAt(j);
- break;
- }
- else
- {
- j++;
- }
- }
- }
- }
- List<CardTemplate> arg_256_0 = list2;
- Predicate<CardTemplate> arg_256_1;
- if ((arg_256_1 = Tracker.<>c.<>9__25_2) == null)
- {
- arg_256_1 = (Tracker.<>c.<>9__25_2 = new Predicate<CardTemplate>(Tracker.<>c.<>9.<GetDeckCards>b__25_2));
- }
- arg_256_0.RemoveAll(arg_256_1);
- Hook.WriteConsole(list.Count.ToString());
- foreach (CardTemplate current4 in list)
- {
- if (current4.templateId != -1)
- {
- list2.Add(current4);
- }
- }
- return list2;
- }
- public static bool OpponentCardFilter(CardInstance card, int opponentId)
- {
- if ((card.get_CardGroup() != 1 || !UserConfig.Vars.OpponentBronze) && (card.get_CardGroup() != 2 || !UserConfig.Vars.OpponentSilver) && (card.get_CardGroup() != 3 || !UserConfig.Vars.OpponentGold))
- {
- return false;
- }
- if (CardTypeHelper.GetContainedFlags(card.get_CardType()).Contains(1024) && card.get_Tokens().get_AmbushToken().get_CurrentState() == 1)
- {
- return false;
- }
- Availability value = card.GetCardDefinition().AvailabilityWrapper.get_Value();
- return card.get_Revealed() && card.get_SpawningPlayer() == opponentId && card.get_Location() != 8 && card.get_Location() != 2 && !card.IsLeader && value != null && value != 268435455;
- }
- public static void OnAbilityWillAffect(AbilityEventInfo info)
- {
- if (info.SourceCard == 0uL || info.AffectedInstances == null || info.AffectedInstances.Count <= 0)
- {
- return;
- }
- int bottomPlayerID = GwentGlobalObjectsRegistry.get_BottomPlayerID();
- CardInstance cardInstanceFromID = Tracker.gameController.get_CardManager().GetCardInstanceFromID(info.SourceCard);
- if (cardInstanceFromID != null && (cardInstanceFromID.get_PlayedBy() == bottomPlayerID || cardInstanceFromID.get_SpawningPlayer() == bottomPlayerID))
- {
- Hook.WriteConsole("AbilityWillAffect: " + info.AbilityId.ToString());
- if (info.AbilityId == -813761170)
- {
- PlayerDeck.Add(cardInstanceFromID.get_TemplateRef(), 2);
- }
- }
- }
- public static void OnAbilityApplyEnded(AbilityEventInfo info)
- {
- if (info.SourceCard == 0uL || info.AffectedInstances == null || info.AffectedInstances.Count <= 0)
- {
- return;
- }
- int bottomPlayerID = GwentGlobalObjectsRegistry.get_BottomPlayerID();
- CardInstance cardInstanceFromID = Tracker.gameController.get_CardManager().GetCardInstanceFromID(info.SourceCard);
- if (cardInstanceFromID != null && info.AbilityId == -31051523)
- {
- CardInstance cardInstanceFromID2 = Tracker.gameController.get_CardManager().GetCardInstanceFromID(info.AffectedInstances[0]);
- if (cardInstanceFromID2 != null)
- {
- PlayerDeck.Add(cardInstanceFromID2.get_TemplateRef(), 1);
- }
- }
- if (cardInstanceFromID != null && (cardInstanceFromID.get_PlayedBy() == bottomPlayerID || cardInstanceFromID.get_SpawningPlayer() == bottomPlayerID))
- {
- Hook.WriteConsole("AbilityApplyEnded: " + info.AbilityId.ToString());
- if (info.AbilityId == -372716485)
- {
- CardInstance cardInstanceFromID3 = Tracker.gameController.get_CardManager().GetCardInstanceFromID(info.AffectedInstances[0]);
- if (cardInstanceFromID3 != null)
- {
- PlayerDeck.Add(cardInstanceFromID3.get_TemplateRef(), 2);
- }
- }
- if (info.AbilityId == 1288951619 || info.AbilityId == -1505577093)
- {
- CardInstance cardInstanceFromID4 = Tracker.gameController.get_CardManager().GetCardInstanceFromID(info.AffectedInstances[0]);
- if (cardInstanceFromID4 != null)
- {
- PlayerDeck.Add(cardInstanceFromID4.get_TemplateRef(), 1);
- }
- }
- if (info.AbilityId == 1263231436)
- {
- foreach (ulong current in info.AffectedInstances)
- {
- CardInstance cardInstanceFromID5 = Tracker.gameController.get_CardManager().GetCardInstanceFromID(current);
- if (cardInstanceFromID5 != null)
- {
- PlayerDeck.Add(cardInstanceFromID5.get_TemplateRef(), 1);
- }
- }
- }
- if (info.AbilityId == -2024648741)
- {
- CardInstance cardInstanceFromID6 = Tracker.gameController.get_CardManager().GetCardInstanceFromID(info.AffectedInstances[0]);
- if (cardInstanceFromID6 != null)
- {
- PlayerDeck.Add(cardInstanceFromID6.get_TemplateRef(), 2);
- }
- }
- if (info.AbilityId == -1862040966)
- {
- CardInstance cardInstanceFromID7 = Tracker.gameController.get_CardManager().GetCardInstanceFromID(info.AffectedInstances[0]);
- if (cardInstanceFromID7 != null)
- {
- PlayerDeck.Add(cardInstanceFromID7.get_TemplateRef(), 1);
- }
- }
- if (info.AbilityId == -733948379 || info.AbilityId == -646357120 || info.AbilityId == -281179227)
- {
- CardInstance cardInstanceFromID8 = Tracker.gameController.get_CardManager().GetCardInstanceFromID(info.AffectedInstances[0]);
- if (cardInstanceFromID8 != null)
- {
- PlayerDeck.Add(cardInstanceFromID8.get_TemplateRef(), 1);
- Hook.WriteConsole(cardInstanceFromID8.GetTextKey());
- }
- }
- }
- }
- public static void OnCardBanished(ulong[] instanceIds)
- {
- for (int i = 0; i < instanceIds.Length; i++)
- {
- ulong num = instanceIds[i];
- try
- {
- CardInstance cardInstanceFromID = Tracker.gameController.get_CardManager().GetCardInstanceFromID(num);
- if (cardInstanceFromID != null)
- {
- Availability value = cardInstanceFromID.GetCardDefinition().AvailabilityWrapper.get_Value();
- if (value == 268435455 || value == null)
- {
- break;
- }
- if (LocalizationManager.get_Instance().GetTranslationText(cardInstanceFromID.GetTextKey()).StartsWith("#"))
- {
- break;
- }
- Tracker.banishedCards.Add(cardInstanceFromID.get_TemplateRef());
- }
- }
- catch (Exception)
- {
- }
- }
- }
- private static Vector3 WorldToScreen(Vector3 worldPos)
- {
- Vector3 vector = Camera.get_main().WorldToScreenPoint(worldPos);
- vector.y = (float)Screen.get_height() - (vector.y + vector.z) + -180f;
- return vector;
- }
- private static void DrawCardInfoDebug()
- {
- }
- private static string getB64Image()
- {
- return "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";
- }
- }
- }
- //user config
- namespace GwentHook
- {
- internal static class UserConfig
- {
- [Serializable]
- public class ConfigData
- {
- [Serializable]
- public class Movables
- {
- public Movable Deck;
- public Movable Opponent;
- public Movable Banished;
- public Movable Statistic;
- public Movable Rank1;
- public Movable Rank2;
- public Movables()
- {
- int num = (int)((double)Screen.get_height() * 0.15);
- this.Deck = new Movable(new Vector2((float)(Screen.get_width() - UserConfig.DefaultScaleX), (float)num));
- this.Opponent = new Movable(new Vector2(0f, (float)num));
- this.Banished = new Movable(new Vector2((float)(Screen.get_width() / 2 - UserConfig.DefaultScaleX / 2), (float)num));
- this.Statistic = new Movable(new Vector2((float)(Screen.get_width() / 2 - UserConfig.DefaultScaleX / 2), 0f));
- this.Rank1 = new Movable(new Vector2(0f, 0f));
- this.Rank2 = new Movable(new Vector2(0f, (float)(Screen.get_height() - UserConfig.DefaultScaleY)));
- }
- }
- public bool AutoUpdate;
- public bool AutoUpdateDecision;
- public string InstalledVersion;
- public bool StartWithWindows;
- public bool StatisticOverlay;
- public bool DeckOverlay;
- public bool DeckBronze;
- public bool DeckSilver;
- public bool DeckGold;
- public bool OpponentOverlay;
- public bool OpponentBronze;
- public bool OpponentSilver;
- public bool OpponentGold;
- public bool CollapseDeck;
- public bool CollapseOpponent;
- public bool CollapseBanished;
- public bool Rarity;
- public bool BaseStrengthOverlay;
- public bool BanishedOverlay;
- public bool GroupCards;
- public int ScaleX;
- public int ScaleY;
- public UserConfig.ConfigData.Movables Anchors;
- public ConfigData()
- {
- this.AutoUpdate = false;
- this.AutoUpdateDecision = false;
- this.InstalledVersion = "0.0.0.0";
- this.StartWithWindows = false;
- this.StatisticOverlay = true;
- this.DeckOverlay = true;
- this.DeckBronze = true;
- this.DeckSilver = true;
- this.DeckGold = true;
- this.OpponentOverlay = true;
- this.OpponentBronze = true;
- this.OpponentSilver = true;
- this.OpponentGold = true;
- this.Rarity = true;
- this.BaseStrengthOverlay = true;
- this.BanishedOverlay = true;
- this.GroupCards = true;
- this.CollapseDeck = true;
- this.CollapseOpponent = true;
- this.CollapseBanished = true;
- this.ScaleX = UserConfig.DefaultScaleX;
- this.ScaleY = UserConfig.DefaultScaleY;
- this.Anchors = new UserConfig.ConfigData.Movables();
- }
- }
- private static int DefaultScaleX = 250;
- private static int DefaultScaleY = 26;
- public static UserConfig.ConfigData Vars = new UserConfig.ConfigData();
- private static string GetPath()
- {
- string expr_11 = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + "\\GwentTracker";
- Directory.CreateDirectory(expr_11);
- return expr_11 + "\\config.json";
- }
- public static void Save()
- {
- File.WriteAllText(UserConfig.GetPath(), GwentUtil.Serialize(typeof(UserConfig.ConfigData), UserConfig.Vars));
- }
- public static void Load()
- {
- try
- {
- UserConfig.Vars = (GwentUtil.Deserialize(typeof(UserConfig.ConfigData), File.ReadAllText(UserConfig.GetPath())) as UserConfig.ConfigData);
- }
- catch (Exception)
- {
- UserConfig.Vars = new UserConfig.ConfigData();
- }
- }
- public static void Kill()
- {
- UserConfig.Vars = new UserConfig.ConfigData();
- UserConfig.Save();
- }
- public static void RegisterInStartup(bool isChecked)
- {
- RegistryKey registryKey = Registry.CurrentUser.OpenSubKey("SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Run", true);
- if (isChecked)
- {
- registryKey.SetValue("Gwent Tracker", Hook.AssemblyDirectory.Replace('/', '\\') + "\\Gwent Tracker.exe");
- return;
- }
- registryKey.DeleteValue("Gwent Tracker");
- }
- }
- }
- //user interface
- namespace GwentHook
- {
- internal class UserInterface
- {
- public static bool visible;
- private static Vector2 scrollPos;
- private static bool initialized = false;
- private static GUIStyle windowStyle;
- private static GUIStyle verticalStyle;
- private static GUIStyle listButton;
- private static GUIStyle listButtonActive;
- private static int w = 400;
- private static int h1 = 230;
- private static int h2 = 190;
- private static int h3 = 10;
- private static int o = 20;
- private static TrackedDeck trackedDeck;
- private static bool startupState;
- public static bool Draw()
- {
- if (!UserInterface.visible)
- {
- return false;
- }
- int num = UserInterface.h1 + UserInterface.h2 + UserInterface.h3;
- Rect rect = new Rect((float)(Screen.get_width() / 2 - UserInterface.w - UserInterface.o), (float)(Screen.get_height() / 2 - num / 2 - UserInterface.o), (float)(UserInterface.w * 2 + UserInterface.o * 2), (float)UserInterface.h2);
- Rect rect2 = new Rect((float)(Screen.get_width() / 2 - UserInterface.w - UserInterface.o), (float)(Screen.get_height() / 2 - num / 2 + UserInterface.h2 + 1), (float)(UserInterface.w + UserInterface.o), (float)UserInterface.h1);
- Rect rect3 = new Rect((float)(Screen.get_width() / 2), (float)(Screen.get_height() / 2 - num / 2 + UserInterface.h2 + 1), (float)(UserInterface.w + UserInterface.o), (float)UserInterface.h1);
- Rect rect4 = new Rect((float)(Screen.get_width() / 2 - (UserInterface.w + UserInterface.o) / 2), (float)(Screen.get_height() / 2 - num / 2 + UserInterface.h1 + UserInterface.h2 + 1), (float)(UserInterface.w + UserInterface.o), (float)UserInterface.h3);
- if (!UserInterface.initialized)
- {
- UserInterface.windowStyle = new GUIStyle(GUI.get_skin().get_window());
- GUIStyleState arg_1FE_0 = UserInterface.windowStyle.get_normal();
- GUIStyleState arg_1F7_0 = UserInterface.windowStyle.get_active();
- GUIStyleState arg_1ED_0 = UserInterface.windowStyle.get_hover();
- GUIStyleState arg_1E3_0 = UserInterface.windowStyle.get_focused();
- GUIStyleState arg_1D9_0 = UserInterface.windowStyle.get_onActive();
- GUIStyleState arg_1CF_0 = UserInterface.windowStyle.get_onNormal();
- GUIStyleState arg_1C5_0 = UserInterface.windowStyle.get_onHover();
- Texture2D texture2D;
- UserInterface.windowStyle.get_onNormal().set_background(texture2D = Tracker.TrackerSkin.CreateBorderedButtonTexture(UserInterface.w, UserInterface.h1, Color.get_black(), new Color(0.3f, 0.3f, 0.3f, 1f)));
- Texture2D texture2D2;
- arg_1C5_0.set_background(texture2D2 = texture2D);
- Texture2D texture2D3;
- arg_1CF_0.set_background(texture2D3 = texture2D2);
- Texture2D texture2D4;
- arg_1D9_0.set_background(texture2D4 = texture2D3);
- Texture2D texture2D5;
- arg_1E3_0.set_background(texture2D5 = texture2D4);
- Texture2D texture2D6;
- arg_1ED_0.set_background(texture2D6 = texture2D5);
- Texture2D background;
- arg_1F7_0.set_background(background = texture2D6);
- arg_1FE_0.set_background(background);
- GUIStyleState arg_29E_0 = UserInterface.windowStyle.get_normal();
- GUIStyleState arg_297_0 = UserInterface.windowStyle.get_active();
- GUIStyleState arg_28D_0 = UserInterface.windowStyle.get_hover();
- GUIStyleState arg_283_0 = UserInterface.windowStyle.get_focused();
- GUIStyleState arg_279_0 = UserInterface.windowStyle.get_onActive();
- GUIStyleState arg_26F_0 = UserInterface.windowStyle.get_onNormal();
- GUIStyleState arg_265_0 = UserInterface.windowStyle.get_onHover();
- Color white;
- UserInterface.windowStyle.get_onNormal().set_textColor(white = Color.get_white());
- Color color;
- arg_265_0.set_textColor(color = white);
- Color color2;
- arg_26F_0.set_textColor(color2 = color);
- Color color3;
- arg_279_0.set_textColor(color3 = color2);
- Color color4;
- arg_283_0.set_textColor(color4 = color3);
- Color color5;
- arg_28D_0.set_textColor(color5 = color4);
- Color textColor;
- arg_297_0.set_textColor(textColor = color5);
- arg_29E_0.set_textColor(textColor);
- UserInterface.verticalStyle = new GUIStyle(GUI.get_skin().get_box());
- UserInterface.listButton = new GUIStyle(GUI.get_skin().get_button());
- UserInterface.listButton.get_normal().set_background(Tracker.TrackerSkin.CreateBorderedButtonTexture(UserInterface.w, UserInterface.h2, Color.get_black(), new Color(0f, 0f, 0f, 0.5f)));
- UserInterface.listButton.get_hover().set_background(Tracker.TrackerSkin.CreateBorderedButtonTexture(UserInterface.w, UserInterface.h2, Color.get_black(), new Color(0f, 0f, 0f, 0.6f)));
- UserInterface.listButton.get_active().set_background(Tracker.TrackerSkin.CreateBorderedButtonTexture(UserInterface.w, UserInterface.h2, Color.get_black(), new Color(0f, 0f, 0f, 0.7f)));
- UserInterface.listButton.get_focused().set_background(Tracker.TrackerSkin.CreateBorderedButtonTexture(UserInterface.w, UserInterface.h2, Color.get_black(), new Color(0f, 0f, 0f, 0.8f)));
- UserInterface.listButton.set_alignment(3);
- UserInterface.listButtonActive = new GUIStyle(GUI.get_skin().get_button());
- UserInterface.listButtonActive.get_normal().set_background(Tracker.TrackerSkin.CreateBorderedButtonTexture(UserInterface.w, UserInterface.h2, new Color(0.5f, 0.5f, 0.5f, 0.5f), new Color(0.5f, 0.5f, 0.5f, 0.5f)));
- UserInterface.listButtonActive.get_hover().set_background(Tracker.TrackerSkin.CreateBorderedButtonTexture(UserInterface.w, UserInterface.h2, new Color(0.5f, 0.5f, 0.5f, 0.6f), new Color(0.5f, 0.5f, 0.5f, 0.6f)));
- UserInterface.listButtonActive.get_active().set_background(Tracker.TrackerSkin.CreateBorderedButtonTexture(UserInterface.w, UserInterface.h2, new Color(0.5f, 0.5f, 0.5f, 0.7f), new Color(0.5f, 0.5f, 0.5f, 0.7f)));
- UserInterface.listButtonActive.get_focused().set_background(Tracker.TrackerSkin.CreateBorderedButtonTexture(UserInterface.w, UserInterface.h2, new Color(0.5f, 0.5f, 0.5f, 0.8f), new Color(0.5f, 0.5f, 0.5f, 0.8f)));
- UserInterface.listButtonActive.set_alignment(3);
- UserInterface.initialized = true;
- }
- GUILayout.Window(1337, rect2, new GUI.WindowFunction(UserInterface.DoMainWindowL), "", UserInterface.windowStyle, new GUILayoutOption[0]);
- GUILayout.Window(1338, rect3, new GUI.WindowFunction(UserInterface.DoMainWindowR), "", UserInterface.windowStyle, new GUILayoutOption[0]);
- GUILayout.Window(1339, rect4, new GUI.WindowFunction(UserInterface.DoBottomWindow), "", UserInterface.windowStyle, new GUILayoutOption[0]);
- if (UserInterface.trackedDeck != null)
- {
- GUILayout.Window(1340, rect, new GUI.WindowFunction(UserInterface.DoSelectorWindow), "", UserInterface.windowStyle, new GUILayoutOption[0]);
- }
- return true;
- }
- private static void DoMainWindowL(int windowID)
- {
- GUILayout.Space(-10f);
- GUILayout.BeginVertical(UserInterface.verticalStyle, new GUILayoutOption[0]);
- UserConfig.Vars.Rarity = GUILayout.Toggle(UserConfig.Vars.Rarity, " Show card rarity", new GUILayoutOption[0]);
- UserConfig.Vars.BaseStrengthOverlay = GUILayout.Toggle(UserConfig.Vars.BaseStrengthOverlay, " Show base strength", new GUILayoutOption[0]);
- UserConfig.Vars.StatisticOverlay = GUILayout.Toggle(UserConfig.Vars.StatisticOverlay, " Show deck statistic", new GUILayoutOption[0]);
- UserConfig.Vars.BanishedOverlay = GUILayout.Toggle(UserConfig.Vars.BanishedOverlay, " Show banished cards", new GUILayoutOption[0]);
- UserConfig.Vars.GroupCards = GUILayout.Toggle(UserConfig.Vars.GroupCards, " Group cards", new GUILayoutOption[0]);
- UserConfig.Vars.DeckOverlay = GUILayout.Toggle(UserConfig.Vars.DeckOverlay, " Show own deck", new GUILayoutOption[0]);
- GUILayout.BeginHorizontal(new GUILayoutOption[0]);
- GUILayout.Space(15f);
- UserConfig.Vars.DeckBronze = GUILayout.Toggle(UserConfig.Vars.DeckBronze, " Bronze", new GUILayoutOption[]
- {
- GUILayout.Width(80f)
- });
- UserConfig.Vars.DeckSilver = GUILayout.Toggle(UserConfig.Vars.DeckSilver, " Silver", new GUILayoutOption[]
- {
- GUILayout.Width(80f)
- });
- UserConfig.Vars.DeckGold = GUILayout.Toggle(UserConfig.Vars.DeckGold, " Gold", new GUILayoutOption[]
- {
- GUILayout.Width(80f)
- });
- GUILayout.EndHorizontal();
- UserConfig.Vars.OpponentOverlay = GUILayout.Toggle(UserConfig.Vars.OpponentOverlay, " Show opponent cards", new GUILayoutOption[0]);
- GUILayout.BeginHorizontal(new GUILayoutOption[0]);
- GUILayout.Space(15f);
- UserConfig.Vars.OpponentBronze = GUILayout.Toggle(UserConfig.Vars.OpponentBronze, " Bronze", new GUILayoutOption[]
- {
- GUILayout.Width(80f)
- });
- UserConfig.Vars.OpponentSilver = GUILayout.Toggle(UserConfig.Vars.OpponentSilver, " Silver", new GUILayoutOption[]
- {
- GUILayout.Width(80f)
- });
- UserConfig.Vars.OpponentGold = GUILayout.Toggle(UserConfig.Vars.OpponentGold, " Gold", new GUILayoutOption[]
- {
- GUILayout.Width(80f)
- });
- GUILayout.EndHorizontal();
- GUILayout.EndVertical();
- }
- private static void DoMainWindowR(int windowID)
- {
- GUILayout.Space(-10f);
- GUILayout.BeginVertical(UserInterface.verticalStyle, new GUILayoutOption[0]);
- GUILayout.Label("Scale X", new GUILayoutOption[0]);
- UserConfig.Vars.ScaleX = (int)GUILayout.HorizontalSlider((float)UserConfig.Vars.ScaleX, 100f, 500f, new GUILayoutOption[0]);
- GUILayout.Label("Scale Y", new GUILayoutOption[0]);
- UserConfig.Vars.ScaleY = (int)GUILayout.HorizontalSlider((float)UserConfig.Vars.ScaleY, 16f, 46f, new GUILayoutOption[0]);
- GUILayout.EndVertical();
- GUILayout.Space(5f);
- GUILayout.BeginVertical(UserInterface.verticalStyle, new GUILayoutOption[0]);
- UserConfig.Vars.AutoUpdate = GUILayout.Toggle(UserConfig.Vars.AutoUpdate, " Enable automatic updates", new GUILayoutOption[0]);
- UserConfig.Vars.StartWithWindows = GUILayout.Toggle(UserConfig.Vars.StartWithWindows, " Start with windows", new GUILayoutOption[0]);
- GUILayout.EndVertical();
- GUILayout.Space(5f);
- GUILayout.BeginHorizontal(new GUILayoutOption[0]);
- if (GUILayout.Button("Share card collection", new GUILayoutOption[0]))
- {
- UserInterface.OnShareCollection();
- }
- if (GUILayout.Button(Hook.importingDeck ? "Importing.." : "Import deck", new GUILayoutOption[0]))
- {
- Hook.CurrentlyNotWorking();
- return;
- }
- GUILayout.EndHorizontal();
- GUILayout.Space(5f);
- if (GUILayout.Button("Reset everything (except statistics)", new GUILayoutOption[0]))
- {
- UserConfig.Kill();
- }
- }
- private static void DoSelectorWindow(int windowID)
- {
- GUILayout.Space(-10f);
- GUILayout.Box("Gwent Tracker v" + Hook.version.ToString() + " - by buffy", new GUILayoutOption[0]);
- GUILayout.Space(10f);
- GUILayout.BeginHorizontal(UserInterface.verticalStyle, new GUILayoutOption[0]);
- UserInterface.scrollPos = GUILayout.BeginScrollView(UserInterface.scrollPos, new GUILayoutOption[0]);
- foreach (TrackedDeck current in DeckStatistics.GetAllDecks())
- {
- GUIStyle gUIStyle = UserInterface.listButton;
- if (current == UserInterface.trackedDeck)
- {
- gUIStyle = UserInterface.listButtonActive;
- }
- if (GUILayout.Button(GwentUtil.GetDeckName(current.GetId()), gUIStyle, new GUILayoutOption[0]))
- {
- UserInterface.trackedDeck = current;
- }
- }
- GUILayout.EndScrollView();
- GUILayout.Space(20f);
- GUILayout.BeginVertical(new GUILayoutOption[0]);
- UserInterface.trackedDeck.trackCasual = GUILayout.Toggle(UserInterface.trackedDeck.trackCasual, " Track in casual play", new GUILayoutOption[0]);
- UserInterface.trackedDeck.trackRanked = GUILayout.Toggle(UserInterface.trackedDeck.trackRanked, " Track in ranked play", new GUILayoutOption[0]);
- GUILayout.Space(5f);
- if (GUILayout.Button("Reset statistic", new GUILayoutOption[]
- {
- GUILayout.Width(137f)
- }))
- {
- UserInterface.trackedDeck.Reset();
- }
- if (GUILayout.Button("Share with others", new GUILayoutOption[]
- {
- GUILayout.Width(137f)
- }))
- {
- UserInterface.OnShareDeck();
- }
- GUILayout.EndVertical();
- foreach (TrackedDeck current2 in DeckStatistics.GetAllDecks())
- {
- if (current2.GetId() == UserInterface.trackedDeck.GetId())
- {
- GUILayout.Space(10f);
- GUILayout.BeginVertical(new GUILayoutOption[0]);
- GUILayout.Label("All factions", new GUILayoutOption[0]);
- foreach (KeyValuePair<FactionId, TrackedDeck.WL> current3 in current2.GetStats())
- {
- GUILayout.Label(LocalizationHelper.GetFactionName(current3.Key), new GUILayoutOption[0]);
- }
- GUILayout.EndVertical();
- GUILayout.BeginVertical(new GUILayoutOption[0]);
- TrackedDeck.WL wLSum = current2.GetWLSum();
- GUILayout.Label(string.Concat(new object[]
- {
- " [",
- wLSum.w,
- " - ",
- wLSum.l,
- "] [",
- wLSum.GetAsPercent().ToString(),
- "%]"
- }), new GUILayoutOption[0]);
- foreach (KeyValuePair<FactionId, TrackedDeck.WL> current4 in current2.GetStats())
- {
- GUILayout.Label(string.Concat(new object[]
- {
- " [",
- current4.Value.w,
- " - ",
- current4.Value.l,
- "] [",
- current4.Value.GetAsPercent().ToString(),
- "%]"
- }), new GUILayoutOption[0]);
- }
- GUILayout.EndVertical();
- }
- }
- GUILayout.EndHorizontal();
- }
- private static void DoBottomWindow(int windowID)
- {
- GUILayout.Space(-10f);
- if (GUILayout.Button("Save and close", new GUILayoutOption[0]))
- {
- UserInterface.Hide();
- }
- }
- public static void OnShareDeck()
- {
- Hook.CurrentlyNotWorking();
- }
- public static void OnShareCollection()
- {
- Hook.CurrentlyNotWorking();
- }
- public static TrackedDeck GetFallbackDeck()
- {
- TrackedDeck result = null;
- List<TrackedDeck> allDecks = DeckStatistics.GetAllDecks();
- if (allDecks.Count > 0)
- {
- result = allDecks[0];
- ulong activeDeckId = Singleton<CardsCollectionsAndDecksManager>.get_Instance().GetCollection(0).GetActiveDeckId();
- foreach (TrackedDeck current in allDecks)
- {
- if (current.GetId() == activeDeckId)
- {
- result = current;
- break;
- }
- }
- }
- return result;
- }
- public static void Show()
- {
- UserInterface.visible = true;
- InputManager.get_Instance().set_enabled(false);
- UserInterface.startupState = UserConfig.Vars.StartWithWindows;
- UserInterface.trackedDeck = UserInterface.GetFallbackDeck();
- }
- public static void Hide()
- {
- UserInterface.visible = false;
- InputManager.get_Instance().set_enabled(true);
- UserConfig.Save();
- if (UserConfig.Vars.StartWithWindows != UserInterface.startupState)
- {
- UserConfig.RegisterInStartup(UserConfig.Vars.StartWithWindows);
- }
- }
- }
- }
Add Comment
Please, Sign In to add comment