public override void Tick() { base.Tick(); Fresh.Tick(); if (ControllerPlugin == null) { ControllerPlugin = Server.vm.EODHost.GetFirstHandler <VMEODNightclubControllerPlugin>(); } if (PlayerClient != null && ControllerPlugin.RoundActive) { //active interaction is in index 0, callee is the invoker, dance id is var queue = PlayerClient.Avatar.Thread.Queue; var active = queue.FirstOrDefault(); var danceID = 0; if (PlayerClient.Avatar.Thread.ActiveQueueBlock > -1 && active.Callee == ControllerClient.Invoker && active.InteractionNumber > 5) { danceID = active.InteractionNumber - 6; } else { active = null; } if (active?.UID != ActiveInteractionUID) { if (ActiveInteractionUID != null) { //a dance ended. DanceCompleted(ActiveInteractionID); } ActiveInteractionUID = active?.UID; ActiveInteractionID = danceID; } if (++TimeSinceRatingChange > 30 * 5) { CalculateCurrentDanceRating(); } } //we register a dance as completed when its interaction }
public override void Tick() { base.Tick(); if (ControllerPlugin == null) { ControllerPlugin = Server.vm.EODHost.GetFirstHandler <VMEODNightclubControllerPlugin>(); } if (Tock % 3 == 0) { //S_DiscoverTiles(0, ControllerClient); if (ScreenTiles != null) { DrawAnimation(TileWrap++); } else { S_DiscoverTiles(1, ControllerClient); } } Tock++; }
public override void Tick() { base.Tick(); Fresh.Tick(); //push out ratings when we have a real client //under event 1 if (ControllerPlugin == null) { ControllerPlugin = Server.vm.EODHost.GetFirstHandler <VMEODNightclubControllerPlugin>(); } else if (ControllerClient != null) { if (TimeToRating-- == 0) { TimeToRating = 5 * 30; //todo: periodic send bool newPatternCorrect = false; for (int i = 0; i < 4; i++) { if (PatternDirty[i]) { var p = Patterns[i]; var ind = (short)((p[0] - '0') * 16 + (p[1] - '0') * 4 + (p[2] - '0')); var dist = ControllerPlugin.CurrentWinningDJPattern[i] - ind; if (dist == 0 && !PatternCorrect[i]) { PatternCorrect[i] = true; newPatternCorrect = true; } Fresh.SendCommand(ind, i); var distPct = 1 - Math.Abs(dist / 64f); PatternRatings[i] = (distPct) * (distPct); PatternDirty[i] = false; } } //recalculate our rating. send it out too! var avg = PatternRatings.Average(); Rating = (int)Math.Min(100, Math.Round(100 * (0.8f * avg * Fresh.GoodScoreFreshness + 0.25f * ControllerPlugin.RoundPercentage()))); ControllerClient.SendOBJEvent(new VMEODEvent(1, (short)Rating)); if (newPatternCorrect) { var stationPos = ControllerClient.Invoker.Position; ControllerPlugin.DanceFloor.AddParticle(VMEODNCParticleType.Arrow, ControllerPlugin.DanceFloor.GetDirection(new Point(stationPos.TileX, stationPos.TileY)), 0, GroupID); } else if (LastRating != Rating && LastRating != -1) { if (LastRating > Rating) { ControllerPlugin.DanceFloor.AddParticle(VMEODNCParticleType.Colder, 0, 0, GroupID); } else { var rand = new Random(); ControllerPlugin.DanceFloor.AddParticle(VMEODNCParticleType.Line, (float)(rand.Next(8) * Math.PI / 4), 0, GroupID); } } LastRating = Rating; } } }