private void Awake() { if (Instance != null) { Debug.Log("Instance already assigned"); } Instance = this; HideCharacterList(); }
protected override void Initialize() { ScreenHeight = _graphics.PreferredBackBufferHeight; ScreenWidth = _graphics.PreferredBackBufferWidth; base.Initialize(); Player = new PlayerEntity(this, _spriteBatch, new FireSword(this, _spriteBatch)); AV = new AdventureManager(this, _spriteBatch, Player); //Mobs.Add(new MediumSkeleton(this, _spriteBatch, Player)); }
private void Awake() { scene = SceneManager.GetActiveScene(); //only run if Internal tools scene if (scene.name.Equals("Internal_Tools", StringComparison.Ordinal) == true) { //check if instance already exists if (i == null) { i = this; } //if instance already exists and it's not this else if (i != this) { //Then destroy this in order to reinforce the singleton pattern (can only ever be one instance of toolManager) Destroy(gameObject); } //components adventureScript = GetComponent <AdventureManager>(); actorScript = GetComponent <ActorPoolManager>(); toolDataScript = GetComponent <ToolDataManager>(); toolFileScript = GetComponent <ToolFileManager>(); toolInputScript = GetComponent <ToolInput>(); toolDetailScript = GetComponent <ToolDetails>(); jointScript = GetComponent <JointManager>(); actorFileScript = GetComponent <ActorFileManager>(); //gui adventureUIScript = AdventureUI.Instance(); actorPoolUIScript = ActorPoolUI.Instance(); toolUIScript = ToolUI.Instance(); //error Check Debug.Assert(adventureScript != null, "Invalid adventureScript (Null)"); Debug.Assert(actorScript != null, "Invalid actorScript (Null)"); Debug.Assert(toolDataScript != null, "Invalid toolDataScript (Null)"); Debug.Assert(adventureUIScript != null, "Invalid adventureUIScript (Null)"); Debug.Assert(actorPoolUIScript != null, "Invalid actorPoolUIScript (Null)"); Debug.Assert(toolUIScript != null, "Invalid toolUIScript (Null)"); Debug.Assert(toolInputScript != null, "Invalid toolInputScript (Null)"); Debug.Assert(toolDetailScript != null, "Invalid toolDetailScript (Null)"); Debug.Assert(jointScript != null, "Invalid loadScript (Null)"); Debug.Assert(actorFileScript != null, "Invalid actorFileScript (Null)"); } }
static void Prefix(AdventureManager __instance) { //Event was finished, checks if the temporary event was created and removes it to avoid it from being used by the game if (AdventureManager.eventOwners.ContainsKey(__instance)) { AdvModule advModule = Array.Find <AdvModule>(AdventureLibrary.modules, (AdvModule o) => o.name == "Slavyan"); AdvEvent[] advEventList = Array.FindAll <AdvEvent>(advModule.events, (AdvEvent o) => o.name == "Generic Remove Character"); AdvEvent advEvent = null; if (advEventList.Length > 0) { advEvent = advEventList[0]; List <AdvEvent> list = new List <AdvEvent>(advModule.events); if (advModule.events.Contains(advEvent)) { list.Remove(advEvent); advModule.events = list.ToArray(); } } } }
public static void SetNextAction() { if (State.QuestLog.CurrentActNumber == 0) { QuestManager.DoIntro(); } else { if (State.Player.HP > 0) { if (State.QuestLog.Location == "Town") { if (State.Player.Inventory.Any()) { AdventureManager.SellLoot(); } else { AdventureManager.WalkToBattle(); } } else { AdventureManager.DoBattle(); } } else { if (State.QuestLog.Location == "Town") { AdventureManager.Rest(); } else { AdventureManager.WalkToTown(); } } } }
static bool Prefix(Equip __instance) { if (__instance.name == "Remove Character") { Dictionary <UIManager.Screen, List <ScreenBase> > openScreensByEnum = Traverse.Create(UIManager.Get()).Field("openScreensByEnum").GetValue <Dictionary <UIManager.Screen, List <ScreenBase> > >(); //Closes Equip and Navbar to return to HUD if (UIManager.Get() != null && openScreensByEnum != null) { foreach (KeyValuePair <UIManager.Screen, List <ScreenBase> > keyValuePair in openScreensByEnum) { if (keyValuePair.Value != null && keyValuePair.Value.Count >= 1) { List <ScreenBase> list = new List <ScreenBase>(keyValuePair.Value); foreach (ScreenBase screenBase in list) { if (!(screenBase is TopLayer) && screenBase.name != "HUD(Clone)") { UIManager.Close(screenBase); } } } } } //Clones "Giving up people" to simplify it and allow character to be removed without gaining items/rep with the slavyans AdvModule advModule = Array.Find <AdvModule>(AdventureLibrary.modules, (AdvModule o) => o.name == "Slavyan"); AdvEvent[] advEventList = Array.FindAll <AdvEvent>(advModule.events, (AdvEvent o) => o.name == "Generic Remove Character"); AdvEvent advEvent; if (advEventList.GetLength(0) == 0) { advEvent = Array.FindAll <AdvEvent>(advModule.events, (AdvEvent o) => o.name == "Giving up people")[0].Clone(); advEvent.module = advModule; advEvent.name = "Generic Remove Character"; Array.Resize <AdvEvent>(ref advModule.events, advModule.events.Length + 1); advModule.events[advModule.events.Length - 1] = advEvent; //advEvent.uniqueID = advModule.GetNextEventIndex(); //Might not be necessary to add ID since it will be removed later UnityEngine.Debug.Log("Equip_ButtonClick_Patch --------------------- making new event " + advEvent.name); } else { //In case the temporary event already exists, but I'm removing them after the event ends advEvent = advEventList[0]; } //Modifies the event to make it more generic and simple AdvNode[] nodes = advEvent.nodes; foreach (AdvNode node in nodes) { if (node is NodeAdventure) { (node as NodeAdventure).story = "You approach your group to decide if anyone should leave."; } List <AdvOutput> outputs = node.outputs; if (outputs != null) { foreach (AdvOutput output in outputs) { if (output.name == "Wish them well and leave.") { output.name = "Send someone away."; } if (output.name == "Actually, ask them to stay with you!") { output.name = "Nevermind."; } if (output.name == "Confirm") { output.targetID = 5; } if (output.name == "Cancel") { output.targetID = 5; } } } } //Run the new temporary event ClientGroupData selectedGroup = GroupSelectionManager.Get().GetSelectedGroup(); Thea2.Server.Group group = null; if (selectedGroup != null) { group = EntityManager.Get <Thea2.Server.Group>(selectedGroup.GetID(), true); } AdventureManager adventureManager = AdventureManager.TriggerEvent(group.ownerID, advEvent, group, null, -1, true); return(false); } return(true); }
private void Awake() { adventureManager = FindObjectOfType <AdventureManager>(); battleController = FindObjectOfType <BattleController>(); }
private void Awake() { instance = this; }
// Use this for initialization void Start() { adventureManager = GameObject.Find("Adventure").GetComponent <AdventureManager>(); }
static void Main(string[] args) { string url = "irc.chat.twitch.tv"; int port = 80; string user = "******"; string oAuthToken = System.IO.File.ReadAllText(@"token.txt"); // token.txt must be in the same folder as EXE string channel = "lobosjr"; //Set up one IrcClient, only one is required it allows better cooldown managerment and traffic will //never cause this code to run slower then any twitch cool down for bots. TwitchClientFactory icf = new TwitchClientFactory(); ITwitchClient client = icf.create(url, port, user, oAuthToken, channel, 600, new OperationRequestEventRaiser(), new PrivMessageEventRaiser(), new WhisperMessageEventRaiser()); client.DefaultMessageHandler += (o, e) => { Console.WriteLine(string.Format("System: {0}", e.Raw)); }; //Set up Legacy Item -> IEquipment converter. LegacyItemEquipmentConverter liec = new LegacyItemEquipmentConverter(); //Set up Equipment repository, if legacy then this will load all items from old files and convert them //into IEquipment in memory. IEquipmentRepository equipmentRepository = LegacyEquipmentRepository .getInstance(liec, LegacyEquipmentRepository.LEGACY_ITEM_BRIDGE_FILE_PATH, LegacyEquipmentRepository.LEGACY_ITEM_PREFIX_FILE_PATH); //Set up Player Repository, Factory and default ILevelObservers ILevelObserver levelUpNotifier = new LevelupNotifier(client); PlayerFactory pf = new PlayerFactory(3, 20, levelUpNotifier); ILevelObserver classChoiceNotifier = new ClassChoiceNotifier(client, pf, 3); pf.GetCurrentDefaultObservers().Add(classChoiceNotifier); IPlayerRepository playerRepo = LegacyPlayerRepository.getInstance(3, 20, pf, equipmentRepository, LegacyPlayerRepository.LEGACY_USER_COINS_FILE_PATH, LegacyPlayerRepository.LEGACY_USER_XP_FILE_PATH, LegacyPlayerRepository.LEGACY_USER_CLASS_FILE_PATH, "players.json"); //Set up Adventure repository. IAdventureRepository adventureRepository = LegacyAdventureRepository .getInstance(LegacyAdventureRepository.LEGACY_DUNGEON_BRIDGE_FILE_PATH, LegacyAdventureRepository.LEGACY_DUNGEON_FILE_PATH_PREFIX, equipmentRepository); //Set up Adventure manager who's Run() func should be used to run adventures on a daemon thread IAdventureManager adventureManager = new AdventureManager(client, 3); new Thread(() => { Thread.CurrentThread.Name = "Adventure Manager"; Thread.CurrentThread.IsBackground = true; adventureManager.Run(); }).Start(); //Set up Party Pool, this keeps track of current parties. IPartyPool partyPool = new PartyPool(client); //Set up Group finder, use the current adventure managers queue. Decide party size capacity for // group finder. GroupFinderFactory gff = new GroupFinderFactory(); IGroupFinder groupFinder = gff.Create(partyPool, 3, adventureRepository, adventureManager); //Set up FutureTask Registry which will keep track of time based operations FutureTaskRegistry futureTaskRegistry = new FutureTaskRegistry(); //Set up Custom Command Factory and Repository for the Command Manager allowing //for saved custom commands to be used aswell as providing capability for new //custom commands to be created from chat(broadcaster/mod only). CustomCommandFactory ccf = new CustomCommandFactory(); CustomCommandRepository ccr = new CustomCommandRepository(); CommandManager commandManager = new CommandManager(client, ccf, ccr); //Initialise all commands to be added to the command manager, seperated by //the source of the request, either PRVMSG or WHISPER. #region Initialisation of Commands #region General Commands UptimeCommand uptime = new UptimeCommand(); Command <IPrivRequest> broadcasting = new BroadcastingFlagCommand(user, playerRepo, pf, uptime, client, futureTaskRegistry, 1, 3, 2, TimeSpan.FromMinutes(30)); Command <IPrivRequest> time = new TimeCommand(); Command <IPrivRequest> playlist = new PlaylistCommand("http://open.spotify.com/user/1251282601/playlist/2j1FVSjJ4zdJiqGQgXgW3t"); Command <IPrivRequest> opinion = new OpinionCommand(); Command <IPrivRequest> pun = new PunCommand(); Command <IPrivRequest> quote = new QuoteCommand(); Command <IPrivRequest> raffle = new RaffleCommand(client, 5, futureTaskRegistry); #endregion #region RPG Commands #region General Command <IWhisperRequest> stats = new StatsCommand(pf, playerRepo); Command <IWhisperRequest> inventory = new InventoryCommand(pf, playerRepo); Command <IWhisperRequest> item = new ItemCommand(equipmentRepository, pf, playerRepo); Command <IWhisperRequest> equip = new EquipCommand(equipmentRepository, pf, playerRepo); Command <IWhisperRequest> unequip = new UnequipCommand(equipmentRepository, pf, playerRepo); Command <IWhisperRequest> shop = new ShopCommand(); Command <IWhisperRequest> classChoice = new ClassChoice(pf, playerRepo, 3); Command <IWhisperRequest> gloat = new GloatCommand(client, pf, playerRepo); Command <IWhisperRequest> respec = new RespecCommand(pf, playerRepo); Command <IWhisperRequest> daily = new DailyCommand(pf, playerRepo); Command <IWhisperRequest> queue = new QueueCommand(groupFinder, pf, playerRepo); Command <IWhisperRequest> leaveQueue = new LeaveQueueCommand(groupFinder, pf, playerRepo); Command <IWhisperRequest> queueTime = new QueueTimeCommand(groupFinder, pf, playerRepo); #endregion #region Party Commands Command <IWhisperRequest> createParty = new CreatePartyCommand(partyPool, pf, playerRepo); Command <IWhisperRequest> pendingInvite = new PendingInvite(partyPool, pf, playerRepo); Command <IWhisperRequest> leaveParty = new LeavePartyCommand(pf, playerRepo); #region Party Leader Commands Command <IWhisperRequest> partyAdd = new AddPartyCommand(client, pf, playerRepo); Command <IWhisperRequest> partyKick = new KickPartyCommand(client, pf, playerRepo); Command <IWhisperRequest> partyStart = new StartPartyCommand(groupFinder, pf, playerRepo); Command <IWhisperRequest> partyPromote = new PromotePartyCommand(client, pf, playerRepo); #endregion #endregion #region Broadcaster only Command <IWhisperRequest> addPlayerXp = new AddPlayerXP(pf, playerRepo); Command <IWhisperRequest> addPlayerCoin = new AddPlayerCoin(pf, playerRepo); Command <IWhisperRequest> setPlayerLevel = new SetPlayerLevel(pf, playerRepo); #endregion #endregion #endregion commandManager.AddAll(uptime, broadcasting, time, playlist, opinion, pun, quote, raffle); commandManager.AddAll(stats, inventory, item, equip, unequip, shop, classChoice, gloat, respec, daily, queue, leaveQueue, queueTime, createParty, pendingInvite, leaveParty, partyAdd, partyKick, partyStart, partyPromote, addPlayerXp, addPlayerCoin, setPlayerLevel); //Provide Handles for events raised by client, multiple handles can be added //allow for parsing of PRVMSG chat for mirroring certain messages. #region Client Event Handling client.AddOperationHandler += commandManager.Handle; client.CancelOperationHandler += commandManager.Handle; client.DeleteOperationHandler += commandManager.Handle; client.EditOperationHandler += commandManager.Handle; client.InfoOperationHandler += commandManager.Handle; client.PrivHandler += (o, e) => { Console.WriteLine(string.Format("{0}: {1}", e.User, e.Message)); }; client.PrivRequestHandler += commandManager.Handle; client.WhisperHandler += (o, e) => { Console.WriteLine(string.Format("Whisper {0}: {1}", e.User, e.Message)); }; client.WhisperRequestHandler += commandManager.Handle; #endregion //new thread for sending messages back to twitch server. new Thread(() => { Thread.CurrentThread.Name = "Twitch Client"; Thread.CurrentThread.IsBackground = true; client.Run(); }).Start(); futureTaskRegistry.Run(); }