Fixed and improved a bunch of the recently commit Support Desk tables and database accessors. Removed a file that doesn't exist added from last commit.

This commit is contained in:
Filip Maj 2016-08-20 19:16:33 -04:00
parent c087fb44c0
commit 685fe7dd5a
5 changed files with 79 additions and 166 deletions

View File

@ -1260,12 +1260,11 @@ namespace FFXIVClassic_Map_Server
query = @"
INSERT INTO supportdesk_tickets
(id, title, body, langCode)
(title, body, langCode)
VALUES
(@id, @title, @body, @langCode)";
(@title, @body, @langCode)";
cmd = new MySqlCommand(query, conn);
cmd.Parameters.AddWithValue("@id", gmTicket.ticketIssueIndex);
cmd.Parameters.AddWithValue("@title", gmTicket.ticketTitle);
cmd.Parameters.AddWithValue("@body", gmTicket.ticketBody);
cmd.Parameters.AddWithValue("@langCode", gmTicket.langCode);
@ -1283,7 +1282,7 @@ namespace FFXIVClassic_Map_Server
}
}
public static string[] getFAQNames(uint lanCode = 1)
public static string[] getFAQNames(uint langCode = 1)
{
string[] faqs = null;
List<string> raw = new List<string>();
@ -1295,20 +1294,21 @@ namespace FFXIVClassic_Map_Server
string query = @"
SELECT
id,
label,
sort
title
FROM supportdesk_faqs
ORDER BY sort";
WHERE languageCode = @langCode
ORDER BY slot
";
MySqlCommand cmd = new MySqlCommand(query, conn);
cmd.Parameters.AddWithValue("@langCode", langCode);
using (MySqlDataReader reader = cmd.ExecuteReader())
{
while (reader.Read())
{
uint id = reader.GetUInt32(0);
string label = reader.GetString(1);
string label = reader.GetString(0);
raw.Add(label);
}
}
@ -1326,7 +1326,7 @@ namespace FFXIVClassic_Map_Server
return faqs;
}
public static string getFAQBody(uint id, uint lanCode = 1)
public static string getFAQBody(uint slot, uint langCode = 1)
{
string body = string.Empty;
using (MySqlConnection conn = new MySqlConnection(String.Format("Server={0}; Port={1}; Database={2}; UID={3}; Password={4}", ConfigConstants.DATABASE_HOST, ConfigConstants.DATABASE_PORT, ConfigConstants.DATABASE_NAME, ConfigConstants.DATABASE_USERNAME, ConfigConstants.DATABASE_PASSWORD)))
@ -1339,10 +1339,11 @@ namespace FFXIVClassic_Map_Server
SELECT
body
FROM supportdesk_faqs
WHERE id=@id";
WHERE slot=@slot and languageCode=@langCode";
MySqlCommand cmd = new MySqlCommand(query, conn);
cmd.Parameters.AddWithValue("@id", id);
cmd.Parameters.AddWithValue("@slot", slot);
cmd.Parameters.AddWithValue("@langCode", langCode);
using (MySqlDataReader reader = cmd.ExecuteReader())
{
@ -1376,11 +1377,9 @@ namespace FFXIVClassic_Map_Server
string query = @"
SELECT
id,
title,
sort
title
FROM supportdesk_issues
ORDER BY sort";
ORDER BY slot";
MySqlCommand cmd = new MySqlCommand(query, conn);
@ -1388,8 +1387,7 @@ namespace FFXIVClassic_Map_Server
{
while (reader.Read())
{
uint id = reader.GetUInt32(0);
string label = reader.GetString(1);
string label = reader.GetString(0);
raw.Add(label);
}
}

View File

@ -123,7 +123,6 @@
<Compile Include="lua\LuaNpc.cs" />
<Compile Include="lua\LuaPlayer.cs" />
<Compile Include="lua\LuaScript.cs" />
<Compile Include="managers\SupportDeskManager.cs" />
<Compile Include="PacketProcessor.cs" />
<Compile Include="packets\BasePacket.cs" />
<Compile Include="packets\receive\ChatMessagePacket.cs" />

View File

@ -1,53 +1,25 @@
-- MySQL dump 10.13 Distrib 5.7.13, for Linux (x86_64)
--
-- Host: localhost Database: ffxiv
-- ------------------------------------------------------
-- Server version 5.7.13-0ubuntu0.16.04.2
/*
MySQL Data Transfer
Source Host: localhost
Source Database: ffxiv_server
Target Host: localhost
Target Database: ffxiv_server
Date: 8/20/2016 7:15:35 PM
*/
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8 */;
/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */;
/*!40103 SET TIME_ZONE='+00:00' */;
/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
--
-- Table structure for table `supportdesk_faqs`
--
DROP TABLE IF EXISTS `supportdesk_faqs`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
SET FOREIGN_KEY_CHECKS=0;
-- ----------------------------
-- Table structure for supportdesk_faqs
-- ----------------------------
CREATE TABLE `supportdesk_faqs` (
`id` int(10) NOT NULL,
`label` varchar(50) NOT NULL,
`body` varchar(50) NOT NULL,
`sort` int(11) NOT NULL,
PRIMARY KEY (`id`)
`slot` tinyint(4) NOT NULL,
`languageCode` tinyint(4) NOT NULL,
`title` varchar(128) NOT NULL,
`body` text NOT NULL,
PRIMARY KEY (`slot`,`languageCode`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `supportdesk_faqs`
--
LOCK TABLES `supportdesk_faqs` WRITE;
/*!40000 ALTER TABLE `supportdesk_faqs` DISABLE KEYS */;
INSERT INTO `supportdesk_faqs` VALUES (1,'Testing','Testy Test FAQ!',1);
/*!40000 ALTER TABLE `supportdesk_faqs` ENABLE KEYS */;
UNLOCK TABLES;
/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;
/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
-- Dump completed on 2016-08-19 5:05:33
-- ----------------------------
-- Records
-- ----------------------------
INSERT INTO `supportdesk_faqs` VALUES ('0', '1', 'Welcome to FFXIV Classic', 'Welcome to the FFXIV 1.0 server emulator FFXIVClassic!\r\n\r\nThis is still currently a work in progress, and you may find bugs or issues as you play with this server. Keep in mind that this is not even remotely close to being finished, and that it is a work in progress.\r\n\r\nCheck out the blog at: \r\nhttp://ffxivclassic.fragmenterworks.com/ \r\nCheck out videos at: \r\nhttps://www.youtube.com/channel/UCr2703_er1Dj7Lx5pzpQpfg');

View File

@ -1,54 +1,26 @@
-- MySQL dump 10.13 Distrib 5.7.13, for Linux (x86_64)
--
-- Host: localhost Database: ffxiv
-- ------------------------------------------------------
-- Server version 5.7.13-0ubuntu0.16.04.2
/*
MySQL Data Transfer
Source Host: localhost
Source Database: ffxiv_server
Target Host: localhost
Target Database: ffxiv_server
Date: 8/20/2016 7:15:41 PM
*/
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8 */;
/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */;
/*!40103 SET TIME_ZONE='+00:00' */;
/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
--
-- Table structure for table `supportdesk_issues`
--
DROP TABLE IF EXISTS `supportdesk_issues`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
SET FOREIGN_KEY_CHECKS=0;
-- ----------------------------
-- Table structure for supportdesk_issues
-- ----------------------------
CREATE TABLE `supportdesk_issues` (
`id` int(11) NOT NULL,
`slot` smallint(4) unsigned NOT NULL,
`title` varchar(50) NOT NULL,
`sort` int(11) NOT NULL,
PRIMARY KEY (`id`)
PRIMARY KEY (`slot`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `supportdesk_issues`
--
LOCK TABLES `supportdesk_issues` WRITE;
/*!40000 ALTER TABLE `supportdesk_issues` DISABLE KEYS */;
INSERT INTO `supportdesk_issues` VALUES (1,'Report Harassment',1);
INSERT INTO `supportdesk_issues` VALUES (2,'Report Cheating',2);
INSERT INTO `supportdesk_issues` VALUES (3,'Leave Suggestion',3);
/*!40000 ALTER TABLE `supportdesk_issues` ENABLE KEYS */;
UNLOCK TABLES;
/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;
/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
-- Dump completed on 2016-08-19 5:05:51
-- ----------------------------
-- Records
-- ----------------------------
INSERT INTO `supportdesk_issues` VALUES ('0', 'Report Harassment');
INSERT INTO `supportdesk_issues` VALUES ('1', 'Report Cheating');
INSERT INTO `supportdesk_issues` VALUES ('2', 'Report a Bug or Glitch');
INSERT INTO `supportdesk_issues` VALUES ('3', 'Leave Suggestion');

View File

@ -1,52 +1,24 @@
-- MySQL dump 10.13 Distrib 5.7.13, for Linux (x86_64)
--
-- Host: localhost Database: ffxiv
-- ------------------------------------------------------
-- Server version 5.7.13-0ubuntu0.16.04.2
/*
MySQL Data Transfer
Source Host: localhost
Source Database: ffxiv_server
Target Host: localhost
Target Database: ffxiv_server
Date: 8/20/2016 7:15:46 PM
*/
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8 */;
/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */;
/*!40103 SET TIME_ZONE='+00:00' */;
/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
--
-- Table structure for table `supportdesk_tickets`
--
DROP TABLE IF EXISTS `supportdesk_tickets`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
SET FOREIGN_KEY_CHECKS=0;
-- ----------------------------
-- Table structure for supportdesk_tickets
-- ----------------------------
CREATE TABLE `supportdesk_tickets` (
`id` int(20) NOT NULL,
`title` varchar(100) NOT NULL,
`body` varchar(100) NOT NULL,
`langCode` varchar(10) NOT NULL,
`id` int(20) unsigned NOT NULL AUTO_INCREMENT,
`title` varchar(128) NOT NULL,
`body` text NOT NULL,
`langCode` smallint(4) unsigned NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
/*!40101 SET character_set_client = @saved_cs_client */;
) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=latin1;
--
-- Dumping data for table `supportdesk_tickets`
--
LOCK TABLES `supportdesk_tickets` WRITE;
/*!40000 ALTER TABLE `supportdesk_tickets` DISABLE KEYS */;
/*!40000 ALTER TABLE `supportdesk_tickets` ENABLE KEYS */;
UNLOCK TABLES;
/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;
/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
-- Dump completed on 2016-08-19 5:06:23
-- ----------------------------
-- Records
-- ----------------------------