Beispiel #1
0
 public static void Payout(ClientInfo _cInfo)
 {
     try
     {
         if (Dict.ContainsKey(_cInfo.CrossplatformId.CombinedString))
         {
             Dict.TryGetValue(_cInfo.CrossplatformId.CombinedString, out int[] pot);
             Wallet.AddCurrency(_cInfo.CrossplatformId.CombinedString, pot[1]);
             Dict.Remove(_cInfo.CrossplatformId.CombinedString);
             PersistentContainer.Instance.Players[_cInfo.CrossplatformId.CombinedString].LastGamble = DateTime.Now;
             PersistentContainer.DataChange = true;
             Phrases.Dict.TryGetValue("Gamble4", out string phrase);
             phrase = phrase.Replace("{Value}", pot[1].ToString());
             phrase = phrase.Replace("{CoinName}", Wallet.Currency_Name);
             ChatHook.ChatMessage(_cInfo, Config.Chat_Response_Color + phrase + "[-]", -1, Config.Server_Response_Name, EChatType.Whisper, null);
         }
         else
         {
             Phrases.Dict.TryGetValue("Gamble2", out string phrase);
             ChatHook.ChatMessage(_cInfo, Config.Chat_Response_Color + phrase + "[-]", -1, Config.Server_Response_Name, EChatType.Whisper, null);
         }
     }
     catch (Exception e)
     {
         Log.Out(string.Format("[SERVERTOOLS] Error in Gamble.Payout: {0}", e.Message));
     }
 }
