示例#1
0
 private static void Init6(object sender, ElapsedEventArgs e, ClientInfo _cInfo, string _ip)
 {
     BattleLogger.BattleLog(_cInfo, _ip);
 }
示例#2
0
 public static void PlayerDisconnected(ClientInfo _cInfo, bool _bShutdown)
 {
     try
     {
         Log.Out("[SERVERTOOLS] Player detected disconnecting");
         if (_cInfo != null && !string.IsNullOrEmpty(_cInfo.playerId) && _cInfo.entityId != -1)
         {
             if (BattleLogger.IsEnabled && BattleLogger.LogFound && !_bShutdown && !StopServer.StopServerCountingDown && !StopServer.Shutdown && BattleLogger.Players.ContainsKey(_cInfo.playerId))
             {
                 BattleLogger.BattleLog(_cInfo);
             }
             if (FriendTeleport.Dict.ContainsKey(_cInfo.entityId))
             {
                 FriendTeleport.Dict.Remove(_cInfo.entityId);
                 FriendTeleport.Dict1.Remove(_cInfo.entityId);
             }
             if (Zones.ZoneExit.ContainsKey(_cInfo.entityId))
             {
                 Zones.ZoneExit.Remove(_cInfo.entityId);
             }
             if (Zones.Forgive.ContainsKey(_cInfo.entityId))
             {
                 Zones.Forgive.Remove(_cInfo.entityId);
             }
             if (Zones.Victim.ContainsKey(_cInfo.entityId))
             {
                 Zones.Victim.Remove(_cInfo.entityId);
             }
             if (FriendTeleport.Dict.ContainsKey(_cInfo.entityId))
             {
                 FriendTeleport.Dict.Remove(_cInfo.entityId);
             }
             if (FriendTeleport.Dict1.ContainsKey(_cInfo.entityId))
             {
                 FriendTeleport.Dict1.Remove(_cInfo.entityId);
             }
             if (Travel.Flag.Contains(_cInfo.entityId))
             {
                 Travel.Flag.Remove(_cInfo.entityId);
             }
             if (Wallet.IsEnabled && Wallet.Session_Bonus > 0)
             {
                 DateTime _time;
                 if (PersistentOperations.Session.TryGetValue(_cInfo.playerId, out _time))
                 {
                     TimeSpan varTime           = DateTime.Now - _time;
                     double   fractionalMinutes = varTime.TotalMinutes;
                     int      _timepassed       = (int)fractionalMinutes;
                     if (_timepassed > 60)
                     {
                         int _sessionBonus = _timepassed / 60 * Wallet.Session_Bonus;
                         if (_sessionBonus > 0)
                         {
                             Wallet.AddCoinsToWallet(_cInfo.playerId, _sessionBonus);
                         }
                     }
                     int _timePlayed = PersistentContainer.Instance.Players[_cInfo.playerId].TotalTimePlayed;
                     PersistentContainer.Instance.Players[_cInfo.playerId].TotalTimePlayed = _timePlayed + _timepassed;
                     PersistentContainer.Instance.Save();
                 }
             }
             if (PersistentOperations.Session.ContainsKey(_cInfo.playerId))
             {
                 PersistentOperations.Session.Remove(_cInfo.playerId);
             }
             if (Bank.TransferId.ContainsKey(_cInfo.playerId))
             {
                 Bank.TransferId.Remove(_cInfo.playerId);
             }
             if (Zones.reminder.ContainsKey(_cInfo.entityId))
             {
                 Zones.reminder.Remove(_cInfo.entityId);
             }
             if (BloodmoonWarrior.WarriorList.Contains(_cInfo.entityId))
             {
                 BloodmoonWarrior.WarriorList.Remove(_cInfo.entityId);
             }
         }
     }
     catch (Exception e)
     {
         Log.Out(string.Format("[SERVERTOOLS] Error in API.PlayerDisconnected: {0}.", e.Message));
     }
 }