Results 1 to 10 of 10

Threaded View

  1. #1
    HGAEHaeheadhetdhtertherh's Avatar
    Join Date
    Oct 2015
    Gender
    male
    Posts
    281
    Reputation
    10
    Thanks
    199

    [FSOD] Grenade Fix

    replace Grenade.cs with this
    Code:
    #region
    
    using System;
    using wServer.networking.svrPackets;
    using wServer.realm;
    using wServer.realm.entities;
    using wServer.realm.entities.player;
    
    #endregion
    
    namespace wServer.logic.behaviors
    {
        public class Grenade : Behavior
        {
            //State storage: cooldown timer
    
            private readonly int damage;
            private readonly float radius;
            private readonly double range;
            private Cooldown coolDown;
            private double? fixedAngle;
    
            public Grenade(double radius, int damage, double range = 5,
                double? fixedAngle = null, Cooldown coolDown = new Cooldown())
            {
                this.radius = (float) radius;
                this.damage = damage;
                this.range = range;
                this.fixedAngle = fixedAngle*Math.PI/180;
                this.coolDown = coolDown.Normalize();
            }
    
            protected override void OnStateEntry(Entity host, RealmTime time, ref object state)
            {
                state = 0;
            }
    
            protected override void TickCore(Entity host, RealmTime time, ref object state)
            {
                int cool = (int) state;
    
                if (cool <= 0)
                {
                    if (host.HasConditionEffect(ConditionEffectIndex.Stunned)) return;
    
                    Entity player = host.GetNearestEntity(range, null);
                    if (player != null || fixedAngle != null)
                    {
                        Position target;
                        if (fixedAngle != null)
                            target = new Position
                            {
                                X = host.X + (float)(range * Math.Cos(fixedAngle.Value)),
                                Y = host.Y + (float)(range * Math.Sin(fixedAngle.Value)),
                            };
                        else
                            target = new Position
                            {
                                X = player.X,
                                Y = player.Y,
                            };
                        host.Owner.BroadcastPacket(new ShowEffectPacket
                        {
                            EffectType = EffectType.Throw,
                            Color = new ARGB(0xffff0000),
                            TargetId = host.Id,
                            PosA = target
                        }, null);
                        host.Owner.Timers.Add(new WorldTimer(1500, (world, t) =>
                        {
                            world.BroadcastPacket(new AOEPacket
                            {
                                Position = target,
                                Radius = radius,
                                Damage = (ushort) damage,
                                EffectDuration = 0,
                                Effects = 0,
                                OriginType = (short)host.ObjectType
                            }, null);
                            world.Aoe(target, radius, true, p => { (p as IPlayer).Damage(damage, host as Character); });
                        }));
                    }
                    cool = coolDown.Next(Random);
                }
                else
                    cool -= time.thisTickTimes;
    
                state = cool;
            }
        }
    }
    Simple Fix by Me
    Last edited by HGAEHaeheadhetdhtertherh; 01-03-2017 at 03:25 AM.

  2. The Following User Says Thank You to HGAEHaeheadhetdhtertherh For This Useful Post:

    The Real DethStrike (10-09-2017)

Similar Threads

  1. [FSOD] Davy Jones Fixed.
    By MikeRaarupBirk in forum Realm of the Mad God Private Servers Tutorials/Source Code
    Replies: 13
    Last Post: 10-14-2016, 09:19 AM
  2. [Help Request] How to replace/fix FSOD dungeons?
    By ZombiJordan in forum Realm of the Mad God Private Servers Help
    Replies: 2
    Last Post: 09-02-2016, 05:10 AM
  3. [Help Request] how to fix buy gold FSOD
    By OGgurk in forum Realm of the Mad God Private Servers Help
    Replies: 3
    Last Post: 06-06-2016, 06:36 PM
  4. FSoD Paladin Seal fix
    By Masternx in forum Realm of the Mad God Private Servers Tutorials/Source Code
    Replies: 15
    Last Post: 05-07-2016, 01:29 AM
  5. grenades
    By gothgod in forum General Game Hacking
    Replies: 5
    Last Post: 12-29-2005, 11:54 AM