コード例 #1
0
 public static bool ExplosionServer_Prefix(GameManager __instance, Vector3 _worldPos, Vector3i _blockPos, int _playerId)
 {
     try
     {
         if (_playerId > 0)
         {
             AdminToolsClientInfo Admin = GameManager.Instance.adminTools.GetAdminToolsClientInfo(_playerId.ToString());
             if (Admin.PermissionLevel > ProcessDamage.Admin_Level)
             {
                 return(ProtectedSpaces.AllowExplosion(_worldPos));
             }
         }
     }
     catch (Exception e)
     {
         Log.Out(string.Format("[SERVERTOOLS] Error in Injections.ExplosionServer_Prefix: {0}", e.Message));
     }
     return(true);
 }
コード例 #2
0
 public static bool ExplosionServer_Prefix(Vector3 _worldPos, int _playerId)
 {
     try
     {
         if (_playerId > 0)
         {
             ClientInfo _cInfo = PersistentOperations.GetClientInfoFromEntityId(_playerId);
             if (_cInfo != null)
             {
                 if (GameManager.Instance.adminTools.GetUserPermissionLevel(_cInfo) > ProcessDamage.Admin_Level)
                 {
                     return(ProtectedSpaces.AllowExplosion(_worldPos));
                 }
             }
         }
     }
     catch (Exception e)
     {
         Log.Out(string.Format("[SERVERTOOLS] Error in Injections.ExplosionServer_Prefix: {0}", e.Message));
     }
     return(true);
 }