Beispiel #2
0
        public static void StartLotto()
        {
            System.Random rnd    = new System.Random();
            int           random = rnd.Next(0, LottoEntries.Count + 1);
            ClientInfo    winner = LottoEntries[random];
            int           winnings;

            if (LottoEntries.Count == 8)
            {
                winnings = LottoValue * LottoEntries.Count + Bonus;
            }
            else
            {
                winnings = LottoValue * LottoEntries.Count;
            }
            LottoValue = 0;
            LottoEntries.Clear();
            Wallet.AddCurrency(winner.CrossplatformId.CombinedString, winnings);
            Phrases.Dict.TryGetValue("Lottery10", out string phrase);
            phrase = phrase.Replace("{PlayerName}", winner.playerName);
            phrase = phrase.Replace("{Value}", winnings.ToString());
            phrase = phrase.Replace("{CoinName}", Wallet.Currency_Name);
            ChatHook.ChatMessage(null, Config.Chat_Response_Color + phrase + "[-]", -1, Config.Server_Response_Name, EChatType.Global, null);
        }
        public override void Execute(List <string> _params, CommandSenderInfo _senderInfo)
        {
            try
            {
                if (_params.Count < 1 || _params.Count > 2)
                {
                    SingletonMonoBehaviour <SdtdConsole> .Instance.Output(string.Format("[SERVERTOOLS] Wrong number of arguments, expected 1 or 2, found '{0}'", _params.Count));

                    return;
                }
                if (_params[0].ToLower().Equals("off"))
                {
                    if (Wallet.IsEnabled)
                    {
                        Wallet.IsEnabled = false;
                        Config.WriteXml();
                        Config.LoadXml();
                        SingletonMonoBehaviour <SdtdConsole> .Instance.Output(string.Format("[SERVERTOOLS] Wallet has been set to off"));

                        return;
                    }
                    else
                    {
                        SingletonMonoBehaviour <SdtdConsole> .Instance.Output(string.Format("[SERVERTOOLS] Wallet is already off"));

                        return;
                    }
                }
                else if (_params[0].ToLower().Equals("on"))
                {
                    if (!Wallet.IsEnabled)
                    {
                        Wallet.IsEnabled = true;
                        Config.WriteXml();
                        Config.LoadXml();
                        SingletonMonoBehaviour <SdtdConsole> .Instance.Output(string.Format("[SERVERTOOLS] Wallet has been set to on"));

                        return;
                    }
                    else
                    {
                        SingletonMonoBehaviour <SdtdConsole> .Instance.Output(string.Format("[SERVERTOOLS] Wallet is already on"));

                        return;
                    }
                }
                else if (_params[0].ToLower().Equals("all"))
                {
                    bool negative = false;
                    if (_params[1].Contains("-"))
                    {
                        _params[1].Replace("-", "");
                        negative = true;
                    }
                    if (!int.TryParse(_params[1], out int adjustCoins))
                    {
                        SingletonMonoBehaviour <SdtdConsole> .Instance.Output(string.Format("[SERVERTOOLS] Can not adjust wallet. Value '{0}' is invalid", _params[1]));
                    }
                    else
                    {
                        List <ClientInfo> clientList = PersistentOperations.ClientList();
                        if (clientList != null)
                        {
                            for (int i = 0; i < clientList.Count; i++)
                            {
                                ClientInfo cInfo = clientList[i];
                                if (cInfo != null)
                                {
                                    if (negative)
                                    {
                                        if (Wallet.GetCurrency(cInfo.CrossplatformId.CombinedString) >= adjustCoins)
                                        {
                                            Wallet.RemoveCurrency(cInfo.CrossplatformId.CombinedString, adjustCoins);
                                            SingletonMonoBehaviour <SdtdConsole> .Instance.Output(string.Format("[SERVERTOOLS] Removed '{0}' '{1}' from Id '{2}' named '{3}'", _params[1], Wallet.Currency_Name, cInfo.CrossplatformId.CombinedString, cInfo.playerName));
                                        }
                                        else
                                        {
                                            SingletonMonoBehaviour <SdtdConsole> .Instance.Output(string.Format("[SERVERTOOLS] Unable to remove '{0}' '{1}'. Target '{2}' named '{3}' does not have enough", _params[1], Wallet.Currency_Name, cInfo.CrossplatformId.CombinedString, cInfo.playerName));
                                        }
                                        return;
                                    }
                                    else
                                    {
                                        Wallet.AddCurrency(cInfo.CrossplatformId.CombinedString, adjustCoins);
                                        SingletonMonoBehaviour <SdtdConsole> .Instance.Output(string.Format("[SERVERTOOLS] Added '{0}' '{1}' to id '{2}' named '{3}'", _params[1], Wallet.Currency_Name, cInfo.CrossplatformId.CombinedString, cInfo.playerName));

                                        return;
                                    }
                                }
                            }
                        }
                    }
                }
                else if (_params.Count == 2)
                {
                    if (_params[1].Length < 1 || _params[1].Length > 6)
                    {
                        SingletonMonoBehaviour <SdtdConsole> .Instance.Output(string.Format("[SERVERTOOLS] Can not adjust wallet. Value '{0}' is invalid", _params[1]));

                        return;
                    }
                    bool negative = false;
                    if (_params[1].Contains("-"))
                    {
                        _params[1].Replace("-", "");
                        negative = true;
                    }
                    if (!int.TryParse(_params[1], out int adjustCoins))
                    {
                        SingletonMonoBehaviour <SdtdConsole> .Instance.Output(string.Format("[SERVERTOOLS] Can not adjust wallet. Value '{0}' is invalid", _params[1]));

                        return;
                    }
                    if (_params[0].Contains("_"))
                    {
                        PersistentPlayer p = PersistentContainer.Instance.Players[_params[0]];
                        if (p != null)
                        {
                            if (negative)
                            {
                                Wallet.RemoveCurrency(_params[0], adjustCoins);
                                SingletonMonoBehaviour <SdtdConsole> .Instance.Output(string.Format("[SERVERTOOLS] Removed '{0}' '{1}' from Id '{2}'", _params[1], Wallet.Currency_Name, _params[0]));
                            }
                            else
                            {
                                Wallet.AddCurrency(_params[0], adjustCoins);
                                SingletonMonoBehaviour <SdtdConsole> .Instance.Output(string.Format("[SERVERTOOLS] Added '{0}' '{1}' to wallet '{2}'", _params[1], Wallet.Currency_Name, _params[0]));
                            }
                        }
                        else
                        {
                            SingletonMonoBehaviour <SdtdConsole> .Instance.Output(string.Format("[SERVERTOOLS] Id not found '{0}'", _params[0]));
                        }
                    }
                    else
                    {
                        SingletonMonoBehaviour <SdtdConsole> .Instance.Output(string.Format("[SERVERTOOLS] Invalid Id '{0}'", _params[0]));
                    }
                }
                else if (_params.Count == 1)
                {
                    if (_params[0].Contains("_"))
                    {
                        ClientInfo cInfo = PersistentOperations.GetClientInfoFromNameOrId(_params[0]);
                        if (cInfo != null)
                        {
                            int currentWallet = Wallet.GetCurrency(cInfo.CrossplatformId.CombinedString);
                            SingletonMonoBehaviour <SdtdConsole> .Instance.Output(string.Format("[SERVERTOOLS] Id '{0}' named '{1}' has '{2}' '{3}'", _params[0], cInfo.playerName, currentWallet, Wallet.Currency_Name));
                        }
                    }
                }
                else
                {
                    SingletonMonoBehaviour <SdtdConsole> .Instance.Output(string.Format("[SERVERTOOLS] Invalid argument '{0}'", _params[0]));
                }
            }
            catch (Exception e)
            {
                Log.Out(string.Format("[SERVERTOOLS] Error in WalletConsole.Execute: {0}", e.Message));
            }
        }
Beispiel #4
0
 private static void Init2(string _playerId, int _amount)
 {
     Wallet.AddCurrency(_playerId, _amount);
 }
Beispiel #5
0
 public static void BuyAuction(ClientInfo _cInfo, int _purchase, int _price)
 {
     if (AuctionItems.TryGetValue(_purchase, out string id))
     {
         if (PersistentContainer.Instance.Players[id].Auction != null && PersistentContainer.Instance.Players[id].Auction.Count > 0)
         {
             PersistentContainer.Instance.Players[id].Auction.TryGetValue(_purchase, out ItemDataSerializable itemData);
             ItemValue itemValue = new ItemValue(ItemClass.GetItem(itemData.name, false).type);
             if (itemValue != null)
             {
                 if (itemValue.ItemClass.HasQuality)
                 {
                     itemValue.Quality = 1;
                     if (itemData.quality > 0)
                     {
                         itemValue.Quality = itemData.quality;
                     }
                 }
                 itemValue.UseTimes = itemData.useTimes;
                 itemValue.Seed     = itemData.seed;
                 if (itemData.modSlots > 0)
                 {
                     itemValue.Modifications = new ItemValue[itemData.modSlots];
                 }
                 if (itemData.cosmeticSlots > 0)
                 {
                     itemValue.CosmeticMods = new ItemValue[itemData.cosmeticSlots];
                 }
                 World      world      = GameManager.Instance.World;
                 EntityItem entityItem = (EntityItem)EntityFactory.CreateEntity(new EntityCreationData
                 {
                     entityClass     = EntityClass.FromString("item"),
                     id              = EntityFactory.nextEntityID++,
                     itemStack       = new ItemStack(itemValue, itemData.count),
                     pos             = world.Players.dict[_cInfo.entityId].position,
                     rot             = new Vector3(20f, 0f, 20f),
                     lifetime        = 60f,
                     belongsPlayerId = _cInfo.entityId
                 });
                 world.SpawnEntityInWorld(entityItem);
                 _cInfo.SendPackage(NetPackageManager.GetPackage <NetPackageEntityCollect>().Setup(entityItem.entityId, _cInfo.entityId));
                 world.RemoveEntity(entityItem.entityId, EnumRemoveEntityReason.Despawned);
                 AuctionItems.Remove(_purchase);
                 PersistentContainer.Instance.Players[id].Auction.Remove(_purchase);
                 PersistentContainer.Instance.AuctionPrices.Remove(_purchase);
                 PersistentContainer.DataChange = true;
                 Wallet.RemoveCurrency(_cInfo.CrossplatformId.CombinedString, _price);
                 float fee           = _price * ((float)Tax / 100);
                 int   adjustedPrice = _price - (int)fee;
                 Wallet.AddCurrency(id, adjustedPrice);
                 string playerName = PersistentOperations.GetPlayerDataFileFromId(id).ecd.entityName;
                 using (StreamWriter sw = new StreamWriter(Filepath, true, Encoding.UTF8))
                 {
                     sw.WriteLine(string.Format("{0}: '{1}' '{2}' named '{3}' has purchased auction entry '{3}', profits went to id '{4}' named '{5}'", DateTime.Now, _cInfo.PlatformId.CombinedString, _cInfo.CrossplatformId.CombinedString, _cInfo.playerName, _purchase, id, playerName));
                     sw.WriteLine();
                     sw.Flush();
                     sw.Close();
                 }
                 Phrases.Dict.TryGetValue("Auction9", out string phrase);
                 phrase = phrase.Replace("{Count}", itemData.count.ToString());
                 phrase = phrase.Replace("{ItemName}", itemValue.ItemClass.GetLocalizedItemName() ?? itemValue.ItemClass.GetItemName());
                 phrase = phrase.Replace("{Value}", _price.ToString());
                 phrase = phrase.Replace("{CoinName}", Wallet.Currency_Name);
                 ChatHook.ChatMessage(_cInfo, Config.Chat_Response_Color + phrase + "[-]", -1, Config.Server_Response_Name, EChatType.Whisper, null);
                 ClientInfo cInfo2 = PersistentOperations.GetClientInfoFromNameOrId(id);
                 if (cInfo2 != null)
                 {
                     Phrases.Dict.TryGetValue("Auction10", out string phrase1);
                     ChatHook.ChatMessage(cInfo2, Config.Chat_Response_Color + phrase1 + "[-]", -1, Config.Server_Response_Name, EChatType.Whisper, null);
                 }
             }
         }
     }
 }
