Skip to content

Commit

Permalink
Add files via upload
Browse files Browse the repository at this point in the history
  • Loading branch information
iThorgrim authored Feb 20, 2021
1 parent 4a44190 commit 6fe58c1
Show file tree
Hide file tree
Showing 2 changed files with 249 additions and 22 deletions.
149 changes: 149 additions & 0 deletions parangon-client.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,149 @@
--[[
Created by iThorgrim
Parangon with Interface
You are going to use a script shared by myself (iThorgrim) so i would ask you to respect my work and not to assign this work to you.
If you want to learn more about World of Warcraft development.
(Only for French speaking people.)
Open-Wow -> https://open-wow.eu
Discord -> https://discord.gg/JUYgbNMwQu
If you wish to thank me for my work you can make a small donation.
Paypal ->
Thank you for using my script, if you have a suggestion or a problem with it please make a topic about it:
Issues -> https://github.com/iThorgrim-Hub/lua-aio-parangon/issues
See you soon for a next script.
]]--

local aio = AIO or require("AIO");
if aio.AddAddon() then
return
end

local parangon = {
parangon_aio = aio.AddHandlers("AIO_Parangon", {})
}

parangon.mainWindow = CreateFrame("Frame", parangon.mainWindow, UIParent)
parangon.mainWindow:SetSize(350, 500);
parangon.mainWindow:SetMovable(false);
parangon.mainWindow:EnableMouse(true);
parangon.mainWindow:RegisterForDrag("Right_Button")
parangon.mainWindow:SetPoint("CENTER", 0, 50)
parangon.mainWindow:Show()

parangon.mainWindowTexture = parangon.mainWindow:CreateTexture()
parangon.mainWindowTexture:SetAllPoints(parangon.mainWindow)
parangon.mainWindowTexture:SetTexture("interface/parangon/parangon_frame")
parangon.mainWindowTexture:SetTexCoord(0.58154296875, 0.96435546875, 0.04052734375, 0.81201171875)

parangon.mainWindowArt = CreateFrame("Button", parangon.mainWindowArt, parangon.mainWindow)
parangon.mainWindowArt:SetSize(180, 110)
parangon.mainWindowArt:SetPoint("TOP", -80, -65)
parangon.mainWindowArt:SetFrameLevel(1)
parangon.mainWindowArt:SetAlpha(0.4)
parangon.mainWindowArt:SetFrameLevel(2)

parangon.mainWindowArtTexture = parangon.mainWindowArt:CreateTexture()
parangon.mainWindowArtTexture:SetAllPoints(parangon.mainWindowArt)
parangon.mainWindowArtTexture:SetTexture("interface/parangon/parangon_frame")
parangon.mainWindowArtTexture:SetTexCoord(0.00048828125, 0.35009765625, 0.00048828125, 0.21435546875)


parangon.buttonsCoords = {
global = {
pos_y = 50
}
}

parangon.leftButtons = {}
parangon.leftButtonsTexture = {}

parangon.leftButtonsArt = {}

parangon.centerButtons = {}
parangon.centerText = {}

parangon.rightButtons = {}
parangon.rightButtonsTexture = {}

parangon.spellsList = {
[7464] = {name = 'Strength', icon = '_D3mantraofconviction'},
[7471] = {name = 'Agility', icon = '_D3mantraofevasion'},
[7477] = {name = 'Stamina', icon = '_D3mantraofretribution'},
[7468] = {name = 'Intellect', icon = '_D3mantraofhealing'},
}

for id, subtable in pairs(parangon.spellsList) do
parangon.leftButtons[id] = CreateFrame("Frame", parangon.leftButtons[id], parangon.mainWindow)
parangon.leftButtons[id]:SetSize(50, 50)
parangon.leftButtons[id]:SetPoint("LEFT", 20, parangon.buttonsCoords.global.pos_y)
parangon.leftButtons[id]:SetFrameLevel(1000)
parangon.leftButtons[id]:SetFrameLevel(3)

parangon.leftButtonsTexture[id] = parangon.leftButtons[id]:CreateTexture()
parangon.leftButtonsTexture[id]:SetAllPoints(parangon.leftButtons[id])
parangon.leftButtonsTexture[id]:SetTexture("interface/parangon/parangon_frame")
parangon.leftButtonsTexture[id]:SetTexCoord(0.05029296875, 0.14794921875, 0.86669921875, 0.96337890625)

parangon.leftButtonsArt[id] = CreateFrame("Frame", parangon.leftButtonsArt[id], parangon.leftButtons[id], nil)
parangon.leftButtonsArt[id]:SetSize(45, 45)
parangon.leftButtonsArt[id]:SetBackdrop(
{
bgFile = "Interface/Icons/"..subtable.icon,
insets = {left = 0, right = 0, top = 0, bottom = 0}
}
)
parangon.leftButtonsArt[id]:SetPoint("CENTER", 0, 0)
parangon.leftButtonsArt[id]:SetFrameLevel(2)

parangon.centerButtons[id] = CreateFrame("Button", parangon.centerButtons[id], parangon.mainWindow, nil)
parangon.centerButtons[id]:SetSize(200, 65)
parangon.centerButtons[id]:SetPoint("CENTER", 0, parangon.buttonsCoords.global.pos_y)
parangon.centerButtons[id]:SetNormalTexture("Interface/Parangon/LargeButtonBorder")
parangon.centerButtons[id]:SetHighlightTexture("Interface/Parangon/LargeButtonBorder_Hover")
parangon.centerButtons[id]:SetPushedTexture("Interface/Parangon/LargeButtonBorder_Push")
parangon.centerButtons[id]:EnableMouseWheel(1)
parangon.centerButtons[id]:SetFrameLevel(3)

parangon.centerText[id] = parangon.centerButtons[id]:CreateFontString(parangon.centerText[id])
parangon.centerText[id]:SetFont("Interface/Fonts/MARCELLUS.TTF", 14)
parangon.centerText[id]:SetSize(190, 3)
parangon.centerText[id]:SetPoint("CENTER", -1, 1)
parangon.centerText[id]:SetText("|CFFFFFFFF"..subtable.name.."|r")
parangon.centerText[id]:SetShadowColor(0, 0, 0)
parangon.centerText[id]:SetShadowOffset(0.5, 0.5)

parangon.rightButtons[id] = CreateFrame("Frame", parangon.rightButtons[id], parangon.mainWindow)
parangon.rightButtons[id]:SetSize(50, 50)
parangon.rightButtons[id]:SetPoint("Right", -20, parangon.buttonsCoords.global.pos_y)
parangon.rightButtons[id]:SetFrameLevel(1000)
parangon.rightButtons[id]:SetFrameLevel(3)

parangon.rightButtonsTexture[id] = parangon.rightButtons[id]:CreateTexture()
parangon.rightButtonsTexture[id]:SetAllPoints(parangon.rightButtons[id])
parangon.rightButtonsTexture[id]:SetTexture("interface/parangon/parangon_frame")
parangon.rightButtonsTexture[id]:SetTexCoord(0.19287109375, 0.28955078125, 0.86669921875, 0.96240234375)

parangon.buttonsCoords.global.pos_y = parangon.buttonsCoords.global.pos_y - 60
end

parangon.saveButton = CreateFrame("Button", parangon.saveButton, parangon.mainWindow)
parangon.saveButton:SetSize(200, 40)
parangon.saveButton:SetNormalTexture("Interface/buttons/ui-dialogbox-button-gold-up")
parangon.saveButton:SetHighlightTexture("Interface/buttons/ui-dialogbox-button-highlight")
parangon.saveButton:SetPushedTexture("Interface/buttons/ui-dialogbox-button-gold-down")
parangon.saveButton:SetPoint("BOTTOM", 0, 20)
parangon.saveButton:SetFrameLevel(2)

parangon.saveButtonText = parangon.saveButton:CreateFontString(parangon.saveButtonText)
parangon.saveButtonText:SetFont("Fonts/FRIZQT__.TTF", 12)
parangon.saveButtonText:SetSize(180, 3)
parangon.saveButtonText:SetPoint("CENTER", 0, 6)
parangon.saveButtonText:SetText("|CFFFFFFFFAccept changes|r")
parangon.saveButtonText:SetShadowColor(0, 0, 0)
parangon.saveButtonText:SetShadowOffset(0.5, 0.5)
122 changes: 100 additions & 22 deletions parangon-server.lua
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,12 @@
See you soon for a next script.
]]--

local aio = aio or require("aio")
local aio = AIO or require("aio")

local parangon = {

config = {
db_name = 'ac_eluna',
db_name = 'R1_Eluna',

pointsPerLevel = 1,
minLevel = 70,
Expand All @@ -49,10 +49,10 @@ local parangon = {
parangon.account = {}

function parangon.onServerStart(event)
CharDBExecute('CREATE DATABASE IF NOT EXISTS `'..parangon.config.db_name..';')
CharDBExecute('CREATE DATABASE IF NOT EXISTS `'..parangon.config.db_name..'`;')
CharDBExecute('CREATE TABLE IF NOT EXISTS `'..parangon.config.db_name..'`.`account_parangon` (`account_id` INT(11) NOT NULL, `level` INT(11) DEFAULT 1, `exp` INT(11) DEFAULT 0, PRIMARY KEY (`account_id`) );');
CharDBExecute('CREATE TABLE IF NOT EXISTS `'..parangon.config.db_name..'`.`characters_parangon` (`account_id` INT(11) NOT NULL, `guid` INT(11) NOT NULL, `strength` INT(11) DEFAULT 0, `agility` INT(11) DEFAULT 0, `stamina` INT(11) DEFAULT 0, `intellect` INT(11) DEFAULT 0, PRIMARY KEY (`account_id`, `guid`));');
io.write('Eluna :: Parangon System start')
io.write('Eluna :: Parangon System start \n')
end
RegisterServerEvent(14, parangon.onServerStart)

Expand All @@ -68,29 +68,107 @@ function parangon.setStats(player)
end
end

function parangon.setStatsIncrease(player, stat, value)
local pCombat = player:IsInCombat()
if (not pCombat) then
local pLevel = player:GetLevel()

if (pLevel >= parangon.config.minLevel) then
if ((player:GetData('parangon_points') - value) > 0) then

player:SetData('parangon_stats_'..stat, (player:GetData('parangon_stats_'..stat) + value))
player:SetData('parangon_points', (player:GetData('parangon_points') - value))

parangon.setAddonInfo(player)
else
player:SendNotification('You have no more points to award.');
end
-- flags
-- true == add_points
-- false == remove_points
function parangon.setStatsInformation(player, stat, value, flags)
local pCombat = player:IsInCombat()
if (not pCombat) then
local pLevel = player:GetLevel()
if (pLevel >= parangon.config.minLevel) then
if flags then
if ((player:GetData('parangon_points') - value) > 0) then
player:SetData('parangon_stats_'..stat, (player:GetData('parangon_stats_'..stat) + value))
player:SetData('parangon_points', (player:GetData('parangon_points') - value))
else
player:SendNotification('You have no more points to award.')
return false
end
else
if (player:GetData('parangon_stats_'..stat) > 0) then
player:SetData('parangon_stats_'..stat, (player:GetData('parangon_stats_'..stat) - value))
player:SetData('parangon_points', (player:GetData('parangon_points') + value))
else
player:SendNotification('You don\'t have the level required to do that.');
player:SendNotification('You have no points to take out.')
return false
end
end
parangon.setAddonInfo(player)
else
player:SendNotification('You can\'t do this in combat.');
player:SendNotification('You don\'t have the level required to do that.')
end
else
player:SendNotification('You can\'t do this in combat.')
end
end

function Player:setParangonInfo(strength, agility, stamina, intellect)
self:SetData('parangon_stats_7464', strength)
self:SetData('parangon_stats_7471', agility)
self:SetData('parangon_stats_7477', stamina)
self:SetData('parangon_stats_7468', intellect)
end

function parangon.onLogin(event, player)
local pAcc = player:GetAccountId()
local getParangonCharInfo = CharDBQuery('SELECT strength, agility, stamina, intellect FROM `'..parangon.config.db_name..'`.`characters_parangon` WHERE account_id = '..pAcc)
if getParangonCharInfo then
player:setParangonInfo(getParangonCharInfo:GetUInt32(0), getParangonCharInfo:GetUInt32(1), getParangonCharInfo:GetUInt32(2), getParangonCharInfo:GetUInt32(3))
else
local pGuid = player:GetGUIDLow()
CharDBExecute('INSERT INTO `'..parangon.config.db_name..'`.`characters_parangon` VALUES ('..pAcc..', '..pGuid..', 0, 0, 0, 0)')
player:setParangonInfo(0, 0, 0, 0)
end

end
if not parangon.account[pAcc] then
parangon.account[pAcc] = {
level = 1,
exp = 0,
exp_max = 0,
}
end

local getParangonAccInfo = AuthDBQuery('SELECT level, exp FROM `'..parangon.config.db_name..'`.`account_parangon` WHERE account_id = '..pAcc)
if getParangonAccInfo then
parangon.account[pAcc].level = getParangonAccInfo:GetUInt32(0)
parangon.account[pAcc].exp = getParangonAccInfo:GetUInt32(1)
parangon.account[pAcc].exp_max = parangon.config.expMax * parangon.account[pAcc].level
else
AuthDBExecute('INSERT INTO `'..parangon.config.db_name..'`.`account_parangon` VALUES ('..pAcc..', 1, 0)')
end
end
RegisterPlayerEvent(3, parangon.onLogin)

function parangon.getPlayers(event)
for _, player in pairs(GetPlayersInWorld()) do
parangon.onLogin(event, player)
end
io.write('Eluna :: Parangon System start \n')
end
RegisterServerEvent(33, parangon.getPlayers)

function parangon.onLogout(event, player)
local pAcc = player:GetAccountId()
local pGuid = player:GetGUIDLow()
local strength, agility, stamina, intellect = player:GetData('parangon_stats_7464'), player:GetData('parangon_stats_7471'), player:GetData('parangon_stats_7477'), player:GetData('parangon_stats_7468')
CharDBExecute('REPLACE INTO `'..parangon.config.db_name..'`.`characters_parangon` VALUES ('..pAcc..', '..pGuid..', '..strength..', '..agility..', '..stamina..', '..intellect..')')

if not parangon.account[pAcc] then
parangon.account[pAcc] = {
level = 1,
exp = 0,
exp_max = 0,
}
end

local level, exp = parangon.account[pAcc].level, parangon.account[pAcc].exp
AuthDBExecute('REPLACE INTO `'..parangon.config.db_name..'`.`account_parangon` VALUES ('..pAcc..', '..level..', '..exp..')')
end
RegisterPlayerEvent(4, parangon.onLogout)

function parangon.setPlayers(event)
for _, player in pairs(GetPlayersInWorld()) do
parangon.onLogout(event, player)
end
end
RegisterServerEvent(16, parangon.setPlayers)

0 comments on commit 6fe58c1

Please sign in to comment.