Graal Forums

Graal Forums (https://forums.graalonline.com/forums/index.php)
-   Code Gallery (https://forums.graalonline.com/forums/forumdisplay.php?f=179)
-   -   Support Center System [Unfinished] (https://forums.graalonline.com/forums/showthread.php?t=73772)

Rapidwolve 05-01-2007 01:21 AM

Support Center System [Unfinished]
 
Here's another unfinished script of mine (that I don't plan on finishing). Features right now include submitting tickets, and admins can view, delete, open, or close tickets. Never got around to scripting responses.

Modify NPC (Control-NPC):
PHP Code:

function onRCChat()
{
  if (
params[0] == "viewcomplaint") 
    
findNPC("Complaint-Database").ViewComplaint(params[1]);
} 

Create NPC (Complaint-Database):
PHP Code:

/*

NPC by Rapidwolve

*/

function onCreated()
  
createVariables();
  
function 
createVariables()
{
  
this.skip_flags = {"alerts_highlevel", "skip_flags", "registered_complaints",  "allowed_admincenter", "debug_mode"};
  
this.alerts_highlevel = {"High", "Serious"};
  
this.debug_mode = false;  // Output all actions to NC
  
this.allowed_admincenter = {"rapidwolve", "Frotter"};  // People allowed to the admin center
}

public function 
RegisterComplaint(complainer, category, seriousness, description)
{
  
temp.id = NextAvailableID();
  
this.("complaint_" @ temp.id) = {temp.complainer, temp.category, temp.seriousness, temp.description, "Open"};
  
  
findPlayer(temp.complainer).triggerClient("weapon", "-Complaint Reporter", "SentComplaint", temp.id);
  
  if(
temp.seriousness in this.alerts_highlevel)
  
sendMessage(format("New high priority ticket submitted by, %s. Index: %i", temp.complainer, temp.id), true);
  
  
this.registered_complaints ++;
}

public function 
NextAvailableID()
{
  
temp.currentid = 1;
  
    while (
this.("complaint_" @ temp.currentid)[0])
      
temp.currentid ++;
      
  return (
temp.currentid);
}

public function 
sendMessage(message, override)
{
  if (
this.debug_mode || temp.override)
    echo(
format("[Support Center]: %s", temp.message));
}

public function 
ViewComplaint(id)
{
  
temp.complaint = this.("complaint_" @ temp.id);
  if (!
temp.complaint[0]) return sendMessage("No such complaint index. " @ temp.id);
  
  
sendpm("--Viewing complaint (Index-" SPC temp.id @ ")--:" NL
  
"Complainer: " @ temp.complaint[0] NL
  
"Category: " @ temp.complaint[1] NL
  
"Priority: " @ temp.complaint[2] NL
  
"Description: " @ temp.complaint[3]);
}


public function 
GetSupportTickets(admin)
{
  if (!(
temp.admin in this.allowed_admincenter) && !(temp.admin == this.allowed_admincenter)) 
    return 
findPlayer(temp.admin).triggerClient("weapon", "-Complaint Reporter", "NotAllowed");
  
  
temp.list.clear();
  
  for (
temp.i: this.getDynamicVarNames())
  {
    if (
temp.i[0] in this.skip_flags) continue;
      
temp.idlist.add(temp.i.substring(("complaint_").length()));
      
temp.list.add((this.(@temp.i)));
  }

  
findPlayer(temp.admin).triggerClient("weapon", "-Complaint Reporter", "RefreshTicketsList", temp.list, temp.idlist);
}

public function 
GetPlayerSupportTickets(account)
{
  
temp.list.clear();
  
  for (
temp.i: this.getDynamicVarNames())
  {
    if ((
temp.i[0] in this.skip_flags) || (this.(@temp.i)[0] != temp.account)) continue;
      
temp.idlist.add(temp.i.substring(("complaint_").length()));
      
temp.list.add((this.(@temp.i)));
  }
  
findPlayer(temp.account).triggerClient("weapon", "-Complaint Reporter", "RefreshMyTicketsList", temp.list, temp.idlist);
}

public function 
GetSupportTicket(id, admin)
  
findPlayer(temp.admin).triggerClient("weapon", "-Complaint Reporter", "ViewSupportTicket", temp.id, this.("complaint_" @ temp.id));

public function 
CloseTicket(id){
  
sendMessage(format("%s has closed ticket %i", player.account, temp.id));
  
this.("complaint_" @ temp.id)[4] = "Closed";
}

public function 
OpenTicket(id){
  
sendMessage(format("%s has opened ticket %i", player.account, temp.id));
  
this.("complaint_" @ temp.id)[4] = "Open";
}

public function 
DeleteTicket(id){
  
sendMessage(format("%s has deleted ticket %i", player.account, temp.id));
  
this.("complaint_" @ temp.id).clear();
  
this.("complaint_" @ temp.id) == "";  // double check
}

public function 
toggleTicketStatus(id){
  
temp.ticket = this.("complaint_" @ temp.id)[4];
  ((
temp.ticket == "Open") ? CloseTicket(temp.id):OpenTicket(temp.id));
} 

Images can be found at:
http://forums.graal2001.com/forums/s...ad.php?t=73510

Rapidwolve 05-01-2007 01:24 AM

Create Weapon (-Complaint Reporter):
Part 1
PHP Code:

/*

NPC by Rapidwolve
Last Updated: April 15, 2007

*/

function onCreated()
  
this.database = findNPC("Complaint-Database");
  
function 
onActionServerside(action)
{
  switch (
action)
  {
    case 
"RegisterComplaint":
      
this.database.RegisterComplaint(params[1], params[2], params[3], params[4]); // [1 = Account | 2 = Category | 3 = Seriousness| 4 = Description]
    
break;
    
    case 
"GetSupportTickets":
      
this.database.GetSupportTickets(player.account);
    break;
    
    case 
"GetSupportTicket":
      
this.database.GetSupportTicket(params[1], player.account);
    break;
    
    case 
"GetMySupportTickets":
      
this.database.GetPlayerSupportTickets(player.account);
    break;
    
    case 
"CloseTicket":
      
this.database.CloseTicket(params[1]);
    break;
    
    case 
"toggleTicketStatus":
      
this.database.toggleTicketStatus(params[1]);
    break;
    
    case 
"DeleteTicket":
      
this.database.DeleteTicket(params[1]);
    break;
  }
}

//#CLIENTSIDE

function onCreated()
  
resetVariables();

function 
resetVariables()
{
  
enum key
  
{
    
F9 = 120,
    
F11 = 122
  
};

  
join("profiles");   // Allows use of ZodiacWindowProfile
  
  
this.verification_code = "0verRide";  // Overrides the current verification code
  
  
this.description_minimum = 30;  // Minimum characters for the description
  
this.description_maximum = 500; // Maximum characters for the description
  
  
this.complaint_categorys = 
  {
"Script Error", "Hacker","Faulty Weapon/Skill", 
  
"Heavy Lag", "Monster Malfunction", "Event Error", // Categorys
  
"Corruption", "Wrongful Jailing", "Suggestions",
  
"Other"
  
};
  
  
this.admin_message =
  
"<center>
  Welcome to the Administration Desk for Support Center
  to use, right or double click on a ticket and select an option.
  <b>View Ticket</b> opens the ticket and allows you to view the
  description and add a reply or close the ticket. <b>Toggle Status</b> 
  toggles depending on whether the ticket is Open or Closed.
  
  This system was created by <i>Rapidwolve</i></center>"
;
  
  
this.priority_levels = 
  {
"Serious", "High", "Medium", 
  
"Low", "Unimportant"};  // Priority Levels
  
  
this.terms =
  
"<center>
  Welcome to Zodiac's Support Center, please note
  that abuse of this tool or providing false information
  can and will result in a jailing or possibly a ban
  depending on the offense. All actions are logged.
  </center>"
;   // Terms
  
  
this.active = false;
  
  
this.admin_active = false;
}
function 
onKeyPressed(code, key)
{
  switch (
temp.code)
  {
    case 
key.F9:   // [F9] Key
      
this.active = (this.active ? false : true);   // If its active then make it not active, vice cersa
      
toggleWindow();
    break;
    
    case 
key.F11:   // [F11] Key
      
this.admin_active = (this.admin_active ? false : true);
      
toggleAdminWindow();
    break;
  }
}

function 
toggleWindow()
{ 
  if (
this.active)
    
CloseSystem();    // Close if already open when [F9] is pressed
  
else 
    
drawWindow();     // Open if closed when [F9] is pressed
} 


Rapidwolve 05-01-2007 01:25 AM

Append to Weapon (-Complaint Reporter):
Part 2
PHP Code:

function toggleAdminWindow()
{
  if (
this.admin_active)
    
CloseAdminSystem();
  else
    
drawAdminWindow();
}

function 
drawWindow()
{
  new 
GuiWindowCtrl("Reporter_Window")
  {
    
profile = "ZodiacWindowProfile";
    
visible = true;
    
title = true;
    
position = {(screenwidth / 3), (screenheight / 3)};
    
text = "Zodiac Support Center; Submit Ticket - Press [F9] to close";
    
canMaximize = canMinimize = canResize = canClose = false;
    
extent = {400, 360};
    
    new 
GuiScrollCtrl("Reporter_Holder")
    {
      
profile = "GuiBlueScrollProfile";
      
hScrollBar = vScrollBar = "alwaysOff";
      
position = {6, 24};
      
extent = {(400-12), (360-60)};
      
      new 
GuiMLTextCtrl("Reporter_Terms")
      {
        
width = 260;
        
position = {60, 170};
        
profile = "GuiBlueTextProfile";
        
text = thiso.terms;
      }
      
      new 
GuiCheckBoxCtrl("Reporter_AcceptTerms")
      {
          
profile = "GuiBlueCheckBoxProfile";
          
text = "Accept";
          
extent = {52, 15};
          
position = {160, 260};
          
checked = false;
          
thiso.catchevent(this, "onAction", "GenerateCode");
      }
      
      new 
GuiMLTextCtrl("Reporter_Code")
      {
          
profile = "GuiBlueCheckBoxProfile";
          
text = "Please accept the terms for the code";
          
extent = {192, 15};
          
position = {115, 280};
      }
      
      new 
GuiTextCtrl("Reporter_TypeLabel")
      {
        
profile = "GuiBlueTextProfile";
        
position = {24, 40};
        
text = "Category:";
      }
      
      new 
GuiTextCtrl("Reporter_PriorityLabel")
      {
        
profile = "GuiBlueTextProfile";
        
position = {24, 10};
        
text = "Priority:";
      }
      
      new 
GuiTextCtrl("Reporter_DescriptionLabel")
      {
        
profile = "GuiBlueTextProfile";
        
position = {24, 110};
        
text = "Description:";
      }
      
      new 
GuiScrollCtrl("Reporter_DescriptionHolder")
      {
        
profile = "GuiBlueScrollProfile";
        
position = {220, 110};
        
extent = {150, 65};
        
hScrollBar = "alwaysOff";
        
vScrollBar = "dynamic";
        
        new 
GuiMLTextEditCtrl("Reporter_InputDescription")
        {
          
profile = "GuiBlueTextProfile";
          
position = {1, 0};
          
width = 143;
        }
      }

      new 
GuiPopUpMenuCtrl("Reporter_ListSeriousness")
      {
        
profile = "GuiBluePopUpMenuProfile";
        
textprofile = "GuiBlueTextProfile";
        
scrollprofile = "GuiBlueScrollProfile";
        
        
extent = {150, 25};
        
position = {220, 10};
        
clearrows();
        
        for (
temp.rows: thiso.priority_levels)
          
addRow(1, temp.rows);
        
setSelectedRow(2);
      
      }
      
      new 
GuiScrollCtrl("Reporter_InputTypeHolder")
      {
        
profile = "GuiBlueScrollProfile";
        
hScrollBar = "alwaysOff";
        
vScrollBar = "dynamic";
        
extent = {150, 65};
        
position = {220, 40};
        
        new 
GuiTextListCtrl("Reporter_InputTSelections")
        {
          
profile = "GuiBlueTextListProfile";
          
width = 140;
          
fitparentwidth = true;
          
clearrows();
          for (
temp.rows: thiso.complaint_categorys)
            
addRow(0, temp.rows);
          
setSelectedRow(0);
        }
      }
    }
    
      new 
GuiButtonCtrl("Reporter_BtnFAQ")
      {
        
profile = "GuiBlueButtonProfile";
        
position = {6, 327};
        
extent = {65, 25};
        
text = "Read FAQ";
        
thiso.catchevent(this, "onAction", "ViewFAQ");
      }
      new 
GuiButtonCtrl("Reporter_BtnAbout")
      {
        
profile = "GuiBlueButtonProfile";
        
position = {70, 327};
        
extent = {63, 25};
        
text = "About";
        
thiso.catchevent(this, "onAction", "ViewAboutText");
      }
      new 
GuiTextEditCtrl("Reporter_VerifyTextCode1")
      {
        
position = {134, 327};
        
profile = "GuiBlueTextEditProfile";
        
extent = {95, 25};
        
text = "<Insert Code>";
        
thiso.catchevent(this, "onAction", "SubmitComplaint");
      }

      new 
GuiButtonCtrl("Reporter_BtnViewMyTickets")
      {
        
profile = "GuiBlueButtonProfile";
        
position = {230, 327};
        
extent = {90, 25};
        
text = "View My Tickets";
        
thiso.catchevent(this, "onAction", "ViewMyTicketList");
    }
    
      new 
GuiButtonCtrl("Reporter_BtnSubmit")
      {
        
profile = "GuiBlueButtonProfile";
        
position = {320, 327};
        
extent = {75, 25};
        
text = "Submit Ticket";
        
thiso.catchevent(this, "onAction", "SubmitComplaint");
    }
  }
}

function 
drawAdminWindow()
{
  
GetSupportTickets();
  new 
GuiWindowCtrl("AdminCenter_Window")
  {
    
profile = "ZodiacWindowProfile";
    
title = true;
    
position = {(screenwidth / 2), (screenheight / 3)};
    
extent = {400, 345};
    
text = "Zodiac Support Center; Administration Desk - Press [F11] to close";
    
canMaximize = canMinimize = canResize = canClose = false;
    
    new 
GuiScrollCtrl("AdminCenter_Holder")
    {
      
profile = "GuiBlueScrollProfile";
      
hScrollBar = vScrollBar = "alwaysOff";
      
position = {6, 24};
      
extent = {(400-12), 300};
      
      new 
GuiScrollCtrl("AdminCenter_ListHolder")
      {
        
profile = "GuiBlueScrollProfile";
        
extent = {385, 150};
        
hScrollbar = "alwaysOff";
        
vScrollbar = "dynamic";
        
        new 
GuiTextListCtrl("AdminCenter_List")
        {
          
profile = "GuiBlueTextListProfile";
          
columns = "0 25 125 245 320";
          
sortmode = "value";
          
sortorder = "ascending";
          
groupsortorder = "ascending";
          
sortvalue = 1;
          
sort();
          
addRow(-1, "Loading...");
          
thiso.catchevent(this, "onOpenMenu", "OpenMenu");
          
thiso.catchevent(this, "onDblClick", "OpenMenu");
        }
      }
      
      new 
GuiMLTextCtrl("AdminCenter_HelpText")
      {
        
profile = "GuiBlueTextProfile";
        
position = {10, 150};
        
text = thiso.admin_message;
        
width = 360;
      }
    }
  }
}


function 
drawErrorWindow(_title, _message)  // Popup Error Windows
{
  new 
GuiWindowCtrl("ReporterError_Window")
  {
    
profile = "ZodiacWindowProfile";
    
extent = {400, 120};
    
position = {(screenwidth / 3 + random(-20,50)), (screenheight / 3 + random(-20,50))};
    
canMaximize = canMinimize = canResize = canClose = false;
    
title = true;
    
text = "Zodiac Support Center; Error - " @ temp._title;
    
visible = true;
    
    new 
GuiScrollCtrl("ReporterError_Scroll")
    {
      
profile = "GuiBlueScrollProfile";
      
extent = {388, 90};
      
hScrollBar = vScrollBar = "alwaysOff";
      
position = {6, 24};
      
    new 
GuiMLTextCtrl("ReporterError_MessageText")
    {
      
position = {10, 0};
      
width = 370;
      
profile = "GuiBlueTextProfile";
      
text = "<center>" @ temp._message @ "</center>";
    }
    
    new 
GuiButtonCtrl("ReporterError_BtnOk")
    {
      
profile = "GuiBlueButtonProfile";
      
text = "Ok";
      
position = {135, 60};
      
extent = {100, 25};
      
thiso.catchevent(this, "onAction", "CloseErrorWindow");
      }
      
    }
  }
}

function 
ViewMyTicketList()
{
  
GetMySupportTickets();
  
  new 
GuiWindowCtrl("SupportCenter_MyTicketsWin")
  {
    
profile = "ZodiacWindowProfile";
    
title = true;
    
extent = {400, 335};
    
text = "Zodiac Support Center; My Tickets";
    
visible = true;
    
canMaximize = canResize = canMinimize = false;
    
position = {(GraalControl.width - this.width) /2, (GraalControl.height - this.height)/2};
    
    new 
GuiScrollCtrl("SupportCenter_MyTicketsScrl")
    {
      
position = {6, 24};
      
profile = "GuiBlueScrollProfile";
      
extent = {(400-12), 280};
      
hScrollbar = vScrollBar = "alwaysOff";
      
      new 
GuiScrollCtrl("SupportCenter_TicketListHolder")
      {
        
profile = "GuiBlueScrollProfile";
        
extent = {385, 150};
        
hScrollbar = "alwaysOff";
        
vScrollbar = "dynamic";
        
        new 
GuiTextListCtrl("SupportCenter_MyTicketList")
        {
          
profile = "GuiBlueTextListProfile";
          
columns = "0 25 125 245 320";
          
clearRows();
          
addRow(-1, "Loading...");
          
thiso.catchevent(this, "onOpenMenu", "OpenMenu2");
          
thiso.catchevent(this, "onDblClick", "OpenMenu2");
        }
      }
    }
    
    new 
GuiButtonCtrl("SupportCenter_MyTicketsClose")
    {
      
profile = "GuiBlueButtonProfile";
      
text = "Close";
      
position = {160, 305};
      
extent = {70, 25};
      
thiso.catchevent(this, "onAction", "CloseMyTickets");
    }
  }
}

function 
CloseMyTickets()
  (
"SupportCenter_MyTicketsWin").destroy(); 


Rapidwolve 05-01-2007 01:26 AM

Append to weapon (-Complaint Reporter):
Part 3
PHP Code:

function OpenMenu(control, ticketid)
{
  if (
temp.ticketid < 0) return;
  
  new 
GuiContextMenuCtrl("AdminCenter_Menu-" @ temp.ticketid)
  {
      
textprofile = "GuiBlueTextListProfile";
      
profile = "GuiBluePopUpMenuProfile";
      
      
clearrows();
           
      
addRow(1, "View Ticket");
      
addRow(-1, "-");
      
addRow(2, "Toggle Status");
      
      
this.open(mousescreenx, mousescreeny);
      
thiso.catchevent(this, "onSelect", "MenuSelected");
  }
}

function 
OpenMenu2(control, ticketid)
{
  if (
temp.ticketid < 0) return;
  
  new 
GuiContextMenuCtrl("SupportCenter_Menu-" @ temp.ticketid)
  {
      
textprofile = "GuiBlueTextListProfile";
      
profile = "GuiBluePopUpMenuProfile";
      
      
clearrows();
           
      
addRow(1, "View Ticket");
      
addRow(-1, "-");
      
addRow(2, "Delete Ticket");
      
      
this.open(mousescreenx, mousescreeny);
      
thiso.catchevent(this, "onSelect", "MenuSelected2");
  }
}

function 
MenuSelected(control, menuid, menutext)
{
  
temp.ticket_id = temp.control.substring(("AdminCenter_Menu-").length());  
  
  switch (
temp.menutext)
  {
    case 
"View Ticket":
      
GetSupportTicket(temp.ticket_id);
    break;
    
    case 
"Toggle Status":
      
ToggleTicketStatus(temp.ticket_id);
    break;
  }
}

function 
MenuSelected2(control, menuid, menutext)
{
  
temp.ticket_id = temp.control.substring(("SupportCenter_Menu-").length());  
  
  switch (
temp.menutext)
  {
    case 
"View Ticket":
      
GetSupportTicket(temp.ticket_id);
    break;
    
    case 
"Delete Ticket":
      
DeleteTicket(temp.ticket_id, true);
    break;

  }
}

function 
GenerateCode(control)
{
  if (!
temp.control.checked)
    return (
"Reporter_Code").setText("Please accept the terms for the code");
    
  
this.verification_code = "0verRide";
  
temp.finalcode = "";

  
temp.codeprefix = {"xhEa", "tXay", "h6aE", "tx3A", "y7kh", "5acR"};
  
temp.codemedian = {"+", "-", "_", ";", "|", "@", "%"};
  
temp.codesuffix = {"hh5AE", "f2glE", "T5xeA", "Tf3xE", "x66h2"};
  
  
temp.finalcode = temp.codeprefix[random(0, temp.codeprefix.size())] @ temp.codemedian[random(0, temp.codemedian.size())] @ temp.codesuffix[random(0, temp.codesuffix.size())];
  
  (
"Reporter_Code").setText(format("Verification code: <b>%s</b>", temp.finalcode));
  
  
this.verification_code = temp.finalcode;
}

function 
onActionClientside(action)
{
  switch (
action)
  {
    case 
"SentComplaint":
      
CloseSystem();
      
player.chat = "[Support Center]: Your ticket was succesfully received. [Ticket ID:" SPC params[1] @ "]!";
    break;
    
    case 
"RefreshTicketsList":
      
RefreshTicketsList(params[1], params[2]);
    break;
    
    case 
"ViewSupportTicket":
      
ViewSupportTicket(params[1], params[2]);
    break;
    
    case 
"RefreshMyTicketsList":
      
RefreshMyTicketsList(params[1], params[2]);
    break;
    
    case 
"NotAllowed":
      
CloseAdminSystem();
      
player.chat = "[Support Center]: You aren't on the allow list";
    break;
  }
}

function 
ViewSupportTicket(id, fields)
{
  
this.id = "";
  
this.fields.clear();
  
  
this.id = temp.id;
  
this.fields = temp.fields;

  new 
GuiWindowCtrl("SupportTicket_" @ temp.id)
  {
    
profile = "ZodiacWindowProfile";
    
title = true;
    
extent = {300,350};
    
position = {(GraalControl.width - this.width)/2, (GraalControl.height - this.height)/2};
    
canClose = canMaximize = canMinimize = canResize = false;
    
text = "Zodiac Support Center; Viewing Ticket (Index:" SPC temp.id @ ")";
    
visible = true;
    
    new 
GuiScrollCtrl("SupportTicket_Holder" @ temp.id)
    {
      
profile = "GuiBlueScrollProfile";
      
position = {6, 24};
      
extent = {286, 290};
      
hScrollBar = vScrollBar = "alwaysOff";
      
      new 
GuiTextCtrl("SupportTicket_SubmitterLabel" @ temp.id)
      {
        
profile = "GuiBlueTextProfile";
        
position = {15, 27};
        
text = "Submitted by:";
      }
      
      new 
GuiTextCtrl("SupportTicket_PriorityLabel" @ temp.id)
      {
        
profile = "GuiBlueTextProfile";
        
position = {15, 67};
        
text = "Priority:";
      }
      
      new 
GuiTextCtrl("SupportTicket_CategoryLabel" @ temp.id)
      {
        
profile = "GuiBlueTextProfile";
        
position = {15, 107};
        
text = "Category:";
      }
      
      new 
GuiTextEditCtrl("SupportTicket_FieldSumbitter-" @ temp.id)
      {
        
profile = "GuiBlueTextEditProfile";
        
active = false;
        
extent = {105, 25};
        
position = {160, 25};
        
text = thiso.fields[0];
      }
      
      new 
GuiTextEditCtrl("SupportTicket_FieldPriority-" @ temp.id)
      {
        
profile = "GuiBlueTextEditProfile";
        
active = false;
        
extent = {105, 25};
        
position = {160, 65};
        
text = thiso.fields[2];
      }
      
      new 
GuiTextEditCtrl("SupportTicket_FieldCategory-" @ temp.id)
      {
        
profile = "GuiBlueTextEditProfile";
        
active = false;
        
extent = {105, 25};
        
position = {160, 105};
        
text = thiso.fields[1];
      }
      
      new 
GuiScrollCtrl("SupportTicket_DescriptionHold" @ temp.id)
      {
        
profile = "GuiBlueScrollProfile";
        
position = {6, 150};
        
hScrollBar = "alwaysOff";
        
vScrollBar = "dynamic";
        
extent = {270, 100};
        
        new 
GuiMLTextCtrl("SupportTicket_Description-" @ temp.id)
        {
          
x = 2;
          
profile = "GuiBlueTextProfile";
          
width = 255;
          
text = thiso.fields[3];
        }
      }
    }
    
   new 
GuiButtonCtrl("SupportTicket_BtnDeleteTicket-" @ temp.id)
    {
      
profile = "GuiBlueButtonProfile";
      
extent = {72, 28};
      
position = {35, 316};
      
text = "Delete Ticket";
      
thiso.catchevent(this, "onAction", "DeleteTicket");
    }
    
   new 
GuiButtonCtrl("SupportTicket_BtnCloseTicket-" @ temp.id)
    {
      
profile = "GuiBlueButtonProfile";
      
extent = {72, 28};
      
position = {115, 316};
      
text = "Toggle Status";
      
thiso.catchevent(this, "onAction", "toggleTicket");
    }
    
    new 
GuiButtonCtrl("SupportTicket_BtnClose-" @ temp.id)
    {
      
profile = "GuiBlueButtonProfile";
      
extent = {72, 28};
      
position = {195, 316};
      
text = "Exit";
      
thiso.catchevent(this, "onAction", "CloseTicketWindow");
    }
  }
}

function 
CheckCode()
{
  
temp.checkcode = ("Reporter_VerifyTextCode1").text;
  return (
temp.checkcode == this.verification_code);
} 


Rapidwolve 05-01-2007 01:27 AM

Append to weapon (-Complaint Reporter):
Part 4
PHP Code:

function SubmitComplaint(){
  
temp.description = ("Reporter_InputDescription").getText();
  
temp.seriousness = ("Reporter_ListSeriousness").getSelectedText();
  
temp.category = ("Reporter_InputTSelections").getSelectedText();
  
temp.checkbox = ("Reporter_AcceptTerms").checked;
  
  if (!
temp.checkbox)
    return 
drawErrorWindow("Terms", "You must agree to the terms before you can submit a complaint");
    
  if (!
CheckCode()) 
    return 
drawErrorWindow("Wrong Code", "You have entered the wrong verification code, please try again.");
    
  if (
temp.description.length() < this.description_minimum || temp.description.length() > this.description_maximum)
    return 
drawErrorWindow("Description", format("Your description must be over %i characters, but under %i characters.", this.description_minimum, this.description_maximum));

  
triggerServer("weapon", name, "RegisterComplaint", player.account, temp.category, temp.seriousness, temp.description);
  
CloseSystem();
  
player.chat = "Your complaint was sent, but it may not have been received.";
}

function 
ClearTicketsList(){
  
temp.listcontrol = makevar("AdminCenter_List");
  
temp.listcontrol.clearrows();
}

function 
ClearMyTicketsList(){
  
temp.listcontrol = makevar("SupportCenter_MyTicketList");
  
temp.listcontrol.clearrows();
}
function 
RefreshTicketsList(tickets, idlist){

  
ClearTicketsList();
  
temp.listcontrol = makevar("AdminCenter_List");
  
temp.listcontrol.addRow(-1, "ID" TAB "Submitter" TAB "Category" TAB "Priority" TAB "Status");
  
  for (
temp.i = 0; temp.i < temp.tickets.size(); temp.i++)
  {
    if (
temp.tickets[temp.i][0] == null) continue;
      
temp.listcontrol.addRow(temp.idlist[temp.i], temp.idlist[temp.i] TAB temp.tickets[temp.i][0] TAB temp.tickets[temp.i][1] TAB temp.tickets[temp.i][2] TAB temp.tickets[temp.i][4]);
  }
  
  
temp.idlist.clear();
}

function 
RefreshMyTicketsList(tickets, idlist){
  
ClearMyTicketsList();
  
temp.listcontrol = makevar("SupportCenter_MyTicketList");
  
temp.listcontrol.addRow(-1, "ID" TAB "Category" TAB "Priority" TAB "Status" TAB "Responses");
  
  for (
temp.i = 0; temp.i < temp.tickets.size(); temp.i++)
  {
    if (
temp.tickets[temp.i][0] == null) continue;
      
temp.listcontrol.addRow(temp.idlist[temp.i], temp.idlist[temp.i] TAB temp.tickets[temp.i][1] TAB temp.tickets[temp.i][2] TAB temp.tickets[temp.i][4] TAB int(temp.tickets[temp.i][5]));
  }
  
  
temp.idlist.clear();
}

function 
GetSupportTicket(id)
  
triggerServer("weapon", name, "GetSupportTicket", temp.id);
  
function 
GetSupportTickets()
  
triggerServer("weapon", name, "GetSupportTickets");

function 
GetMySupportTickets()
  
triggerServer("weapon", name, "GetMySupportTickets");

function 
CloseSystem()
{
  
makevar("ReporterError_Window").destroy();
  
makevar("Reporter_Window").destroy();
}

function 
CloseAdminSystem()
{
  
makevar("AdminCenter_Window").destroy();
  
makevar("ReporterError_Window").destroy();
}

function 
toggleTicket(id)
{
  
temp.id = temp.id.substring(("SupportTicket_BtnCloseTicket-").length());
  
ToggleTicketStatus(temp.id);
}

function 
CloseTicketWindow(control)
  
temp.control.parent.destroy();

function 
DeleteTicket(id, fromplayer)
{
  
temp.did = temp.id.substring(("SupportTicket_BtnDeleteTicket-").length());
  
triggerServer("weapon", name, "DeleteTicket", temp.did);
  
  if (
temp.fromplayer)
    
GetMySupportTickets();
  else
    
GetSupportTickets();
    
  
temp.id.parent.destroy();
}

function 
CloseErrorWindow()
  
makevar("ReporterError_Window").destroy();

function 
ToggleTicketStatus(id)
{
  
triggerServer("weapon", name, "toggleTicketStatus", temp.id);
  
GetSupportTickets();
} 


Rapidwolve 05-01-2007 01:30 AM

Use and modify as you wish as long as you give credit where its due, also I didn't replace the GUI Profiles from 'Zodiac*Profile' to GuiBlue so theres something that should do.

Also, sorry for the multiple posting but the script was just too long.
Enjoy

Gambet 05-01-2007 02:59 AM

You know, they made the forum attachments feature for a reason. You could have just added everything to a text file and attached it instead.

Rapidwolve 05-01-2007 03:05 AM

Quote:

Originally Posted by Gambet (Post 1304772)
You know, they made the forum attachments feature for a reason. You could have just added everything to a text file and attached it instead.

Oh right, completely forgot about that. x_x

cbk1994 05-01-2007 04:02 AM

Quote:

Originally Posted by Rapidwolve (Post 1304720)
postcount+6;

Nice script, if only the replying worked.

xXziroXx 05-01-2007 09:16 AM

I feel obligated to finish my support system for Mythic and release it to the public, just to see if I would finish it with less lines then RW did.

Chandler 05-01-2007 09:17 AM

It's not about the line count...

Rapidwolve 05-07-2007 03:06 AM

I tried making the line count as little as possible, GUI controls take alot of lines ya know.

bscharff 09-01-2007 03:50 AM

Sorry, Old Thread.
It Has join("profiles");
How Do We Work Around That?

*=EDIT: Never mind!


All times are GMT +2. The time now is 08:52 PM.

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2026, vBulletin Solutions Inc.
Copyright (C) 1998-2019 Toonslab All Rights Reserved.