コード例 #3
0
ファイル: Mods.cs プロジェクト: Tsaukpaetra/7dtd-ServerTools
 public static void Load()
 {
     PersistentOperations.SetInstallFolder();
     if (!DiscordBot.TokenLoaded)
     {
         DiscordBot.BuildToken();
     }
     if (!RunTimePatch.Applied)
     {
         RunTimePatch.PatchAll();
     }
     if (!Timers.IsRunning)
     {
         Timers.TimerStart();
     }
     if (!Triggers.IsRunning)
     {
         Triggers.Load();
     }
     if (Poll.IsEnabled && PersistentContainer.Instance.PollOpen)
     {
         Poll.CheckTime();
     }
     if (!ClanManager.IsEnabled)
     {
         ClanManager.Clans.Clear();
         ClanManager.ClanMember.Clear();
     }
     if (!InfoTicker.IsEnabled && InfoTicker.IsRunning)
     {
         InfoTicker.Unload();
     }
     if (InfoTicker.IsEnabled && !InfoTicker.IsRunning)
     {
         InfoTicker.Load();
     }
     if (Gimme.IsRunning && !Gimme.IsEnabled)
     {
         Gimme.Unload();
     }
     if (!Gimme.IsRunning && Gimme.IsEnabled)
     {
         Gimme.Load();
     }
     if (Badwords.IsRunning && !Badwords.IsEnabled)
     {
         Badwords.Unload();
     }
     if (!Badwords.IsRunning && Badwords.IsEnabled)
     {
         Badwords.Load();
     }
     if (!LoginNotice.IsRunning && LoginNotice.IsEnabled)
     {
         LoginNotice.Load();
     }
     if (LoginNotice.IsRunning && !LoginNotice.IsEnabled)
     {
         LoginNotice.Unload();
     }
     if (!Zones.IsRunning && Zones.IsEnabled)
     {
         Zones.Load();
     }
     if (Zones.IsRunning && !Zones.IsEnabled)
     {
         Zones.Unload();
     }
     if (!VoteReward.IsRunning && VoteReward.IsEnabled)
     {
         VoteReward.Load();
     }
     if (VoteReward.IsRunning && !VoteReward.IsEnabled)
     {
         VoteReward.Unload();
     }
     if (!Watchlist.IsRunning && Watchlist.IsEnabled)
     {
         Watchlist.Load();
     }
     if (Watchlist.IsRunning && !Watchlist.IsEnabled)
     {
         Watchlist.Unload();
     }
     if (!ReservedSlots.IsRunning && ReservedSlots.IsEnabled)
     {
         ReservedSlots.Load();
     }
     if (ReservedSlots.IsRunning && !ReservedSlots.IsEnabled)
     {
         ReservedSlots.Unload();
     }
     if (!StartingItems.IsRunning && StartingItems.IsEnabled)
     {
         StartingItems.Load();
     }
     if (StartingItems.IsRunning && !StartingItems.IsEnabled)
     {
         StartingItems.Unload();
     }
     if (!Travel.IsRunning && Travel.IsEnabled)
     {
         Travel.Load();
     }
     if (Travel.IsRunning && !Travel.IsEnabled)
     {
         Travel.Unload();
     }
     if (!Shop.IsRunning && Shop.IsEnabled)
     {
         Shop.Load();
     }
     if (Shop.IsRunning && !Shop.IsEnabled)
     {
         Shop.Unload();
     }
     if (!Motd.IsRunning && Motd.IsEnabled)
     {
         Motd.Load();
     }
     if (Motd.IsRunning && !Motd.IsEnabled)
     {
         Motd.Unload();
     }
     if (InvalidItems.IsRunning && !InvalidItems.IsEnabled)
     {
         InvalidItems.Unload();
     }
     if (!InvalidItems.IsRunning && InvalidItems.IsEnabled)
     {
         InvalidItems.Load();
     }
     if (HighPingKicker.IsRunning && !HighPingKicker.IsEnabled)
     {
         HighPingKicker.Unload();
     }
     if (!HighPingKicker.IsRunning && HighPingKicker.IsEnabled)
     {
         HighPingKicker.Load();
     }
     if (CredentialCheck.IsRunning && !CredentialCheck.IsEnabled)
     {
         CredentialCheck.Unload();
     }
     if (!CredentialCheck.IsRunning && CredentialCheck.IsEnabled)
     {
         CredentialCheck.Load();
     }
     if (CustomCommands.IsRunning && !CustomCommands.IsEnabled)
     {
         CustomCommands.Unload();
     }
     if (!CustomCommands.IsRunning && CustomCommands.IsEnabled)
     {
         CustomCommands.Load();
     }
     if (DupeLog.IsRunning && !DupeLog.IsEnabled)
     {
         DupeLog.Unload();
     }
     if (!DupeLog.IsRunning && DupeLog.IsEnabled)
     {
         DupeLog.Load();
     }
     if (ChatColorPrefix.IsRunning && !ChatColorPrefix.IsEnabled)
     {
         ChatColorPrefix.Unload();
     }
     if (!ChatColorPrefix.IsRunning && ChatColorPrefix.IsEnabled)
     {
         ChatColorPrefix.Load();
     }
     if (KillNotice.IsRunning && !KillNotice.IsEnabled)
     {
         KillNotice.Unload();
     }
     if (!KillNotice.IsRunning && KillNotice.IsEnabled)
     {
         KillNotice.Load();
     }
     if (Prayer.IsRunning && !Prayer.IsEnabled)
     {
         Prayer.Unload();
     }
     if (!Prayer.IsRunning && Prayer.IsEnabled)
     {
         Prayer.Load();
     }
     if (BloodmoonWarrior.IsRunning && !BloodmoonWarrior.IsEnabled)
     {
         BloodmoonWarrior.Unload();
     }
     else if (!BloodmoonWarrior.IsRunning && BloodmoonWarrior.IsEnabled)
     {
         BloodmoonWarrior.Load();
     }
     if (ProtectedSpaces.IsRunning && !ProtectedSpaces.IsEnabled)
     {
         ProtectedSpaces.Unload();
     }
     else if (!ProtectedSpaces.IsRunning && ProtectedSpaces.IsEnabled)
     {
         ProtectedSpaces.Load();
     }
     if (ClanManager.IsEnabled)
     {
         ClanManager.ClanList();
     }
     if (Auction.IsEnabled)
     {
         Auction.AuctionList();
     }
     if (Mute.IsEnabled)
     {
         Mute.ClientMuteList();
         Mute.MuteList();
     }
     if (Jail.IsEnabled)
     {
         Jail.JailList();
     }
     if (WebAPI.IsEnabled && !WebAPI.IsRunning)
     {
         WebAPI.Load();
     }
     else if (WebAPI.IsRunning && !WebAPI.IsEnabled)
     {
         WebAPI.Unload();
     }
 }
