public void timerDone(object info) { try { timeLeft -= 60000; #region Conditions if (Session == null) { stopTimer(); return; } if (timeLeft == 3 * 60000) { if (GangManager.TurfData[Convert.ToInt32(Session.GetHabbo().CurrentRoomId)].GangId > 0) { RoleplayManager.AlertGang("Your turf is slowly being captured in RoomID " + Session.GetHabbo().CurrentRoomId + "! They're getting close!", GangManager.TurfData[Convert.ToInt32(Session.GetHabbo().CurrentRoomId)].GangId); } } else if (timeLeft == 1 * 60000) { if (GangManager.TurfData[Convert.ToInt32(Session.GetHabbo().CurrentRoomId)].GangId > 0) { RoleplayManager.AlertGang("Your turf is nearly captured in RoomID " + Session.GetHabbo().CurrentRoomId + "! Hurry Hurry!", GangManager.TurfData[Convert.ToInt32(Session.GetHabbo().CurrentRoomId)].GangId); } } if (timeLeft > 0) { int minutesRemaining = timeLeft / 60000; Session.SendWhisper("You have " + minutesRemaining + " minute(s) left until you capture the turf!"); timer.Change(60000, Timeout.Infinite); return; } #endregion #region Execute RoleplayManager.Shout(Session, "*Successfully captures gang turf*"); GangManager.TurfData[Convert.ToInt32(Session.GetHabbo().CurrentRoomId)].GangId = Session.GetRoleplay().GangId; using (IQueryAdapter dbClient = Plus.GetDatabaseManager().GetQueryReactor()) { dbClient.RunFastQuery("UPDATE rp_gangs_turfs SET gang_id = '" + Session.GetRoleplay().GangId + "' WHERE turf_id = '" + Session.GetHabbo().CurrentRoomId + "'"); } GangManager.initTurfs(); if (GangManager.TurfData[Convert.ToInt32(Session.GetHabbo().CurrentRoomId)].GangId > 0) { RoleplayManager.AlertGang("Your turf just got captured in RoomID " + Session.GetHabbo().CurrentRoomId + "! It's too late!", GangManager.TurfData[Convert.ToInt32(Session.GetHabbo().CurrentRoomId)].GangId); } Session.GetRoleplay().GangCapturing = false; stopTimer(); #endregion } catch { stopTimer(); } }
public void Setup() { _mockGangProvider = new Mock <IGangProvider>(); _mockGangerProvider = new Mock <IGangerProvider>(); _mockSkillProvider = new Mock <ISkillProvider>(); _mockTerritoryProvider = new Mock <ITerritoryProvider>(); _mockWeaponProvider = new Mock <IWeaponProvider>(); _mockInjuryProvider = new Mock <IInjuryProvider>(); _mockDiceRoller = new Mock <IDiceRoller>(); _gangManager = new GangManager(_mockGangProvider.Object, _mockGangerProvider.Object, _mockTerritoryProvider.Object, _mockWeaponProvider.Object, _mockInjuryProvider.Object, _mockSkillProvider.Object, _mockDiceRoller.Object); }
/// <summary> /// Initializes a new instance of the <see cref="Game"/> class. /// </summary> /// <param name="conns">The conns.</param> internal Game(int conns) { Console.WriteLine(); Console.WriteLine(@" ╔═╗╔╗╔╗──── ╔═╗╔═╗ ", @""); Console.WriteLine(@" ║╔╝╠╣║╚╗╔╦╗ ║╬║║╬║ ", @""); Console.WriteLine(@" ║╚╗║║║╔╣║║║ ║╗╣║╔╝", @""); Console.WriteLine(@" ╚═╝╚╝╚═╝╠╗║ ╚╩╝╚╝─ ", @""); Console.WriteLine(@" ────────╚═╝ ────── ", @""); Console.WriteLine(); Out.WriteLine(@"Mereos Developer", @"", ConsoleColor.Red); Out.WriteLine(@"Emulador desenvolvido para CityRP.", @"", ConsoleColor.Red); Console.WriteLine(); Out.WriteLine(@"CityRP Emulador está inicializando...", @"", ConsoleColor.Green); Console.WriteLine(); _clientManager = new GameClientManager(); using (var queryReactor = Plus.GetDatabaseManager().GetQueryReactor()) { AbstractBar bar = new AnimatedBar(); const int wait = 15, end = 5; uint itemsLoaded; uint navigatorLoaded; uint roomModelLoaded; uint achievementLoaded; uint pollLoaded; Progress(bar, wait, end, "Loading Bans..."); _banManager = new ModerationBanManager(); _banManager.Init(); Progress(bar, wait, end, "Loading Roles..."); _roleManager = new RoleManager(); _roleManager.LoadRights(queryReactor); Progress(bar, wait, end, "Loading Items..."); _itemManager = new ItemManager(); _itemManager.LoadItems(queryReactor, out itemsLoaded); Progress(bar, wait, end, "Loading Catalog..."); _catalog = new Catalog(); Progress(bar, wait, end, "Loading Clothing..."); _clothingManager = new ClothingManager(); _clothingManager.Initialize(queryReactor); Progress(bar, wait, end, "Loading Crafting..."); _craftingManager = new CraftingManager(); _craftingManager.Initialize(queryReactor); Progress(bar, wait, end, "Loading Rooms..."); _roomManager = new RoomManager(); _roomManager.LoadModels(queryReactor, out roomModelLoaded); Progress(bar, wait, end, "Loading Navigator..."); _navigator = new Navigator(); _navigator.Initialize(queryReactor, out navigatorLoaded); Progress(bar, wait, end, "Loading Groups..."); _groupManager = new GroupManager(); _groupManager.InitGroups(); _globalInventory = new InventoryGlobal(); Progress(bar, wait, end, "Loading HotelView..."); _hotelView = new HotelView(); Progress(bar, wait, end, "Loading ModerationTool..."); _moderationTool = new ModerationTool(); _moderationTool.LoadMessagePresets(queryReactor); _moderationTool.LoadPendingTickets(queryReactor); Progress(bar, wait, end, "Loading Bots..."); _botManager = new BotManager(); Progress(bar, wait, end, "Loading Quests..."); _questManager = new QuestManager(); _questManager.Initialize(queryReactor); Progress(bar, wait, end, "Loading Events..."); _events = new RoomEvents(); Progress(bar, wait, end, "Loading Ranks..."); _roomRankConfig = new RoomRankConfig(); _roomRankConfig.Initialize(); Progress(bar, wait, end, "Loading Talents..."); _talentManager = new TalentManager(); _talentManager.Initialize(queryReactor); Progress(bar, wait, end, "Loading Pinata..."); _pinataHandler = new PinataHandler(); _pinataHandler.Initialize(queryReactor); Progress(bar, wait, end, "Loading Crackable Eggs..."); _crackableEggHandler = new CrackableEggHandler(); _crackableEggHandler.Initialize(queryReactor); Progress(bar, wait, end, "Loading Polls..."); _pollManager = new PollManager(); _pollManager.Init(queryReactor, out pollLoaded); Progress(bar, wait, end, "Loading Achievements..."); _achievementManager = new AchievementManager(queryReactor, out achievementLoaded); Progress(bar, wait, end, "Loading StaticMessages ..."); StaticMessagesManager.Load(); Progress(bar, wait, end, "Loading Guides ..."); _guideManager = new GuideManager(); #region Roleplay Console.Write("[" + DateTime.Now.ToString("HH:mm:ss") + "] >> Lista de procurados gerada!"); Console.WriteLine(" -> READY!"); RoleplayManager.GenerateWantedList(); JobManager.init(); Console.Write("[" + DateTime.Now.ToString("HH:mm:ss") + "] >> " + JobManager.JobData.Count + " Trabalhos carregados"); Console.WriteLine(" -> READY!"); GetGroupManager().InitGroups(); GangManager.init(); Console.Write("[" + DateTime.Now.ToString("HH:mm:ss") + "] >> " + GangManager.GangData.Count + " Gangues carregadas"); Console.WriteLine(" -> READY!"); WeaponManager.init(); Console.Write("[" + DateTime.Now.ToString("HH:mm:ss") + "] >> " + WeaponManager.WeaponsData.Count + " Armas carregadas"); Console.WriteLine(" -> READY!"); ColourManager.Initialize(); MafiaWars = new MafiaWarManager(); Console.Write("[" + DateTime.Now.ToString("HH:mm:ss") + "] >> Mini Games iniciados!"); Console.WriteLine(" -> READY!"); RoleplayManager.init(); #endregion Manager.Cache.StartProcess(); using (var dbCleanUp = Plus.GetDatabaseManager().GetQueryReactor()) DatabaseCleanup(dbCleanUp); Console.Write("\r".PadLeft(Console.WindowWidth - Console.CursorLeft - 1)); } }
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; } }