public override bool Draw(UltimaBatcher2D batcher, int x, int y) { base.Draw(batcher, x, y); ResetHueVector(); for (int i = 0; i < _container.Count; i++) { if (i + 1 >= _container.Count) { break; } Control c0 = _container[i]; Control c1 = _container[i + 1]; batcher.DrawLine ( SolidColorTextureCache.GetTexture(Color.White), c0.ScreenCoordinateX, c0.ScreenCoordinateY, c1.ScreenCoordinateX, c1.ScreenCoordinateY, c0.ScreenCoordinateX + (c1.ScreenCoordinateX - c0.ScreenCoordinateX) / 2, c0.ScreenCoordinateY + (c1.ScreenCoordinateY - c0.ScreenCoordinateY) / 2 ); } return(true); }
public override bool Draw(UltimaBatcher2D batcher, int x, int y) { base.Draw(batcher, x, y); Vector3 hueVector = ShaderHueTranslator.GetHueVector(0); batcher.Draw ( _mapTexture, new Rectangle(x + _hit.X, y + _hit.Y, _hit.Width, _hit.Height), hueVector ); var texture = SolidColorTextureCache.GetTexture(Color.White); for (int i = 0; i < _container.Count; i++) { // HACK: redraw because pins are drawn when calling base.Draw(batcher, x, y); _container[i].Draw(batcher, x + _container[i].X, y + _container[i].Y); if (i + 1 >= _container.Count) { break; } Control c0 = _container[i]; Control c1 = _container[i + 1]; batcher.DrawLine ( texture, new Vector2(c0.ScreenCoordinateX, c0.ScreenCoordinateY), new Vector2(c1.ScreenCoordinateX, c1.ScreenCoordinateY), hueVector, 1 ); } return(true); }
public void Draw(UltimaBatcher2D batcher, int x, int y) { bool removeEffects = false; if (Timer < Engine.Ticks) { if (CurrentCount == 0) { return; } removeEffects = true; } else if (Type == 0xFF || Type == 0xFE) { return; } uint passed = Engine.Ticks - LastTick; if (passed > 7000) { LastTick = Engine.Ticks; passed = 25; } bool windChanged = false; if (WindTimer < Engine.Ticks) { if (WindTimer == 0) { windChanged = true; } WindTimer = Engine.Ticks + (uint)(RandomHelper.GetValue(7, 13) * 1000); sbyte lastWind = Wind; Wind = (sbyte)RandomHelper.GetValue(0, 4); if (RandomHelper.GetValue(0, 2) != 0) { Wind *= -1; } if (Wind < 0 && lastWind > 0) { Wind = 0; } else if (Wind > 0 && lastWind < 0) { Wind = 0; } if (lastWind != Wind) { windChanged = true; } } //switch ((WEATHER_TYPE) Type) //{ // case WEATHER_TYPE.WT_RAIN: // case WEATHER_TYPE.WT_FIERCE_STORM: // // TODO: set color // break; // case WEATHER_TYPE.WT_SNOW: // case WEATHER_TYPE.WT_STORM: // // TODO: set color // break; // default: // break; //} Point winpos = Engine.Profile.Current.GameWindowPosition; Point winsize = Engine.Profile.Current.GameWindowSize; for (int i = 0; i < Effects.Count; i++) { var effect = Effects[i]; if (effect.X < x || effect.X > x + winsize.X || effect.Y < y || effect.Y > y + winsize.Y) { if (removeEffects) { Effects.RemoveAt(i--); if (CurrentCount > 0) { CurrentCount--; } else { CurrentCount = 0; } continue; } effect.X = x + RandomHelper.GetValue(0, winsize.X); effect.Y = y + RandomHelper.GetValue(0, winsize.Y); } switch ((WEATHER_TYPE)Type) { case WEATHER_TYPE.WT_RAIN: float scaleRation = effect.ScaleRatio; effect.SpeedX = -4.5f - scaleRation; effect.SpeedY = 5.0f + scaleRation; break; case WEATHER_TYPE.WT_FIERCE_STORM: effect.SpeedX = Wind; effect.SpeedY = 6.0f; break; case WEATHER_TYPE.WT_SNOW: case WEATHER_TYPE.WT_STORM: if (Type == (byte)WEATHER_TYPE.WT_SNOW) { effect.SpeedX = Wind; effect.SpeedY = 1.0f; } else { effect.SpeedX = Wind * 1.5f; effect.SpeedY = 1.5f; } if (windChanged) { effect.SpeedAngle = MathHelper.ToDegrees((float)Math.Atan2(effect.SpeedX, effect.SpeedY)); effect.SpeedMagnitude = (float)Math.Sqrt(Math.Pow(effect.SpeedX, 2) + Math.Pow(effect.SpeedY, 2)); } float speed_angle = effect.SpeedAngle; float speed_magnitude = effect.SpeedMagnitude; speed_magnitude += effect.ScaleRatio; speed_angle += SinOscillate(0.4f, 20, Engine.Ticks + effect.ID); var rad = MathHelper.ToRadians(speed_angle); effect.SpeedX = speed_magnitude * (float)Math.Sin(rad); effect.SpeedY = speed_magnitude * (float)Math.Cos(rad); break; default: break; } float speedOffset = passed / SimulationRation; switch ((WEATHER_TYPE)Type) { case WEATHER_TYPE.WT_RAIN: case WEATHER_TYPE.WT_FIERCE_STORM: int oldX = (int)effect.X; int oldY = (int)effect.Y; float ofsx = effect.SpeedX * speedOffset; float ofsy = effect.SpeedY * speedOffset; effect.X += ofsx; effect.Y += ofsy; const float MAX_OFFSET_XY = 5.0f; if (ofsx >= MAX_OFFSET_XY) { oldX = (int)(effect.X - MAX_OFFSET_XY); } else if (ofsx <= -MAX_OFFSET_XY) { oldX = (int)(effect.X + MAX_OFFSET_XY); } if (ofsy >= MAX_OFFSET_XY) { oldY = (int)(effect.Y - MAX_OFFSET_XY); } else if (oldY <= -MAX_OFFSET_XY) { oldY = (int)(effect.Y + MAX_OFFSET_XY); } batcher.DrawLine(Textures.GetTexture(Color.Gray), x + oldX, y + oldY, x + (int)effect.X, y + (int)effect.Y, 0, 0); break; case WEATHER_TYPE.WT_SNOW: case WEATHER_TYPE.WT_STORM: effect.X += effect.SpeedX * speedOffset; effect.Y += effect.SpeedY * speedOffset; batcher.Draw2D(Textures.GetTexture(Color.White), x + (int)effect.X, y + (int)effect.Y, 2, 2, ref _hueVector); break; default: break; } } LastTick = Engine.Ticks; }
public void Draw(UltimaBatcher2D batcher) { //RETURN IF DISABLED if (!ProfileManager.CurrentProfile.UOClassicCombatLines) { return; } //POST Point p = World.Player.RealScreenPosition; p.X += (int)World.Player.Offset.X + 22; p.Y += (int)(World.Player.Offset.Y - World.Player.Offset.Z) + 22; //GET LIST FROM UI UOClassicCombatLines UOClassicCombatLines = UIManager.GetGump <UOClassicCombatLines>(); //GET LAST TARGET Entity _lasttarget = World.Get(TargetManager.LastTargetInfo.Serial); //SEARCH MOBS IN LIST foreach (Mobile mobile in World.Mobiles) { //VAR FOR MODES bool _draw = false; Color color = Color.White; if (!mobile.IsHuman) { continue; } if (mobile == World.Player) { continue; } switch (mobile.NotorietyFlag) { case NotorietyFlag.Innocent: if (ProfileManager.CurrentProfile.UOClassicCombatLines_ToggleHuntingMmode && ProfileManager.CurrentProfile.UOClassicCombatLines_ToggleHMBlue && !World.Party.Contains(mobile.Serial)) { _draw = true; } color = Color.Blue; break; case NotorietyFlag.Ally: color = Color.Green; break; case NotorietyFlag.Criminal: if (ProfileManager.CurrentProfile.UOClassicCombatLines_ToggleHuntingMmode && ProfileManager.CurrentProfile.UOClassicCombatLines_ToggleHMCriminal && !World.Party.Contains(mobile.Serial)) { _draw = true; } color = Color.Gray; break; case NotorietyFlag.Gray: color = Color.Gray; break; case NotorietyFlag.Enemy: if (ProfileManager.CurrentProfile.UOClassicCombatLines_ToggleHuntingMmode && ProfileManager.CurrentProfile.UOClassicCombatLines_ToggleHMOrange && !World.Party.Contains(mobile.Serial)) { _draw = true; } color = Color.Orange; break; case NotorietyFlag.Murderer: if (ProfileManager.CurrentProfile.UOClassicCombatLines_ToggleHuntingMmode && ProfileManager.CurrentProfile.UOClassicCombatLines_ToggleHMRed && !World.Party.Contains(mobile.Serial)) { _draw = true; } color = Color.Red; break; case NotorietyFlag.Invulnerable: color = Color.Yellow; break; default: color = Color.White; break; } if (ProfileManager.CurrentProfile.UOClassicCombatLines_ToggleLastTarget && _lasttarget != null) { if (mobile.Serial == _lasttarget.Serial) { _draw = true; color = Color.White; } } if (UOClassicCombatLines.entryList.Exists(mob => mob.Serial == mobile.Serial) || _draw) { //CALC WHERE MOBILE IS Point pm = mobile.RealScreenPosition; pm.X += (int)mobile.Offset.X + 22; pm.Y += (int)(mobile.Offset.Y - mobile.Offset.Z) + 22; if (!mobile.IsDead) { //CALC MIDDLE int ox = (pm.X + p.X) / 2; int oy = (pm.Y + p.Y) / 2; batcher.DrawLine(SolidColorTextureCache.GetTexture(color), pm.X, pm.Y, p.X, p.Y, ox, oy); } } } }