Apexx 60 Posted July 23, 2017 Share Posted July 23, 2017 Hey, in c#, how can I test the time that has passed from combat start? Thanks! Link to comment https://wrobot.eu/forums/topic/6571-c-time-since-combat-start/ Share on other sites More sharing options...
reapler 154 Posted July 23, 2017 Share Posted July 23, 2017 Hello, for this purpose you need a stopwatch and events: private readonly Stopwatch _combatTimer = new Stopwatch(); public void Initialize() { EventsLua.AttachEventLua(LuaEventsId.PLAYER_REGEN_DISABLED, CombatStart); EventsLua.AttachEventLua(LuaEventsId.PLAYER_REGEN_ENABLED, CombatEnd); } private void CombatStart(object context) { _combatTimer.Restart(); } private void CombatEnd(object context) { _combatTimer.Reset(); } usage in a method for example: if (_combatTimer.ElapsedMilliseconds > 8000) { Logging.Write("In combat since 8 seconds"); } Matenia 1 Link to comment https://wrobot.eu/forums/topic/6571-c-time-since-combat-start/#findComment-29783 Share on other sites More sharing options...
Apexx 60 Posted July 23, 2017 Author Share Posted July 23, 2017 Excellent response! Thanks so much, @reapler! I will try this out soon. Link to comment https://wrobot.eu/forums/topic/6571-c-time-since-combat-start/#findComment-29784 Share on other sites More sharing options...
Droidz 2738 Posted July 24, 2017 Share Posted July 24, 2017 Hello, wManager.Wow.Helpers.Fight.CombatStartSince To get command, convert your xml fightclasses to c# (with fightclass editor) Link to comment https://wrobot.eu/forums/topic/6571-c-time-since-combat-start/#findComment-29794 Share on other sites More sharing options...
Apexx 60 Posted July 24, 2017 Author Share Posted July 24, 2017 Wow, I feel so dumb right now.. I should have known that. Thank you, @Droidz Link to comment https://wrobot.eu/forums/topic/6571-c-time-since-combat-start/#findComment-29808 Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now