Beispiel #6
0
 public static void OldPlayerJoined(ClientInfo _cInfo, EntityPlayer _player)
 {
     try
     {
         string id = _cInfo.CrossplatformId.CombinedString;
         if (Hardcore.IsEnabled && PersistentContainer.Instance.Players[id] != null)
         {
             if (Hardcore.Optional)
             {
                 if (PersistentContainer.Instance.Players[id].HardcoreEnabled)
                 {
                     Hardcore.Check(_cInfo, _player);
                 }
             }
             else if (!PersistentContainer.Instance.Players[id].HardcoreEnabled)
             {
                 string[] hardcoreStats = { _cInfo.playerName, "0", "0" };
                 PersistentContainer.Instance.Players[id].HardcoreStats   = hardcoreStats;
                 PersistentContainer.Instance.Players[id].HardcoreEnabled = true;
                 PersistentContainer.DataChange = true;
                 Hardcore.Check(_cInfo, _player);
             }
         }
         if (LoginNotice.IsEnabled && LoginNotice.Dict1.ContainsKey(_cInfo.PlatformId.CombinedString) || LoginNotice.Dict1.ContainsKey(id))
         {
             LoginNotice.PlayerNotice(_cInfo);
         }
         if (Motd.IsEnabled)
         {
             Motd.Send(_cInfo);
         }
         if (Bloodmoon.IsEnabled)
         {
             Bloodmoon.Exec(_cInfo);
         }
         if (Shutdown.IsEnabled && Shutdown.Alert_On_Login)
         {
             Shutdown.NextShutdown(_cInfo);
         }
         if (ExitCommand.IsEnabled)
         {
             ExitCommand.AlertPlayer(_cInfo);
         }
         if (Poll.IsEnabled && PersistentContainer.Instance.PollOpen && !PersistentContainer.Instance.PollVote.ContainsKey(id))
         {
             Poll.Message(_cInfo);
         }
         if (ClanManager.IsEnabled && PersistentContainer.Instance.Players[id] != null)
         {
             Dictionary <string, string> clanRequests = PersistentContainer.Instance.Players[id].ClanRequestToJoin;
             if (clanRequests != null && clanRequests.Count > 0)
             {
                 ChatHook.ChatMessage(_cInfo, Config.Chat_Response_Color + "New clan requests from:[-]", -1, Config.Server_Response_Name, EChatType.Whisper, null);
                 foreach (var request in clanRequests)
                 {
                     ChatHook.ChatMessage(_cInfo, Config.Chat_Response_Color + request.Value + "[-]", -1, Config.Server_Response_Name, EChatType.Whisper, null);
                 }
             }
         }
         if (PersistentContainer.Instance.Players[id] != null)
         {
             if (PersistentContainer.Instance.Players[id].EventSpawn)
             {
                 PersistentContainer.Instance.Players[id].EventSpawn = false;
                 PersistentContainer.DataChange = true;
             }
             if (Wallet.IsEnabled && PersistentContainer.Instance.Players[id].PlayerWallet > 0)
             {
                 Wallet.AddCurrency(id, PersistentContainer.Instance.Players[id].PlayerWallet);
                 PersistentContainer.Instance.Players[id].PlayerWallet = 0;
                 PersistentContainer.DataChange = true;
             }
             if (PersistentContainer.Instance.Players[id].JailRelease)
             {
                 PersistentContainer.Instance.Players[id].JailRelease = false;
                 PersistentContainer.DataChange = true;
                 Vector3[] _pos = GameManager.Instance.World.GetRandomSpawnPointPositions(1);
                 _cInfo.SendPackage(NetPackageManager.GetPackage <NetPackageTeleportPlayer>().Setup(new Vector3(_pos[0].x, _pos[0].y + 1, _pos[0].z), null, false));
                 Phrases.Dict.TryGetValue("Jail2", out string phrase);
                 ChatHook.ChatMessage(_cInfo, Config.Chat_Response_Color + phrase + "[-]", -1, Config.Server_Response_Name, EChatType.Whisper, null);
             }
         }
         if (AutoPartyInvite.IsEnabled)
         {
             AutoPartyInvite.Exec(_cInfo, _player);
         }
         if (Event.Open && Event.Teams.ContainsKey(id) && PersistentContainer.Instance.Players[id] != null && PersistentContainer.Instance.Players[id].EventSpawn)
         {
             Event.Spawn(_cInfo);
         }
     }
     catch (Exception e)
     {
         Log.Out(string.Format("[SERVERTOOLS] Error in API.OldPlayerJoined: {0}", e.Message));
     }
 }
Beispiel #7
0
 public static void PlayerDisconnected(ClientInfo _cInfo, bool _bShutdown)
 {
     try
     {
         if (_cInfo != null && _cInfo.CrossplatformId != null)
         {
             string id = _cInfo.CrossplatformId.CombinedString;
             Log.Out(string.Format("[SERVERTOOLS] Player with id '{0}' '{1}' disconnected", _cInfo.PlatformId.CombinedString, id));
             if (ExitCommand.IsEnabled && ExitCommand.Players.ContainsKey(_cInfo.entityId) && !_bShutdown)
             {
                 Timers.ExitWithoutCommand(_cInfo, _cInfo.ip);
             }
             if (FriendTeleport.Dict.ContainsKey(_cInfo.entityId))
             {
                 FriendTeleport.Dict.Remove(_cInfo.entityId);
                 FriendTeleport.Dict1.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 (Wallet.IsEnabled && Wallet.Session_Bonus > 0)
             {
                 if (PersistentOperations.Session.TryGetValue(id, out DateTime 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.AddCurrency(id, sessionBonus);
                         }
                     }
                     int timePlayed = PersistentContainer.Instance.Players[id].TotalTimePlayed;
                     PersistentContainer.Instance.Players[id].TotalTimePlayed = timePlayed + timepassed;
                     PersistentContainer.DataChange = true;
                 }
             }
             if (Bank.TransferId.ContainsKey(id))
             {
                 Bank.TransferId.Remove(id);
             }
             if (Zones.ZonePlayer.ContainsKey(_cInfo.entityId))
             {
                 Zones.ZonePlayer.Remove(_cInfo.entityId);
             }
             if (Zones.Reminder.ContainsKey(_cInfo.entityId))
             {
                 Zones.Reminder.Remove(_cInfo.entityId);
             }
             if (BloodmoonWarrior.WarriorList.Contains(_cInfo.entityId))
             {
                 BloodmoonWarrior.WarriorList.Remove(_cInfo.entityId);
                 BloodmoonWarrior.KilledZombies.Remove(_cInfo.entityId);
             }
             if (Teleportation.Teleporting.Contains(_cInfo.entityId))
             {
                 Teleportation.Teleporting.Remove(_cInfo.entityId);
             }
             if (LevelUp.PlayerLevels.ContainsKey(_cInfo.entityId))
             {
                 LevelUp.PlayerLevels.Remove(_cInfo.entityId);
             }
             if (KillNotice.Damage.ContainsKey(_cInfo.entityId))
             {
                 KillNotice.Damage.Remove(_cInfo.entityId);
             }
             if (InfiniteAmmo.Dict.ContainsKey(_cInfo.entityId))
             {
                 InfiniteAmmo.Dict.Remove(_cInfo.entityId);
             }
             if (PersistentOperations.NewPlayerQue.Contains(_cInfo))
             {
                 PersistentOperations.NewPlayerQue.Remove(_cInfo);
             }
             if (PersistentOperations.BlockChatCommands.Contains(_cInfo))
             {
                 PersistentOperations.BlockChatCommands.Remove(_cInfo);
             }
             if (PersistentOperations.Session.ContainsKey(id))
             {
                 PersistentOperations.Session.Remove(id);
             }
         }
         else
         {
             Log.Out("[SERVERTOOLS] Player disconnected");
         }
     }
     catch (Exception e)
     {
         Log.Out(string.Format("[SERVERTOOLS] Error in API.PlayerDisconnected: {0}", e.Message));
     }
 }
