Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #region shoot
- public void Shoot()
- {
- bool CanShoot = false;
- if (Session.GetHabbo().CurrentWeapon.WeaponType.ToLower() == "gun" || Session.GetHabbo().CurrentWeapon.WeaponType.ToLower() == "projectile")
- CanShoot = true;
- if (Session.GetHabbo().CurrentWeapon != null && CanShoot)
- {
- string Username = Params[1];
- string DeathMessage = String.Empty;
- List<GameClient> ToSplashDamage = new List<GameClient>();
- if (!String.IsNullOrEmpty(Username) || Username != null)
- {
- Room Room = Session.GetHabbo().CurrentRoom;
- RoomUser Me = Room.GetRoomUserManager().GetRoomUserByHabbo(Session.GetHabbo().Username);
- RoomUser Rival = Room.GetRoomUserManager().GetRoomUserByHabbo(Username);
- if (Me.IsTazed)
- return;
- if (Username.ToLower() == Session.GetHabbo().Username.ToLower())
- {
- return;
- }
- if (Room.Description.Contains("HIT_DISABLED") && Session.GetHabbo().Rank < 10)
- {
- if (!Rival.GetClient().GetHabbo().IsZombie)
- {
- Session.SendNotif("Fighting has been disabled in this room.");
- return;
- }
- else if (!ButterflyEnvironment.ZombieInfectionMode && Rival.GetClient().GetHabbo().IsZombie)
- {
- Rival.GetClient().GetHabbo().IsZombie = false;
- }
- else if (Rival.GetClient().GetHabbo().IsWorking)
- {
- Session.SendNotif("Fighting has been disabled in this room.");
- return;
- }
- }
- if (Session.GetHabbo().CurrentWeapon.AmmoLoaded < 1)
- {
- Me.ForceWhisper(Session, "You are out of ammo for this weapon! You must :reload before you can use it again!");
- return;
- }
- if (Rival != null && Me != null)
- {
- int WeaponRange = Session.GetHabbo().CurrentWeapon.WeaponRange;
- int MaxDamage = Session.GetHabbo().CurrentWeapon.MaxDamage;
- if (Session.GetHabbo().CurrentWeapon.HasFmj)
- {
- MaxDamage += 60;
- }
- if (Session.GetHabbo().CurrentWeapon.HasRedDot)
- {
- WeaponRange += 6;
- }
- if (Rival.GetClient().GetHabbo().IsAfk)
- {
- Session.GetHabbo().CurrentRoom.GetRoomUserManager().GetRoomUserByHabbo(Session.GetHabbo().Username).ForceWhisper(Session, "You cannot shoot users who are afk!");
- return;
- }
- if (Rival.GetClient().GetHabbo().HitPoints > Rival.GetClient().GetHabbo().MaxHitPoints)
- {
- Rival.GetClient().GetHabbo().HitPoints = Rival.GetClient().GetHabbo().MaxHitPoints;
- }
- if(Rival.GetClient().GetHabbo().CurrentRoomId == Session.GetHabbo().CurrentRoomId && Session.GetHabbo().CanReachUser(Rival, WeaponRange))
- {
- Random rand = new Random();
- int WillHit = rand.Next(1, MaxDamage);
- TimeSpan Span = DateTime.Now - Session.GetHabbo().LastShotAt;
- int CoolDown = Session.GetHabbo().CocaineEffects ? 2 : 4;
- if (Span.Seconds <= CoolDown && Session.GetHabbo().ShootCounter >= 1)
- {
- Me.ForceWhisper(Session, "*Cooling down (" + Span.Seconds + "/" + CoolDown + ")*");
- return;
- }
- else
- {
- Session.GetHabbo().ShootCounter = 0;
- }
- int NewHealth = Rival.GetClient().GetHabbo().HitPoints - WillHit;
- if (WillHit > 0)
- {
- int Chance = rand.Next(1, 20);
- bool Bypass = true;
- double AgilChance = Convert.ToDouble(Rival.GetClient().GetHabbo().AgilityHitChance);
- int FinalChance = Rival.GetClient().GetHabbo().AgilityHitChance;
- if (Session.GetHabbo().HasMDMAEffects && Rival.GetClient().GetHabbo().AgilityLevel > 1)
- {
- AgilChance = AgilChance / 2;
- FinalChance += Convert.ToInt32(Math.Round(AgilChance, 0, MidpointRounding.AwayFromZero));
- }
- if (Session.GetHabbo().CurrentWeapon.WeaponType.ToLower() == "projectile")
- {
- ToSplashDamage = Rival.GetClient().GetHabbo().GetUsersInRadius(Session.GetHabbo().CurrentWeapon.WeaponRadius);
- }
- if (Chance > FinalChance)
- Bypass = false;
- if (Session.GetHabbo().CurrentWeapon.WeaponName.ToLower() == "the force")
- Bypass = true;
- if (!Bypass)
- {
- Session.GetHabbo().CurrentWeapon.AmmoLoaded -= 1;
- Me.Chat(Session, "*Shoots their " + Session.GetHabbo().CurrentWeapon.WeaponName + " at " + Rival.GetClient().GetHabbo().Username + ", but " + Rival.GetClient().GetHabbo().Username + " dodged it*", true, true);
- Session.GetHabbo().LastShotAt = DateTime.Now;
- Session.GetHabbo().ShootCounter = Session.GetHabbo().ShootCounter + 1;
- return;
- }
- if (NewHealth > 0)
- {
- Me.Chat(Session, "*Shoots their " + Session.GetHabbo().CurrentWeapon.WeaponName + " at " + Rival.GetClient().GetHabbo().Username + ", hitting them for " + WillHit.ToString() + " damage. (" + NewHealth.ToString() + "/" + Rival.GetClient().GetHabbo().MaxHitPoints.ToString() + ")*", true, true);
- Rival.GetClient().GetHabbo().HitPoints = NewHealth;
- Logging.WriteLine("[Combat] " + Session.GetHabbo().Username + " has hit " + Rival.GetClient().GetHabbo().Username + " for " + WillHit.ToString() + " damage");
- }
- else
- {
- Me.Chat(Session, "*Shoots their " + Session.GetHabbo().CurrentWeapon.WeaponName + " at " + Rival.GetClient().GetHabbo().Username + ", killing them*", true, true);
- Session.GetHabbo().KillCount = Session.GetHabbo().KillCount + 1;
- if (Rival.GetClient().GetHabbo().IsWorkingOut)
- {
- Rival.GetClient().GetHabbo().StopWorkoutTimer(false);
- }
- if (Rival.GetClient().GetHabbo().Credits > 1 && !Rival.GetClient().GetHabbo().IsZombie)
- {
- int MaxTake = Rival.GetClient().GetHabbo().Credits;
- int MyTake = rand.Next(1, Rival.GetClient().GetHabbo().Credits - 1);
- Session.GetHabbo().Credits = Session.GetHabbo().Credits + MyTake;
- Session.GetHabbo().UpdateCreditsBalance();
- Rival.GetClient().GetHabbo().Credits = Rival.GetClient().GetHabbo().Credits - MyTake;
- Rival.GetClient().GetHabbo().UpdateCreditsBalance();
- Me.Chat(Session, "*Has picked up $" + MyTake.ToString() + " from " + Rival.GetClient().GetHabbo().Username + "'s dead body*", true);
- DeathMessage = "You have been killed by " + Session.GetHabbo().Username + " and transported to hospital. You must wait 2 minutes to heal fully.\rYou lost $" + MyTake.ToString() + " on death. Remember to utilise your bank account!";
- }
- else
- {
- DeathMessage = "You have been killed by " + Session.GetHabbo().Username + " and transported to hospital. You must wait 2 minutes to heal fully.";
- }
- Rival.GetClient().GetHabbo().IsSmokingWeed = false;
- int BountyAmount = 0;
- if (ButterflyEnvironment.Bounties.TryGetValue(Rival.GetClient(), out BountyAmount) && !ButterflyEnvironment.ZombieInfectionMode)
- {
- Session.GetHabbo().Credits += BountyAmount;
- Session.GetHabbo().UpdateCreditsBalance();
- ServerMessage HotelAlert = new ServerMessage(808);
- HotelAlert.AppendStringWithBreak("Message from the Agency");
- HotelAlert.AppendStringWithBreak("The bounty placed on " + Rival.GetClient().GetHabbo().Username + " for $" + BountyAmount + " has been collected by " + Session.GetHabbo().Username);
- ButterflyEnvironment.GetGame().GetClientManager().QueueBroadcaseMessage(HotelAlert);
- ButterflyEnvironment.Bounties.Remove(Rival.GetClient());
- Logging.WriteLine("[Bounty] The bounty on " + Rival.GetClient().GetHabbo().Username + " has been collected by " + Session.GetHabbo().Username);
- }
- Rival.GetClient().GetHabbo().HitPoints = 0;
- Rival.GetClient().GetHabbo().GotKilledAt = DateTime.Now;
- Rival.GetClient().GetHabbo().JustGotKilled = true;
- Rival.GetClient().GetHabbo().UserDead = true;
- Rival.GetClient().SendNotif(DeathMessage);
- Rival.GetClient().GetHabbo().CanTravel = true;
- Rival.GetClient().GetMessageHandler().PrepareRoomForUser(ButterflyEnvironment.HospitalRoomId, String.Empty);
- Logging.WriteLine("[Combat] " + Session.GetHabbo().Username + " has killed " + Rival.GetClient().GetHabbo().Username);
- }
- Session.GetHabbo().CurrentWeapon.AmmoLoaded -= 1;
- Session.GetHabbo().LastShotAt = DateTime.Now;
- Session.GetHabbo().ShootCounter = Session.GetHabbo().ShootCounter + 1;
- if (Session.GetHabbo().CurrentWeapon.WeaponType.ToLower() == "projectile" && ToSplashDamage.Count > 0)
- {
- foreach (GameClient Cli in ToSplashDamage)
- {
- if (Cli == null || Cli == Session || Cli.GetHabbo().IsAfk)
- continue;
- int SplashDamageHit = rand.Next(1, WillHit);
- if (Cli.GetHabbo().HitPoints - SplashDamageHit < 1)
- {
- Cli.GetHabbo().IsSmokingWeed = false;
- Cli.GetHabbo().GotKilledAt = DateTime.Now;
- Cli.GetHabbo().JustGotKilled = true;
- Cli.GetHabbo().UserDead = true;
- Cli.GetHabbo().CanTravel = true;
- Cli.SendNotif("You were killed by an explosive fired by " + Session.GetHabbo().Username + ".\rYou have not lost any money.");
- Cli.GetMessageHandler().PrepareRoomForUser(ButterflyEnvironment.HospitalRoomId, String.Empty);
- Logging.WriteLine("[Combat] " + Cli.GetHabbo().Username + " has been killed due to splash damage");
- }
- else
- {
- Cli.GetHabbo().HitPoints -= SplashDamageHit;
- Cli.GetHabbo().Shout("*Has been hit by an explosion, causing " + SplashDamageHit.ToString() + " damage (" + Cli.GetHabbo().HitPoints.ToString() + "/" + Cli.GetHabbo().MaxHitPoints + ")*", true);
- Logging.WriteLine("[Combat] " + Cli.GetHabbo().Username + " has been hit for " + SplashDamageHit.ToString() + " health by splash damage");
- }
- }
- }
- }
- }
- }
- }
- }
- }
- #endregion
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement