Code:
CREATE TABLE `custom_duel_champions` (
`champion` INT(10) NOT NULL DEFAULT '0' COMMENT 'Id of champion, this is the same as unit entry',
`difficulty` TINYINT(1) NOT NULL DEFAULT '0' COMMENT 'difficulty of champion',
PRIMARY KEY (`champion`)
)
COMMENT='Part of the custom duel system, you can edit this but be careful.'
ENGINE=MyISAM
ROW_FORMAT=DEFAULT;
CREATE TABLE `custom_duel_duels` (
`player` VARCHAR(30) NOT NULL DEFAULT '',
`enemy` VARCHAR(30) NOT NULL DEFAULT '',
`player_hp` INT(10) NOT NULL DEFAULT '0',
`enemy_hp` INT(10) NOT NULL DEFAULT '0',
`player_status` TINYINT(1) NOT NULL DEFAULT '0' COMMENT 'Disabled',
`enemy_status` TINYINT(1) NOT NULL DEFAULT '0' COMMENT 'Disabled',
`champion` TINYINT(1) NOT NULL DEFAULT '0',
PRIMARY KEY (`player`)
)
COMMENT='Part of the custom duel system, do not edit.'
ENGINE=MyISAM
ROW_FORMAT=DEFAULT;
CREATE TABLE `custom_duel_locks` (
`player` VARCHAR(30) NOT NULL DEFAULT '',
`enemy` VARCHAR(30) NOT NULL DEFAULT '',
`expire` BIGINT(20) NOT NULL DEFAULT '0'
)
COMMENT='Part of the custom duel system, do not edit.'
ENGINE=MyISAM
ROW_FORMAT=DEFAULT;
CREATE TABLE `custom_duel_players` (
`name` VARCHAR(30) NOT NULL DEFAULT '',
`class` VARCHAR(30) NOT NULL DEFAULT '',
`rank_name` VARCHAR(30) NOT NULL DEFAULT '',
`rank` SMALLINT(5) NOT NULL DEFAULT '0',
`ranked_wins` INT(10) NOT NULL DEFAULT '0',
`strength` INT(10) NOT NULL DEFAULT '10',
`agility` INT(10) NOT NULL DEFAULT '7',
`intellect` INT(10) NOT NULL DEFAULT '10',
`spirit` INT(10) NOT NULL DEFAULT '7',
`stamina` INT(10) NOT NULL DEFAULT '9',
`defense` INT(10) NOT NULL DEFAULT '4',
`power` INT(10) NOT NULL DEFAULT '0',
`crit` INT(10) NOT NULL DEFAULT '3',
`dodge` INT(10) NOT NULL DEFAULT '5',
`busy` TINYINT(1) NOT NULL DEFAULT '0',
`statpoints` INT(10) NOT NULL DEFAULT '0',
`won` INT(10) NOT NULL DEFAULT '0',
`lost` INT(10) NOT NULL DEFAULT '0',
`ties` INT(10) NOT NULL DEFAULT '0',
PRIMARY KEY (`name`)
)
COMMENT='Part of the custom duel system, do not edit.'
ENGINE=MyISAM
ROW_FORMAT=DEFAULT;
INSERT INTO `creature_names` (`entry`, `name`, `subname`, `info_str`, `flags1`, `type`, `family`, `rank`, `killcredit1`, `killcredit2`, `male_displayid`, `female_displayid`, `male_displayid2`, `female_displayid2`, `unknown_float1`, `unknown_float2`, `leader`, `questitem1`, `questitem2`, `questitem3`, `questitem4`, `questitem5`, `questitem6`, `waypointid`) VALUES (70010, 'Gul\'Dan', 'Duel Champion', '', 0, 0, 0, 1, 0, 0, 21588, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0);
INSERT INTO `creature_names` (`entry`, `name`, `subname`, `info_str`, `flags1`, `type`, `family`, `rank`, `killcredit1`, `killcredit2`, `male_displayid`, `female_displayid`, `male_displayid2`, `female_displayid2`, `unknown_float1`, `unknown_float2`, `leader`, `questitem1`, `questitem2`, `questitem3`, `questitem4`, `questitem5`, `questitem6`, `waypointid`) VALUES (70011, 'Maiev Shadowsong', 'Duel Champion', '', 0, 0, 0, 1, 0, 0, 20628, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0);
INSERT INTO `creature_names` (`entry`, `name`, `subname`, `info_str`, `flags1`, `type`, `family`, `rank`, `killcredit1`, `killcredit2`, `male_displayid`, `female_displayid`, `male_displayid2`, `female_displayid2`, `unknown_float1`, `unknown_float2`, `leader`, `questitem1`, `questitem2`, `questitem3`, `questitem4`, `questitem5`, `questitem6`, `waypointid`) VALUES (70015, 'Illidan Stormrage', 'Duel Champion', '', 0, 0, 0, 1, 0, 0, 27571, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0);
INSERT INTO `creature_names` (`entry`, `name`, `subname`, `info_str`, `flags1`, `type`, `family`, `rank`, `killcredit1`, `killcredit2`, `male_displayid`, `female_displayid`, `male_displayid2`, `female_displayid2`, `unknown_float1`, `unknown_float2`, `leader`, `questitem1`, `questitem2`, `questitem3`, `questitem4`, `questitem5`, `questitem6`, `waypointid`) VALUES (70014, 'Alexstrasza', 'Duel Champion', '', 0, 0, 0, 1, 0, 0, 28227, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0);
INSERT INTO `creature_names` (`entry`, `name`, `subname`, `info_str`, `flags1`, `type`, `family`, `rank`, `killcredit1`, `killcredit2`, `male_displayid`, `female_displayid`, `male_displayid2`, `female_displayid2`, `unknown_float1`, `unknown_float2`, `leader`, `questitem1`, `questitem2`, `questitem3`, `questitem4`, `questitem5`, `questitem6`, `waypointid`) VALUES (70012, 'Uther the Lightbringer', 'Duel Champion', '', 0, 0, 0, 1, 0, 0, 23889, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0);
INSERT INTO `creature_names` (`entry`, `name`, `subname`, `info_str`, `flags1`, `type`, `family`, `rank`, `killcredit1`, `killcredit2`, `male_displayid`, `female_displayid`, `male_displayid2`, `female_displayid2`, `unknown_float1`, `unknown_float2`, `leader`, `questitem1`, `questitem2`, `questitem3`, `questitem4`, `questitem5`, `questitem6`, `waypointid`) VALUES (70013, 'Warchief Thrall', 'Duel Champion', '', 0, 0, 0, 1, 0, 0, 19015, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0);
INSERT INTO `creature_names` (`entry`, `name`, `subname`, `info_str`, `flags1`, `type`, `family`, `rank`, `killcredit1`, `killcredit2`, `male_displayid`, `female_displayid`, `male_displayid2`, `female_displayid2`, `unknown_float1`, `unknown_float2`, `leader`, `questitem1`, `questitem2`, `questitem3`, `questitem4`, `questitem5`, `questitem6`, `waypointid`) VALUES (70016, 'The Lich King', 'Duel Champion', '', 0, 0, 0, 1, 0, 0, 28672, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0);
INSERT INTO `creature_names` (`entry`, `name`, `subname`, `info_str`, `flags1`, `type`, `family`, `rank`, `killcredit1`, `killcredit2`, `male_displayid`, `female_displayid`, `male_displayid2`, `female_displayid2`, `unknown_float1`, `unknown_float2`, `leader`, `questitem1`, `questitem2`, `questitem3`, `questitem4`, `questitem5`, `questitem6`, `waypointid`) VALUES (70017, 'Chaos', 'Duel Champion', '', 0, 0, 0, 1, 0, 0, 25683, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0);
INSERT INTO `creature_proto` (`entry`, `minlevel`, `maxlevel`, `faction`, `minhealth`, `maxhealth`, `mana`, `scale`, `npcflags`, `attacktime`, `attacktype`, `mindamage`, `maxdamage`, `can_ranged`, `rangedattacktime`, `rangedmindamage`, `rangedmaxdamage`, `respawntime`, `armor`, `resistance1`, `resistance2`, `resistance3`, `resistance4`, `resistance5`, `resistance6`, `combat_reach`, `bounding_radius`, `auras`, `boss`, `money`, `invisibility_type`, `walk_speed`, `run_speed`, `fly_speed`, `extra_a9_flags`, `spell1`, `spell2`, `spell3`, `spell4`, `spell_flags`, `modImmunities`, `isTrainingDummy`, `guardtype`, `summonguard`) VALUES (70010, 80, 80, 35, 1000000, 1000000, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, '', 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0);
INSERT INTO `creature_proto` (`entry`, `minlevel`, `maxlevel`, `faction`, `minhealth`, `maxhealth`, `mana`, `scale`, `npcflags`, `attacktime`, `attacktype`, `mindamage`, `maxdamage`, `can_ranged`, `rangedattacktime`, `rangedmindamage`, `rangedmaxdamage`, `respawntime`, `armor`, `resistance1`, `resistance2`, `resistance3`, `resistance4`, `resistance5`, `resistance6`, `combat_reach`, `bounding_radius`, `auras`, `boss`, `money`, `invisibility_type`, `walk_speed`, `run_speed`, `fly_speed`, `extra_a9_flags`, `spell1`, `spell2`, `spell3`, `spell4`, `spell_flags`, `modImmunities`, `isTrainingDummy`, `guardtype`, `summonguard`) VALUES (70011, 80, 80, 35, 1000000, 1000000, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, '', 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0);
INSERT INTO `creature_proto` (`entry`, `minlevel`, `maxlevel`, `faction`, `minhealth`, `maxhealth`, `mana`, `scale`, `npcflags`, `attacktime`, `attacktype`, `mindamage`, `maxdamage`, `can_ranged`, `rangedattacktime`, `rangedmindamage`, `rangedmaxdamage`, `respawntime`, `armor`, `resistance1`, `resistance2`, `resistance3`, `resistance4`, `resistance5`, `resistance6`, `combat_reach`, `bounding_radius`, `auras`, `boss`, `money`, `invisibility_type`, `walk_speed`, `run_speed`, `fly_speed`, `extra_a9_flags`, `spell1`, `spell2`, `spell3`, `spell4`, `spell_flags`, `modImmunities`, `isTrainingDummy`, `guardtype`, `summonguard`) VALUES (70012, 80, 80, 35, 1000000, 1000000, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, '', 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0);
INSERT INTO `creature_proto` (`entry`, `minlevel`, `maxlevel`, `faction`, `minhealth`, `maxhealth`, `mana`, `scale`, `npcflags`, `attacktime`, `attacktype`, `mindamage`, `maxdamage`, `can_ranged`, `rangedattacktime`, `rangedmindamage`, `rangedmaxdamage`, `respawntime`, `armor`, `resistance1`, `resistance2`, `resistance3`, `resistance4`, `resistance5`, `resistance6`, `combat_reach`, `bounding_radius`, `auras`, `boss`, `money`, `invisibility_type`, `walk_speed`, `run_speed`, `fly_speed`, `extra_a9_flags`, `spell1`, `spell2`, `spell3`, `spell4`, `spell_flags`, `modImmunities`, `isTrainingDummy`, `guardtype`, `summonguard`) VALUES (70013, 80, 80, 35, 1000000, 1000000, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, '', 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0);
INSERT INTO `creature_proto` (`entry`, `minlevel`, `maxlevel`, `faction`, `minhealth`, `maxhealth`, `mana`, `scale`, `npcflags`, `attacktime`, `attacktype`, `mindamage`, `maxdamage`, `can_ranged`, `rangedattacktime`, `rangedmindamage`, `rangedmaxdamage`, `respawntime`, `armor`, `resistance1`, `resistance2`, `resistance3`, `resistance4`, `resistance5`, `resistance6`, `combat_reach`, `bounding_radius`, `auras`, `boss`, `money`, `invisibility_type`, `walk_speed`, `run_speed`, `fly_speed`, `extra_a9_flags`, `spell1`, `spell2`, `spell3`, `spell4`, `spell_flags`, `modImmunities`, `isTrainingDummy`, `guardtype`, `summonguard`) VALUES (70014, 80, 80, 35, 1000000, 1000000, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, '', 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0);
INSERT INTO `creature_proto` (`entry`, `minlevel`, `maxlevel`, `faction`, `minhealth`, `maxhealth`, `mana`, `scale`, `npcflags`, `attacktime`, `attacktype`, `mindamage`, `maxdamage`, `can_ranged`, `rangedattacktime`, `rangedmindamage`, `rangedmaxdamage`, `respawntime`, `armor`, `resistance1`, `resistance2`, `resistance3`, `resistance4`, `resistance5`, `resistance6`, `combat_reach`, `bounding_radius`, `auras`, `boss`, `money`, `invisibility_type`, `walk_speed`, `run_speed`, `fly_speed`, `extra_a9_flags`, `spell1`, `spell2`, `spell3`, `spell4`, `spell_flags`, `modImmunities`, `isTrainingDummy`, `guardtype`, `summonguard`) VALUES (70015, 80, 80, 35, 1000000, 1000000, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, '', 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0);
INSERT INTO `creature_proto` (`entry`, `minlevel`, `maxlevel`, `faction`, `minhealth`, `maxhealth`, `mana`, `scale`, `npcflags`, `attacktime`, `attacktype`, `mindamage`, `maxdamage`, `can_ranged`, `rangedattacktime`, `rangedmindamage`, `rangedmaxdamage`, `respawntime`, `armor`, `resistance1`, `resistance2`, `resistance3`, `resistance4`, `resistance5`, `resistance6`, `combat_reach`, `bounding_radius`, `auras`, `boss`, `money`, `invisibility_type`, `walk_speed`, `run_speed`, `fly_speed`, `extra_a9_flags`, `spell1`, `spell2`, `spell3`, `spell4`, `spell_flags`, `modImmunities`, `isTrainingDummy`, `guardtype`, `summonguard`) VALUES (70016, 80, 80, 35, 1000000, 1000000, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, '', 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0);
INSERT INTO `creature_proto` (`entry`, `minlevel`, `maxlevel`, `faction`, `minhealth`, `maxhealth`, `mana`, `scale`, `npcflags`, `attacktime`, `attacktype`, `mindamage`, `maxdamage`, `can_ranged`, `rangedattacktime`, `rangedmindamage`, `rangedmaxdamage`, `respawntime`, `armor`, `resistance1`, `resistance2`, `resistance3`, `resistance4`, `resistance5`, `resistance6`, `combat_reach`, `bounding_radius`, `auras`, `boss`, `money`, `invisibility_type`, `walk_speed`, `run_speed`, `fly_speed`, `extra_a9_flags`, `spell1`, `spell2`, `spell3`, `spell4`, `spell_flags`, `modImmunities`, `isTrainingDummy`, `guardtype`, `summonguard`) VALUES (70017, 80, 80, 35, 1000000, 1000000, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, '', 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0);
INSERT INTO `custom_duel_champions` (`champion`, `difficulty`) VALUES (70010, 1);
INSERT INTO `custom_duel_champions` (`champion`, `difficulty`) VALUES (70011, 2);
INSERT INTO `custom_duel_champions` (`champion`, `difficulty`) VALUES (70012, 3);
INSERT INTO `custom_duel_champions` (`champion`, `difficulty`) VALUES (70013, 4);
INSERT INTO `custom_duel_champions` (`champion`, `difficulty`) VALUES (70014, 5);
INSERT INTO `custom_duel_champions` (`champion`, `difficulty`) VALUES (70015, 6);
INSERT INTO `custom_duel_champions` (`champion`, `difficulty`) VALUES (70016, 7);
INSERT INTO `custom_duel_champions` (`champion`, `difficulty`) VALUES (70017, 8);
INSERT INTO `creature_names` (`entry`, `name`, `subname`, `info_str`, `flags1`, `type`, `family`, `rank`, `killcredit1`, `killcredit2`, `male_displayid`, `female_displayid`, `male_displayid2`, `female_displayid2`, `unknown_float1`, `unknown_float2`, `leader`, `questitem1`, `questitem2`, `questitem3`, `questitem4`, `questitem5`, `questitem6`, `waypointid`) VALUES (70003, 'Varian Wrynn', 'Duel Master', '', 0, 0, 0, 1, 0, 0, 28127, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0);
INSERT INTO `creature_proto` (`entry`, `minlevel`, `maxlevel`, `faction`, `minhealth`, `maxhealth`, `mana`, `scale`, `npcflags`, `attacktime`, `attacktype`, `mindamage`, `maxdamage`, `can_ranged`, `rangedattacktime`, `rangedmindamage`, `rangedmaxdamage`, `respawntime`, `armor`, `resistance1`, `resistance2`, `resistance3`, `resistance4`, `resistance5`, `resistance6`, `combat_reach`, `bounding_radius`, `auras`, `boss`, `money`, `invisibility_type`, `walk_speed`, `run_speed`, `fly_speed`, `extra_a9_flags`, `spell1`, `spell2`, `spell3`, `spell4`, `spell_flags`, `modImmunities`, `isTrainingDummy`, `guardtype`, `summonguard`) VALUES (70003, 80, 80, 35, 1000000, 1000000, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, '', 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0);
Pastebin:
Code:
Data provided by Pastebin.com - Download Raw - See Original
--[[
##################################
# #
# Made by Laurea #
# #
# Special thanks: #
# Sympathy at wow-v for teaching #
# me how to use metatables. #
# #
##################################
]]
local WorldDB = "world" --Name of your world db
local MasterID = 70003 --Id of npc you choose path at (warrior or mage)
--Duel ranks and ranked wins needed to get them.
--If you are going to edit these, only edit the rank names and wins needed.
CustomDuel = {
ranks = {
warrior = {
[1] = "Novice",
[2] = "Squire",
[3] = "Scout",
[4] = "Footman",
[5] = "Knight",
[6] = "Blademaster",
[7] = "Warlord",
},
mage = {
[1] = "Apprentice",
[2] = "Initiate",
[3] = "Disciple",
[4] = "Adept",
[5] = "Master",
[6] = "Oracle",
[7] = "Arch Mage",
},
both = {
[8] = "Demigod",
[9] = "God",
[10] = "Titan",
[11] = "Infinity",
[12] = "Chaos",
},
ranked_wins ={
[1] = 0,
[2] = 5,
[3] = 20,
[4] = 60,
[5] = 150,
[6] = 300,
[7] = 600,
[8] = 1200,
[9] = 1800,
[10] = 2700,
[11] = 4050,
[12] = 6075,
[13] = 9999999, --Do not edit, its for debugging
},
},
--DO NOT EDIT ANYTHING BEYOND THIS POINT
champions = {
[1] = {
health = 90,
mindamage = 16,
maxdamage = 24,
defense = 12,
power = 6,
crit = 1,
dodge = 1,
},
[2] = {
health = 180,
mindamage = 32,
maxdamage = 48,
defense = 24,
power = 12,
crit = 1,
dodge = 1,
},
[3] = {
health = 360,
mindamage = 64,
maxdamage = 96,
defense = 48,
power = 24,
crit = 5,
dodge = 1,
},
[4] = {
health = 720,
mindamage = 128,
maxdamage = 192,
defense = 96,
power = 48,
crit = 10,
dodge = 4,
},
[5] = {
health = 1440,
mindamage = 256,
maxdamage = 384,
defense = 192,
power = 96,
crit = 15,
dodge = 8,
},
[6] = {
health = 2880,
mindamage = 512,
maxdamage = 768,
defense = 384,
power = 192,
crit = 20,
dodge = 12,
},
[7] = {
health = 5760,
mindamage = 1024,
maxdamage = 1536,
defense = 768,
power = 384,
crit = 25,
dodge = 16,
},
[8] = {
health = 11520,
mindamage = 2048,
maxdamage = 3072,
defense = 1536,
power = 768,
crit = 30,
dodge = 20,
},
},
stats = {},
queries = {},
functions = {},
__index = function(_, key)
return CustomDuel.functions[key]
end
}
local duel = {}
local reset = {}
setmetatable (duel, CustomDuel)
function CustomDuel.OnChat(event, player, message, type, language)
if message == "#duel" then
player:SendBroadcastMessage("|cff0088FF#duel start|r Starts a duel with targeted player.")
player:SendBroadcastMessage("|cff0088FF#duel stats|r Shows your duel stats.")
player:SendBroadcastMessage("|cff0088FF#duel tstats|r Shows the duel stats of targeted player.")
player:SendBroadcastMessage("|cff0088FF#duel cstats|r Compares yours and targeted players duel stats.")
player:SendBroadcastMessage("|cff0088FF#duel setup|r Sets your starting duel stats.")
player:SendBroadcastMessage("|cff0088FF#duel reset|r Resets your duel stats.")
player:SendBroadcastMessage("|cff0088FF#duel info|r Shows info about dueling.")
player:SendBroadcastMessage("|cff0088FF#duel faq|r shows some common questions and their answers.")
elseif message == "#duel info" then
player:SendBroadcastMessage("1. |cff0088FFOnly you can see your own duels, not anyone else.")
player:SendBroadcastMessage("2. |cff0088FFDuels \"tick\" every 5 seconds, they are not finished instantly.")
player:SendBroadcastMessage("3. |cff0088FFIf you win or loose to someone they do not get a win/loose in their stats, only you do.")
player:SendBroadcastMessage("4. |cff0088FFEvery time you win a duel you get 1 statpoint.")
player:SendBroadcastMessage("5. |cff0088FFWhen you win or loose to a player you get locked, this means you cannot gain a ranked win from the player. Locks last for 5 minutes and you can still duel anyone else to get a ranked win.")
player:SendBroadcastMessage("6. |cff0088FFYou do not get rewarded for winning over someone 2 ranks or more below your own and if you win over someone 1 rank or more above your own you get 1 extra statpoint.")
elseif message == "#duel faq" then
player:SendBroadcastMessage("Q: |cff0088FFI only get a message saying i have no duel stats when i try to duel someone, check my stats or compare my stats!")
player:SendBroadcastMessage("A: |cff00FF00Write \"#duel setup\" without the quotes.")
player:SendBroadcastMessage("Q: |cff0088FFWhen i try to use #duel tstats or #duel cstats it says my target does not have any duel stats!")
player:SendBroadcastMessage("A: |cff00FF00This means your target does not have any duel stats.")
player:SendBroadcastMessage("Q: |cff0088FFI reseted my duel stats but changed my mind, how can i get them back?")
player:SendBroadcastMessage("A: |cff00FF00You cant, thats why you had to confirm the reset.")
elseif message == "#duel stats" then
if duel:GetQuery(player) == false or duel:GetStats(player) == false then
player:SendBroadcastMessage("You do not have any duel stats.")
elseif duel:GetBusy(player) == 1 then
player:SendBroadcastMessage("You cannot check your duel stats while dueling.")
else
local query = duel:GetQuery(player)
local stats = duel:GetStats(player)
local class = duel:GetClass(player)
local fornext = CustomDuel.ranks.ranked_wins[query.rank+1] - query.ranked_wins
player:SendBroadcastMessage("Class: |cff0088FF"..class)
player:SendBroadcastMessage("Rank: |cff0088FF"..query.rank_name)
player:SendBroadcastMessage("Ranked wins: |cff0088FF"..query.ranked_wins)
player:SendBroadcastMessage("Ranked wins for next rank: |cff0088FF"..fornext)
player:SendBroadcastMessage("Health: |cff0088FF"..stats.health)
player:SendBroadcastMessage("Min Damage: |cff0088FF"..stats.mindamage)
player:SendBroadcastMessage("Max damage: |cff0088FF"..stats.maxdamage)
if class == "Warrior" then
player:SendBroadcastMessage("Attackpower: |cff0088FF"..stats.power)
else
player:SendBroadcastMessage("Spellpower: |cff0088FF"..stats.power)
end
player:SendBroadcastMessage("Defense: |cff0088FF"..stats.defense)
player:SendBroadcastMessage("Crit: |cff0088FF"..stats.crit)
player:SendBroadcastMessage("Dodge: |cff0088FF"..stats.dodge)
player:SendBroadcastMessage("Statpoints: |cff0088FF"..query.statpoints)
player:SendBroadcastMessage("Duels won: |cff0088FF"..query.won)
player:SendBroadcastMessage("Duels lost: |cff0088FF"..query.lost)
player:SendBroadcastMessage("Ties: |cff0088FF"..query.ties)
end
elseif message == "#duel tstats" then
local target = player:GetSelection()
if target == nil then
player:SendBroadcastMessage("You do not have any target.")
elseif target:IsPlayer() == false then
player:SendBroadcastMessage("You can only use this command on players.")
elseif duel:GetQuery(target) == false or duel:GetStats(target) == false or duel:GetBusy(target) == false then
player:SendBroadcastMessage(target:GetName().." does not have any duel stats.")
elseif duel:GetBusy(player) == 1 then
player:SendBroadcastMessage("You cannot check others duel stats while dueling.")
else
local query = duel:GetQuery(target)
local stats = duel:GetStats(target)
local class = duel:GetClass(target)
player:SendBroadcastMessage("Name: |cff0088FF"..target:GetName())
player:SendBroadcastMessage("Class: |cff0088FF"..class)
player:SendBroadcastMessage("Rank: |cff0088FF"..query.rank_name)
player:SendBroadcastMessage("Health: |cff0088FF"..stats.health)
player:SendBroadcastMessage("Min Damage: |cff0088FF"..stats.mindamage)
player:SendBroadcastMessage("Max damage: |cff0088FF"..stats.maxdamage)
if class == "Warrior" then
player:SendBroadcastMessage("Attackpower: |cff0088FF"..stats.power)
else
player:SendBroadcastMessage("Spellpower: |cff0088FF"..stats.power)
end
player:SendBroadcastMessage("Defense: |cff0088FF"..stats.defense)
player:SendBroadcastMessage("Crit: |cff0088FF"..stats.crit)
player:SendBroadcastMessage("Dodge: |cff0088FF"..stats.dodge)
player:SendBroadcastMessage("Duels won: |cff0088FF"..query.won)
player:SendBroadcastMessage("Duels lost: |cff0088FF"..query.lost)
player:SendBroadcastMessage("Ties: |cff0088FF"..query.ties)
end
elseif message == "#duel cstats" then
local target = player:GetSelection()
if duel:GetQuery(player) == false then
player:SendBroadcastMessage("You do not have any duel stats.")
elseif target == nil then
player:SendBroadcastMessage("You do not have any target.")
elseif target:IsPlayer() == false then
player:SendBroadcastMessage("You can only use this command on players.")
elseif duel:GetQuery(target) == false or duel:GetStats(target) == false or duel:GetBusy(target) == false then
player:SendBroadcastMessage(target:GetName().." does not have any duel stats.")
elseif duel:GetBusy(player) == 1 then
player:SendBroadcastMessage("You cannot compare duel stats while dueling.")
else
local query = duel:GetQuery(player)
local stats = duel:GetStats(player)
local class = duel:GetClass(player)
local tquery = duel:GetQuery(target)
local tstats = duel:GetStats(target)
local tclass = duel:GetClass(target)
player:SendBroadcastMessage(string.format("Class: |cff0088FF%s %s", class, tclass))
if query.rank > tquery.rank then
player:SendBroadcastMessage(string.format("Rank: |cff00FF00%s|r |cffFF0000%s", query.rank_name, tquery.rank_name))
elseif query.rank < tquery.rank then
player:SendBroadcastMessage(string.format("Rank: |cffFF0000%s|r |cff00FF00%s", query.rank_name, tquery.rank_name))
elseif query.rank == tquery.rank then
player:SendBroadcastMessage(string.format("Rank: |cff0088FF%s|r |cff0088FF%s", query.rank_name, tquery.rank_name))
end
if stats.health > tstats.health then
player:SendBroadcastMessage(string.format("Health: |cff00FF00%d|r |cffFF0000%d", stats.health, tstats.health))
elseif stats.health < tstats.health then
player:SendBroadcastMessage(string.format("Health: |cffFF0000%d|r |cff00FF00%d", stats.health, tstats.health))
elseif stats.health == tstats.health then
player:SendBroadcastMessage(string.format("Health: |cff0088FF%d", stats.health))
end
if stats.mindamage > tstats.mindamage then
player:SendBroadcastMessage(string.format("Min Damage: |cff00FF00%d|r |cffFF0000%d", stats.mindamage, tstats.mindamage))
elseif stats.mindamage < tstats.mindamage then
player:SendBroadcastMessage(string.format("Min Damage: |cffFF0000%d|r |cff00FF00%d", stats.mindamage, tstats.mindamage))
elseif stats.mindamage == tstats.mindamage then
player:SendBroadcastMessage(string.format("Min Damage: |cff0088FF%d", stats.mindamage))
end
if stats.maxdamage > tstats.maxdamage then
player:SendBroadcastMessage(string.format("Max Damage: |cff00FF00%d|r |cffFF0000%d", stats.maxdamage, tstats.maxdamage))
elseif stats.maxdamage < tstats.maxdamage then
player:SendBroadcastMessage(string.format("Max Damage: |cffFF0000%d|r |cff00FF00%d", stats.maxdamage, tstats.maxdamage))
elseif stats.maxdamage == tstats.maxdamage then
player:SendBroadcastMessage(string.format("Max Damage: |cff0088FF%d", stats.maxdamage))
end
if stats.power > tstats.power then
player:SendBroadcastMessage(string.format("Power: |cff00FF00%d|r |cffFF0000%d", stats.power, tstats.power))
elseif stats.power < tstats.power then
player:SendBroadcastMessage(string.format("Power: |cffFF0000%d|r |cff00FF00%d", stats.power, tstats.power))
elseif stats.power == tstats.power then
player:SendBroadcastMessage(string.format("Power: |cff0088FF%d", stats.power))
end
if stats.defense > tstats.defense then
player:SendBroadcastMessage(string.format("Defense: |cff00FF00%d|r |cffFF0000%d", stats.defense, tstats.defense))
elseif stats.defense < tstats.defense then
player:SendBroadcastMessage(string.format("Defense: |cffFF0000%d|r |cff00FF00%d", stats.defense, tstats.defense))
elseif stats.defense == tstats.defense then
player:SendBroadcastMessage(string.format("Defense: |cff0088FF%d", stats.defense))
end
if stats.crit > tstats.crit then
player:SendBroadcastMessage(string.format("Crit chance: |cff00FF00%d|r |cffFF0000%d", stats.crit, tstats.crit))
elseif stats.crit < tstats.crit then
player:SendBroadcastMessage(string.format("Crit chance: |cffFF0000%d|r |cff00FF00%d", stats.crit, tstats.crit))
elseif stats.crit == tstats.crit then
player:SendBroadcastMessage(string.format("Crit chance: |cff0088FF%d", stats.crit))
end
if stats.dodge > tstats.dodge then
player:SendBroadcastMessage(string.format("Dodge chance: |cff00FF00%d|r |cffFF0000%d", stats.dodge, tstats.dodge))
elseif stats.dodge < tstats.dodge then
player:SendBroadcastMessage(string.format("Dodge chance: |cffFF0000%d|r |cff00FF00%d", stats.dodge, tstats.dodge))
elseif stats.dodge == tstats.dodge then
player:SendBroadcastMessage(string.format("Dodge chance: |cff0088FF%d", stats.dodge))
end
if query.won > tquery.won then
player:SendBroadcastMessage(string.format("Duels won: |cff00FF00%d|r |cffFF0000%d", query.won, tquery.won))
elseif query.won < tquery.won then
player:SendBroadcastMessage(string.format("Duels won: |cffFF0000%d|r |cff00FF00%d", query.won, tquery.won))
elseif query.won == tquery.won then
player:SendBroadcastMessage(string.format("Duels won: |cff0088FF%d", query.won))
end
if query.lost > tquery.lost then
player:SendBroadcastMessage(string.format("Duels lost: |cff00FF00%d|r |cffFF0000%d", query.lost, tquery.lost))
elseif query.lost < tquery.lost then
player:SendBroadcastMessage(string.format("Duels lost: |cffFF0000%d|r |cff00FF00%d", query.lost, tquery.lost))
elseif query.lost == tquery.lost then
player:SendBroadcastMessage(string.format("Duels lost: |cff0088FF%d", query.lost))
end
if query.ties > tquery.ties then
player:SendBroadcastMessage(string.format("Ties: |cff00FF00%d|r |cffFF0000%d", query.ties, tquery.ties))
elseif query.ties < tquery.ties then
player:SendBroadcastMessage(string.format("Ties: |cffFF0000%d|r |cff00FF00%d", query.ties, tquery.ties))
elseif query.ties == tquery.ties then
player:SendBroadcastMessage(string.format("Ties: |cff0088FF%d", query.ties))
end
end
elseif message == "#duel setup" then
if duel:GetQuery(player) ~= nil then
player:SendBroadcastMessage("You already have duel stats. If you want to reset them use #duel reset instead.")
else
player:SendBroadcastMessage("Disabled as of v4.0. Please go to a Duel Master instead.")
end
elseif message == "#duel reset" then
if duel:GetQuery(player) == nil or duel:GetStats(player) == nil then
player:SendBroadcastMessage("You do not have any duel stats.")
elseif duel:GetBusy(player) == 1 then
player:SendBroadcastMessage("You cannot reset your duel stats while dueling.")
elseif reset[player:GetName()] == 1 then
player:SendBroadcastMessage("You already have an active duel stat reset request.")
else
player:SendBroadcastMessage("|cffFF0000WARNING: If you reset your duel stats there is no way to get them back!|r Type #confirm to confirm the duel stat reset.")
reset[player:GetName()] = {
expire = os.time()+10,
check = 1,
}
end
elseif message == "#duel start" then
local target = player:GetSelection()
if target == nil then
player:SendBroadcastMessage("You do not have any target.")
elseif target:IsPlayer() == false and duel:Champion(target) == false then
player:SendBroadcastMessage("You can only duel players and champions.")
elseif target:GetName() == player:GetName() then
player:SendBroadcastMessage("You cannot duel yourself.")
elseif duel:GetQuery(player) == false or duel:GetStats(player) == false then
player:SendBroadcastMessage("You do not have any duel stats.")
elseif duel:Champion(target) == false and (duel:GetQuery(target) == false or duel:GetStats(target) == false) then
player:SendBroadcastMessage(target:GetName().." does not have any duel stats.")
elseif duel:GetBusy(player) == 1 then
player:SendBroadcastMessage("You are already in a duel.")
elseif duel:Champion(target) ~= false then
local diff = duel:Champion(target)
local name = target:GetName()
name = (name:gsub("'", "\\'"))
WorldDBQuery("INSERT INTO `custom_duel_duels` (`player`, `enemy`, `player_hp`, `enemy_hp`, `player_status`, `enemy_status`, `champion`) VALUES ('"..player:GetName().."', '"..name.."', "..duel:GetStats(player).health..", "..CustomDuel.champions[diff].health..", 0, 0, "..diff..")")
WorldDBQuery("UPDATE `custom_duel_players` SET `busy`=1 WHERE `name`='"..player:GetName().."'")
else
WorldDBQuery("INSERT INTO `custom_duel_duels` (`player`, `enemy`, `player_hp`, `enemy_hp`, `player_status`, `enemy_status`, `champion`) VALUES ('"..player:GetName().."', '"..target:GetName().."', "..duel:GetStats(player).health..", "..duel:GetStats(target).health..", 0, 0, 0)")
WorldDBQuery("UPDATE `custom_duel_players` SET `busy`=1 WHERE `name`='"..player:GetName().."'")
end
end
if message:find("#duel") then
return 0
end
end
function CustomDuel.OnFirstEnter(event, player)
if duel:GetQuery(player) ~= false then
WorldDBQuery("DELETE FROM `custom_duel_players` WHERE (`name`='"..player:GetName().."')")
end
end
function CustomDuel.Tick()
local query = WorldDBQuery("SELECT `player`, `enemy`, `player_hp`, `enemy_hp`, `player_status`, `enemy_status`, `champion` FROM `"..WorldDB.."`.`custom_duel_duels`")
if query ~= nil then
local rows = query:GetRowCount()
for i=1, rows do
local player = query:GetColumn(0):GetString()
local enemy = query:GetColumn(1):GetString()
local player_hp = query:GetColumn(2):GetString()
local enemy_hp = query:GetColumn(3):GetString()
local player_status = query:GetColumn(4):GetString()
local enemy_status = query:GetColumn(5):GetString()
local stats = CustomDuel.stats[player]
local estats
if query:GetColumn(6):GetFloat() == 0 then
estats = CustomDuel.stats[enemy]
else
local diff = query:GetColumn(6):GetFloat()
estats = CustomDuel.champions[diff]
end
local plr = GetPlayer(player)
local damage = math.random(stats.mindamage, stats.maxdamage)
local edamage = math.random(estats.mindamage, estats.maxdamage)
if query:GetColumn(6):GetFloat() == 0 and stats.class ~= estats.class then
damage = damage*2
edamage = edamage*2
end
local def = stats.defense - estats.power
local edef = estats.defense - stats.power
if def < 0 then
def = 0
end
if edef < 0 then
edef = 0
end
damage = damage - edef
edamage = edamage - def
local crit = math.random(1, 100)
local ecrit = math.random(1, 100)
if crit <= stats.crit then
damage = damage*2
crit = true
else
crit = false
end
if ecrit <= estats.crit then
edamage = edamage*2
ecrit = true
else
ecrit = false
end
if damage <= 0 then
damage = 1
end
if edamage <= 0 then
edamage = 1
end
local dodge = math.random(1, 100)
local edodge = math.random(1, 100)
if dodge <= stats.dodge then
edamage = 0
dodge = true
else
dodge = false
end
if edodge <= estats.dodge then
damage = 0
edodge = true
else
edodge = false
end
player_hp = player_hp - edamage
enemy_hp = enemy_hp - damage
WorldDBQuery("UPDATE `custom_duel_duels` SET `player_hp`="..player_hp..", `enemy_hp`="..enemy_hp.." WHERE `player`='"..player.."'")
if dodge == true then
plr:SendAreaTriggerMessage(string.format("You dodge %s's attack.", enemy))
elseif ecrit == true and dodge == false then
plr:SendAreaTriggerMessage(string.format("%s criticaly hits you for %d damage. You have %d hp left.", enemy, edamage, player_hp))
elseif ecrit == false and dodge == false then
plr:SendAreaTriggerMessage(string.format("%s hits you for %d damage. You have %d hp left.", enemy, edamage, player_hp))
end
if edodge == true then
plr:SendAreaTriggerMessage(string.format("%s dodges your attack.", enemy))
elseif crit == true and edodge == false then
plr:SendAreaTriggerMessage(string.format("You criticaly hit %s for %d damage. %s has %d hp left", enemy, damage, enemy, enemy_hp))
elseif crit == false and edodge == false then
plr:SendAreaTriggerMessage(string.format("You hit %s for %d damage. %s has %d hp left", enemy, damage, enemy, enemy_hp))
end
if player_hp > 0 and enemy_hp <= 0 then
local pquery = duel:GetQuery(player)
local diff = query:GetColumn(6):GetFloat()
if diff == 0 then
local equery = duel:GetQuery(enemy)
local lock = WorldDBQuery("SELECT `player`, `enemy`, `expire` FROM `"..WorldDB.."`.`custom_duel_locks` WHERE `player`='"..player.."' AND `enemy`='"..enemy.."'")
if lock == nil then
if pquery.rank == equery.rank then
local statpoints = pquery.statpoints + 1
local ranked = pquery.ranked_wins + 1
WorldDBQuery("UPDATE `custom_duel_players` SET `ranked_wins`="..ranked..", `statpoints`="..statpoints.." WHERE `name`='"..player.."'")
plr:SendBroadcastMessage("You have won the duel against "..enemy.."! As your ranks were the same you gain 1 ranked win and 1 statpoint.")
elseif pquery.rank-equery-rank < 0 then
local statpoints = pquery.statpoints + 2
local ranked = pquery.ranked_wins + 1
WorldDBQuery("UPDATE `custom_duel_players` SET `ranked_wins`="..ranked..", `statpoints`="..statpoints.." WHERE `name`='"..player.."'")
plr:SendBroadcastMessage("You have won the duel against "..enemy.."! As your rank is atleast 1 or more below your opponents you gain 1 ranked win and 2 statpoints.")
elseif equery.rank-pquery.rank > 1 then
plr:SendBroadcastMessage("You have won the duel against "..enemy.."! As your rank is atleast 2 or more above your opponents you gain nothing.")
end
else
if pquery.rank == equery.rank then
local statpoints = pquery.statpoints + 1
WorldDBQuery("UPDATE `custom_duel_players` SET `statpoints`="..statpoints.." WHERE `name`='"..player.."'")
plr:SendBroadcastMessage("You have won the duel against "..enemy.."! As your ranks were the same you gain 1 statpoint.")
elseif pquery.rank-equery.rank < 0 then
local statpoints = pquery.statpoints + 2
WorldDBQuery("UPDATE `custom_duel_players` SET `statpoints`="..statpoints.." WHERE `name`='"..player.."'")
plr:SendBroadcastMessage("You have won the duel against "..enemy.."! As your rank is atleast 1 or more below your opponents you gain 2 statpoints.")
elseif equery.rank-pquery.rank > 1 then
plr:SendBroadcastMessage("You have won the duel against "..enemy.."! As your rank is atleast 2 or more above your opponents you gain nothing.")
end
end
if pquery.rank < 12 and duel:GetQuery(player).ranked_wins >= CustomDuel.ranks.ranked_wins[pquery.rank+1] then
local newrank = pquery.rank+1
if newrank <= 7 and pquery.class == "Warrior" then
WorldDBQuery("UPDATE `custom_duel_players` SET `rank_name`='"..CustomDuel.ranks.warrior[newrank].."', `rank`="..newrank.." WHERE `name`='"..player.."'")
elseif newrank <= 7 and pquery.class == "Mage" then
WorldDBQuery("UPDATE `custom_duel_players` SET `rank_name`='"..CustomDuel.ranks.mage[newrank].."', `rank`="..newrank.." WHERE `name`='"..player.."'")
elseif newrank >= 8 then
WorldDBQuery("UPDATE `custom_duel_players` SET `rank_name`='"..CustomDuel.ranks.both[newrank].."', `rank`="..newrank.." WHERE `name`='"..player.."'")
end
end
local won = pquery.won+1
if lock == nil then
WorldDBQuery("INSERT INTO `custom_duel_locks` (`player`, `enemy`, `expire`) VALUES ('"..player.."', '"..enemy.."', "..(os.time()+300)..")")
end
elseif diff == 1 then
local lock = WorldDBQuery("SELECT `player`, `enemy`, `expire` FROM `"..WorldDB.."`.`custom_duel_locks` WHERE `player`='"..player.."' AND `enemy`='"..enemy.."'")
if lock == nil then
local won = pquery.won+1
local ep = 5
local statpoints = pquery.statpoints + ep
WorldDBQuery("UPDATE `custom_duel_players` SET `statpoints`="..statpoints.." WHERE `name`='"..player.."'")
plr:SendBroadcastMessage("You have successfully defeated the champion "..enemy.."! You are rewarded with "..ep.." statpoints!")
WorldDBQuery("INSERT INTO `custom_duel_locks` (`player`, `enemy`, `expire`) VALUES ('"..player.."', '"..enemy.."', "..(os.time()*5)..")")
else
plr:SendBroadcastMessage("You have already defeated this champion once, you do not get any reward.")
end
elseif diff == 2 then
local lock = WorldDBQuery("SELECT `player`, `enemy`, `expire` FROM `"..WorldDB.."`.`custom_duel_locks` WHERE `player`='"..player.."' AND `enemy`='"..enemy.."'")
if lock == nil then
local won = pquery.won+1
local ep = 10
local statpoints = pquery.statpoints + ep
WorldDBQuery("UPDATE `custom_duel_players` SET `statpoints`="..statpoints.." WHERE `name`='"..player.."'")
plr:SendBroadcastMessage("You have successfully defeated the champion "..enemy.."! You are rewarded with "..ep.." statpoints!")
WorldDBQuery("INSERT INTO `custom_duel_locks` (`player`, `enemy`, `expire`) VALUES ('"..player.."', '"..enemy.."', "..(os.time()*5)..")")
else
plr:SendBroadcastMessage("You have already defeated this champion once, you do not get any reward.")
end
elseif diff == 3 then
local lock = WorldDBQuery("SELECT `player`, `enemy`, `expire` FROM `"..WorldDB.."`.`custom_duel_locks` WHERE `player`='"..player.."' AND `enemy`='"..enemy.."'")
if lock == nil then
local won = pquery.won+1
local ep = 20
local statpoints = pquery.statpoints + ep
WorldDBQuery("UPDATE `custom_duel_players` SET `statpoints`="..statpoints.." WHERE `name`='"..player.."'")
plr:SendBroadcastMessage("You have successfully defeated the champion "..enemy.."! You are rewarded with "..ep.." statpoints!")
WorldDBQuery("INSERT INTO `custom_duel_locks` (`player`, `enemy`, `expire`) VALUES ('"..player.."', '"..enemy.."', "..(os.time()*5)..")")
else
plr:SendBroadcastMessage("You have already defeated this champion once, you do not get any reward.")
end
elseif diff == 4 then
local lock = WorldDBQuery("SELECT `player`, `enemy`, `expire` FROM `"..WorldDB.."`.`custom_duel_locks` WHERE `player`='"..player.."' AND `enemy`='"..enemy.."'")
if lock == nil then
local won = pquery.won+1
local ep = 40
local statpoints = pquery.statpoints + ep
WorldDBQuery("UPDATE `custom_duel_players` SET `statpoints`="..statpoints.." WHERE `name`='"..player.."'")
plr:SendBroadcastMessage("You have successfully defeated the champion "..enemy.."! You are rewarded with "..ep.." statpoints!")
WorldDBQuery("INSERT INTO `custom_duel_locks` (`player`, `enemy`, `expire`) VALUES ('"..player.."', '"..enemy.."', "..(os.time()*5)..")")
else
plr:SendBroadcastMessage("You have already defeated this champion once, you do not get any reward.")
end
elseif diff == 5 then
local lock = WorldDBQuery("SELECT `player`, `enemy`, `expire` FROM `"..WorldDB.."`.`custom_duel_locks` WHERE `player`='"..player.."' AND `enemy`='"..enemy.."'")
if lock == nil then
local won = pquery.won+1
local ep = 80
local statpoints = pquery.statpoints + ep
WorldDBQuery("UPDATE `custom_duel_players` SET `statpoints`="..statpoints.." WHERE `name`='"..player.."'")
plr:SendBroadcastMessage("You have successfully defeated the champion "..enemy.."! You are rewarded with "..ep.." statpoints!")
WorldDBQuery("INSERT INTO `custom_duel_locks` (`player`, `enemy`, `expire`) VALUES ('"..player.."', '"..enemy.."', "..(os.time()*5)..")")
else
plr:SendBroadcastMessage("You have already defeated this champion once, you do not get any reward.")
end
elseif diff == 6 then
local lock = WorldDBQuery("SELECT `player`, `enemy`, `expire` FROM `"..WorldDB.."`.`custom_duel_locks` WHERE `player`='"..player.."' AND `enemy`='"..enemy.."'")
if lock == nil then
local won = pquery.won+1
local ep = 160
local statpoints = pquery.statpoints + ep
WorldDBQuery("UPDATE `custom_duel_players` SET `statpoints`="..statpoints.." WHERE `name`='"..player.."'")
plr:SendBroadcastMessage("You have successfully defeated the champion "..enemy.."! You are rewarded with "..ep.." statpoints!")
WorldDBQuery("INSERT INTO `custom_duel_locks` (`player`, `enemy`, `expire`) VALUES ('"..player.."', '"..enemy.."', "..(os.time()*5)..")")
else
plr:SendBroadcastMessage("You have already defeated this champion once, you do not get any reward.")
end
elseif diff == 7 then
local lock = WorldDBQuery("SELECT `player`, `enemy`, `expire` FROM `"..WorldDB.."`.`custom_duel_locks` WHERE `player`='"..player.."' AND `enemy`='"..enemy.."'")
if lock == nil then
local won = pquery.won+1
local ep = 320
local statpoints = pquery.statpoints + ep
WorldDBQuery("UPDATE `custom_duel_players` SET `statpoints`="..statpoints.." WHERE `name`='"..player.."'")
plr:SendBroadcastMessage("You have successfully defeated the champion "..enemy.."! You are rewarded with "..ep.." statpoints!")
WorldDBQuery("INSERT INTO `custom_duel_locks` (`player`, `enemy`, `expire`) VALUES ('"..player.."', '"..enemy.."', "..(os.time()*5)..")")
else
plr:SendBroadcastMessage("You have already defeated this champion once, you do not get any reward.")
end
elseif diff == 8 then
local lock = WorldDBQuery("SELECT `player`, `enemy`, `expire` FROM `"..WorldDB.."`.`custom_duel_locks` WHERE `player`='"..player.."' AND `enemy`='"..enemy.."'")
if lock == nil then
local won = pquery.won+1
local ep = 640
local statpoints = pquery.statpoints + ep
WorldDBQuery("UPDATE `custom_duel_players` SET `statpoints`="..statpoints.." WHERE `name`='"..player.."'")
plr:SendBroadcastMessage("You have successfully defeated the champion "..enemy.."! You are rewarded with "..ep.." statpoints!")
WorldDBQuery("INSERT INTO `custom_duel_locks` (`player`, `enemy`, `expire`) VALUES ('"..player.."', '"..enemy.."', "..(os.time()*5)..")")
else
plr:SendBroadcastMessage("You have already defeated this champion once, you do not get any reward.")
end
end
duel:Setup(player)
WorldDBQuery("UPDATE `custom_duel_players` SET `busy`=0 WHERE `name`='"..player.."'")
WorldDBQuery("DELETE FROM `custom_duel_duels` WHERE (`player`='"..player.."')")
elseif player_hp <= 0 and enemy_hp > 0 then
local pquery = duel:GetQuery(player)
local equery = duel:GetQuery(enemy)
plr:SendBroadcastMessage("You have lost the duel against "..enemy..".")
local lost = pquery.lost+1
WorldDBQuery("UPDATE `custom_duel_players` SET `busy`=0, `lost`="..lost.." WHERE `name`='"..player.."'")
WorldDBQuery("DELETE FROM `custom_duel_duels` WHERE (`player`='"..player.."')")
duel:Setup(player)
elseif player_hp <= 0 and enemy_hp <= 0 then
local pquery = duel:GetQuery(player)
local equery = duel:GetQuery(enemy)
plr:SendBroadcastMessage("Both you and your opponent are dead, its a tie.")
local ties = pquery.ties+1
WorldDBQuery("UPDATE `custom_duel_players` SET `busy`=0, `ties`="..ties.." WHERE `name`='"..player.."'")
WorldDBQuery("DELETE FROM `custom_duel_duels` WHERE (`player`='"..player.."')")
duel:Setup(player)
end
end
end
end
function CustomDuel.ClearLocks()
local query = WorldDBQuery("SELECT `player`, `enemy`, `expire` FROM `"..WorldDB.."`.`custom_duel_locks`")
if query ~= nil then
local rows = query:GetRowCount()
for i=1, rows do
local expire = query:GetColumn(2):GetFloat()
if os.time() >= expire then
WorldDBQuery("DELETE FROM `custom_duel_locks` WHERE (`player`='"..query:GetColumn(0):GetString().."' AND `enemy`='"..query:GetColumn(1):GetString().."')")
end
query:NextRow()
end
end
end
function CustomDuel.ExpireReset()
for k, v in pairs (reset) do
if os.time() >= reset[k].expire then
expire = 0
check = 0
end
end
end
function CustomDuel.Confirm(event, player, message, type, language)
if message == "#confirm" and reset[player:GetName()].check == 1 then
player:SendBroadcastMessage("Your duel stats are now reseted.")
if duel:GetClass(player) == "Warrior" then
WorldDBQuery("UPDATE `custom_duel_players` SET `rank_name`='"..CustomDuel.ranks.warrior[1].."', `rank`=1, `ranked_wins`=0, `strength`=10, `agility`=7, `intellect`=10, `spirit`=7, `stamina`=9, `defense`=4, `power`=1, `crit`=3, `dodge`=5, `busy`=0, `statpoints`=0, `won`=0, `lost`=0, `ties`=0 WHERE `name`='"..player:GetName().."'")
else
WorldDBQuery("UPDATE `custom_duel_players` SET `rank_name`='"..CustomDuel.ranks.mage[1].."', `rank`=1, `ranked_wins`=0, `strength`=10, `agility`=7, `intellect`=10, `spirit`=7, `stamina`=9, `defense`=4, `power`=1, `crit`=3, `dodge`=5, `busy`=0, `statpoints`=0, `won`=0, `lost`=0, `ties`=0 WHERE `name`='"..player:GetName().."'")
end
duel:Setup(player)
reset[player:GetName()].expire = 0
reset[player:GetName()].check = 0
return 0
end
end
function CustomDuel.MasterGossip(pUnit, event, player)
if duel:GetQuery(player) == false then
pUnit:GossipCreateMenu(100, player, 0)
pUnit:GossipMenuAddItem(0, "Do you want to get your duel stats "..player:GetName().."?", 1, 0)
pUnit:GossipSendMenu(player)
elseif duel:GetStatpoints(player) == false or duel:GetStatpoints(player) == 0 then
player:SendBroadcastMessage("You do not have any statpoints.")
player:GossipComplete()
else
pUnit:GossipCreateMenu(100, player, 0)
if duel:GetClass(player) == "Warrior" then
pUnit:GossipMenuAddItem(0, "Buy Strength", 2, 3)
pUnit:GossipMenuAddItem(0, "Buy Agility", 3, 3)
elseif duel:GetClass(player) == "Mage" then
pUnit:GossipMenuAddItem(0, "Buy Intellect", 4, 3)
pUnit:GossipMenuAddItem(0, "Buy Spirit", 5, 3)
end
pUnit:GossipMenuAddItem(0, "Buy Stamina", 6, 3)
pUnit:GossipSendMenu(player)
end
end
function CustomDuel.MasterSelect(pUnit, event, player, id, intid, code)
local code = tonumber(code)
if (intid == 1) then
pUnit:GossipCreateMenu(100, player, 0)
pUnit:GossipMenuAddItem(0, "Warrior", 11, 0)
pUnit:GossipMenuAddItem(0, "Mage", 12, 0)
pUnit:GossipSendMenu(player)
elseif (intid == 11) then
local class = "Warrior"
local rank = CustomDuel.ranks.warrior[1]
duel:Setup(player, class, rank)
player:GossipComplete()
elseif (intid == 12) then
local class = "Mage"
local rank = CustomDuel.ranks.mage[1]
duel:Setup(player, class, rank)
player:GossipComplete()
elseif (intid == 2) then
check = {}
string.gsub(code, "([^%d]+)", function(c) table.insert(check, c) end)
if check[1] ~= nil then
player:SendBroadcastMessage("Please only use numbers next time.")
player:GossipComplete()
check = nil
elseif duel:GetStatpoints(player) < code then
player:SendBroadcastMessage("You do not have "..code.." statpoints.")
player:GossipComplete()
else
local stats = duel:GetQuery(player).strength + code
local statpoints = duel:GetStatpoints(player) - code
player:SendBroadcastMessage("You have bought "..code.." strength.")
WorldDBQuery("UPDATE `custom_duel_players` SET `strength`="..stats..", `statpoints`="..statpoints.." WHERE `name`='"..player:GetName().."'")
duel:Setup(player)
player:GossipComplete()
end
elseif (intid == 3) then
check = {}
string.gsub(code, "([^%d]+)", function(c) table.insert(check, c) end)
if check[1] ~= nil then
player:SendBroadcastMessage("Please only use numbers next time.")
player:GossipComplete()
check = nil
elseif duel:GetStatpoints(player) < code then
player:SendBroadcastMessage("You do not have "..code.." statpoints.")
player:GossipComplete()
else
local stats = duel:GetQuery(player).agility + code
local statpoints = duel:GetStatpoints(player) - code
player:SendBroadcastMessage("You have bought "..code.." agility.")
WorldDBQuery("UPDATE `custom_duel_players` SET `agility`="..stats..", `statpoints`="..statpoints.." WHERE `name`='"..player:GetName().."'")
duel:Setup(player)
player:GossipComplete()
end
elseif (intid == 4) then
check = {}
string.gsub(code, "([^%d]+)", function(c) table.insert(check, c) end)
if check[1] ~= nil then
player:SendBroadcastMessage("Please only use numbers next time.")
player:GossipComplete()
check = nil
elseif duel:GetStatpoints(player) < code then
player:SendBroadcastMessage("You do not have "..code.." statpoints.")
player:GossipComplete()
else
local stats = duel:GetQuery(player).intellect + code
local statpoints = duel:GetStatpoints(player) - code
player:SendBroadcastMessage("You have bought "..code.." intellect.")
WorldDBQuery("UPDATE `custom_duel_players` SET `intellect`="..stats..", `statpoints`="..statpoints.." WHERE `name`='"..player:GetName().."'")
duel:Setup(player)
player:GossipComplete()
end
elseif (intid == 5) then
check = {}
string.gsub(code, "([^%d]+)", function(c) table.insert(check, c) end)
if check[1] ~= nil then
player:SendBroadcastMessage("Please only use numbers next time.")
player:GossipComplete()
check = nil
elseif duel:GetStatpoints(player) < code then
player:SendBroadcastMessage("You do not have "..code.." statpoints.")
player:GossipComplete()
else
local stats = duel:GetQuery(player).spirit + code
local statpoints = duel:GetStatpoints(player) - code
player:SendBroadcastMessage("You have bought "..code.." spirit.")
WorldDBQuery("UPDATE `custom_duel_players` SET `spirit`="..stats..", `statpoints`="..statpoints.." WHERE `name`='"..player:GetName().."'")
duel:Setup(player)
player:GossipComplete()
end
elseif (intid == 6) then
check = {}
string.gsub(code, "([^%d]+)", function(c) table.insert(check, c) end)
if check[1] ~= nil then
player:SendBroadcastMessage("Please only use numbers next time.")
player:GossipComplete()
check = nil
elseif duel:GetStatpoints(player) < code then
player:SendBroadcastMessage("You do not have "..code.." statpoints.")
player:GossipComplete()
else
local stats = duel:GetQuery(player).stamina + code
local statpoints = duel:GetStatpoints(player) - code
player:SendBroadcastMessage("You have bought "..code.." stamina.")
WorldDBQuery("UPDATE `custom_duel_players` SET `stamina`="..stats..", `statpoints`="..statpoints.." WHERE `name`='"..player:GetName().."'")
duel:Setup(player)
player:GossipComplete()
end
end
end
function CustomDuel.StopDuel(event, player)
if duel:GetQuery(player) ~= false and duel:GetBusy(player) == 1 then
WorldDBQuery("DELETE FROM `custom_duel_duels` WHERE (`player`='"..player:GetName().."')")
local add1 = 5
local add2 = math.random(duel:GetQuery(player).lost/20, duel:GetQuery(player).lost/20)
local add
if add1 > add2 then
add = duel:GetQuery(player).lost + add1
else
add = duel:GetQuery(player).lost + add2
end
WorldDBQuery("UPDATE `custom_duel_players` SET `lost`="..add..", `busy`=0 WHERE `name`='"..player:GetName().."'")
end
end
--Custom functions
function CustomDuel.functions:GetClass(player)
assert(type(player) == "userdata", "Bad argument #1 to `GetClass` (Expected userdata, got "..type(player)..").")
if CustomDuel.stats[player:GetName()] ~= nil then
return CustomDuel.stats[player:GetName()].class
else
return false
end
end
function CustomDuel.functions:GetStats(player)
assert(type(player) == "userdata", "Bad argument #1 to `GetStats` (Expected userdata, got "..type(player)..").")
if CustomDuel.stats[player:GetName()] ~= nil then
return CustomDuel.stats[player:GetName()]
else
return false
end
end
function CustomDuel.functions:GetQuery(player)
assert(type(player) == "userdata" or "string", "Bad argument #1 to `GetQuery` (Expected userdata or string, got "..type(player)..").")
if type(player) == "userdata" then
if WorldDBQuery("SELECT `name` FROM `"..WorldDB.."`.`custom_duel_players` WHERE `name`='"..player:GetName().."'") ~= nil then
local query = WorldDBQuery("SELECT `name`, `class`, `rank_name`, `rank`, `ranked_wins`, `strength`, `agility`, `intellect`, `spirit`, `stamina`, `defense`, `power`, `crit`, `dodge`, `busy`, `statpoints`, `won`, `lost`, `ties` FROM `"..WorldDB.."`.`custom_duel_players` WHERE `name`='"..player:GetName().."'")
CustomDuel.queries[player:GetName()] = {
name = query:GetColumn(0):GetString(),
class = query:GetColumn(1):GetString(),
rank_name = query:GetColumn(2):GetString(),
rank = query:GetColumn(3):GetFloat(),
ranked_wins = query:GetColumn(4):GetFloat(),
strength = query:GetColumn(5):GetFloat(),
agility = query:GetColumn(6):GetFloat(),
intellect = query:GetColumn(7):GetFloat(),
spirit = query:GetColumn(8):GetFloat(),
stamina = query:GetColumn(9):GetFloat(),
defense = query:GetColumn(10):GetFloat(),
power = query:GetColumn(11):GetFloat(),
crit = query:GetColumn(12):GetFloat(),
dodge = query:GetColumn(13):GetFloat(),
busy = query:GetColumn(14):GetFloat(),
statpoints = query:GetColumn(15):GetFloat(),
won = query:GetColumn(16):GetFloat(),
lost = query:GetColumn(17):GetFloat(),
ties = query:GetColumn(18):GetFloat(),
}
return CustomDuel.queries[player:GetName()]
else
return false
end
elseif type(player) == "string" then
if WorldDBQuery("SELECT `name` FROM `"..WorldDB.."`.`custom_duel_players` WHERE `name`='"..player.."'") ~= nil then
local query = WorldDBQuery("SELECT `name`, `class`, `rank_name`, `rank`, `ranked_wins`, `strength`, `agility`, `intellect`, `spirit`, `stamina`, `defense`, `power`, `crit`, `dodge`, `busy`, `statpoints`, `won`, `lost`, `ties` FROM `"..WorldDB.."`.`custom_duel_players` WHERE `name`='"..player.."'")
CustomDuel.queries[player] = {
name = query:GetColumn(0):GetString(),
class = query:GetColumn(1):GetString(),
rank_name = query:GetColumn(2):GetString(),
rank = query:GetColumn(3):GetFloat(),
ranked_wins = query:GetColumn(4):GetFloat(),
strength = query:GetColumn(5):GetFloat(),
agility = query:GetColumn(6):GetFloat(),
intellect = query:GetColumn(7):GetFloat(),
spirit = query:GetColumn(8):GetFloat(),
stamina = query:GetColumn(9):GetFloat(),
defense = query:GetColumn(10):GetFloat(),
power = query:GetColumn(11):GetFloat(),
crit = query:GetColumn(12):GetFloat(),
dodge = query:GetColumn(13):GetFloat(),
busy = query:GetColumn(14):GetFloat(),
statpoints = query:GetColumn(15):GetFloat(),
won = query:GetColumn(16):GetFloat(),
lost = query:GetColumn(17):GetFloat(),
ties = query:GetColumn(18):GetFloat(),
}
return CustomDuel.queries[player]
else
return false
end
end
end
function CustomDuel.functions:GetBusy(player)
assert(type(player) == "userdata", "Bad argument #1 to `GetBusy` (Expected userdata, got "..type(player)..").")
if WorldDBQuery("SELECT `name` FROM `"..WorldDB.."`.`custom_duel_players` WHERE `name`='"..player:GetName().."'") ~= nil then
return WorldDBQuery("SELECT `busy` FROM `"..WorldDB.."`.`custom_duel_players` WHERE `name`='"..player:GetName().."'"):GetColumn(0):GetFloat()
else
return false
end
end
function CustomDuel.functions:Setup(player, ...)
local class, rank = ...
assert(type(player) == "userdata" or "string", "Bad argument #1 to `Setup` (Expected userdata or string, got "..type(player)..").")
local name
if type(player) == "userdata" then
name = player:GetName()
elseif type(player) == "string" then
name = player
end
if duel:GetQuery(player) == false then
WorldDBQuery("INSERT INTO `custom_duel_players` (`name`, `class`, `rank_name`, `rank`, `ranked_wins`, `strength`, `agility`, `intellect`, `spirit`, `stamina`, `defense`, `power`, `crit`, `dodge`, `busy`, `statpoints`, `won`, `lost`, `ties`) VALUES ('"..name.."', '"..class.."', '"..rank.."', 1, 0, 10, 7, 10, 7, 9, 1, 4, 1, 3, 5, 0, 0, 0, 0, 0, 0)")
end
local query = duel:GetQuery(player)
if query.class == "Warrior" then
CustomDuel.stats[name] = {
class = query.class,
health = query.stamina*5,
mindamage = math.random(query.strength*0.8, query.strength*0.8),
maxdamage = math.random(query.strength*1.2, query.strength*1.2),
defense = math.random(query.defense+(query.agility*0.35), query.defense+(query.agility*0.35)),
power = math.random(query.power+((query.strength*0.10)+(query.agility*0.10)), query.power+((query.strength*0.10)+(query.agility*0.10))),
crit = math.random(query.crit+(query.agility*0.05), query.crit+(query.agility*0.05)),
dodge = math.random(query.dodge+(query.agility*0.01), query.dodge+(query.agility*0.01)),
}
else
CustomDuel.stats[name] = {
class = query.class,
health = query.stamina*5,
mindamage = math.random(query.intellect*0.8, query.intellect*0.8),
maxdamage = math.random(query.intellect*1.2, query.intellect*1.2),
defense = math.random(query.defense+(query.spirit*0.35), query.defense+(query.spirit*0.35)),
power = math.random(query.power+((query.intellect*0.10)+(query.spirit*0.10)), query.power+((query.intellect*0.10)+(query.spirit*0.10))),
crit = math.random(query.crit+(query.spirit*0.05), query.crit+(query.spirit*0.05)),
dodge = math.random(query.dodge+(query.spirit*0.01), query.dodge+(query.spirit*0.01)),
}
end
if CustomDuel.stats[name].crit > 30 then
CustomDuel.stats[name].crit = 30
end
if CustomDuel.stats[name].dodge > 20 then
CustomDuel.stats[name].dodge = 20
end
end
function CustomDuel.functions:GetStatpoints(player)
assert(type(player) == "userdata", "Bad argument #1 to `GetBusy` (Expected userdata, got "..type(player)..").")
if WorldDBQuery("SELECT `name` FROM `"..WorldDB.."`.`custom_duel_players` WHERE `name`='"..player:GetName().."'") ~= nil then
return WorldDBQuery("SELECT `statpoints` FROM `"..WorldDB.."`.`custom_duel_players` WHERE `name`='"..player:GetName().."'"):GetColumn(0):GetFloat()
else
return false
end
end
function CustomDuel.functions:Champion(pUnit)
assert(type(pUnit) == "userdata", "Bad argument #1 to `Champion` (Expected userdata, got "..type(pUnit)..").")
if pUnit:GetObjectType() == "Unit" then
local id = pUnit:GetEntry()
if WorldDBQuery("SELECT `champion`, `difficulty` FROM `"..WorldDB.."`.`custom_duel_champions` WHERE `champion`="..id) ~= nil then
return WorldDBQuery("SELECT `champion`, `difficulty` FROM `"..WorldDB.."`.`custom_duel_champions` WHERE `champion`="..id):GetColumn(1):GetFloat()
else
return false
end
else
return false
end
end
--Startup events
if GetLuaEngine() == "LuaHypArc" then
RegisterServerHook(16, CustomDuel.OnChat)
RegisterServerHook(3, CustomDuel.OnFirstEnter)
RegisterServerHook(16, CustomDuel.Confirm)
RegisterServerHook(13, CustomDuel.StopDuel)
RegisterTimedEvent("CustomDuel.Tick", 5000, 0)
RegisterTimedEvent("CustomDuel.ClearLocks", 10000, 0)
RegisterTimedEvent("CustomDuel.ExpireReset", 1000, 0)
RegisterUnitGossipEvent(MasterID, 1, "CustomDuel.MasterGossip")
RegisterUnitGossipEvent(MasterID, 2, "CustomDuel.MasterSelect")
RegisterTimedEvent("CustomDuel.Setup", 2000, 1)
local start = os.time()
local players = 0
local query = WorldDBQuery("SELECT `name` FROM `"..WorldDB.."`.`custom_duel_players`")
if query ~= nil then
local rows = query:GetRowCount()
for i=1, rows do
players = players+1
end
end
logcol(3)
print ("\n\n[Custom Duel System]: Loading...")
print (string.format("[Custom Duel System]: Loaded %d player(s).", players))
print (string.format("[Custom Duel System]: Loaded in %f seconds.", os.time() - start))
print ("[Custom Duel System]: Version 4.1 (Made by Laurea)\n\n")
logcol(15)
else
logcol(4)
print ("\n\n[Custom Duel System]: Failed to load - Server does not have LuaHypArc.\n\n")
logcol(15)
end
function CustomDuel.Setup()
local query = WorldDBQuery("SELECT `name`, `class`, `rank_name`, `rank`, `ranked_wins`, `strength`, `agility`, `intellect`, `spirit`, `stamina`, `defense`, `power`, `crit`, `dodge`, `busy`, `statpoints`, `won`, `lost`, `ties` FROM `"..WorldDB.."`.`custom_duel_players`")
if query ~= nil then
local rows = query:GetRowCount()
for i=1, rows do
local name = query:GetColumn(0):GetString()
local class = query:GetColumn(1):GetString()
local strength = query:GetColumn(5):GetFloat()
local agility = query:GetColumn(6):GetFloat()
local intellect = query:GetColumn(7):GetFloat()
local spirit = query:GetColumn(8):GetFloat()
local stamina = query:GetColumn(9):GetFloat()
local defense = query:GetColumn(10):GetFloat()
local power = query:GetColumn(11):GetFloat()
local crit = query:GetColumn(12):GetFloat()
local dodge = query:GetColumn(13):GetFloat()
if class == "Warrior" then
CustomDuel.stats[name] = {
name = name,
class = class,
health = stamina*5,
mindamage = math.random(strength*0.8, strength*0.8),
maxdamage = math.random(strength*1.2, strength*1.2),
defense = math.random(defense+(agility*0.35), defense+(agility*0.35)),
power = math.random(power+((strength*0.10)+(agility*0.10)), power+((strength*0.10)+(agility*0.10))),
crit = math.random(crit+(agility*0.05), crit+(agility*0.05)),
dodge = math.random(dodge+(agility*0.01), dodge+(agility*0.01)),
}
else
CustomDuel.stats[name] = {
name = name,
class = class,
health = stamina*5,
mindamage = math.random(intellect*0.8, intellect*0.8),
maxdamage = math.random(intellect*1.2, intellect*1.2),
defense = math.random(defense+(spirit*0.35), defense+(spirit*0.35)),
power = math.random(power+((intellect*0.10)+(spirit*0.10)), power+((intellect*0.10)+(spirit*0.10))),
crit = math.random(crit+(spirit*0.05), crit+(spirit*0.05)),
dodge = math.random(dodge+(spirit*0.01), dodge+(spirit*0.01)),
}
end
if CustomDuel.stats[name].crit > 30 then
CustomDuel.stats[name].crit = 30
end
if CustomDuel.stats[name].dodge > 20 then
CustomDuel.stats[name].dodge = 20
end
query:NextRow()
end
end
end
Pastebin: