using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Conquer_Online_Server.Game.ConquerStructures;
namespace Conquer_Online_Server.Database
{
class QuizData
{
public static void Load()
{
{
string[] AllLines = System.IO.File.ReadAllLines("database\\QuizShow.txt");
int questionscount = AllLines.Length;
for (int x = 0; x < questionscount; x++)
{
string[] Info = AllLines[x].Split('#');
string Question = Info[0];
QuizShow.Answer[] Answers = new QuizShow.Answer[4];
Answers[0] = new QuizShow.Answer(Info[1].Split(':')[0], ushort.Parse(Info[1].Split(':')[1]));
Answers[1] = new QuizShow.Answer(Info[2].Split(':')[0], ushort.Parse(Info[2].Split(':')[1]));
Answers[2] = new QuizShow.Answer(Info[3].Split(':')[0], ushort.Parse(Info[3].Split(':')[1]));
Answers[3] = new QuizShow.Answer(Info[4].Split(':')[0], ushort.Parse(Info[4].Split(':')[1]));
QuizShow.Question Q = new QuizShow.Question(Question, Answers);
QuizShow.AllQuestions.Add((ushort)x, Q);
}
}
}
}
}
PHP Code:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Conquer_Online_Server.ServerBase;
using Conquer_Online_Server.Client;
namespace Conquer_Online_Server.Game.ConquerStructures
{
public class QuizShow
{
public static Dictionary<ushort, Question> AllQuestions = new Dictionary<ushort, Question>();
public static Dictionary<ushort, Question> Questions = new Dictionary<ushort, Question>();
static System.Timers.Timer Timer;
public static ushort QuestionNO = 0;
public static QuizShowScore[] Scores = new QuizShowScore[500];
public static bool QuizON = false;
public static bool QuizON1 = true;
static List<int> Container;
public static void Start()
{
QuizON = true;
Random Rand = new Random();
Container = new List<int>();
for (int x = 0; x < 20; x++)
{
Again:
int Gen = Rand.Next(0, 70);
if (!Container.Contains(Gen))
{
Question Q = (Question)AllQuestions[(ushort)Gen];
Answer[] RealAnswers = new Answer[4];
bool[] Set = new bool[4];
for (int i = 0; i < 4; i++)
{
int e = Rand.Next(0, 4);
while (Set[e])
e = Rand.Next(0, 4);
RealAnswers[i] = Q.Answers[e];
Set[e] = true;
}
Q.Answers = RealAnswers;
Questions.Add((ushort)x, Q);
Container.Add(Gen);
}
else
goto Again;
}
Timer = new System.Timers.Timer();
Timer.Interval = 30000;
Timer.Elapsed += new System.Timers.ElapsedEventHandler(Timer_Elapsed);
foreach (GameState client in Kernel.GamePool.Values)
{
client.Send(new Conquer_Online_Server.Network.GamePackets.QuizInfo().StartBuffer());
client.QuizInfo = new Info();
}
Scores = new QuizShowScore[500];
for (int x = 0; x < 501; x++)
{ try { Scores[x] = new QuizShowScore(); } catch { continue; } }
Kernel.MainQuiz = new MainInfo();
Juststarted = true;
QuestionNO = 0;
Timer.Start();
Timer.AutoReset = true;
}
public class QuizShowScore
{
public uint EntityID = 0;
public uint Score = 0;
}
public class MainInfo
{
public string[] Name;
public ushort[] Time;
public ushort[] Score;
public MainInfo()
{
Name = new string[3];
Time = new ushort[3];
Score = new ushort[3];
Name[0] = "none";
Name[1] = "none";
Name[2] = "none";
Time[0] = 0;
Time[1] = 0;
Time[2] = 0;
Score[0] = 0;
Score[1] = 0;
Score[2] = 0;
}
}
public class Info
{
public int LastAnswer;
public ushort Time;
public ushort Score;
public ushort QNo;
public byte[] Answers;
public ushort Rank;
public Info()
{
LastAnswer = 0;
Time = 0;
Score = 0;
QNo = 1;
Answers = new byte[Questions.Count];
Rank = 0;
}
}
public class Question
{
public string m_Question;
public Answer[] Answers;
public Question(string question, Answer[] answers)
{
m_Question = question;
Answers = answers;
}
public static implicit operator string(Question q)
{
return q.m_Question;
}
}
public class Answer
{
public string m_Answer;
public ushort Points;
public Answer(string answer, ushort points)
{
m_Answer = answer; Points = points;
}
public static implicit operator string(Answer q)
{
return q.m_Answer;
}
}
}
}
quiz show 09/02/2009 - Conquer Online 2 - 1 Replies can you copy the questions for conquer quiz show during the quiz?
quiz show 06/18/2009 - CO2 Private Server - 4 Replies the quiz show is added in coemuv2? and the nobility rank too?.
and if this is not added how i can add the quiz show and nobility rank?
Quiz Show Answers 05/29/2009 - Conquer Online 2 - 38 Replies http://cid7.net/questions.php
It includes most Non-CO related questions (will be added soon)
Database Size: 1250 questions
Make sure you enter most of the words from the question when submitting (it uses a very weak algorithm to search the phrases - thus the more words you have, the higher chance it gets the correct answer)
You can ask questions using space or ~
Just for those who want to test it , here is a dump of a recent Co Quiz