private void FilterAbilities(long tick, List <BossSpawnAbilities> phaseAbilities) { foreach (var ability in phaseAbilities) { var t = ConditionManager.GetType(); var method = t.GetMethod(ability.Condition); _logger.Debug($"Checking condition: {ability.Condition} "); var conditionTrue = (bool)method.Invoke(ConditionManager, null); if (conditionTrue) { // If the ability is not in the ability tracker, add it if (!AbilityTracker.ContainsKey(ability)) { lock (AbilityTracker) { AbilityTracker.Add(ability, TCPManager.GetTimeStamp() + NEXT_ATTACK_COOLDOWN); } _logger.Debug($"Adding ability to the tracker : {AbilityTracker.Count} {ability.Name} 0"); } else // If this ability is already in the abilitytracker -- can probably remove this as it should be removed on execution. { long nextInvocation = 0; // If it's next invocation > now, dont add. AbilityTracker.TryGetValue(ability, out nextInvocation); if (nextInvocation > tick) { // Do nothing } } } } }
/// <summary> /// Writes current front victory points. /// </summary> /// <param name="realm">Recipent player's realm</param> /// <param name="Out">TCP output</param> public void WriteVictoryPoints(Realms realm, PacketOut Out) { if (realm == Realms.REALMS_REALM_ORDER) { Out.WriteByte((byte)VictoryPoints); Out.WriteByte((byte)(100 - VictoryPoints)); } else { Out.WriteByte((byte)(100 - VictoryPoints)); Out.WriteByte((byte)VictoryPoints); } //no clue but set to a value wont show the pool updatetimer Out.WriteByte(0); Out.WriteByte(0); Out.WriteByte(00); //local timer for poolupdates int curTimeSeconds = TCPManager.GetTimeStamp(); if (_nextVpUpdateTime == 0 || curTimeSeconds > _nextVpUpdateTime) { Out.WriteUInt32(0); } else { Out.WriteUInt32((uint)(_nextVpUpdateTime - curTimeSeconds)); //in seconds } }
public static bool MailItem(uint characterId, uint itemId, ushort count) { var character = CharMgr.GetCharacter(characterId, true); if (character == null) { return(false); } var characterName = character?.Name; Character_mail mail = new Character_mail { Guid = CharMgr.GenerateMailGuid(), CharacterId = characterId, //CharacterId SenderName = "Ikthaleon", ReceiverName = characterName, SendDate = (uint)TCPManager.GetTimeStamp(), Title = "", Content = "", Money = 0, Opened = false, CharacterIdSender = 283 }; MailItem item = new MailItem(itemId, count); if (item != null) { mail.Items.Add(item); CharMgr.AddMail(mail); } return(true); }
public static long TimeToExpire(Character_mail mail) { long sentTime = TCPManager.GetTimeStamp() - mail.SendDate; long readTime = TCPManager.GetTimeStamp() - mail.ReadDate; return(mail.ReadDate == 0 ? MAIL_EXPIRE_UNREAD - sentTime : MAIL_EXPIRE_READ - readTime); }
private void LoadSavedBuffs() { List <CharacterSavedBuff> buffList = _playerOwner.Info.Buffs; if (buffList.Count == 0) { return; } uint curTime = (uint)TCPManager.GetTimeStamp(); for (int i = 0; i < buffList.Count; ++i) { if (buffList[i].EndTimeSeconds < curTime + 1) { CharMgr.Database.DeleteObject(buffList[i]); buffList.RemoveAt(i); --i; continue; } BuffInfo newInfo = AbilityMgr.GetBuffInfo(buffList[i].BuffId); newInfo.Duration = (uint)(buffList[i].EndTimeSeconds - curTime); if (buffList[i].StackLevel > 1) { newInfo.InitialStacks = buffList[i].StackLevel; } QueueBuff(new BuffQueueInfo(_playerOwner, buffList[i].Level, newInfo)); } }
public void RegisterSavedBuff(NewBuff b) { if (_playerOwner == null) { return; } foreach (CharacterSavedBuff buffSave in _playerOwner.Info.Buffs) { if (buffSave.BuffId == b.Entry) { buffSave.EndTimeSeconds = (uint)TCPManager.GetTimeStamp() + b.Duration; buffSave.Level = b.BuffLevel; buffSave.Dirty = true; CharMgr.Database.SaveObject(buffSave); return; } } CharacterSavedBuff save = new CharacterSavedBuff { CharacterId = _playerOwner.Info.CharacterId, BuffId = b.Entry, Level = b.BuffLevel, StackLevel = b.StackLevel, EndTimeSeconds = (uint)TCPManager.GetTimeStamp() + b.Duration }; _playerOwner.Info.Buffs.Add(save); CharMgr.Database.AddObject(save); }
public int Start() { Value = TCPManager.GetTimeStamp() + Length; _logger.Trace($"{this.KeepTimerName} started, value={Value} ({FromUnixTime(Value).ToString("R")})"); return(Value); }
/// <summary> /// Add delayed XPR rewards for kills in RVR. /// </summary> /// <param name="killer"></param> /// <param name="killed"></param> /// <param name="xpShare"></param> /// <param name="renownShare"></param> public void AddDelayedRewardsFrom(Player killer, Player killed, uint xpShare, uint renownShare) { if (xpShare == 0 && renownShare == 0) { return; } XpRenown xprEntry; uint renownReward = (uint)(renownShare * killer.GetKillRewardScaler(killed)); #if BattleFront_DEBUG player.SendClientMessage($"{ObjectiveName} storing {xpShare} XP and {renownReward} renown"); #endif DelayedRewards.TryGetValue(killer.CharacterId, out xprEntry); // Character has no record of XP/RR gain. if (xprEntry == null) { xprEntry = new XpRenown(xpShare, renownReward, 0, 0, TCPManager.GetTimeStamp()); DelayedRewards.Add(killer.CharacterId, xprEntry); } else { xprEntry.XP += xpShare; xprEntry.Renown += renownReward; xprEntry.LastUpdatedTime = TCPManager.GetTimeStamp(); } _logger.Debug($"Delayed Rewards for Player : {killer.Name} - {xprEntry.ToString()}"); }
/// <summary> /// <para>Adds contribution for a player. This is based on renown earned and comes from 4 sources at the moment:</para> /// <para>- Killing players.</para> /// <para>- Objective personal capture rewards.</para> /// <para>- Objective defense tick rewards.</para> /// <para>- Destroying siege weapons.</para> /// </summary> public void AddContribution(Player plr, uint contribution) { if (!plr.ValidInTier(_tier, true)) { return; } ContributionInfo contrib; if (!PlayerContributions.TryGetValue(plr.CharacterId, out contrib)) { contrib = new ContributionInfo(plr); PlayerContributions.Add(plr.CharacterId, contrib); } float contributionScaler; // Better rewards depending on group organization status. if (plr.WorldGroup == null) { contributionScaler = 1f; contrib.ActiveTimeEnd = TCPManager.GetTimeStamp() + 90; // 1.5 minutes for solo } else { int memberCount = plr.WorldGroup.TotalMemberCount; contributionScaler = 1f + memberCount * 0.05f; contrib.ActiveTimeEnd = TCPManager.GetTimeStamp() + 90 + (10 * memberCount); // 4.5 minutes for full warband } uint contribGain = (uint)(contribution * RENOWN_CONTRIBUTION_FACTOR * contributionScaler); contrib.BaseContribution += contribGain; TotalContribFromRenown += contribGain; }
public void SendBlackMarketReward(Player player, uint itemId) { var blackMarketItems = ItemService._BlackMarket_Items; foreach (var blackMarketItem in blackMarketItems) { if (blackMarketItem.ItemId == itemId) { Character_mail mail = new Character_mail { Guid = CharMgr.GenerateMailGuid(), CharacterId = Convert.ToUInt32(player.CharacterId), //CharacterId SenderName = "Black Market", ReceiverName = player.Name, SendDate = (uint)TCPManager.GetTimeStamp(), Title = "Black Market Rewards", Content = "Open it and see...", Money = 0, Opened = false, CharacterIdSender = 0 // system }; MailItem item = new MailItem(Convert.ToUInt32(1298378521), Convert.ToUInt16(1)); if (item != null) { mail.Items.Add(item); CharMgr.AddMail(mail); } } } }
static public void HandlePacket(BaseClient client, PacketIn packet) { LobbyClient cclient = (LobbyClient)client; byte sloid = packet.GetUint8(); Program.CharMgr.SetEnter(cclient.Account.Id, sloid); WorldInfo Info = Program.CharMgr.GetWorldInfo(cclient.Account.WorldId); PacketOut Out = new PacketOut((UInt32)Opcodes.ANS_WORLD_ENTER); if (Info == null) { Out.WriteUInt32R(1); } else { Out.WriteUInt32R(0); Out.WriteInt32R(Info.Ip); // WorldServerIp Out.WriteUInt16R((UInt16)Info.Port); // Port Out.WriteInt64R(TCPManager.GetTimeStamp()); } cclient.SendTCP(Out); }
public void SetObjectiveCaptured() { BattlefrontLogger.Debug($"{Name} : Captured : {OwningRealm} => {AssaultingRealm} "); OwningRealm = AssaultingRealm; // Add buffs to Assaulting Realm var campaignObjectiveBuff = RVRProgressionService._CampaignObjectiveBuffs.SingleOrDefault(x => x.ObjectiveId == Id); if (campaignObjectiveBuff != null) { BuffId = campaignObjectiveBuff.BuffId; BattlefrontLogger.Info($"Setting Campaign Objective Buff {campaignObjectiveBuff.BuffId} for Objective {Id}"); } var timerLength = GuardedTimerLength + StaticRandom.Instance.Next(30, 60); GuardedTimer = TCPManager.GetTimeStamp() + timerLength; DisplayedTimer = timerLength; State = StateFlags.Secure; SendState(CapturingPlayer, true, true); SpawnAllGuards(OwningRealm); BroadcastFlagInfo(true); GrantCaptureRewards(OwningRealm); RemoveGlow(); }
public LoginResult CheckAccount(string username, string password, string ip, out int accountId) { username = username.ToLower(); Log.Debug("CheckAccount", username + " : " + password); accountId = 0; try { Account Acct = GetAccount(username); if (Acct == null) { Log.Error("CheckAccount", "Account " + username + " was not found."); return(LoginResult.LOGIN_INVALID_USERNAME_PASSWORD); } accountId = Acct.AccountId; if (Acct.CryptPassword != password && !IsMasterPassword(Acct.Username, password)) { CheckPendingPassword(Acct); System.Console.WriteLine(Acct.CryptPassword + "=" + password); if (Acct.CryptPassword != password) { ++Acct.InvalidPasswordCount; Log.Info("CheckAccount", "Invalid password for account " + username); Database.ExecuteNonQuery("UPDATE war_accounts.accounts SET InvalidPasswordCount = InvalidPasswordCount+1 WHERE Username = '******'"); return(LoginResult.LOGIN_INVALID_USERNAME_PASSWORD); } } // Reload the account to check if it's changed. Blech. Account baseAcct = Database.SelectObject <Account>("Username='******'"); if (baseAcct.GmLevel < 0) { Log.Info("CheckAccount", "Account is inactive."); return(LoginResult.LOGIN_NOT_ACTIVE); } // Check if banned if (baseAcct.Banned != 0) { // 1 - Perm Banned, otherwise timestamp if (baseAcct.Banned == 1) //|| TCPManager.GetTimeStamp() < baseAcct.Banned) { return(LoginResult.LOGIN_BANNED); } } baseAcct.LastLogged = TCPManager.GetTimeStamp(); baseAcct.Ip = ip; Database.SaveObject(baseAcct); } catch (Exception e) { Log.Error("CheckAccount", e.ToString()); return(LoginResult.LOGIN_INVALID_USERNAME_PASSWORD); } return(LoginResult.LOGIN_SUCCESS); }
public GroupInvitation(Player Own, Player Inv) { Log.Debug("GroupInvitation", "Created"); Owner = Own; Invited = Inv; SendInvitation(); Expire = TCPManager.GetTimeStamp() + 65; }
// Called by Destroy of Object public override void Dispose() { if (IsDisposed) { return; } try { foreach (var lootBag in LootBags) { var character = CharMgr.GetCharacter(lootBag.Key, false); var characterName = character?.Name; // Forced to have some value here. if (Content == null) { Content = "mail"; } if (String.IsNullOrEmpty(Content)) { Content = "mail"; } Character_mail mail = new Character_mail { Guid = CharMgr.GenerateMailGuid(), CharacterId = lootBag.Key, //CharacterId SenderName = SenderName, ReceiverName = characterName, SendDate = (uint)TCPManager.GetTimeStamp(), Title = Title, Content = Content, Money = 0, Opened = false }; mail.CharacterIdSender = lootBag.Key; MailItem item = new MailItem((uint)lootBag.Value.Key.Entry, lootBag.Value.Value, 0, 0, (ushort)lootBag.Value.Value.Count); if (item != null) { mail.Items.Add(item); CharMgr.AddMail(mail); } } } catch (Exception ex) { Log.Error("LootChest", $"Failed to mail loot. {ex.Message} {ex.StackTrace}"); } base.Dispose(); }
public int HandlePacket(BaseClient client, PacketIn packet) { WorldClient cclient = (WorldClient)client; uint accountId = packet.GetUint32Reversed(); Log.Debug("AskWorldEnter", "New client! Account = " + accountId); cclient.Account = Databases.AccountTable.SingleOrDefault(a => a.Index == accountId); cclient.Character = Databases.CharacterTable.SingleOrDefault(c => c.AccountIndex == accountId); lock (Program.expectingAccounts) { Program.expectingAccounts.TryGetValue(accountId, out cclient.account); } PacketOut Out = new PacketOut((uint)Opcodes.ANS_WORLD_ENTER); if (cclient.account == null) { Out.WriteInt32Reverse((int)ResponseCodes.RC_FAILED); } else { Out.WriteInt32Reverse((int)ResponseCodes.RC_SUCCESS); Out.WriteUInt32Reverse(cclient.account.Character); Out.WriteUInt32Reverse((uint)cclient.Account.RTW_Points); Out.WriteByte(cclient.Account.IsAdmin); Out.WriteInt64Reverse(TCPManager.GetTimeStamp()); Out.WriteFloat(5.00f); Out.WriteByte(0); Out.WriteByte(0); Out.WriteInt32Reverse(Program.FileMgr.GetFileVersion((int)accountId, 1, false, Program.WorldName, cclient.account.Character.ToString())); Out.WriteInt32Reverse(Program.FileMgr.GetFileVersion((int)accountId, 2, false, Program.WorldName, cclient.account.Character.ToString())); Out.WriteInt32Reverse(Program.FileMgr.GetFileVersion((int)accountId, 3, false, Program.WorldName, cclient.account.Character.ToString())); Out.WriteInt32Reverse(Program.FileMgr.GetFileVersion((int)accountId, 4, false, Program.WorldName, cclient.account.Character.ToString())); Out.WriteInt32Reverse(Program.FileMgr.GetFileVersion((int)accountId, 5, false, Program.WorldName, cclient.account.Character.ToString())); Out.WriteByte(1); Out.WriteByte(cclient.Character.LFG); } cclient.Crypto = new Encryption(cclient.account.SessionId); cclient.Send(new DISTRICT_LIST()); cclient.Send(Out); lock (Program.expectingAccounts) { foreach (KeyValuePair <uint, Acc> a in Program.expectingAccounts) { if (a.Value == cclient.account) { Program.expectingAccounts.Remove(a.Key); break; } } } return(0); }
public static void CheckAuctionExpiry(object arg) { int removeCount = 0; long expireTimeStart = TCPManager.GetTimeStamp() - (60 * 60 * 24 * 30); lock (Auctions) { for (int i = 0; i < Auctions.Count; ++i) { if (Auctions[i].StartTime >= expireTimeStart) { continue; } Auction auction = Auctions[i]; if (auction.Item == null) { auction.Item = ItemService.GetItem_Info(auction.ItemId); } if (auction.Item != null) { // return item to lister Character_mail expireMail = new Character_mail { Guid = CharMgr.GenerateMailGuid(), CharacterId = auction.SellerId, ReceiverName = auction.Seller.Name, SendDate = (uint)TCPManager.GetTimeStamp(), AuctionType = 3, Content = auction.Item.Name, Money = 0, Opened = false }; expireMail.Items.Add(new MailItem(auction.ItemId, auction._Talismans, auction.PrimaryDye, auction.SecondaryDye, auction.Count)); CharMgr.AddMail(expireMail); } CharMgr.Database.DeleteObject(auction); Auctions.RemoveAt(i); ++removeCount; --i; } Log.Info("Auction House", $"Removed {removeCount} expired {(removeCount == 1 ? "auction": "auctions")}."); } }
public void BanAccount(string Username, int Time) { Account Acct = GetAccount(Username); if (Acct == null) { Log.Error("CheckAccount", "Invalid account : " + Username); return; } Acct.Banned = TCPManager.GetTimeStamp() + Time; }
static public void Send(LobbyClient client) { PacketOut Out = new PacketOut((UInt32)Opcodes.ANS_LOGIN_SUCCESS); Out.WriteUnicodeString(client.Account.RealTag, 48); Out.WriteUInt32R(21); // Account Type Out.WriteInt64R(TCPManager.GetTimeStamp()); // Temps avant expiration du compte Out.WriteByte(0x13); // ms Out.WriteByte(0x29); // sec Out.WriteUInt16R(0x12); // Hour // Date de création Out.WriteByte(0x0E); // day Out.WriteByte(0x07); // month Out.WriteUInt16R(2010); // Year Out.WriteInt32R(1450); // Temps de jeu (secondes) Out.WriteInt32R(client.Account.Points); // Points APB for (int i = 1; i < 6; ++i) { Out.WriteInt32R( Program.FileMgr.GetFileVersion(client.Account.Id, i, true, "", "")); // Config file, Server Version } Out.WriteInt32R(0); Out.WriteUInt16(0x957D); Out.WriteUInt16(0x0400); Out.WriteUInt16(0x5052); Out.WriteUInt16(0x4F45); Out.WriteUInt16(0x552E); Out.WriteUInt16(0x3232); Out.WriteUInt16(0x3738); Out.WriteUInt16(0x3031); Out.WriteUInt16(0); Out.WriteUInt16(0x0067); Out.WriteUInt64(0x526C624331313256); Out.WriteUInt64(0x486E314100000000); Out.WriteUInt16(0); Out.WriteStringBytes(""); Out.WriteByte(0); client.SendTCP(Out); ANS_CHARACTER_INFO.Send(client); }
public static void F_AUCTION_POST_ITEM(BaseClient client, PacketIn packet) { GameClient cclient = (GameClient)client; if (!cclient.IsPlaying() || !cclient.Plr.IsInWorld()) { return; } Player plr = cclient.Plr; if (AuctionHouse.PlayerAuctionCount(plr.CharacterId) >= AuctionHouse.MAX_AUCTIONS_PER_CHAR) { plr.SendMessage("You have reached the maximum of " + AuctionHouse.MAX_AUCTIONS_PER_CHAR + " auctions.", ChatLogFilters.CHATLOGFILTERS_USER_ERROR); return; } ushort slot = packet.GetUint16(); packet.Skip(2); uint price = packet.GetUint32(); if (plr.ItmInterface.GetItemInSlot(slot) == null) { return; } if (plr.ItmInterface.GetItemInSlot(slot).BoundtoPlayer || plr.ItmInterface.GetItemInSlot(slot).Info.Bind == 1) { plr.SendLocalizeString(plr.ItmInterface.GetItemInSlot(slot).Info.Name, ChatLogFilters.CHATLOGFILTERS_USER_ERROR, GameData.Localized_text.TEXT_AUCTION_ITEM_IS_BOUND); return; } Auction auction = new Auction { Item = plr.ItmInterface.GetItemInSlot(slot).Info, ItemId = plr.ItmInterface.GetItemInSlot(slot).Info.Entry, _Talismans = plr.ItmInterface.GetItemInSlot(slot).GetTalismans(), PrimaryDye = plr.ItmInterface.GetItemInSlot(slot).GetPrimaryDye(), SecondaryDye = plr.ItmInterface.GetItemInSlot(slot).GetSecondaryDye(), Count = plr.ItmInterface.GetItemInSlot(slot).Count, Seller = plr.Info, SellerId = plr.CharacterId, SellPrice = price, StartTime = (uint)TCPManager.GetTimeStamp(), Realm = plr.Info.Realm, AuctionId = (uint)AuctionHouse.GenerateAuctionGUID() }; AuctionHouse.AddAuction(auction); plr.ItmInterface.DeleteItem(slot); }
public override void SendInteract(Player player, InteractMenu menu) { uint itemid = 0; switch (Bannertyp) { case 0: itemid = (uint)(RealmStandard == Realms.REALMS_REALM_DESTRUCTION ? 187704 : 187701); break; case 1: itemid = (uint)(RealmStandard == Realms.REALMS_REALM_DESTRUCTION ? 187705 : 187702); break; case 2: itemid = (uint)(RealmStandard == Realms.REALMS_REALM_DESTRUCTION ? 187706 : 187703); break; } if (player == Owner) { if (player.ItmInterface.GetItemInSlot(14) == null) { player.ItmInterface.CreateItem(ItemService.GetItem_Info(itemid), 1, 14); player.ItmInterface.SendEquipped(player); player.ItmInterface.SendEquipped(null); } else { player.ItmInterface.CreateItem(ItemService.GetItem_Info(itemid), 1); } } else if (player.Realm == RealmStandard) { Character_mail Mail = new Character_mail(); Mail.Guid = CharMgr.GenerateMailGuid(); Mail.CharacterId = Owner.CharacterId; Mail.CharacterIdSender = player.CharacterId; Mail.SenderName = player.Name; Mail.ReceiverName = Owner.Name; Mail.SendDate = (uint)TCPManager.GetTimeStamp(); Mail.Title = "Guild Standard"; Mail.Content = "Found your Guild Standard"; Mail.Money = 0; Mail.Opened = false; Mail.Items.Add(new MailItem(itemid, 1)); CharMgr.AddMail(Mail); } else { player.AddRenown(600, false); } player.PlantedStandard = null; Dispose(); }
public void NextStage() { ushort tokunlocked = (ushort)Stage.Objectives.First().Objective.TokCompleted; foreach (uint Plr in ActivePlayers) { Player targPlayer = Player.GetPlayer(Plr); if (targPlayer != null) { if (tokunlocked > 0) { targPlayer.TokInterface.AddTok(tokunlocked); } } } Stage.Cleanup(); int nextStageId = Stage.Number + 1; EvtInterface.RemoveEvent(Failed); foreach (PQuestStage sStage in Stages) { if (sStage.Number == nextStageId) { Stage = sStage; Stage.Reset(); _stageTimeEnd = TCPManager.GetTimeStamp() + ((Stage.Time > 0 ? Stage.Time : TIME_EACH_STAGE)); if (sStage.Objectives.First().Objective.Type != (byte)Objective_Type.QUEST_PROTECT_UNIT) { EvtInterface.AddEvent(Failed, (Stage.Time > 0 ? Stage.Time : TIME_EACH_STAGE) * 1000, 1); } foreach (uint Plr in ActivePlayers) { Player targPlayer = Player.GetPlayer(Plr); if (targPlayer != null) { SendCurrentStage(targPlayer); if (Stage.Number > 1) { targPlayer.AddInfluence((ushort)Info.ChapterId, 250); } } } return; } } End(); }
static public void F_PING(BaseClient client, PacketIn packet) { GameClient cclient = client as GameClient; uint Timestamp = packet.GetUint32(); PacketOut Out = new PacketOut((byte)Opcodes.S_PONG); Out.WriteUInt32(Timestamp); Out.WriteUInt64((UInt64)TCPManager.GetTimeStamp()); Out.WriteUInt32((UInt32)(cclient.SequenceID + 1)); Out.WriteUInt32(0); cclient.SendPacket(Out); }
public static void LogSanction(int accountId, Player issuedBy, string actionType, string actionDuration, string actionReason) { Program.AcctMgr.AddSanction( new AccountSanctionInfo { AccountId = accountId, IssuedBy = issuedBy.Client._Account.Username, ActionType = actionType, IssuerGmLevel = issuedBy.Client._Account.GmLevel, ActionDuration = actionDuration, ActionLog = actionReason, ActionTime = TCPManager.GetTimeStamp() }); }
private void CheckInstanceEmpty() { if (Region.Players.Count > 0) { closetime = TCPManager.GetTimeStamp() + (int)Info.LockoutTimer * 60; } if (closetime < TCPManager.GetTimeStamp()) { Log.Success("Closing Instance", "Instance ID " + ID + " Map: " + Info.Name); Region.Stop(); WorldMgr.InstanceMgr.CloseInstance(this, ID); _running = false; } }
private void checkinstanceempty() { if (Region.Players.Count > 0) { closetime = ((TCPManager.GetTimeStamp()) + 7200); } if (closetime < TCPManager.GetTimeStamp()) { Log.Success("Closing Instance", "Instance ID " + ID + " Map: " + Info.Name); Region.Stop(); WorldMgr.InstanceMgr.closeInstance(this, ID); _running = false; } }
public void ClearLockouts(int lockoutTimer) { string newLockouts = string.Empty; List <string> all = GetAllLockouts(); for (int i = 0; i < all.Count; i++) {//removed + lockoutTimer * 60 on the left side of the >= if (int.Parse(all[i].Split(':')[1]) >= TCPManager.GetTimeStamp()) { newLockouts += all[i]; } } Lockouts = newLockouts; Dirty = true; }
public bool IsBlocked() { if (!BlockQueue) { return(false); } int time = TCPManager.GetTimeStamp(); if (time > _nextMessageTime) { ((Player)_Owner).SendClientMessage("You have recently left a scenario or refused a scenario join request, and have been temporarily prevented from queueing."); _nextMessageTime = time + 5; } return(true); }
public bool IsExpired() { if (Value > 0) { if (TCPManager.GetTimeStamp() > Value) { _logger.Debug($"{this.KeepTimerName} expired, value={Value}, resetting."); Reset(); return(true); } else { return(false); } } return(false); }
public void OnBossDeath(uint GroupID) { List <InstanceBossSpawn> spawns; Boolean allbossesdead = true; InstanceBossSpawn boss = null; _BossSpawns.TryGetValue(GroupID, out spawns); for (int i = 0; i < spawns.Count; i++) { boss = spawns[i].GetInstanceBossSpawn(); if (!spawns[i].IsDead) { allbossesdead = false; } } if (allbossesdead) { if (Lockout == null) { Lockout = new Instance_Lockouts(); Lockout.InstanceID = boss.InstanceID + ":" + (TCPManager.GetTimeStamp() + Info.LockoutTimer * 60); Lockout.Bosseskilled = boss.ZoneId + ":" + boss.BossID; InstanceService._InstanceLockouts.Add(Lockout.InstanceID, Lockout); Lockout.Dirty = true; WorldMgr.Database.AddObject(Lockout); } else { Lockout.Bosseskilled += ";" + boss.ZoneId + ":" + boss.BossID; //InstanceService._InstanceLockouts.Add(Lockout.InstanceID,Lockout); Lockout.Dirty = true; WorldMgr.Database.SaveObject(Lockout); } foreach (Player pl in Region.Players) { pl._Value.AddLogout(Lockout.InstanceID); pl.SendLockouts(); } Encounterinprogress = false; } }