public static void ExecuteAttack(GameClient Session, GameClient TargetSession) { if (CombatManager.CanAttack(Session, TargetSession)) { bool Boxed = false; int Damage = CombatManager.DamageCalculator(Session); if (TargetSession.GetRoleplay().Armor >= 1 && TargetSession.GetRoleplay().inColourWars == false) { TargetSession.GetRoleplay().Armor -= Damage; #region Armor Broken? if (TargetSession.GetRoleplay().Armor <= 0 && TargetSession.GetRoleplay().Armored == true) { TargetSession.GetRoleplay().Armored = false; TargetSession.GetRoleplay().ArmoredFigSet = false; Session.GetRoleplay().ApplySpecialStatus("armored"); TargetSession.GetHabbo().GetRoomUser().LastBubble = 3; RoleplayManager.Shout(TargetSession, "*Body-armor shatters*"); TargetSession.GetHabbo().GetRoomUser().LastBubble = 0; } #endregion } else { TargetSession.GetRoleplay().CurHealth -= Damage; } if (!Session.GetRoleplay().inColourWars&& Session.GetRoleplay().InMafiaWars == false) { Session.GetRoleplay().Energy -= 2; } Session.GetRoleplay().Punches++; if (TargetSession.GetRoleplay().CurHealth <= 0) { if (TargetSession.GetRoleplay().IsBoxing) { if (TargetSession == Session) { Session.GetRoleplay().CurHealth = 1; Session.SendWhisper("You cannot kill yourself!"); return; } if (Session.GetRoleplay().BoxingRoom != null && Session.GetRoleplay().BoxingRoom.SoloQueue != null) { RoleplayManager.Shout(Session, "*Swings my fist at " + TargetSession.GetHabbo().UserName + ", knocking them out winning the round!*"); Boxed = true; Session.GetRoleplay().BoxingRoom.SoloQueue.EndMatch(Session.GetHabbo().UserName, true); } } if (TargetSession.GetRoleplay().inColourWars) { if (TargetSession == Session) { Session.GetRoleplay().CurHealth = 1; Session.SendWhisper("You cannot kill yourself!"); return; } Session.GetHabbo().GetRoomUser().LastBubble = 3; Session.GetRoleplay().GiveColorWarPoints(ColourManager.KillPoints); Session.Shout("*Clecnhes my fist, swinging it hard and fast at " + TargetSession.GetHabbo().UserName + ", Landing a blow on their face causing " + Damage + " damage, sending them back to the graveyard! [+ " + ColourManager.KillPoints + " Color Wars Pts]*"); TargetSession.GetRoleplay().Transport(ColourManager.GraveYardID, 2); TargetSession.GetRoleplay().CurHealth = 100; TargetSession.GetRoleplay().Energy = 100; TargetSession.GetRoleplay().Hunger = 0; new DeadTimer(TargetSession); // Add color points } if (TargetSession.GetRoleplay().InMafiaWars) { if (TargetSession == Session) { Session.GetRoleplay().CurHealth = 1; Session.SendWhisper("You cannot kill yourself!"); return; } Session.GetHabbo().GetRoomUser().LastBubble = 3; Session.GetRoleplay().GiveMafiaWarPoints(MafiaWarManager.KillPoints); RoleplayManager.Shout(Session, "*Swings my fist at " + TargetSession.GetHabbo().UserName + ", Landing a blow on their face causing " + Damage + " damage, sending them back to the start! [+ " + MafiaWarManager.KillPoints + " Mafia Wars Pts]*"); TargetSession.GetRoleplay().Transport(Plus.GetGame().MafiaWars.GraveYardID, 2); TargetSession.GetRoleplay().CurHealth = 100; TargetSession.GetRoleplay().Energy = 100; TargetSession.GetRoleplay().Hunger = 0; } if (TargetSession.GetRoleplay().Brawl == true) { Session.GetRoleplay().GiveColorWarPoints(1); Session.GetHabbo().GetRoomUser().LastBubble = 3; RoleplayManager.Shout(Session, "*Swings at " + TargetSession.GetHabbo().UserName + ", causing " + Damage + " damage, and kicking them out of brawl! [+5BP]*"); Session.GetHabbo().GetRoomUser().LastBubble = 0; Session.GetRoleplay().Brawl_Pts += 5; Session.GetRoleplay().SaveQuickStat("brawl_pts", Session.GetRoleplay().Brawl_Pts + ""); TargetSession.GetRoleplay().Brawl = false; TargetSession.GetRoleplay().inBrawl = false; if (TargetSession.GetRoleplay().Working) { TargetSession.GetRoleplay().StopWork(); } TargetSession.GetRoleplay().DeadFigSet = false; TargetSession.GetRoleplay().DeadSeconds = 60; TargetSession.GetRoleplay().DeadTimer = 2; TargetSession.GetRoleplay().Dead = true; if (TargetSession.GetRoleplay().usingCar == true) { TargetSession.GetRoleplay().usingCar = false; TargetSession.GetHabbo().GetRoomUser().FastWalking = false; } RoomUser User1 = null; User1 = TargetSession.GetHabbo().GetRoomUser(); RoleplayManager.HandleDeath(TargetSession); } else if (TargetSession.GetRoleplay().Brawl == false && TargetSession.GetRoleplay().inColourWars == false && !TargetSession.GetRoleplay().InMafiaWars&& Boxed == false) { #region Gang Rewards if (Session.GetRoleplay().GangId > 0 && GangManager.validGang(Session.GetRoleplay().GangId, Session.GetRoleplay().GangRank)) { Random _s = new Random(); using (IQueryAdapter dbClient = Plus.GetDatabaseManager().GetQueryReactor()) { bool HasGang = false; int gangpts = _s.Next((TargetSession.GetRoleplay().Strength + TargetSession.GetRoleplay().savedSTR) * 1 - (int)Math.Round((double)(TargetSession.GetRoleplay().Strength + TargetSession.GetRoleplay().savedSTR) / 3, 0), TargetSession.GetRoleplay().Strength * 2); GangManager.GangData[Session.GetRoleplay().GangId].Kills++; GangManager.GangData[Session.GetRoleplay().GangId].Points += gangpts; if (TargetSession.GetRoleplay().GangId > 0 && GangManager.validGang(TargetSession.GetRoleplay().GangId, TargetSession.GetRoleplay().GangRank)) { HasGang = true; } if (HasGang) { if (!Session.GetHabbo().HasFuse("fuse_owner")) { GangManager.GangData[TargetSession.GetRoleplay().GangId].Deaths++; } dbClient.RunFastQuery("UPDATE rp_gangs SET deaths = " + GangManager.GangData[TargetSession.GetRoleplay().GangId].Deaths + " WHERE id = " + TargetSession.GetRoleplay().GangId + ""); } dbClient.RunFastQuery("UPDATE rp_gangs SET kills = " + GangManager.GangData[Session.GetRoleplay().GangId].Kills + ", points = " + GangManager.GangData[Session.GetRoleplay().GangId].Points + " WHERE id = " + Session.GetRoleplay().GangId + ""); } } #endregion Session.GetHabbo().GetRoomUser().LastBubble = 3; /*if (Session.GetRoleplay().LastKilled != TargetSession.GetHabbo().UserName) * {*/ int score = new Random().Next(0, 20); Session.GetHabbo().AchievementPoints += score; Session.GetHabbo().UpdateActivityPointsBalance(); Session.GetRoleplay().Kills++; Session.GetRoleplay().PunchKills++; Session.SendMessage(AchievementScoreUpdateComposer.Compose(Session.GetHabbo().AchievementPoints)); Session.Shout("*Lands a final blow to their face " + TargetSession.GetHabbo().UserName + ", causing " + Damage + " damage sending them to hospital! [-2 Energy, +" + score + " PTS]*"); /*} * if (Session.GetRoleplay().LastKilled == TargetSession.GetHabbo().UserName) * { * Shout(Session, "*Swings at " + TargetSession.GetHabbo().UserName + ", causing " + Damage + " damage and knocking them out! [-2 Energy]*"); * Session.SendWhisper("The last person you killed is this same person!"); * }*/ Session.GetHabbo().GetRoomUser().LastBubble = 0; if (!Session.GetHabbo().HasFuse("fuse_owner")) { TargetSession.GetRoleplay().Deaths++; } TargetSession.SendNotif("You were knocked out by " + Session.GetHabbo().UserName + ", and being transported to the hospital!"); if (TargetSession.GetRoleplay().Working) { TargetSession.GetRoleplay().StopWork(); } TargetSession.GetRoleplay().DeadFigSet = false; TargetSession.GetRoleplay().DeadSeconds = 60; TargetSession.GetRoleplay().DeadTimer = 2; TargetSession.GetRoleplay().Dead = true; if (TargetSession.GetRoleplay().usingCar == true) { TargetSession.GetRoleplay().usingCar = false; TargetSession.GetHabbo().GetRoomUser().FastWalking = false; } RoomUser User = null; User = TargetSession.GetHabbo().GetRoomUser(); RoleplayManager.HandleDeath(TargetSession); Bounties.CheckBounty(Session, TargetSession.GetHabbo().UserName); Plus.GetGame().GetAchievementManager().ProgressUserAchievement(Session, "ACH_Fighter", 1); Plus.GetGame().GetAchievementManager().ProgressUserAchievement(TargetSession, "ACH_Death", 1); } } else { Session.GetHabbo().GetRoomUser().LastBubble = 3; TargetSession.GetHabbo().GetRoomUser().LastBubble = 3; Session.Shout("*Swings at " + TargetSession.GetHabbo().UserName + ", causing " + Damage + " damage [-2 Energy]*"); if (TargetSession.GetRoleplay().Armor >= 1 && TargetSession.GetRoleplay().inColourWars == false) { RoleplayManager.commandShout(TargetSession, "*[" + TargetSession.GetRoleplay().Armor + "AP Left!]*", 3); } else { RoleplayManager.commandShout(TargetSession, "*[" + TargetSession.GetRoleplay().CurHealth + "/" + TargetSession.GetRoleplay().MaxHealth + "]*", 3); } Session.GetHabbo().GetRoomUser().LastBubble = 0; TargetSession.GetHabbo().GetRoomUser().LastBubble = 0; } Session.GetRoleplay().CoolDown = 3; Session.GetRoleplay().LastKilled = TargetSession.GetHabbo().UserName; TargetSession.GetRoleplay().UpdateStats++; Session.GetRoleplay().UpdateStats++; } else { return; } }