Пример #1
0
        void DeleteDynZone(string DynZoneID)
        {
            var MappingUpdated = (bool)TruePVE?.Call("RemoveMapping", DynZoneID);

            if (MappingUpdated)
            {
                DebugPrint("PVP disabled for Zone: " + DynZoneID, false);
            }

            if (DomeCreateAllowed())
            {
                var DomeDeleted = (bool)ZoneDomes?.Call("RemoveExistingDome", null, DynZoneID);

                if (DomeDeleted)
                {
                    DebugPrint("Dome deleted for Zone: " + DynZoneID, false);
                }
                else
                {
                    PrintWarning("Dome NOT deleted for Zone: " + DynZoneID);
                }
            }

            var ZoneDeleted = (bool)ZoneManager?.Call("EraseZone", DynZoneID);

            if (ZoneDeleted)
            {
                DebugPrint("Deleted Zone: " + DynZoneID + " [" + DateTime.Now.ToString("HH:mm:ss") + "]", false);
            }
            else
            {
                PrintWarning("Zone deletion failed.");
            }
        }
Пример #2
0
        void DesactivateAdminZone(BasePlayer parPlayer)
        {
            FAdminZones.Remove(parPlayer);
            if (ZoneDomes)
            {
                bool undisplaySuccessful = (bool)ZoneDomes?.Call("RemoveExistingDome", parPlayer, parPlayer.UserIDString);
                if (!undisplaySuccessful)
                {
                    PrintToChat(parPlayer, "something wrong happens when undisplaying the dome");
                }
            }
            bool eraseSuccessful = (bool)ZoneManager?.Call("EraseZone", parPlayer.UserIDString);

            if (!eraseSuccessful)
            {
                PrintToChat(parPlayer, "something wrong happens when erasing the zone");
            }
        }
Пример #3
0
 private void OnServerInitialized()
 {
     FTimer?.Destroy();
     if (FConfigFile.UseDynamicZone)
     {
         FTimer = timer.Every(FConfigFile.RefreshInterval, () =>
         {
             Dictionary <BasePlayer, Vector3> newPos = new Dictionary <BasePlayer, Vector3>();
             foreach (var playerAndPos in FAdminZones)
             {
                 BasePlayer currentPlayer = playerAndPos.Key;
                 float distance           = Vector3.Distance(playerAndPos.Value, currentPlayer.ServerPosition);
                 if (distance > FConfigFile.RefreshDistance)
                 {
                     if (CreateOrUpdateAdminZone(currentPlayer))
                     {
                         newPos.Add(currentPlayer, currentPlayer.ServerPosition);
                         bool undisplaySuccessful = (bool)ZoneDomes?.Call("RemoveExistingDome", currentPlayer, currentPlayer.UserIDString);
                         if (undisplaySuccessful)
                         {
                             bool displaySuccessful = (bool)ZoneDomes?.Call("AddNewDome", currentPlayer, currentPlayer.UserIDString);
                             if (!displaySuccessful)
                             {
                                 PrintToChat(currentPlayer, "something wrong happens when undisplaying the dome");
                             }
                         }
                         else
                         {
                             PrintToChat(currentPlayer, "something wrong happens when undisplaying the dome");
                         }
                     }
                     else
                     {
                         PrintToChat(currentPlayer, "something wrong happens when updating the zone " + currentPlayer.UserIDString);
                     }
                 }
             }
             foreach (var playerAndPos in newPos)
             {
                 FAdminZones[playerAndPos.Key] = playerAndPos.Value;
             }
         });
     }
 }
Пример #4
0
 void ActivateAdminZone(BasePlayer parPlayer, float parSize)
 {
     if (!FAdminZones.ContainsKey(parPlayer))
     {
         bool creationSuccessful = CreateOrUpdateAdminZone(parPlayer, parSize);
         if (creationSuccessful)
         {
             FAdminZones.Add(parPlayer, parPlayer.ServerPosition);
             if (ZoneDomes)
             {
                 bool displaySuccessful = (bool)ZoneDomes?.Call("AddNewDome", parPlayer, parPlayer.UserIDString);
                 if (!displaySuccessful)
                 {
                     PrintToChat(parPlayer, "something wrong happens when displaying the dome");
                 }
             }
         }
         else
         {
             PrintToChat(parPlayer, "something wrong happens when creating the zone");
         }
     }
 }
Пример #5
0
 bool RemoveDome(string zoneID) => (bool)ZoneDomes?.Call("RemoveExistingDome", null, zoneID);
Пример #6
0
 bool AddDome(string zoneID) => (bool)ZoneDomes?.Call("AddNewDome", null, zoneID);
Пример #7
0
        void CreateDynZone(Vector3 DynPosition)
        {
            if (ZoneCreateAllowed())
            {
                string DynZoneID = DateTime.Now.ToString("HHmmssff");

                List <string> DynArgs = new List <string>();
                DynArgs.Add("name");
                DynArgs.Add("DynamicPVP");
                DynArgs.Add("radius");
                DynArgs.Add(DynZoneRadius.ToString());
                DynArgs.Add("enter_message");
                DynArgs.Add("Entering a PVP area!");
                DynArgs.Add("leave_message");
                DynArgs.Add("Leaving a PVP area.");
                DynArgs.Add("undestr");
                DynArgs.Add("true");
                if (BlockTeleport)
                {
                    DynArgs.Add("notp");
                    DynArgs.Add("true");
                }
                string[] DynZoneArgs = DynArgs.ToArray();

                var ZoneCreated = (bool)ZoneManager?.Call("CreateOrUpdateZone", DynZoneID, DynZoneArgs, DynPosition);

                if (ZoneCreated)
                {
                    DebugPrint("Created Zone: " + DynZoneID + " [" + DateTime.Now.ToString("HH:mm:ss") + "]", false);
                    if (DomeCreateAllowed())
                    {
                        bool DomeCreated = false;

                        DomeCreated = (bool)ZoneDomes?.Call("AddNewDome", null, DynZoneID);
                        if (DomeCreated)
                        {
                            DebugPrint("Dome created for Zone: " + DynZoneID, false);
                        }
                        else
                        {
                            DebugPrint("Dome NOT created for Zone: " + DynZoneID, true);
                        }
                    }
                    timer.Once(DynZoneDuration, () => { DeleteDynZone(DynZoneID); });

                    var MappingUpdated = (bool)TruePVE?.Call("AddOrUpdateMapping", DynZoneID, "exclude");

                    if (MappingUpdated)
                    {
                        DebugPrint("PVP enabled for Zone: " + DynZoneID + " " + DynPosition, false);
                    }
                    else
                    {
                        PrintWarning("PVP Mapping failed.");
                    }
                }
                else
                {
                    PrintWarning("Zone creation failed.");
                }
            }
        }