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."); } }
bool RemoveMapping(string zoneID) => (bool)TruePVE?.Call("RemoveMapping", zoneID);
bool AddMapping(string zoneID) => (bool)TruePVE?.Call("AddOrUpdateMapping", zoneID, "exclude");
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."); } } }