From bd7225c84e81e69a05ea1055317d2b685da68123 Mon Sep 17 00:00:00 2001 From: cybsec Date: Wed, 21 Jan 2026 15:02:53 -0500 Subject: [PATCH] feat: enhance DP2 moderation assistant with detailed command reasons and severity levels - Replace generic 'DP2 violation' with specific crime-based reasons - Add severity levels to reasons (Minor/Moderate/Severe Theft, Minor/Moderate/Large/Massive Griefing) - Fix ban command generation to use tempban/tempmute with proper time formatting instead of ban - Fix theft-grief point calculation to use blockCount / 20 with minimum 2 points - Fix dark/light mode toggle button functionality - Clear results when category or crime selection changes - Improve command accuracy using AdvancedBan syntax (/tempban, /tempmute, etc.) --- src/components/DP2Form.tsx | 29 ++++- src/hooks/useDP2Calculator.ts | 13 ++- src/lib/dp2-rules.ts | 203 ++++++++++++++++++++++++++++++++-- 3 files changed, 228 insertions(+), 17 deletions(-) diff --git a/src/components/DP2Form.tsx b/src/components/DP2Form.tsx index 41d8fd3..012b8fb 100644 --- a/src/components/DP2Form.tsx +++ b/src/components/DP2Form.tsx @@ -1,6 +1,6 @@ 'use client'; -import { useState } from 'react'; +import { useState, useEffect } from 'react'; import { useForm } from 'react-hook-form'; import { zodResolver } from '@hookform/resolvers/zod'; import { z } from 'zod'; @@ -42,7 +42,8 @@ type FormData = z.infer; export function DP2Form() { const [activeCategory, setActiveCategory] = useState(null); - const { result, isLoading, calculatePunishment, copyToClipboard } = useDP2Calculator(); + const [isDarkMode, setIsDarkMode] = useState(false); + const { result, isLoading, calculatePunishment, copyToClipboard, clearResult } = useDP2Calculator(); const form = useForm({ resolver: zodResolver(FormSchema), @@ -95,10 +96,12 @@ export function DP2Form() { const selectedCrime = CRIMES.find(c => c.id === form.watch('crimeId')); - const filteredCrimes = CRIMES.filter(crime => + const filteredCrimes = CRIMES.filter(crime => activeCategory ? crime.category === activeCategory : true ); + + return (
@@ -107,7 +110,15 @@ export function DP2Form() { dp2 moderation assistant calculate punishments and generate commands based on dp2 guidelines
-