コード例 #4
0
 public static bool ProcessBlockDamage(GameManager __instance, string _persistentPlayerId, List <BlockChangeInfo> _blocksToChange)
 {
     try
     {
         World _world = __instance.World;
         if (__instance != null && _blocksToChange != null && !string.IsNullOrEmpty(_persistentPlayerId) && _blocksToChange != null)
         {
             for (int i = 0; i < _blocksToChange.Count; i++)
             {
                 BlockChangeInfo _newBlockInfo = _blocksToChange[i];                 //new block info
                 BlockValue      _blockValue   = _world.GetBlock(_newBlockInfo.pos); //old block value
                 if (_newBlockInfo != null && _newBlockInfo.bChangeBlockValue)       //new block value
                 {
                     if (_blockValue.type == BlockValue.Air.type)                    //old block was air
                     {
                         if (_newBlockInfo.blockValue.Block is BlockSleepingBag)     //placed a sleeping bag
                         {
                             PersistentOperations.BedBug(_persistentPlayerId);
                         }
                         else if (_newBlockInfo.blockValue.Block is BlockLandClaim)//placed a land claim
                         {
                         }
                         if (BlockLogger.IsEnabled)//placed block
                         {
                             BlockLogger.Log(_persistentPlayerId, _newBlockInfo);
                         }
                         return(true);
                     }
                     if (ProcessDamage.Damage_Detector)
                     {
                         if (_newBlockInfo.blockValue.type == BlockValue.Air.type) //new block is air
                         {
                             if (_blockValue.type == BlockValue.Air.type)          //replaced block
                             {
                                 return(true);
                             }
                             if (_blockValue.Block is BlockLandClaim)            //removed claim
                             {
                                 if (!string.IsNullOrEmpty(_persistentPlayerId)) //id is valid
                                 {
                                     if (!PersistentOperations.ClaimedByAllyOrSelf(_persistentPlayerId, _newBlockInfo.pos))
                                     {
                                         int _total = _blockValue.Block.MaxDamage - _blockValue.damage;
                                         if (_blockValue.Block.MaxDamage - _blockValue.damage >= Block_Damage_Limit && BlockPenalty(_total, _persistentPlayerId))
                                         {
                                             if (ProtectedSpaces.IsEnabled && ProtectedSpaces.IsProtectedSpace(_newBlockInfo.pos))
                                             {
                                                 _world.SetBlockRPC(_newBlockInfo.clrIdx, _newBlockInfo.pos, _blockValue);
                                                 return(false);
                                             }
                                         }
                                     }
                                 }
                             }
                             if (!_blockValue.Block.CanPickup && !PersistentOperations.ClaimedByAllyOrSelf(_persistentPlayerId, _newBlockInfo.pos))//old block can not be picked up and unclaimed space
                             {
                                 int _total = _blockValue.Block.MaxDamage - _blockValue.damage;
                                 if (_total >= Block_Damage_Limit && BlockPenalty(_total, _persistentPlayerId))
                                 {
                                     if (ProtectedSpaces.IsEnabled && ProtectedSpaces.IsProtectedSpace(_newBlockInfo.pos))
                                     {
                                         _world.SetBlockRPC(_newBlockInfo.clrIdx, _newBlockInfo.pos, _blockValue);
                                         return(false);
                                     }
                                 }
                             }
                         }
                         else if (_blockValue.Block.blockID == _newBlockInfo.blockValue.Block.blockID) //block is the same
                         {
                             if (_newBlockInfo.bChangeDamage)                                          //block took damage
                             {
                                 int _total = _newBlockInfo.blockValue.damage - _blockValue.damage;
                                 if (_total >= Block_Damage_Limit && BlockPenalty(_total, _persistentPlayerId))
                                 {
                                     if (ProtectedSpaces.IsEnabled && ProtectedSpaces.IsProtectedSpace(_newBlockInfo.pos) || Zones.IsEnabled && Zones.Protected(_newBlockInfo.pos))
                                     {
                                         _world.SetBlockRPC(_newBlockInfo.clrIdx, _newBlockInfo.pos, _blockValue);
                                         return(false);
                                     }
                                 }
                             }
                             if (_blockValue.damage == _newBlockInfo.blockValue.damage || _newBlockInfo.blockValue.damage == 0)//block replaced
                             {
                                 return(true);
                             }
                         }
                         else if (_blockValue.Block.DowngradeBlock.Block.blockID == _newBlockInfo.blockValue.Block.blockID)//downgraded
                         {
                             if (_blockValue.damage == _newBlockInfo.blockValue.damage || _newBlockInfo.blockValue.damage == 0)
                             {
                                 return(true);
                             }
                             int _total = _blockValue.Block.MaxDamage - _blockValue.damage + _newBlockInfo.blockValue.damage;
                             if (_total >= Block_Damage_Limit && BlockPenalty(_total, _persistentPlayerId))
                             {
                                 if (ProtectedSpaces.IsEnabled && ProtectedSpaces.IsProtectedSpace(_newBlockInfo.pos))
                                 {
                                     _world.SetBlockRPC(_newBlockInfo.clrIdx, _newBlockInfo.pos, _blockValue);
                                     return(false);
                                 }
                             }
                         }
                     }
                 }
             }
         }
     }
     catch (Exception e)
     {
         Log.Out(string.Format("[SERVERTOOLS] Error in ProcessDamage.ProcessBlockDamage: {0}", e.Message));
     }
     return(true);
 }