Beispiel #8
0
 public static bool Exec(NetPackageDamageEntity __instance)
 {
     try
     {
         Entity victim = PersistentOperations.GetEntity(entityId(__instance));
         if (victim != null)
         {
             Entity attacker = PersistentOperations.GetEntity(attackerEntityId(__instance));
             if (attacker != null)
             {
                 if (victim is EntityPlayer)
                 {
                     ClientInfo cInfoVictim = PersistentOperations.GetClientInfoFromEntityId(victim.entityId);
                     if (cInfoVictim != null)
                     {
                         EntityPlayer victimPlayer = victim as EntityPlayer;
                         if (attacker is EntityPlayer)
                         {
                             ClientInfo cInfoAttacker = PersistentOperations.GetClientInfoFromEntityId(attacker.entityId);
                             if (cInfoAttacker != null)
                             {
                                 EntityPlayer attackingPlayer = attacker as EntityPlayer;
                                 if (attackingItem(__instance) != null)
                                 {
                                     if (DamageDetector.IsEnabled && !DamageDetector.IsValidPvP(victim as EntityPlayer, cInfoAttacker, strength(__instance), attackingItem(__instance)))
                                     {
                                         return(true);
                                     }
                                     if (InfiniteAmmo.IsEnabled && attackingItem(__instance).ItemClass.IsGun())
                                     {
                                         int slot = attackingPlayer.inventory.holdingItemIdx;
                                         if (InfiniteAmmo.Exec(cInfoAttacker, attackingPlayer, slot, attackingItem(__instance)))
                                         {
                                             return(true);
                                         }
                                     }
                                 }
                                 else
                                 {
                                     return(true);
                                 }
                                 if (NewPlayerProtection.IsEnabled)
                                 {
                                     if (NewPlayerProtection.IsProtected(victimPlayer))
                                     {
                                         Phrases.Dict.TryGetValue("NewPlayerProtection2", out string phrase);
                                         ChatHook.ChatMessage(cInfoAttacker, Config.Chat_Response_Color + phrase + "[-]", -1, Config.Server_Response_Name, EChatType.Whisper, null);
                                         return(true);
                                     }
                                     else if (NewPlayerProtection.IsProtected(attackingPlayer))
                                     {
                                         Phrases.Dict.TryGetValue("NewPlayerProtection1", out string phrase);
                                         ChatHook.ChatMessage(cInfoVictim, Config.Chat_Response_Color + phrase + "[-]", -1, Config.Server_Response_Name, EChatType.Whisper, null);
                                         return(true);
                                     }
                                 }
                                 //if (Zones.IsEnabled && !Zones.IsValid(cInfoVictim, cInfoAttacker))
                                 //{
                                 //    return true;
                                 //}
                                 if (Lobby.IsEnabled && Lobby.PvE && (Lobby.LobbyPlayers.Contains(victimPlayer.entityId) || Lobby.LobbyPlayers.Contains(attackingPlayer.entityId)))
                                 {
                                     Lobby.PvEViolation(cInfoAttacker);
                                     return(true);
                                 }
                                 if (Market.IsEnabled && Market.PvE && (Market.MarketPlayers.Contains(victimPlayer.entityId) || Market.MarketPlayers.Contains(attackingPlayer.entityId)))
                                 {
                                     Market.PvEViolation(cInfoAttacker);
                                     return(true);
                                 }
                                 float distance = attackingPlayer.GetDistance(victimPlayer);
                                 using (StreamWriter sw = new StreamWriter(Filepath, true, Encoding.UTF8))
                                 {
                                     sw.WriteLine(string.Format("{0}: '{1}' '{2}' named '{3}' @ '{4}' hit '{5}' '{6}' named '{7}' @ '{8}' using '{9}' for '{10}' damage. Distance '{11}'", DateTime.Now, cInfoAttacker.PlatformId.CombinedString, cInfoAttacker.CrossplatformId.CombinedString, cInfoAttacker.playerName, cInfoAttacker.latestPlayerData.ecd.pos, cInfoVictim.PlatformId.CombinedString, cInfoVictim.CrossplatformId.CombinedString, cInfoVictim.playerName, cInfoVictim.latestPlayerData.ecd.pos, attackingItem(__instance).ItemClass.GetLocalizedItemName() ?? attackingItem(__instance).ItemClass.GetItemName(), strength(__instance), distance));
                                     sw.WriteLine();
                                     sw.Flush();
                                     sw.Close();
                                 }
                                 if (bFatal(__instance) && victimPlayer.IsAlive() && lastEntityKilled != victimPlayer.entityId)
                                 {
                                     lastEntityKilled = victimPlayer.entityId;
                                     if (KillNotice.IsEnabled && KillNotice.PvP)
                                     {
                                         KillNotice.PlayerKilledPlayer(cInfoVictim, victimPlayer, cInfoAttacker, attackingPlayer, attackingItem(__instance), strength(__instance));
                                     }
                                     if (Bounties.IsEnabled)
                                     {
                                         Bounties.PlayerKilled(victimPlayer, attackingPlayer, cInfoVictim, cInfoAttacker);
                                     }
                                     if (Wallet.IsEnabled && Wallet.PVP && Wallet.Player_Kill > 0)
                                     {
                                         Wallet.AddCurrency(cInfoAttacker.CrossplatformId.CombinedString, Wallet.Player_Kill);
                                     }
                                     if (MagicBullet.IsEnabled && !MagicBullet.Kill.Contains(cInfoAttacker.entityId))
                                     {
                                         MagicBullet.Kill.Add(cInfoAttacker.entityId);
                                     }
                                 }
                             }
                         }
                         else if (attacker is EntityZombie)
                         {
                             if (NewPlayerProtection.IsEnabled && NewPlayerProtection.IsProtected(victimPlayer))
                             {
                                 return(true);
                             }
                             if (KillNotice.IsEnabled && KillNotice.Zombie_Kills)
                             {
                                 int[] attack = new int[] { attacker.entityId, strength(__instance) };
                                 if (KillNotice.Damage.ContainsKey(victim.entityId))
                                 {
                                     KillNotice.Damage[victim.entityId] = attack;
                                 }
                                 else
                                 {
                                     KillNotice.Damage.Add(victim.entityId, attack);
                                 }
                             }
                         }
                         else if (attacker is EntityAnimal)
                         {
                             if (NewPlayerProtection.IsEnabled && NewPlayerProtection.IsProtected(victimPlayer))
                             {
                                 return(true);
                             }
                             if (KillNotice.IsEnabled && KillNotice.Animal_Kills)
                             {
                                 int[] attack = new int[] { attacker.entityId, strength(__instance) };
                                 if (KillNotice.Damage.ContainsKey(victim.entityId))
                                 {
                                     KillNotice.Damage[victim.entityId] = attack;
                                 }
                                 else
                                 {
                                     KillNotice.Damage.Add(victim.entityId, attack);
                                 }
                             }
                         }
                     }
                 }
                 else if (victim is EntityZombie && attacker is EntityPlayer)
                 {
                     ClientInfo cInfoAttacker = PersistentOperations.GetClientInfoFromEntityId(attacker.entityId);
                     if (cInfoAttacker != null)
                     {
                         EntityPlayer attackingPlayer = attacker as EntityPlayer;
                         if (attackingItem(__instance) != null)
                         {
                             if (DamageDetector.IsEnabled && !DamageDetector.IsValidEntityDamage(attackingPlayer, cInfoAttacker, strength(__instance), attackingItem(__instance)))
                             {
                                 return(true);
                             }
                             if (InfiniteAmmo.IsEnabled && attackingItem(__instance).ItemClass.IsGun())
                             {
                                 int slot = attackingPlayer.inventory.holdingItemIdx;
                                 if (InfiniteAmmo.Exec(cInfoAttacker, attackingPlayer, slot, attackingItem(__instance)))
                                 {
                                     return(true);
                                 }
                             }
                             if (bFatal(__instance) && victim.IsAlive() && lastEntityKilled != victim.entityId)
                             {
                                 lastEntityKilled = victim.entityId;
                                 if (Wallet.IsEnabled && Wallet.Zombie_Kill > 0)
                                 {
                                     Wallet.AddCurrency(cInfoAttacker.CrossplatformId.CombinedString, Wallet.Zombie_Kill);
                                 }
                                 if (BloodmoonWarrior.IsEnabled && BloodmoonWarrior.BloodmoonStarted && BloodmoonWarrior.WarriorList.Contains(cInfoAttacker.entityId))
                                 {
                                     if (BloodmoonWarrior.KilledZombies.TryGetValue(cInfoAttacker.entityId, out int killedZ))
                                     {
                                         BloodmoonWarrior.KilledZombies[cInfoAttacker.entityId] += 1;
                                     }
                                     else
                                     {
                                         BloodmoonWarrior.KilledZombies.Add(cInfoAttacker.entityId, 1);
                                     }
                                 }
                             }
                         }
                         else
                         {
                             return(true);
                         }
                         if (PersistentOperations.IsBloodmoon() && Market.IsEnabled && Market.MarketPlayers.Contains(cInfoAttacker.entityId))
                         {
                             Phrases.Dict.TryGetValue("Market12", out string phrase);
                             ChatHook.ChatMessage(cInfoAttacker, Config.Chat_Response_Color + phrase + "[-]", -1, Config.Server_Response_Name, EChatType.Whisper, null);
                             return(true);
                         }
                         if (PersistentOperations.IsBloodmoon() && Lobby.IsEnabled && Lobby.LobbyPlayers.Contains(cInfoAttacker.entityId))
                         {
                             Phrases.Dict.TryGetValue("Lobby12", out string phrase);
                             ChatHook.ChatMessage(cInfoAttacker, Config.Chat_Response_Color + phrase + "[-]", -1, Config.Server_Response_Name, EChatType.Whisper, null);
                             return(true);
                         }
                         int distance = (int)attackingPlayer.GetDistance(victim);
                         using (StreamWriter sw = new StreamWriter(Filepath, true, Encoding.UTF8))
                         {
                             sw.WriteLine(string.Format("{0}: '{1}' '{2}' named '{3}' @ '{4}' hit '{5}' named '{6}' @ '{7}' using '{8}' for '{9}' damage. Distance '{10}'", DateTime.Now, cInfoAttacker.PlatformId.CombinedString, cInfoAttacker.CrossplatformId.CombinedString, cInfoAttacker.playerName, cInfoAttacker.latestPlayerData.ecd.pos, victim.entityId, victim.EntityClass.entityClassName, victim.position, attackingItem(__instance).ItemClass.GetLocalizedItemName() ?? attackingItem(__instance).ItemClass.GetItemName(), strength(__instance), distance));
                             sw.WriteLine();
                             sw.Flush();
                             sw.Close();
                         }
                     }
                 }
                 else if (victim is EntityAnimal && attacker is EntityPlayer)
                 {
                     ClientInfo cInfoAttacker = PersistentOperations.GetClientInfoFromEntityId(attacker.entityId);
                     if (cInfoAttacker != null)
                     {
                         EntityPlayer attackingPlayer = attacker as EntityPlayer;
                         if (attackingItem(__instance) != null)
                         {
                             if (DamageDetector.IsEnabled && !DamageDetector.IsValidEntityDamage(attackingPlayer, cInfoAttacker, strength(__instance), attackingItem(__instance)))
                             {
                                 return(true);
                             }
                             if (InfiniteAmmo.IsEnabled && attackingItem(__instance).ItemClass.IsGun())
                             {
                                 int slot = attackingPlayer.inventory.holdingItemIdx;
                                 if (InfiniteAmmo.Exec(cInfoAttacker, attackingPlayer, slot, attackingItem(__instance)))
                                 {
                                     return(true);
                                 }
                             }
                         }
                     }
                 }
             }
         }
     }
     catch (Exception e)
     {
         Log.Out(string.Format("[SERVERTOOLS] Error in ProcessDamage.Exec: {0}", e.Message));
     }
     return(false);
 }