From ee1e110336c2d91772f0bce3c6c55646e21c2310 Mon Sep 17 00:00:00 2001 From: ember-rp Date: Fri, 17 May 2024 23:27:34 +0000 Subject: [PATCH] initial commit --- AIO_Server/AIO.lua | 1270 ++++++ AIO_Server/Dep_LuaSrcDiet/COPYRIGHT | 38 + AIO_Server/Dep_LuaSrcDiet/COPYRIGHT_Lua51 | 34 + AIO_Server/Dep_LuaSrcDiet/LuaSrcDiet.lua | 809 ++++ AIO_Server/Dep_LuaSrcDiet/README | 193 + AIO_Server/Dep_LuaSrcDiet/llex.lua | 355 ++ AIO_Server/Dep_LuaSrcDiet/lparser.lua | 1296 ++++++ AIO_Server/Dep_LuaSrcDiet/optlex.lua | 837 ++++ AIO_Server/Dep_LuaSrcDiet/optparser.lua | 566 +++ AIO_Server/Dep_LuaSrcDiet/technotes.txt | 361 ++ AIO_Server/Dep_Smallfolk/LICENSE.md | 20 + AIO_Server/Dep_Smallfolk/README.md | 97 + AIO_Server/Dep_Smallfolk/smallfolk.lua | 218 + AIO_Server/Dep_crc32lua/COPYRIGHT | 25 + AIO_Server/Dep_crc32lua/crc32lua.lua | 207 + AIO_Server/LibCompress.lua | 127 + AIO_Server/bit53.lua | 29 + AIO_Server/queue.lua | 83 + DatatypeCheckFunction.lua | 63 + Dungeons/AoEDamage.lua~ | 30 + Dungeons/Buff.lua | 132 + Dungeons/MoltenCore/ImperialThrone.lua | 29 + Dungeons/MoltenCore/Magmadar.lua | 12 + EnchantReRoll/EnchantReRollC.lua | 354 ++ EnchantReRoll/EnchantReRollS.lua | 228 + Ironman.lua | 102 + Misc/DailyEvents.lua | 33 + Misc/DuelEnd.lua | 13 + Misc/Flight.lua | 136 + Misc/ForceGuild.lua~ | 9 + Misc/FrostNova_Stealth_fix.lua | 23 + Misc/GlorySystem.lua | 106 + Misc/LevelBroadcast.lua | 8 + Misc/NewAuras.lua | 10 + Misc/On_Stealth_Remove_Starfall.lua | 15 + Misc/OrcFix.lua | 11 + Misc/Poisons.lua | 11 + Misc/RemoveSprintOnMapchange.lua | 8 + Misc/Scholo.lua~ | 28 + Misc/ScrollOfUnlearningMailGift.lua | 9 + Misc/SpiritHealer.lua~ | 35 + Misc/TMLock.lua | 41 + Misc/TeleportRevive.lua~ | 19 + Misc/TestReturn.lua | 35 + Misc/Unlearn.lua | 37 + Misc/XPLock.lua~ | 38 + Misc/items/DedicatedScroll.lua | 7 + Misc/items/FounderScroll.lua | 7 + Misc/items/MaraStaff.lua | 8 + Misc/items/SupporterScroll.lua | 7 + Misc/items/TaxiCheatScroll.lua | 17 + Misc/items/ZFGong.lua | 11 + Misc/quests/Mankrik.lua | 8 + Misc/spells/DivineVanish.lua | 7 + Misc/spells/NoSummon.lua | 12 + PvP/CityPvP.lua | 13 + PvP/Guildwars.lua.disable | 2557 +++++++++++ PvP/PvPExp2.lua | 83 + README.md | 10 + SafeSlots/SafeSlotsClient.lua | 372 ++ SafeSlots/SafeSlotsServer.lua | 188 + TheClassMaskingSolution/TooltipCorrector.lua | 2154 +++++++++ .../TooltipCorrectorServer.lua | 62 + .../TooltipCorrectorServer_range.lua-- | 69 + .../TooltipCorrector_range.lua-- | 2183 +++++++++ TutorialStuff/NewbieHelp_Client.lua | 162 + TutorialStuff/NewbieHelp_Server.lua | 30 + extensions/ObjectCooldownExtension.lua | 41 + extensions/ObjectVariables.ext | 94 + extensions/StackTracePlus/LICENSE | 21 + extensions/StackTracePlus/README.md | 128 + extensions/StackTracePlus/StackTracePlus.ext | 411 ++ extensions/_Misc.ext | 14 + .../Blizz_interface_changes_Server.lua | 37 + .../Blizz_interface_improvements.lua | 172 + extra_buttons_bar/ClientEBB.lua | 3937 +++++++++++++++++ extra_buttons_bar/Misc_DeathResFrame.lua | 85 + extra_buttons_bar/ServerEBB.lua | 1131 +++++ .../CharacterAdvancementC.lua | 0 .../CharacterAdvancementS.lua | 0 .../character advancement/druid_vari.lua | 74 + .../character advancement/hunter_vari.lua | 77 + .../character advancement/mage_vari.lua | 78 + .../character advancement/paladin_vari.lua | 78 + .../character advancement/priest_vari.lua | 75 + .../character advancement/rogue_vari.lua | 72 + .../character advancement/shaman_vari.lua | 77 + .../character advancement/warlock_vari.lua | 77 + .../character advancement/warrior_vari.lua | 77 + .../character advancement/zgeneral_vari.lua | 5 + extra_buttons_bar/resets/ClientResets.lua | 0 extra_buttons_bar/resets/ServerResets.lua | 0 .../stat allocation/ClientStatAllocation.lua | 0 .../stat allocation/ServerStatAllocation.lua | 0 .../Instance Variable System.lua | 81 + general_server_luas/awakening_config.lua | 45 + general_server_luas/wholeThing.lua | 299 ++ hardcore_pvp/InteractiveGuards.lua | 94 + hardcore_pvp/PvPClient.lua | 331 ++ hardcore_pvp/PvPServer.lua | 434 ++ hardcore_pvp/SanctuaryFix.lua | 60 + hunger_system/HungerClient.lua-- | 126 + hunger_system/HungerServer.lua-- | 179 + mass_purge/mass_purge.lua | 177 + masterscript.lua | 7 + progression/CustomizeTokens.lua | 37 + progression/LevelUpToken.lua | 44 + progression/ProfessionToken.lua | 177 + push_log.bat | 4 + update_dbc.bat | 2 + update_lua.bat | 2 + update_lua.lua | 95 + 112 files changed, 25062 insertions(+) create mode 100644 AIO_Server/AIO.lua create mode 100644 AIO_Server/Dep_LuaSrcDiet/COPYRIGHT create mode 100644 AIO_Server/Dep_LuaSrcDiet/COPYRIGHT_Lua51 create mode 100644 AIO_Server/Dep_LuaSrcDiet/LuaSrcDiet.lua create mode 100644 AIO_Server/Dep_LuaSrcDiet/README create mode 100644 AIO_Server/Dep_LuaSrcDiet/llex.lua create mode 100644 AIO_Server/Dep_LuaSrcDiet/lparser.lua create mode 100644 AIO_Server/Dep_LuaSrcDiet/optlex.lua create mode 100644 AIO_Server/Dep_LuaSrcDiet/optparser.lua create mode 100644 AIO_Server/Dep_LuaSrcDiet/technotes.txt create mode 100644 AIO_Server/Dep_Smallfolk/LICENSE.md create mode 100644 AIO_Server/Dep_Smallfolk/README.md create mode 100644 AIO_Server/Dep_Smallfolk/smallfolk.lua create mode 100644 AIO_Server/Dep_crc32lua/COPYRIGHT create mode 100644 AIO_Server/Dep_crc32lua/crc32lua.lua create mode 100644 AIO_Server/LibCompress.lua create mode 100644 AIO_Server/bit53.lua create mode 100644 AIO_Server/queue.lua create mode 100644 DatatypeCheckFunction.lua create mode 100644 Dungeons/AoEDamage.lua~ create mode 100644 Dungeons/Buff.lua create mode 100644 Dungeons/MoltenCore/ImperialThrone.lua create mode 100644 Dungeons/MoltenCore/Magmadar.lua create mode 100644 EnchantReRoll/EnchantReRollC.lua create mode 100644 EnchantReRoll/EnchantReRollS.lua create mode 100644 Ironman.lua create mode 100644 Misc/DailyEvents.lua create mode 100644 Misc/DuelEnd.lua create mode 100644 Misc/Flight.lua create mode 100644 Misc/ForceGuild.lua~ create mode 100644 Misc/FrostNova_Stealth_fix.lua create mode 100644 Misc/GlorySystem.lua create mode 100644 Misc/LevelBroadcast.lua create mode 100644 Misc/NewAuras.lua create mode 100644 Misc/On_Stealth_Remove_Starfall.lua create mode 100644 Misc/OrcFix.lua create mode 100644 Misc/Poisons.lua create mode 100644 Misc/RemoveSprintOnMapchange.lua create mode 100644 Misc/Scholo.lua~ create mode 100644 Misc/ScrollOfUnlearningMailGift.lua create mode 100644 Misc/SpiritHealer.lua~ create mode 100644 Misc/TMLock.lua create mode 100644 Misc/TeleportRevive.lua~ create mode 100644 Misc/TestReturn.lua create mode 100644 Misc/Unlearn.lua create mode 100644 Misc/XPLock.lua~ create mode 100644 Misc/items/DedicatedScroll.lua create mode 100644 Misc/items/FounderScroll.lua create mode 100644 Misc/items/MaraStaff.lua create mode 100644 Misc/items/SupporterScroll.lua create mode 100644 Misc/items/TaxiCheatScroll.lua create mode 100644 Misc/items/ZFGong.lua create mode 100644 Misc/quests/Mankrik.lua create mode 100644 Misc/spells/DivineVanish.lua create mode 100644 Misc/spells/NoSummon.lua create mode 100644 PvP/CityPvP.lua create mode 100644 PvP/Guildwars.lua.disable create mode 100644 PvP/PvPExp2.lua create mode 100644 README.md create mode 100644 SafeSlots/SafeSlotsClient.lua create mode 100644 SafeSlots/SafeSlotsServer.lua create mode 100644 TheClassMaskingSolution/TooltipCorrector.lua create mode 100644 TheClassMaskingSolution/TooltipCorrectorServer.lua create mode 100644 TheClassMaskingSolution/TooltipCorrectorServer_range.lua-- create mode 100644 TheClassMaskingSolution/TooltipCorrector_range.lua-- create mode 100644 TutorialStuff/NewbieHelp_Client.lua create mode 100644 TutorialStuff/NewbieHelp_Server.lua create mode 100644 extensions/ObjectCooldownExtension.lua create mode 100644 extensions/ObjectVariables.ext create mode 100644 extensions/StackTracePlus/LICENSE create mode 100644 extensions/StackTracePlus/README.md create mode 100644 extensions/StackTracePlus/StackTracePlus.ext create mode 100644 extensions/_Misc.ext create mode 100644 extra_buttons_bar/Blizz_interface_changes_Server.lua create mode 100644 extra_buttons_bar/Blizz_interface_improvements.lua create mode 100644 extra_buttons_bar/ClientEBB.lua create mode 100644 extra_buttons_bar/Misc_DeathResFrame.lua create mode 100644 extra_buttons_bar/ServerEBB.lua create mode 100644 extra_buttons_bar/character advancement/CharacterAdvancementC.lua create mode 100644 extra_buttons_bar/character advancement/CharacterAdvancementS.lua create mode 100644 extra_buttons_bar/character advancement/druid_vari.lua create mode 100644 extra_buttons_bar/character advancement/hunter_vari.lua create mode 100644 extra_buttons_bar/character advancement/mage_vari.lua create mode 100644 extra_buttons_bar/character advancement/paladin_vari.lua create mode 100644 extra_buttons_bar/character advancement/priest_vari.lua create mode 100644 extra_buttons_bar/character advancement/rogue_vari.lua create mode 100644 extra_buttons_bar/character advancement/shaman_vari.lua create mode 100644 extra_buttons_bar/character advancement/warlock_vari.lua create mode 100644 extra_buttons_bar/character advancement/warrior_vari.lua create mode 100644 extra_buttons_bar/character advancement/zgeneral_vari.lua create mode 100644 extra_buttons_bar/resets/ClientResets.lua create mode 100644 extra_buttons_bar/resets/ServerResets.lua create mode 100644 extra_buttons_bar/stat allocation/ClientStatAllocation.lua create mode 100644 extra_buttons_bar/stat allocation/ServerStatAllocation.lua create mode 100644 general_server_luas/Instance Variable System.lua create mode 100644 general_server_luas/awakening_config.lua create mode 100644 general_server_luas/wholeThing.lua create mode 100644 hardcore_pvp/InteractiveGuards.lua create mode 100644 hardcore_pvp/PvPClient.lua create mode 100644 hardcore_pvp/PvPServer.lua create mode 100644 hardcore_pvp/SanctuaryFix.lua create mode 100644 hunger_system/HungerClient.lua-- create mode 100644 hunger_system/HungerServer.lua-- create mode 100644 mass_purge/mass_purge.lua create mode 100644 masterscript.lua create mode 100644 progression/CustomizeTokens.lua create mode 100644 progression/LevelUpToken.lua create mode 100644 progression/ProfessionToken.lua create mode 100644 push_log.bat create mode 100644 update_dbc.bat create mode 100644 update_lua.bat create mode 100644 update_lua.lua diff --git a/AIO_Server/AIO.lua b/AIO_Server/AIO.lua new file mode 100644 index 0000000..92bf0d2 --- /dev/null +++ b/AIO_Server/AIO.lua @@ -0,0 +1,1270 @@ +--[[ + Copyright (C) 2014- Rochet2 + + This program is free software you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License along + with this program if not, write to the Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. +]] + +--[=[ +-- #API +-- For example scripts see the Examples folder. The example files are named according to their final execution location. To run the examples place all of their files to `server_root/lua_scripts/`. + +-- AIO is required this way due to server and client differences with require function +local AIO = AIO or require("AIO") + +-- Returns true if we are on server side, false if we are on client side +isServer = AIO.IsServer() + +-- Returns AIO version - note the type is not guaranteed to be a number +version = AIO.GetVersion() + +-- Adds the file at given path to files to send to players if called on server side. +-- The addon code is trimmed according to settings in AIO.lua. +-- The addon is cached on client side and will be updated only when needed. +-- Returns false on client side and true on server side. By default the +-- path is the current file's path and name is the file's name +-- 'path' is relative to worldserver.exe but an absolute path can also be given. +-- You should call this function only on startup to ensure everyone gets the same +-- addons and no addon is duplicate. +added = AIO.AddAddon([path, name]) +-- The way this is designed to be used is at the top of an addon file so that the +-- file is added and not run if we are on server, and just run if we are on client: +if AIO.AddAddon() then + return +end + +-- Similar to AddAddon - Adds 'code' to the addons sent to players. The code is trimmed +-- according to settings in AIO.lua. The addon is cached on client side and will +-- be updated only when needed. 'name' is an unique name for the addon, usually +-- you can use the file name or addon name there. Do note that short names are +-- better since they are sent back and forth to indentify files. +-- The function only exists on server side. +-- You should call this function only on startup to ensure everyone gets the same +-- addons and no addon is duplicate. +AIO.AddAddonCode(name, code) + +-- Triggers the handler function that has the name 'handlername' from the handlertable +-- added with AIO.AddHandlers(name, handlertable) for the 'name'. +-- Can also trigger a function registered with AIO.RegisterEvent(name, func) +-- All triggered handlers have parameters handler(player, ...) where varargs are +-- the varargs in AIO.Handle or msg.Add +-- This function is a shorthand for AIO.Msg():Add(name, handlername, ...):Send() +-- For efficiency favour creating messages once and sending them rather than creating +-- them over and over with AIO.Handle(). +-- The server side version. +AIO.Handle(player, name, handlername[, ...]) +-- The client side version. +AIO.Handle(name, handlername[, ...]) + +-- Adds a table of handler functions for the specified 'name'. When a message like: +-- AIO.Handle(name, "HandlerName", ...) is received, the handlertable["HandlerName"] +-- will be called with player and varargs as parameters. +-- Returns the passed 'handlertable'. +-- AIO.AddHandlers uses AIO.RegisterEvent internally, so same name can not be used on both. +handlertable = AIO.AddHandlers(name, handlertable) + +-- Adds a new callback function that is called if a message with the given +-- name is recieved. All parameters the sender sends in the message will +-- be passed to func when called. +-- Example message: AIO.Msg():Add(name, ...):Send() +-- AIO.AddHandlers uses AIO.RegisterEvent internally, so same name can not be used on both. +AIO.RegisterEvent(name, func) + +-- Adds a new function that is called when the initial message is sent to the player. +-- The function is called before sending and the initial message is passed to it +-- along with the player if available: func(msg[, player]) +-- In the function you can modify the passed msg and/or return a new one to be +-- used as initial message. Only on server side. +-- This can be used to send for example initial values (like player stats) for the addons. +-- If dynamic loading is preferred, you can use the messaging API to request the values +-- on demand also. +AIO.AddOnInit(func) + +-- Key is a key for a variable in the global table _G. +-- The variable is stored when the player logs out and will be restored +-- when he logs back in before the addon codes are run. +-- These variables are account bound. +-- Only exists on client side and you should call it only once per key. +-- All saved data is saved to client side. +AIO.AddSavedVar(key) + +-- Key is a key for a variable in the global table _G. +-- The variable is stored when the player logs out and will be restored +-- when he logs back in before the addon codes are run. +-- These variables are character bound. +-- Only exists on client side and you should call it only once per key. +-- All saved data is saved to client side. +AIO.AddSavedVarChar(key) + +-- Makes the addon frame save it's position and restore it on login. +-- If char is true, the position saving is character bound, otherwise account bound. +-- Only exists on client side and you should call it only once per frame. +-- All saved data is saved to client side. +AIO.SavePosition(frame[, char]) + +-- AIO message class: +-- Creates and returns a new AIO message that you can append stuff to and send to +-- client or server. Example: AIO.Msg():Add("MyHandlerName", param1, param2):Send(player) +-- These messages handle all client-server communication. +msg = AIO.Msg() + +-- The name is used to identify the handler function on receiving end. +-- A handler function registered with AIO.RegisterEvent(name, func) +-- will be called on receiving end with the varargs. +function msgmt:Add(name, ...) + +-- Appends messages to eachother, returns self +msg = msg:Append(msg2) + +-- Sends the message, returns self +-- Server side version - sends to all players passed +msg = msg:Send(player, ...) +-- Client side version - sends to server +msg = msg:Send() + +-- Returns true if the message has something in it +hasmsg = msg:HasMsg() + +-- Returns the message as a string +msgstr = msg:ToString() + +-- Erases the so far built message and returns self +msg = msg:Clear() + +-- Assembles the message string from added and appended data. Mainly for internal use. +-- Returns self +msg = msg:Assemble() +]=] + +-- Try to avoid multiple versions of AIO +assert(not AIO, "AIO is already loaded. Possibly different versions!") + +---------------------------------- +-- Server-Client messaging config: +---------------------------------- + +-- When developing an addon it is advised to set AIO_ENABLE_PCALL false and leave others as is if not needed. + +-- Enables some additional prints for debugging +local AIO_ENABLE_DEBUG_MSGS = false -- default false +-- Enables pcall to silence errors and continue running normally when an error occurs +-- If AIO_ENABLE_DEBUG_MSGS is true, errors are printed and running is continued +-- If AIO_ENABLE_PCALL is false, pcall is not used and errors occur normally +-- Erroring out can be useful for debugging scripts +local AIO_ENABLE_PCALL = true -- default true +-- Enables using debug.traceback as the error handler to help locating errors +-- on server side. Make sure you have default Eluna extensions in place. +-- On client side uses _ERRORMESSAGE function to output errors with trace. +local AIO_ENABLE_TRACEBACK = false -- default false +-- prints all messages +local AIO_ENABLE_MSGPRINT = false -- default false + +-- Max VM instructions to do before timeout, default 1e8 +-- Attempts to avoid server freeze on bad code and or user +-- Use 0 to disable timeout +-- Server side only +local AIO_TIMEOUT_INSTRUCTIONCOUNT = 1e8 +-- Amount of data to store per character at maximum, default 0.5mb +-- Attempts to avoid consuming ram +local AIO_MSG_CACHE_SPACE = 5e5 -- bytes +-- Time to wait for a message to arrive, default 15 sec +-- Attempts to avoid consuming ram and storing incomplete messages +local AIO_MSG_CACHE_TIME = 15*1000 -- ms +-- Delay between checking for outdated messages, default 5 sec +local AIO_MSG_CACHE_DELAY = 5*1000 -- ms +-- Delay between possible sending of full addon code, default 5 sec +-- User can potentially request the full addon list repeatedly +-- this limits the ability to do that (avoid lagging from bad user) +-- Server side only +local AIO_UI_INIT_DELAY = 5*1000 -- ms +-- Setting to send or log client errors to Eluna.log, default false +-- Is only able to log errors that client sends and client sends them +-- if it has pcall enabled +local AIO_ERROR_LOG = true +-- Setting to enable and disable LZW compressing for addons, default true +-- Note that compression is not used for messaging in general due to it's slowness +-- It is assumed that messages sent around normally are not thousands of characters long +-- Server side only +local AIO_MSG_COMPRESS = false +-- Setting to enable and disable obfuscation for code to reduce size, default true +-- only used on server side +-- Server side only +local AIO_CODE_OBFUSCATE = true + +local assert = assert +local type = type +local tostring = tostring +local pairs = pairs +local ipairs = ipairs +local ssub = string.sub +local match = string.match +local ceil = ceil or math.ceil +local floor = floor or math.floor +local sbyte = strbyte or string.byte +local schar = string.char +local tconcat = table.concat +local select = select +local pcall = pcall +local xpcall = xpcall +-- Some lua compatibility between 5.1 and 5.2 +loadstring = loadstring or load -- loadstring name varies with lua 5.1 and 5.2 +unpack = unpack or table.unpack -- unpack place varies with lua 5.1 and 5.2 +-- server client compatibility +local AIO_GetTime = os and os.time or function() return GetTime()*1000 end +local AIO_GetTimeDiff = os and os.difftime or function(_now, _then) return _now-_then end + +-- boolean value to define whether we are on server or client side +local AIO_SERVER = type(GetLuaEngine) == "function" +-- Client must have same version (basically same AIO file) +local AIO_VERSION = 1.73 +-- ID characters for client-server messaging +local AIO_ShortMsg = schar(1)..schar(1) +local AIO_Compressed = 'C' +local AIO_Uncompressed = 'U' +local AIO_Prefix = "AIO" +AIO_Prefix = ssub((AIO_Prefix), 1, 16) -- shorten to max allowed +local AIO_ServerPrefix = ssub(("S"..AIO_Prefix), 1, 16) +local AIO_ClientPrefix = ssub(("C"..AIO_Prefix), 1, 16) +assert(#AIO_ServerPrefix == #AIO_ClientPrefix) +-- Client can send only 255 max size messages, but server can send more +-- on different patches the limit varies, on 3.3.5 it is exactly 3004 and on cataclysm 2^23 +-- thus we use 2560 that is about 10 times more data and below both max values. Too high value can crash client. +-- Change if you need to :) +local AIO_MsgLen = (AIO_SERVER and 2560 or 255) -1 -#AIO_ServerPrefix -#AIO_ShortMsg -- remove \t, prefix, msg ID +local MSG_MIN = 1 +local MSG_MAX = 2^16-767 + +-- AIO main table +AIO = +{ + -- AIO flavour functions + unpack = unpack, +} + +local AIO = AIO +-- Client side table containing frames that need to have their position saved +local AIO_SAVEDFRAMES = {} +-- Client side tables that contain keys to _G table for saved variables +-- you should add your variables here with AIO.AddSavedVar(key) or AIO.AddSavedVarChar(key) +local AIO_SAVEDVARS = {} +local AIO_SAVEDVARSCHAR = {} +-- Client side flag for noting if the client has been inited or not +local AIO_INITED = false +-- Server and Client side functions to execute on AIO messages +local AIO_HANDLERS = {} +-- Server side functions to execute when an init msg is received +local AIO_INITHOOKS = {} +-- Server and Client side custom coded handlers for incoming data +local AIO_BLOCKHANDLES = {} +-- A server side table for correct order of addons to send +-- you should add all addon code here with AIO.AddAddon +local AIO_ADDONSORDER = {} + +-- Dependencies +local LibWindow +local LuaSrcDiet +local NewQueue = NewQueue or require("queue") +local Smallfolk = Smallfolk or require("smallfolk") +local TLibCompress = not AIO_SERVER or AIO_MSG_COMPRESS and (TLibCompress or require("LibCompress")) +if AIO_SERVER then + LuaSrcDiet = require("LuaSrcDiet") +else + LibWindow = LibStub("LibWindow-1.1") +end + +-- Returns true if we are on server +function AIO.IsServer() + return AIO_SERVER +end + +-- Returns AIO version - note the type is not guaranteed to be a number +function AIO.GetVersion() + return AIO_VERSION +end + +-- Converts an uint16 number to string (2 chars) +-- Note that this escapes using \0 character so the full uint16 range is not usable +local function AIO_16tostring(uint16) + -- split 16bit to 2 8bit parts but without \0 + assert(uint16 <= 2^16-767, "Too high value") + assert(uint16 >= 0, "Negative value") + local high = floor(uint16 / 254) + local l = high +1 + local r = uint16 - high * 254 +1 + return schar(l)..schar(r) +end + +-- Converts a string (2 chars) to uint16 number +-- Note that the chars can not be \0 character so the full uint16 range is not usable +local function AIO_stringto16(str) + local l = sbyte(ssub(str, 1,1)) -1 + local r = sbyte(ssub(str, 2,2)) -1 + local val = l*254 + r + assert(val <= 2^16-767, "Too high value") + assert(val >= 0, "Negative value") + return val +end + +-- Resets AIO saved variables on client side +local AIO_RESET +if not AIO_SERVER then + function AIO_RESET() + AIO_SAVEDVARS = nil + AIO_SAVEDVARSCHAR = nil + AIO_sv_Addons = nil + AIO_SAVEDFRAMES = {} + end +end + +-- Used to print debug messages if AIO_ENABLE_DEBUG_MSGS is true +function AIO_debug(...) + if AIO_ENABLE_DEBUG_MSGS then + print("AIO:", ...) + end +end + +-- returns the amount of varargs from passed varargs +local function AIO_extractN(...) + return select("#", ...), ... +end + +-- Calls function f with parameters ... with pcall +-- Shows errors with print or AIO_debug +local function AIO_pcall(f, ...) + assert(type(f) == 'function') + if not AIO_ENABLE_PCALL then + return f(...) + end + local data + if AIO_SERVER and AIO_ENABLE_TRACEBACK and debug.traceback then + data = {AIO_extractN(xpcall(f, debug.traceback, ...))} + else + data = {AIO_extractN(pcall(f, ...))} + end + if not data[2] then + if AIO_SERVER then + AIO_debug(data[3]) + else + if AIO_ERROR_LOG then + AIO.Handle("AIO", "Error", data[3]) + end + if AIO_ENABLE_TRACEBACK then + _ERRORMESSAGE(data[3]) + else + print(data[3]) + end + end + return + end + return unpack(data, 3, data[1]+1) +end + +-- Reads a file at given absolute or relative to server root path +-- and returns the full file contents as a string +local function AIO_ReadFile(path) + AIO_debug("Reading a file") + assert(type(path) == 'string', "#1 string expected") + local f = assert(io.open(path, "rb")) + local str = f:read("*all") + f:close() + return str +end + +-- player data handler +local plrdata = {} +local removeque = NewQueue() +local function RemoveData(guid, msgid) + local pdata = plrdata[guid] + if pdata then + if msgid then + local data = pdata[msgid] + if data then + pdata[msgid] = nil + pdata.ramque:gettable()[data.ramquepos] = nil + removeque:gettable()[data.remquepos] = nil + end + else + local que = pdata.ramque:gettable() + local l, r = pdata.ramque:getrange() + for i = l, r do + if que[i] then + removeque:gettable()[que[i].remquepos] = nil + end + end + plrdata[guid] = nil + end + end +end +local function ProcessRemoveQue() + if removeque:empty() then + return + end + local now = AIO_GetTime() + local l, r = removeque:getrange() + for i = l, r do + local v = removeque:popleft() + if v then + if AIO_GetTimeDiff(now, v.stamp) < AIO_MSG_CACHE_TIME then + AIO_debug("removing outdated incomplete message") + removeque:pushleft(v) + break + end + RemoveData(v.guid, v.id) + end + end +end +if AIO_SERVER then + CreateLuaEvent(ProcessRemoveQue, AIO_MSG_CACHE_DELAY, 0) +else + local frame = CreateFrame("Frame") + local timer = AIO_MSG_CACHE_DELAY + local function ONUPDATE(self, diff) + if timer > diff then + timer = timer - diff + else + ProcessRemoveQue() + timer = AIO_MSG_CACHE_DELAY + end + end + frame:SetScript("OnUpdate", ONUPDATE) +end +-- Erase data on logout +if AIO_SERVER then + local function Erase(event, player) + RemoveData(player:GetGUIDLow()) + end + RegisterPlayerEvent(4, Erase) +end + +-- Selects a method to send the string to the player depending on whether +-- running on client or server side. From client to server no player needed +local function AIO_SendAddonMessage(msg, player) + if AIO_SERVER then + -- server -> client + player:SendAddonMessage(AIO_ServerPrefix, msg, 7, player) + else + -- client -> server + SendAddonMessage(AIO_ClientPrefix, msg, "WHISPER", UnitName("player")) + end +end + +-- Sends a string to given players (vararg). +-- Can have one or more receiver players (no receivers when sending from client -> server) +-- Splits too long messages into smaller pieces +local function AIO_Send(msg, player, ...) + assert(type(msg) == "string", "#1 string expected") + assert(not AIO_SERVER or type(player) == 'userdata', "#2 player expected") + + AIO_debug("Sending message length:", #msg) + if AIO_ENABLE_MSGPRINT then + print("sent:", msg) + end + + -- split message to 255 character packets if needed (send long message) + if #msg <= AIO_MsgLen then + -- Send short <= AIO_MsgLen msg + AIO_SendAddonMessage(AIO_ShortMsg..msg, player) + else + -- Send long > AIO_MsgLen msg + + local guid = AIO_SERVER and player:GetGUIDLow() or 1 + if not plrdata[guid] then + plrdata[guid] = { + stored = 0, + ramque = NewQueue(), + MSG_GUID = MSG_MIN, + } + end + local pdata = plrdata[guid] + + -- the chars can not contain \0 + -- 16bit -> Message ID -- 0 reserved for identifying short msg + -- 16bit -> Number of parts (should be > 1) + -- 16bit -> Part ID + -- Rest -> Message String + + -- msglen - 4 bits for header data, messageid is already substracted + local msglen = (AIO_MsgLen-4) + -- Calculate amount of messages to send + local parts = ceil(#msg / msglen) + -- assemble header + local header = AIO_16tostring(pdata.MSG_GUID)..AIO_16tostring(parts) + + -- update guid + if pdata.MSG_GUID >= MSG_MAX then + pdata.MSG_GUID = MSG_MIN + else + pdata.MSG_GUID = pdata.MSG_GUID+1 + end + + -- send messages + for i = 1, parts do + AIO_SendAddonMessage(header..AIO_16tostring(i)..ssub(msg, ((i-1)*msglen)+1, (i*msglen)), player) + end + end + + -- More than one receiver, mass send message + if ... then + for i = 1, select('#',...) do + AIO_Send(msg, select(i, ...)) + end + end +end + +-- Message class metatable +local msgmt = {} +function msgmt.__index(tbl, key) + return msgmt[key] +end + +-- Add a new block to message and returns self +-- A block is a chunk of data identified by a string name +-- blocks are sent between server and client and handled on the receiving end +-- by block handlers. Blockhandlers are functions you can assign to +-- a specific name as a handler with AIO.RegisterEvent(name, func) +-- The All values in the block after it's name will be passed to the handler +-- function in same order. +function msgmt:Add(Name, ...) + assert(Name, "#1 Block must have name") + self.params[#self.params+1] = {select('#', ...), Name, ...} + self.assemble = true + return self +end + +-- Function to append messages together, returns self +-- Example AIO.Msg():Append(msg):Append(msg2):Send(...) +function msgmt:Append(msg2) + assert(type(msg2) == 'table', "#1 table expected") + for i = 1, #msg2.params do + assert(type(msg2.params[i]) == 'table', "#1["..i.."] table expected") + self.params[#self.params+1] = msg2.params[i] + end + self.assemble = true + return self +end + +-- Assembles the message string from stored data +function msgmt:Assemble() + if not self.assemble then + return self + end + self.MSG = Smallfolk.dumps(self.params) + self.assemble = false + return self +end + +-- Function to send the message to given players +function msgmt:Send(player, ...) + assert(not AIO_SERVER or player, "#1 player is nil") + AIO_Send(self:ToString(), player, ...) + return self +end + +-- Erases the so far built message and returns self +function msgmt:Clear() + for i = 1, #self.params do + self.params[i] = nil + end + self.MSG = nil + self.assemble = false + return self +end + +-- Returns the message string or an empty string +function msgmt:ToString() + return self:Assemble().MSG +end + +-- Returns true if the message has something in it +function msgmt:HasMsg() + return #self.params > 0 +end + +-- Creates and returns a new message that you can append stuff to and send to client or server +-- Example: AIO.Msg():Add("MyHandlerName", param1, param2):Send(player) +function AIO.Msg() + local msg = {params = {}, MSG = nil, assemble = false} + setmetatable(msg, msgmt) + return msg +end + +-- Calls the handler for block, see AIO.RegisterEvent +-- for adding handlers for blocks +local preinitblocks = {} +local function AIO_HandleBlock(player, data, skipstored) + local HandleName = data[2] + assert(HandleName, "Invalid handle, no handle name") + + if not AIO_SERVER and not AIO_INITED and (HandleName ~= 'AIO' or data[3] ~= 'Init') then + -- store blocks received before initialization + preinitblocks[#preinitblocks+1] = data + AIO_debug("Received block before Init:", HandleName, data[1], data[3]) + return + end + + local handledata = AIO_BLOCKHANDLES[HandleName] + if not handledata then + error("Unknown AIO block handle: '"..tostring(HandleName).."'") + end + + -- found the block handler and arguments match the format. + -- call the block handler + if AIO_SERVER and data[1] > 15 then + error("Received AIO block with over 15 arguments. Try using tables instead") + return + end + handledata(player, unpack(data, 3, data[1]+2)) + + if not skipstored and not AIO_SERVER and AIO_INITED and HandleName == 'AIO' and data[3] == 'Init' then + -- handle stored blocks after initialization, if they are not init messages + for i = 1, #preinitblocks do + AIO_HandleBlock(player, preinitblocks[i], true) + preinitblocks[i] = nil + end + end +end + +-- Extracts blocks from assembled addon messages +local curmsg = '' +local function AIO_Timeout() + error(string.format("AIO Timeout. Your code ran over %s instructions with message:\n%s", ''..AIO_TIMEOUT_INSTRUCTIONCOUNT, (curmsg or 'nil'))) +end +local function _AIO_ParseBlocks(msg, player) + if AIO_SERVER and AIO_TIMEOUT_INSTRUCTIONCOUNT > 0 then + curmsg = msg + debug.sethook(AIO_Timeout, "", AIO_TIMEOUT_INSTRUCTIONCOUNT) + end + + AIO_debug("Received messagelength:", #msg) + if AIO_ENABLE_MSGPRINT then + print("received:", msg) + end + + -- deserialize the message + local data = AIO_pcall(Smallfolk.loads, msg, #msg) + if not data or type(data) ~= 'table' then + AIO_debug("Received invalid message - data not a table") + return + end + + -- Handle parsing of all blocks + for i = 1, #data do + -- Using pcall here so errors wont stop handling other blocks in the msg + AIO_pcall(AIO_HandleBlock, player, data[i]) + end + + if AIO_SERVER and AIO_TIMEOUT_INSTRUCTIONCOUNT > 0 then + debug.sethook() + end +end +local function AIO_ParseBlocks(msg, player) + AIO_pcall(_AIO_ParseBlocks, msg, player) +end + +-- Handles cleaning and assembling the messages received +-- Messages can be 255 characters long, so big messages will be split +local function _AIO_HandleIncomingMsg(msg, player) + -- Received a long message part (msg split into 255 character parts) + local msgid = ssub(msg, 1,2) + + if msgid == AIO_ShortMsg then + -- Received <= 255 char msg, direct parse, take out the msg tag first + AIO_ParseBlocks(ssub(msg, 3), player) + return + end + + -- the chars can not contain \0 + -- 16bit -> Message ID -- 0 reserved for identifying short msg + -- 16bit -> Number of parts (should be > 1) + -- 16bit -> Part ID + -- Rest -> Message String + + if #msg < 3*2 then + return + end + + local messageId = AIO_stringto16(msgid) + local parts = AIO_stringto16(ssub(msg, 3,4)) + local partId = AIO_stringto16(ssub(msg, 5,6)) + if partId <= 0 or partId > parts then + error("received long message with invalid amount of parts. id, parts: "..partId.." "..parts) + return + end + + msg = ssub(msg, 7) + + -- guid is used to store information about long messages for specific player + local guid = AIO_SERVER and player:GetGUIDLow() or 1 + + if not plrdata[guid] then + plrdata[guid] = { + stored = 0, + ramque = NewQueue(), + MSG_GUID = MSG_MIN, + } + end + local pdata = plrdata[guid] + pdata[messageId] = pdata[messageId] or {} + local data = pdata[messageId] + + -- Different message with same ID, scrap previous message (probably reloaded UI) + -- Or new message so parts is nil + if not data.parts or data.parts.n ~= parts then + if data.parts then + for i = 0, data.parts.n do + data.parts[i] = nil + end + end + data.guid = guid + data.parts = {n=parts} + data.id = messageId + data.stamp = AIO_GetTime() + data.remquepos = removeque:pushright(data) + data.ramquepos = pdata.ramque:pushright(data) + end + + data.parts[partId] = msg + + pdata.stored = pdata.stored + #msg + if pdata.stored > AIO_MSG_CACHE_SPACE then + local l, r = pdata.ramque:getrange() + for i = l, r-1 do -- -1 for leaving at least one message + -- remove message from stores leaving it for GC + local msgdata = pdata.ramque:popleft() + if msgdata then + removeque:gettable()[msgdata.remquepos] = nil + pdata[msgdata.id] = nil + -- count the data it holds and substract from stored data + for j = 1, msgdata.parts.n do + if msgdata.parts[j] then + pdata.stored = pdata.stored - #msgdata.parts[j] + end + end + -- check if enough freed to hold latest message in the cache + if pdata.stored <= AIO_MSG_CACHE_SPACE then + break + end + end + end + -- if still error even though tried freeing all memory possible to free + -- throw error and clear cache + if pdata.stored > AIO_MSG_CACHE_SPACE then + RemoveData(guid) + error("AIO_MSG_CACHE_SPACE is too small for received message") + return + end + end + + -- Has all parts, process + if #data.parts == data.parts.n then + local cat = tconcat(data.parts) + RemoveData(guid, messageId) + AIO_ParseBlocks(cat, player) + end +end +local function AIO_HandleIncomingMsg(msg, player) + AIO_pcall(_AIO_HandleIncomingMsg, msg, player) +end + +-- Adds a new callback function for AIO that is called if +-- a block with the same name is recieved. +-- All parameters the client sends will be passed to func when called +-- Only one function can be a handler for one name (subject for change) +function AIO.RegisterEvent(name, func) + assert(name ~= nil, "name of the registered event expected not nil") + assert(type(func) == "function", "callback function must be a function") + assert(not AIO_BLOCKHANDLES[name], "an event is already registered for the name: "..name) + AIO_BLOCKHANDLES[name] = func +end + +-- Adds a table of handler functions for the specified name. +-- You can fill a table with functions and use this to add them for a name. +-- Then when a message like AIO.Msg():Add("MyName", "HandlerName"):Send() +-- is received, the handlertable["HandlerName"] will be executed with player and additional params passed to the block. +-- Returns the passed table +function AIO.AddHandlers(name, handlertable) + assert(name ~= nil, "#1 expected not nil") + assert(type(handlertable) == 'table', "#2 a table expected") + + for k,v in pairs(handlertable) do + assert(type(v) == 'function', "#2 a table of functions expected, found a "..type(v).." value") + end + + local function handler(player, key, ...) + if key and handlertable[key] then + handlertable[key](player, ...) + end + end + AIO.RegisterEvent(name, handler) + return handlertable +end + +-- Adds the current file as an AIO sent addon. +-- Can be used from server and client, but on client does nothing. +-- You can provide path and/or name of the lua file to add, but if +-- omitted the file the function is executed in will be used as path +-- and the path's or given path's file name will be used. +-- Returns true if addon was added +function AIO.AddAddon(path, name) + if AIO_SERVER then + path = path or debug.getinfo(2, 'S').source:sub(2) + name = name or match(path, "([^/]*)$") + local code = AIO_ReadFile(path) + AIO.AddAddonCode(name, code) + AIO_debug("Added addon path&name:", path, name) + return true + end +end + +if AIO_SERVER then + -- A shorthand for sending a message for a handler. + function AIO.Handle(player, name, handlername, ...) + assert(type(player) == 'userdata', "#1 player expected") + assert(name ~= nil, "#2 expected not nil") + return AIO.Msg():Add(name, handlername, ...):Send(player) + end + + -- Adds the addon code to the sent addons on login. + -- The addon code is trimmed according to settings at top of this file. + -- The addon is cached on client side and will be updated if needed. + -- name is an unique ID for the addon, usually you can use the file name or addon name there + -- Do note that short names are better since they are sent back and forth to indentify files + local crc32 = require("crc32lua").crc32 + function AIO.AddAddonCode(name, code) + assert(type(name) == 'string', "#1 string expected") + assert(type(code) == 'string', "#2 string expected") + if AIO_CODE_OBFUSCATE then + code = LuaSrcDiet(code, 3) + end + if AIO_MSG_COMPRESS then + code = AIO_Compressed..assert(TLibCompress.CompressLZW(code)) + else + code = AIO_Uncompressed..code + end + AIO_ADDONSORDER[#AIO_ADDONSORDER+1] = {name=name, crc=crc32(code), code=code} + end + + -- Adds a new function that is called when an init message + -- is about to be sent by server. The function is called before sending and + -- the message is passed to it along with the player if available: + -- func(msg[, player]) + -- you can modify the passed message and or return a new one + function AIO.AddOnInit(func) + assert(type(func) == 'function', "#1 function expected") + table.insert(AIO_INITHOOKS, func) + end + + -- This restricts player's ability to request the initial UI to some set time delay + local timers = {} + local function RemoveInitTimer(eventid, playerguid) + if type(playerguid) == "number" then + timers[playerguid] = nil + end + end + -- This handles sending initial UI to player. + -- The Client sends a request to the server for the addons along with it's cached addon data. + -- Then the server checks what files it has to send back and what it has to remove from the client's cache. + -- Then after server sends the required data to client, the client will one by one execute the addons + -- in the same order as they are sent from the server. + local versionmsg = AIO.Msg():Add("AIO", "Init", AIO_VERSION) + function AIO_HANDLERS.Init(player, version, clientdata) + -- check that the player is not on cooldown for init calling + local guid = player:GetGUIDLow() + if timers[guid] then + return + end + + -- make a new cooldown for init calling + timers[guid] = CreateLuaEvent(function(e) RemoveInitTimer(e, guid) end, AIO_UI_INIT_DELAY, 1) -- the timer here (AIO_UI_INIT_DELAY) is the min time in ms between inits the player can do + + -- Check for bad version and send version back for error directly + if version ~= AIO_VERSION then + versionmsg:Send(player) + return + end + + local istable = type(clientdata) == 'table' + + local addons = {} + local cached = {} + for i = 1, #AIO_ADDONSORDER do + local data = AIO_ADDONSORDER[i] + local clientcrc = istable and clientdata[data.name] or nil + if clientcrc and clientcrc == data.crc then + -- valid - send name only + cached[i] = data.name + else + -- not cached or outdated - send new + addons[i] = data + end + end + + local initmsg = AIO.Msg():Add("AIO", "Init", AIO_VERSION, #AIO_ADDONSORDER, addons, cached) + + for k,v in ipairs(AIO_INITHOOKS) do + initmsg = v(initmsg, player) or initmsg + end + + initmsg:Send(player) + end + + -- Handler that catches client errors + -- can be used to log client errors to server + function AIO_HANDLERS.Error(player, errmsg) + if not AIO_ERROR_LOG or type(errmsg) ~= 'string' then + return + end + PrintInfo(errmsg) + end + + -- An addon message event handler for the lua engine + -- If the message data is correct, move the message forward to the AIO message handler. + local function ONADDONMSG(event, sender, Type, prefix, msg, target) + if prefix == AIO_ClientPrefix and tostring(sender) == tostring(target) and #msg < 510 then + AIO_HandleIncomingMsg(msg, sender) + end + end + RegisterServerEvent(30, ONADDONMSG) + + for k,v in ipairs(GetPlayersInWorld()) do + AIO.Handle(v, "AIO", "ForceReload") + end + +else + + -- A shorthand for sending a message for a handler. + function AIO.Handle(name, handlername, ...) + assert(name ~= nil, "#1 expected not nil") + return AIO.Msg():Add(name, handlername, ...):Send() + end + + -- Key is a key for a variable in the global table _G + -- The variable is stored when the player logs out and will be restored + -- when he logs back in before the addon codes are run + -- these variables are account bound + function AIO.AddSavedVar(key) + assert(key ~= nil, "#1 table key expected") + AIO_SAVEDVARS[key] = true + end + + -- Key is a key for a variable in the global table _G + -- The variable is stored when the player logs out and will be restored + -- when he logs back in before the addon codes are run + -- these variables are character bound + function AIO.AddSavedVarChar(key) + assert(key ~= nil, "#1 table key expected") + AIO_SAVEDVARSCHAR[key] = true + end + + AIO_FRAMEPOSITIONS = AIO_FRAMEPOSITIONS or {} + AIO.AddSavedVar("AIO_FRAMEPOSITIONS") + AIO_FRAMEPOSITIONSCHAR = AIO_FRAMEPOSITIONSCHAR or {} + AIO.AddSavedVarChar("AIO_FRAMEPOSITIONSCHAR") + -- Makes the frame save it's position over relog + -- If char is true, the position saving is character bound, otherwise account bound + function AIO.SavePosition(frame, char) + assert(frame:GetName(), "Called AIO.SavePosition on a nameless frame") + local store = char and AIO_FRAMEPOSITIONSCHAR or AIO_FRAMEPOSITIONS + if not store[frame:GetName()] then + store[frame:GetName()] = {} + end + LibWindow.RegisterConfig(frame, store[frame:GetName()]) + LibWindow.RestorePosition(frame) + LibWindow.SavePosition(frame) + table.insert(AIO_SAVEDFRAMES, frame) + end + + -- A client side event handler + -- Passes the incoming message to AIO message handler if it is valid + local function ONADDONMSG(self, event, prefix, msg, Type, sender) + if prefix == AIO_ServerPrefix then + if event == "CHAT_MSG_ADDON" and sender == UnitName("player") then + -- Normal AIO message handling from addon messages + AIO_HandleIncomingMsg(msg, sender) + end + end + end + local MsgReceiver = CreateFrame("Frame") + MsgReceiver:RegisterEvent("CHAT_MSG_ADDON") + MsgReceiver:SetScript("OnEvent", ONADDONMSG) + + -- A block handler for Init name, checks the version number and errors out if needed + -- On wrong version prevents handling any more messages + -- Stores new and changed addons to cache and runs the addons from cache + -- Also removes removed and outdated addons + local function RunAddon(name) + -- Check if code is compressed and uncompress if needed + local code = AIO_sv_Addons[name] and AIO_sv_Addons[name].code + assert(code, "Addon doesnt exist") + local compression, compressedcode = ssub(code, 1, 1), ssub(code, 2) + if compression == AIO_Compressed then + compressedcode = assert(TLibCompress.DecompressLZW(compressedcode)) + end + assert(loadstring(compressedcode, name))() + end + function AIO_HANDLERS.Init(player, version, N, addons, cached) + if(AIO_VERSION ~= version) then + AIO_INITED = true + -- stop handling any incoming messages + AIO_HandleBlock = function() end + print("You have AIO version "..AIO_VERSION.." and the server uses "..(version or "nil")..". Get the same version") + return + end + + assert(type(N) == 'number') + assert(type(addons) == 'table') + assert(type(cached) == 'table') + + local validAddons = {} + for i = 1, N do + local name + if addons[i] then + name = addons[i].name + AIO_sv_Addons[name] = addons[i] + validAddons[name] = true + elseif cached[i] then + name = cached[i] + validAddons[name] = true + else + error("Unexpected behavior, try /aio reset") + end + + AIO_pcall(RunAddon, name) + end + + local invalidAddons = {} + for name, data in pairs(AIO_sv_Addons) do + if not validAddons[name] then + invalidAddons[#invalidAddons+1] = name + end + end + + for i = 1, #invalidAddons do + AIO_sv_Addons[invalidAddons[i]] = nil + end + + AIO_INITED = true + print("Initialized AIO version "..AIO_VERSION..". Type '/aio help' for commands") + end + + -- Forces reload of UI for user on next action + function AIO_HANDLERS.ForceReload(player) + local frame = CreateFrame("BUTTON") + frame:SetToplevel(true) + frame:SetFrameStrata("TOOLTIP") + frame:SetFrameLevel(100) + frame:SetAllPoints(WorldFrame) + -- frame.texture = frame:CreateTexture() + -- frame.texture:SetAllPoints(frame) + -- frame.texture:SetTexture(0.1, 0.1, 0.1, 0.5) + frame:SetScript("OnClick", ReloadUI) + print("AIO: Force reloading UI") + message("AIO: Force reloading UI") + end + + -- Forces reset of UI for user on next action + function AIO_HANDLERS.ForceReset(player) + AIO_RESET() + AIO_HANDLERS.ForceReload(player) + end + + local frame = CreateFrame("FRAME") -- Need a frame to respond to events + frame:RegisterEvent("ADDON_LOADED") -- Fired when saved variables are loaded + frame:RegisterEvent("PLAYER_LOGOUT") -- Fired when about to log out + + -- message to request initialization of UI + function frame:OnEvent(event, addon) + if event == "ADDON_LOADED" and addon == "AIO_Client" then + -- Register addon channel on cata+ + local _,_,_, tocversion = GetBuildInfo() + if tocversion and tocversion >= 40100 and RegisterAddonMessagePrefix then + RegisterAddonMessagePrefix("C"..AIO_Prefix) + end + + -- Our saved variables are ready at this point. If there is no save, they will be nil + -- Must be before any other addon action like sending init request + if type(AIO_sv) ~= 'table' then + AIO_sv = {} -- This is the first time this addon is loaded; initialize the var + end + if type(AIO_sv_char) ~= 'table' then + AIO_sv_char = {} -- This is the first time this addon is loaded; initialize the var + end + if type(AIO_sv_Addons) ~= 'table' then + AIO_sv_Addons = {} -- This is the first time this addon is loaded; initialize the var + end + + -- Restore addon saved variables to global namespace + -- Must be before sending init request + for k,v in pairs(AIO_sv) do + if _G[k] then + AIO_debug("Overwriting global var _G["..k.."] with a saved var") + end + _G[k] = v + end + for k,v in pairs(AIO_sv_char) do + if _G[k] then + AIO_debug("Overwriting global var _G["..k.."] with a saved character var") + end + _G[k] = v + end + + -- Request initialization of UI if not done yet + -- works by timer for every second. Timer shut down after inited. + -- initmsg consists of the version and all known crc codes for cached addons. + local rem = {} + local addons = {} + for name, data in pairs(AIO_sv_Addons) do + if type(name) ~= 'string' or type(data) ~= 'table' or type(data.crc) ~= 'number' or type(data.code) ~= 'string' then + table.insert(rem, name) + else + addons[name] = data.crc + end + end + for _,name in ipairs(rem) do + AIO_sv_Addons[name] = nil -- remove invalid addons + end + + local initmsg = AIO.Msg():Add("AIO", "Init", AIO_VERSION, addons) + + local reset = 1 + local timer = reset + local function ONUPDATE(self, diff) + if AIO_INITED then + self:SetScript("OnUpdate", nil) + initmsg = nil + reset = nil + timer = nil + return + end + if timer < diff then + initmsg:Send() + timer = reset + reset = reset * 1.5 + else + timer = timer - diff + end + end + frame:SetScript("OnUpdate", ONUPDATE) + -- initmsg:Send() + elseif event == "PLAYER_LOGOUT" then + -- On logout we must store all global namespace to saved vars + AIO_sv = {} -- discard vars that no longer exist + for key,_ in pairs(AIO_SAVEDVARS or {}) do + AIO_sv[key] = _G[key] + end + AIO_sv_char = {} -- discard vars that no longer exist + for key,_ in pairs(AIO_SAVEDVARSCHAR or {}) do + AIO_sv_char[key] = _G[key] + end + + for k,v in ipairs(AIO_SAVEDFRAMES or {}) do + LibWindow.SavePosition(v) + end + end + end + frame:SetScript("OnEvent", frame.OnEvent) +end + +-- Adds all handlers from AIO_HANDLERS for the "AIO" msg handler +AIO.AddHandlers("AIO", AIO_HANDLERS) + +-- Tables holding the command functions and the help messages +-- both are indexed by the command name. See below for how to add a command and help +local cmds = {} +local helps = {} + +-- A print selector +local function pprint(player, ...) + if player then + player:SendBroadcastMessage(tconcat({...}, " ")) + else + print(...) + end +end + +if AIO_SERVER then + local function OnCommand(event, player, msg) + msg = msg:lower() + if ssub(msg, 1, 3) ~= 'aio' then + return + end + msg = ssub(msg, 5) + if msg and msg ~= "" then + for k,v in pairs(cmds) do + if k:find(msg, 1, true) == 1 then + v(player) + return false + end + end + end + pprint(player, "Unknown command .aio "..tostring(msg)) + cmds.help(player) + return false + end + RegisterPlayerEvent(42, OnCommand) +else + SLASH_AIO1 = "/aio" + function SlashCmdList.AIO(msg) + local msg = msg:lower() + if msg and msg ~= "" then + for k,v in pairs(cmds) do + if k:find(msg, 1, true) == 1 then + v() + return + end + end + end + print("Unknown command /aio "..tostring(msg)) + cmds.help() + end +end + +-- Define slash commands and helps for them +-- triggered with /aio +helps.help = "prints this list" +function cmds.help(player) + pprint(player, "Available commands:") + for k,v in pairs(cmds) do + pprint(player, (AIO_SERVER and '.' or '/').."aio "..k.." - "..(helps[k] or "no info")) + end +end +if not AIO_SERVER then + helps.reset = "resets local AIO cache - clears saved addons and their saved variables and reloads the UI" + function cmds.reset() + AIO_RESET() + ReloadUI() + end +end +helps.trace = "toggles using debug.traceback or _ERRORMESSAGE" +function cmds.trace(player) + AIO_ENABLE_TRACEBACK = not AIO_ENABLE_TRACEBACK + pprint(player, "using trace is now", AIO_ENABLE_TRACEBACK and "on" or "off") +end +helps.debug = "toggles showing of debug messages" +function cmds.debug(player) + AIO_ENABLE_DEBUG_MSGS = not AIO_ENABLE_DEBUG_MSGS + pprint(player, "showing debug messages is now", AIO_ENABLE_DEBUG_MSGS and "on" or "off") +end +helps.pcall = "toggles using pcall" +function cmds.pcall(player) + AIO_ENABLE_PCALL = not AIO_ENABLE_PCALL + pprint(player, "using pcall is now", AIO_ENABLE_PCALL and "on" or "off") +end +helps.printio = "toggles printing all sent and received messages" +function cmds.printio(player) + AIO_ENABLE_MSGPRINT = not AIO_ENABLE_MSGPRINT + pprint(player, "printing IO is now", AIO_ENABLE_MSGPRINT and "on" or "off") +end + +return AIO diff --git a/AIO_Server/Dep_LuaSrcDiet/COPYRIGHT b/AIO_Server/Dep_LuaSrcDiet/COPYRIGHT new file mode 100644 index 0000000..d06a197 --- /dev/null +++ b/AIO_Server/Dep_LuaSrcDiet/COPYRIGHT @@ -0,0 +1,38 @@ +LuaSrcDiet License +------------------ + +LuaSrcDiet is licensed under the terms of the MIT license reproduced +below. This means that LuaSrcDiet is free software and can be used for +both academic and commercial purposes at absolutely no cost. + +Parts of LuaSrcDiet is based on Lua 5 code. See COPYRIGHT_Lua51 +(Lua 5.1.3) for Lua 5 license information. + +For details and rationale, see http://www.lua.org/license.html . + +=============================================================================== + +Copyright (C) 2005-2008 Kein-Hong Man +Lua 5.1.3 Copyright (C) 1994-2008 Lua.org, PUC-Rio. + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. + +=============================================================================== + +(end of COPYRIGHT) diff --git a/AIO_Server/Dep_LuaSrcDiet/COPYRIGHT_Lua51 b/AIO_Server/Dep_LuaSrcDiet/COPYRIGHT_Lua51 new file mode 100644 index 0000000..7faa9a0 --- /dev/null +++ b/AIO_Server/Dep_LuaSrcDiet/COPYRIGHT_Lua51 @@ -0,0 +1,34 @@ +Lua License +----------- + +Lua is licensed under the terms of the MIT license reproduced below. +This means that Lua is free software and can be used for both academic +and commercial purposes at absolutely no cost. + +For details and rationale, see http://www.lua.org/license.html . + +=============================================================================== + +Copyright (C) 1994-2008 Lua.org, PUC-Rio. + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. + +=============================================================================== + +(end of COPYRIGHT) diff --git a/AIO_Server/Dep_LuaSrcDiet/LuaSrcDiet.lua b/AIO_Server/Dep_LuaSrcDiet/LuaSrcDiet.lua new file mode 100644 index 0000000..7de644d --- /dev/null +++ b/AIO_Server/Dep_LuaSrcDiet/LuaSrcDiet.lua @@ -0,0 +1,809 @@ +#!/usr/bin/env lua +--[[-------------------------------------------------------------------- + + LuaSrcDiet + Compresses Lua source code by removing unnecessary characters. + For Lua 5.1.x source code. + + Copyright (c) 2008 Kein-Hong Man + The COPYRIGHT file describes the conditions + under which this software may be distributed. + + See the ChangeLog for more information. + +----------------------------------------------------------------------]] + +--[[-------------------------------------------------------------------- +-- NOTES: +-- * Remember to update version and date information below (MSG_TITLE) +-- * TODO: to implement pcall() to properly handle lexer etc. errors +-- * TODO: verify token stream or double-check binary chunk? +-- * TODO: need some automatic testing for a semblance of sanity +-- * TODO: the plugin module is highly experimental and unstable +----------------------------------------------------------------------]] + +-- standard libraries, functions +local string = string +local math = math +local table = table +local require = require +local print = print +local sub = string.sub +local gmatch = string.gmatch + +-- support modules +local llex = require "llex" +local lparser = require "lparser" +local optlex = require "optlex" +local optparser = require "optparser" +local plugin + +--[[-------------------------------------------------------------------- +-- messages and textual data +----------------------------------------------------------------------]] + +local MSG_TITLE = [[ +LuaSrcDiet: Puts your Lua 5.1 source code on a diet +Version 0.11.2 (20080608) Copyright (c) 2005-2008 Kein-Hong Man +The COPYRIGHT file describes the conditions under which this +software may be distributed. +]] + +local MSG_USAGE = [[ +usage: LuaSrcDiet [options] [filenames] + +example: + >LuaSrcDiet myscript.lua -o myscript_.lua + +options: + -v, --version prints version information + -h, --help prints usage information + -o specify file name to write output + -s suffix for output files (default '_') + --keep keep block comment with inside + --plugin run in plugin/ directory + - stop handling arguments + + (optimization levels) + --none all optimizations off (normalizes EOLs only) + --basic lexer-based optimizations only + --maximum maximize reduction of source + + (informational) + --quiet process files quietly + --read-only read file and print token stats only + --dump-lexer dump raw tokens from lexer to stdout + --dump-parser dump variable tracking tables from parser + --details extra info (strings, numbers, locals) + +features (to disable, insert 'no' prefix like --noopt-comments): +%s +default settings: +%s]] + +------------------------------------------------------------------------ +-- optimization options, for ease of switching on and off +-- * positive to enable optimization, negative (no) to disable +-- * these options should follow --opt-* and --noopt-* style for now +------------------------------------------------------------------------ + +local OPTION = [[ +--opt-comments,'remove comments and block comments' +--opt-whitespace,'remove whitespace excluding EOLs' +--opt-emptylines,'remove empty lines' +--opt-eols,'all above, plus remove unnecessary EOLs' +--opt-strings,'optimize strings and long strings' +--opt-numbers,'optimize numbers' +--opt-locals,'optimize local variable names' +--opt-entropy,'tries to reduce symbol entropy of locals' +]] + +-- preset configuration +local DEFAULT_CONFIG = [[ + --opt-comments --opt-whitespace --opt-emptylines + --opt-numbers --opt-locals +]] +-- override configurations: MUST explicitly enable/disable everything +local BASIC_CONFIG = [[ + --opt-comments --opt-whitespace --opt-emptylines + --noopt-eols --noopt-strings --noopt-numbers + --noopt-locals +]] +local MAXIMUM_CONFIG = [[ + --opt-comments --opt-whitespace --opt-emptylines + --opt-eols --opt-strings --opt-numbers + --opt-locals --opt-entropy +]] +local NONE_CONFIG = [[ + --noopt-comments --noopt-whitespace --noopt-emptylines + --noopt-eols --noopt-strings --noopt-numbers + --noopt-locals +]] + +local DEFAULT_SUFFIX = "_" -- default suffix for file renaming +local PLUGIN_SUFFIX = "plugin/" -- relative location of plugins + +--[[-------------------------------------------------------------------- +-- startup and initialize option list handling +----------------------------------------------------------------------]] + +-- simple error message handler; change to error if traceback wanted +local function die(msg) + print("LuaSrcDiet: "..msg); os.exit() +end +--die = error--DEBUG + +--if not string.match(_VERSION, "5.1", 1, 1) then -- sanity check +-- die("requires Lua 5.1 to run") +--end + +------------------------------------------------------------------------ +-- prepares text for list of optimizations, prepare lookup table +------------------------------------------------------------------------ + +local MSG_OPTIONS = "" +do + local WIDTH = 24 + local o = {} + for op, desc in gmatch(OPTION, "%s*([^,]+),'([^']+)'") do + local msg = " "..op + msg = msg..string.rep(" ", WIDTH - #msg)..desc.."\n" + MSG_OPTIONS = MSG_OPTIONS..msg + o[op] = true + o["--no"..sub(op, 3)] = true + end + OPTION = o -- replace OPTION with lookup table +end + +MSG_USAGE = string.format(MSG_USAGE, MSG_OPTIONS, DEFAULT_CONFIG) + +------------------------------------------------------------------------ +-- global variable initialization, option set handling +------------------------------------------------------------------------ + +local suffix = DEFAULT_SUFFIX -- file suffix +local option = {} -- program options +local stat_c, stat_l -- statistics tables + +-- function to set option lookup table based on a text list of options +-- note: additional forced settings for --opt-eols is done in optlex.lua +local function set_options(CONFIG) + for op in gmatch(CONFIG, "(%-%-%S+)") do + if sub(op, 3, 4) == "no" and -- handle negative options + OPTION["--"..sub(op, 5)] then + option[sub(op, 5)] = false + else + option[sub(op, 3)] = true + end + end +end + +--[[-------------------------------------------------------------------- +-- support functions +----------------------------------------------------------------------]] + +-- list of token types, parser-significant types are up to TTYPE_GRAMMAR +-- while the rest are not used by parsers; arranged for stats display +local TTYPES = { + "TK_KEYWORD", "TK_NAME", "TK_NUMBER", -- grammar + "TK_STRING", "TK_LSTRING", "TK_OP", + "TK_EOS", + "TK_COMMENT", "TK_LCOMMENT", -- non-grammar + "TK_EOL", "TK_SPACE", +} +local TTYPE_GRAMMAR = 7 + +local EOLTYPES = { -- EOL names for token dump + ["\n"] = "LF", ["\r"] = "CR", + ["\n\r"] = "LFCR", ["\r\n"] = "CRLF", +} + +------------------------------------------------------------------------ +-- read source code from file +------------------------------------------------------------------------ + +local function load_file(fname) + local INF = io.open(fname, "rb") + if not INF then die("cannot open \""..fname.."\" for reading") end + local dat = INF:read("*a") + if not dat then die("cannot read from \""..fname.."\"") end + INF:close() + print("loadf ", type(dat)) + return dat +end + +------------------------------------------------------------------------ +-- save source code to file +------------------------------------------------------------------------ + +local function save_file(fname, dat) + local OUTF = io.open(fname, "wb") + if not OUTF then die("cannot open \""..fname.."\" for writing") end + local status = OUTF:write(dat) + if not status then die("cannot write to \""..fname.."\"") end + OUTF:close() + print("loadf ", type(dat)) +end + +------------------------------------------------------------------------ +-- functions to deal with statistics +------------------------------------------------------------------------ + +-- initialize statistics table +local function stat_init() + stat_c, stat_l = {}, {} + for i = 1, #TTYPES do + local ttype = TTYPES[i] + stat_c[ttype], stat_l[ttype] = 0, 0 + end +end + +-- add a token to statistics table +local function stat_add(tok, seminfo) + stat_c[tok] = stat_c[tok] + 1 + stat_l[tok] = stat_l[tok] + #seminfo +end + +-- do totals for statistics table, return average table +local function stat_calc() + local function avg(c, l) -- safe average function + if c == 0 then return 0 end + return l / c + end + local stat_a = {} + local c, l = 0, 0 + for i = 1, TTYPE_GRAMMAR do -- total grammar tokens + local ttype = TTYPES[i] + c = c + stat_c[ttype]; l = l + stat_l[ttype] + end + stat_c.TOTAL_TOK, stat_l.TOTAL_TOK = c, l + stat_a.TOTAL_TOK = avg(c, l) + c, l = 0, 0 + for i = 1, #TTYPES do -- total all tokens + local ttype = TTYPES[i] + c = c + stat_c[ttype]; l = l + stat_l[ttype] + stat_a[ttype] = avg(stat_c[ttype], stat_l[ttype]) + end + stat_c.TOTAL_ALL, stat_l.TOTAL_ALL = c, l + stat_a.TOTAL_ALL = avg(c, l) + return stat_a +end + +--[[-------------------------------------------------------------------- +-- main tasks +----------------------------------------------------------------------]] + +------------------------------------------------------------------------ +-- a simple token dumper, minimal translation of seminfo data +------------------------------------------------------------------------ + +local function dump_tokens(srcfl) + -------------------------------------------------------------------- + -- load file and process source input into tokens + -------------------------------------------------------------------- + local z = load_file(srcfl) + llex.init(z) + llex.llex() + local toklist, seminfolist = llex.tok, llex.seminfo + -------------------------------------------------------------------- + -- display output + -------------------------------------------------------------------- + for i = 1, #toklist do + local tok, seminfo = toklist[i], seminfolist[i] + if tok == "TK_OP" and string.byte(seminfo) < 32 then + seminfo = "(".. string.byte(seminfo)..")" + elseif tok == "TK_EOL" then + seminfo = EOLTYPES[seminfo] + else + seminfo = "'"..seminfo.."'" + end + print(tok.." "..seminfo) + end--for +end + +---------------------------------------------------------------------- +-- parser dump; dump globalinfo and localinfo tables +---------------------------------------------------------------------- + +local function dump_parser(srcfl) + local print = print + -------------------------------------------------------------------- + -- load file and process source input into tokens + -------------------------------------------------------------------- + local z = load_file(srcfl) + llex.init(z) + llex.llex() + local toklist, seminfolist, toklnlist + = llex.tok, llex.seminfo, llex.tokln + -------------------------------------------------------------------- + -- do parser optimization here + -------------------------------------------------------------------- + lparser.init(toklist, seminfolist, toklnlist) + local globalinfo, localinfo = lparser.parser() + -------------------------------------------------------------------- + -- display output + -------------------------------------------------------------------- + local hl = string.rep("-", 72) + print("*** Local/Global Variable Tracker Tables ***") + print(hl.."\n GLOBALS\n"..hl) + -- global tables have a list of xref numbers only + for i = 1, #globalinfo do + local obj = globalinfo[i] + local msg = "("..i..") '"..obj.name.."' -> " + local xref = obj.xref + for j = 1, #xref do msg = msg..xref[j].." " end + print(msg) + end + -- local tables have xref numbers and a few other special + -- numbers that are specially named: decl (declaration xref), + -- act (activation xref), rem (removal xref) + print(hl.."\n LOCALS (decl=declared act=activated rem=removed)\n"..hl) + for i = 1, #localinfo do + local obj = localinfo[i] + local msg = "("..i..") '"..obj.name.."' decl:"..obj.decl.. + " act:"..obj.act.." rem:"..obj.rem + if obj.isself then + msg = msg.." isself" + end + msg = msg.." -> " + local xref = obj.xref + for j = 1, #xref do msg = msg..xref[j].." " end + print(msg) + end + print(hl.."\n") +end + +------------------------------------------------------------------------ +-- reads source file(s) and reports some statistics +------------------------------------------------------------------------ + +local function read_only(srcfl) + local print = print + -------------------------------------------------------------------- + -- load file and process source input into tokens + -------------------------------------------------------------------- + local z = load_file(srcfl) + llex.init(z) + llex.llex() + local toklist, seminfolist = llex.tok, llex.seminfo + print(MSG_TITLE) + print("Statistics for: "..srcfl.."\n") + -------------------------------------------------------------------- + -- collect statistics + -------------------------------------------------------------------- + stat_init() + for i = 1, #toklist do + local tok, seminfo = toklist[i], seminfolist[i] + stat_add(tok, seminfo) + end--for + local stat_a = stat_calc() + -------------------------------------------------------------------- + -- display output + -------------------------------------------------------------------- + local fmt = string.format + local function figures(tt) + return stat_c[tt], stat_l[tt], stat_a[tt] + end + local tabf1, tabf2 = "%-16s%8s%8s%10s", "%-16s%8d%8d%10.2f" + local hl = string.rep("-", 42) + print(fmt(tabf1, "Lexical", "Input", "Input", "Input")) + print(fmt(tabf1, "Elements", "Count", "Bytes", "Average")) + print(hl) + for i = 1, #TTYPES do + local ttype = TTYPES[i] + print(fmt(tabf2, ttype, figures(ttype))) + if ttype == "TK_EOS" then print(hl) end + end + print(hl) + print(fmt(tabf2, "Total Elements", figures("TOTAL_ALL"))) + print(hl) + print(fmt(tabf2, "Total Tokens", figures("TOTAL_TOK"))) + print(hl.."\n") +end + +------------------------------------------------------------------------ +-- process source file(s), write output and reports some statistics +------------------------------------------------------------------------ + +local function process_file(srcfl, destfl) + local function print(...) -- handle quiet option + if option.QUIET then return end + _G.print(...) + end + if plugin and plugin.init then -- plugin init + option.EXIT = false + plugin.init(option, srcfl, destfl) + if option.EXIT then return end + end + print(MSG_TITLE) -- title message + -------------------------------------------------------------------- + -- load file and process source input into tokens + -------------------------------------------------------------------- + local z = load_file(srcfl) + if plugin and plugin.post_load then -- plugin post-load + z = plugin.post_load(z) or z + if option.EXIT then return end + end + llex.init(z) + llex.llex() + local toklist, seminfolist, toklnlist + = llex.tok, llex.seminfo, llex.tokln + if plugin and plugin.post_lex then -- plugin post-lex + plugin.post_lex(toklist, seminfolist, toklnlist) + if option.EXIT then return end + end + -------------------------------------------------------------------- + -- collect 'before' statistics + -------------------------------------------------------------------- + stat_init() + for i = 1, #toklist do + local tok, seminfo = toklist[i], seminfolist[i] + stat_add(tok, seminfo) + end--for + local stat1_a = stat_calc() + local stat1_c, stat1_l = stat_c, stat_l + -------------------------------------------------------------------- + -- do parser optimization here + -------------------------------------------------------------------- + if option["opt-locals"] then + optparser.print = print -- hack + lparser.init(toklist, seminfolist, toklnlist) + local globalinfo, localinfo = lparser.parser() + if plugin and plugin.post_parse then -- plugin post-parse + plugin.post_parse(globalinfo, localinfo) + if option.EXIT then return end + end + optparser.optimize(option, toklist, seminfolist, globalinfo, localinfo) + if plugin and plugin.post_optparse then -- plugin post-optparse + plugin.post_optparse() + if option.EXIT then return end + end + end + -------------------------------------------------------------------- + -- do lexer optimization here, save output file + -------------------------------------------------------------------- + optlex.print = print -- hack + toklist, seminfolist, toklnlist + = optlex.optimize(option, toklist, seminfolist, toklnlist) + if plugin and plugin.post_optlex then -- plugin post-optlex + plugin.post_optlex(toklist, seminfolist, toklnlist) + if option.EXIT then return end + end + local dat = table.concat(seminfolist) + -- depending on options selected, embedded EOLs in long strings and + -- long comments may not have been translated to \n, tack a warning + if string.find(dat, "\r\n", 1, 1) or + string.find(dat, "\n\r", 1, 1) then + optlex.warn.mixedeol = true + end + -- save optimized source stream to output file + save_file(destfl, dat) + -------------------------------------------------------------------- + -- collect 'after' statistics + -------------------------------------------------------------------- + stat_init() + for i = 1, #toklist do + local tok, seminfo = toklist[i], seminfolist[i] + stat_add(tok, seminfo) + end--for + local stat_a = stat_calc() + -------------------------------------------------------------------- + -- display output + -------------------------------------------------------------------- + -- print("Statistics for: "..srcfl.." -> "..destfl.."\n") + -- local fmt = string.format + -- local function figures(tt) + -- return stat1_c[tt], stat1_l[tt], stat1_a[tt], + -- stat_c[tt], stat_l[tt], stat_a[tt] + -- end + -- local tabf1, tabf2 = "%-16s%8s%8s%10s%8s%8s%10s", + -- "%-16s%8d%8d%10.2f%8d%8d%10.2f" + -- local hl = string.rep("-", 68) + -- print("*** lexer-based optimizations summary ***\n"..hl) + -- print(fmt(tabf1, "Lexical", + -- "Input", "Input", "Input", + -- "Output", "Output", "Output")) + -- print(fmt(tabf1, "Elements", + -- "Count", "Bytes", "Average", + -- "Count", "Bytes", "Average")) + -- print(hl) + -- for i = 1, #TTYPES do + -- local ttype = TTYPES[i] + -- print(fmt(tabf2, ttype, figures(ttype))) + -- if ttype == "TK_EOS" then print(hl) end + -- end + -- print(hl) + -- print(fmt(tabf2, "Total Elements", figures("TOTAL_ALL"))) + -- print(hl) + -- print(fmt(tabf2, "Total Tokens", figures("TOTAL_TOK"))) + -- print(hl) + -------------------------------------------------------------------- + -- report warning flags from optimizing process + -------------------------------------------------------------------- + if optlex.warn.lstring then + print("* WARNING: "..optlex.warn.lstring) + elseif optlex.warn.mixedeol then + print("* WARNING: ".."output still contains some CRLF or LFCR line endings") + end + print() +end + +local function process_code(code, config) + option.QUIET = true + if config == 1 then + set_options(DEFAULT_CONFIG) + elseif config == 2 then + set_options(BASIC_CONFIG) + elseif config == 3 then + set_options(MAXIMUM_CONFIG) + else + set_options(NONE_CONFIG) + end + + local function print(...) -- handle quiet option + if option.QUIET then return end + _G.print(...) + end + -- if plugin and plugin.init then -- plugin init + -- option.EXIT = false + -- plugin.init(option, srcfl, destfl) + -- if option.EXIT then return end + -- end + print(MSG_TITLE) -- title message + -------------------------------------------------------------------- + -- load file and process source input into tokens + -------------------------------------------------------------------- + local z = code -- load_file(srcfl) + if plugin and plugin.post_load then -- plugin post-load + z = plugin.post_load(z) or z + if option.EXIT then return end + end + llex.init(z) + llex.llex() + local toklist, seminfolist, toklnlist + = llex.tok, llex.seminfo, llex.tokln + if plugin and plugin.post_lex then -- plugin post-lex + plugin.post_lex(toklist, seminfolist, toklnlist) + if option.EXIT then return end + end + -------------------------------------------------------------------- + -- collect 'before' statistics + -------------------------------------------------------------------- + stat_init() + for i = 1, #toklist do + local tok, seminfo = toklist[i], seminfolist[i] + stat_add(tok, seminfo) + end--for + local stat1_a = stat_calc() + local stat1_c, stat1_l = stat_c, stat_l + -------------------------------------------------------------------- + -- do parser optimization here + -------------------------------------------------------------------- + if option["opt-locals"] then + optparser.print = print -- hack + lparser.init(toklist, seminfolist, toklnlist) + local globalinfo, localinfo = lparser.parser() + if plugin and plugin.post_parse then -- plugin post-parse + plugin.post_parse(globalinfo, localinfo) + if option.EXIT then return end + end + optparser.optimize(option, toklist, seminfolist, globalinfo, localinfo) + if plugin and plugin.post_optparse then -- plugin post-optparse + plugin.post_optparse() + if option.EXIT then return end + end + end + -------------------------------------------------------------------- + -- do lexer optimization here, save output file + -------------------------------------------------------------------- + optlex.print = print -- hack + toklist, seminfolist, toklnlist + = optlex.optimize(option, toklist, seminfolist, toklnlist) + if plugin and plugin.post_optlex then -- plugin post-optlex + plugin.post_optlex(toklist, seminfolist, toklnlist) + if option.EXIT then return end + end + local dat = table.concat(seminfolist) + -- depending on options selected, embedded EOLs in long strings and + -- long comments may not have been translated to \n, tack a warning + if string.find(dat, "\r\n", 1, 1) or + string.find(dat, "\n\r", 1, 1) then + optlex.warn.mixedeol = true + end + -- save optimized source stream to output file + -- save_file(destfl, dat) + -------------------------------------------------------------------- + -- collect 'after' statistics + -------------------------------------------------------------------- + -- stat_init() + -- for i = 1, #toklist do + -- local tok, seminfo = toklist[i], seminfolist[i] + -- stat_add(tok, seminfo) + -- end--for + -- local stat_a = stat_calc() + -------------------------------------------------------------------- + -- display output + -------------------------------------------------------------------- + -- print("Statistics for: "..srcfl.." -> "..destfl.."\n") + -- local fmt = string.format + -- local function figures(tt) + -- return stat1_c[tt], stat1_l[tt], stat1_a[tt], + -- stat_c[tt], stat_l[tt], stat_a[tt] + -- end + -- local tabf1, tabf2 = "%-16s%8s%8s%10s%8s%8s%10s", + -- "%-16s%8d%8d%10.2f%8d%8d%10.2f" + -- local hl = string.rep("-", 68) + -- print("*** lexer-based optimizations summary ***\n"..hl) + -- print(fmt(tabf1, "Lexical", + -- "Input", "Input", "Input", + -- "Output", "Output", "Output")) + -- print(fmt(tabf1, "Elements", + -- "Count", "Bytes", "Average", + -- "Count", "Bytes", "Average")) + -- print(hl) + -- for i = 1, #TTYPES do + -- local ttype = TTYPES[i] + -- print(fmt(tabf2, ttype, figures(ttype))) + -- if ttype == "TK_EOS" then print(hl) end + -- end + -- print(hl) + -- print(fmt(tabf2, "Total Elements", figures("TOTAL_ALL"))) + -- print(hl) + -- print(fmt(tabf2, "Total Tokens", figures("TOTAL_TOK"))) + -- print(hl) + -------------------------------------------------------------------- + -- report warning flags from optimizing process + -------------------------------------------------------------------- + if optlex.warn.lstring then + print("* WARNING: "..optlex.warn.lstring) + elseif optlex.warn.mixedeol then + print("* WARNING: ".."output still contains some CRLF or LFCR line endings") + end + print() + return dat +end + +--[[-------------------------------------------------------------------- +-- main functions +----------------------------------------------------------------------]] + +local arg = {...} -- program arguments +local fspec = {} +set_options(DEFAULT_CONFIG) -- set to default options at beginning + +------------------------------------------------------------------------ +-- per-file handling, ship off to tasks +------------------------------------------------------------------------ + +local function do_files(fspec) + for _, srcfl in ipairs(fspec) do + local destfl + ------------------------------------------------------------------ + -- find and replace extension for filenames + ------------------------------------------------------------------ + local extb, exte = string.find(srcfl, "%.[^%.%\\%/]*$") + local basename, extension = srcfl, "" + if extb and extb > 1 then + basename = sub(srcfl, 1, extb - 1) + extension = sub(srcfl, extb, exte) + end + destfl = basename..suffix..extension + if #fspec == 1 and option.OUTPUT_FILE then + destfl = option.OUTPUT_FILE + end + if srcfl == destfl then + die("output filename identical to input filename") + end + ------------------------------------------------------------------ + -- perform requested operations + ------------------------------------------------------------------ + if option.DUMP_LEXER then + dump_tokens(srcfl) + elseif option.DUMP_PARSER then + dump_parser(srcfl) + elseif option.READ_ONLY then + read_only(srcfl) + else + process_file(srcfl, destfl) + end + end--for +end + +------------------------------------------------------------------------ +-- main function (entry point is after this definition) +------------------------------------------------------------------------ + +local function main() + local argn, i = #arg, 1 + if argn == 0 then + option.HELP = true + end + -------------------------------------------------------------------- + -- handle arguments + -------------------------------------------------------------------- + while i <= argn do + local o, p = arg[i], arg[i + 1] + local dash = string.match(o, "^%-%-?") + if dash == "-" then -- single-dash options + if o == "-h" then + option.HELP = true; break + elseif o == "-v" then + option.VERSION = true; break + elseif o == "-s" then + if not p then die("-s option needs suffix specification") end + suffix = p + i = i + 1 + elseif o == "-o" then + if not p then die("-o option needs a file name") end + option.OUTPUT_FILE = p + i = i + 1 + elseif o == "-" then + break -- ignore rest of args + else + die("unrecognized option "..o) + end + elseif dash == "--" then -- double-dash options + if o == "--help" then + option.HELP = true; break + elseif o == "--version" then + option.VERSION = true; break + elseif o == "--keep" then + if not p then die("--keep option needs a string to match for") end + option.KEEP = p + i = i + 1 + elseif o == "--plugin" then + if not p then die("--plugin option needs a module name") end + if option.PLUGIN then die("only one plugin can be specified") end + option.PLUGIN = p + plugin = require(PLUGIN_SUFFIX..p) + i = i + 1 + elseif o == "--quiet" then + option.QUIET = true + elseif o == "--read-only" then + option.READ_ONLY = true + elseif o == "--basic" then + set_options(BASIC_CONFIG) + elseif o == "--maximum" then + set_options(MAXIMUM_CONFIG) + elseif o == "--none" then + set_options(NONE_CONFIG) + elseif o == "--dump-lexer" then + option.DUMP_LEXER = true + elseif o == "--dump-parser" then + option.DUMP_PARSER = true + elseif o == "--details" then + option.DETAILS = true + elseif OPTION[o] then -- lookup optimization options + set_options(o) + else + die("unrecognized option "..o) + end + else + fspec[#fspec + 1] = o -- potential filename + end + i = i + 1 + end--while + if option.HELP then + print(MSG_TITLE..MSG_USAGE); return true + elseif option.VERSION then + print(MSG_TITLE); return true + end + if #fspec > 0 then + if #fspec > 1 and option.OUTPUT_FILE then + die("with -o, only one source file can be specified") + end + do_files(fspec) + return true + else + die("nothing to do!") + end +end + +-- entry point -> main() -> do_files() +-- if not main() then +-- die("Please run with option -h or --help for usage information") +-- end + +-- end of script + +return process_code diff --git a/AIO_Server/Dep_LuaSrcDiet/README b/AIO_Server/Dep_LuaSrcDiet/README new file mode 100644 index 0000000..990f815 --- /dev/null +++ b/AIO_Server/Dep_LuaSrcDiet/README @@ -0,0 +1,193 @@ + + LuaSrcDiet + Compresses Lua source code by removing unnecessary characters. + + Copyright (c) 2005-2008 Kein-Hong Man + The COPYRIGHT file describes the conditions + under which this software may be distributed. + + http://luaforge.net/projects/luasrcdiet/ + http://luasrcdiet.luaforge.net/ + +-- + +For the older unmaintained version of LuaSrcDiet for Lua 5.0.2 sources, +please see the 5.0/README file. + +-- + +PREVIEW NOTES + +See also: http://luasrcdiet.luaforge.net/ + +The 0.11.0 release of LuaSrcDiet has a local variable name optimizer. +Local variable names are renamed into the shortest possible names. In +addition, variable names are reused whenever possible, reducing the +number of unique variable names. Several hundred local variable names +can be reduced into 53 or less unique names, which allows all locals +to be single-character in length. + +The local variable name optimizer uses a full parser of Lua 5.1 source +code, thus it can rename all local variables, including function +parameters. It should handle the implicit "self" parameter gracefully. +The optimizer needs more testing, but is already able to optimize the +LuaSrcDiet sources itself and generate correct Lua output. + +String and number token optimizations are also performed, apart from the +usual whitespace, line ending and comment removal. Numbers can switch +between different formats. Strings can be simplified and can switch +delimiters between " or ' characters. + +Most options can also be enabled or disabled separately, for maximum +flexibility. If you need to keep a copyright message in the optimized +output, the --keep option can keep block comments that contain a certain +string. + +For samples, see the sample/ directory. Performance statistics can be +found in the sample/statistics.txt file. Preliminary test samples for +strings and numbers can also be found in the sample/ directory. + +Priority for future work: +(a) automatic tests for lexer/parser optimizations +(b) integrity checking, token stream check or binary chunk check + +-- + +INTRODUCTION + +... + +WARNING! Locals optimization does NOT have support for 'arg' vararg +functions (LUA_COMPAT_VARARG). + +-- + +WHAT'S NEW + +Major changes for version 0.11.2 (see the ChangeLog as well): +* improved local variable name allocation, more efficient now +* added experimental --plugin option with an example plugin script +* added a SLOC plugin to count SLOC for Lua 5.1 source files +* added a HTML plugin to see globals and locals marked + +Major changes for version 0.11.1 (see the ChangeLog as well): +* --detail option for more string, number and local variable info +* fixed a local rename bug that generates names that are keywords +* added explanatory notes on local variable optimization +* added --opt-entropy option for locals to reduce symbol entropy + +Major changes for version 0.11.0 (see the ChangeLog as well): +* Local variable name optimization. +* Many options and sample output added. + +Major changes for version 0.10.2 (see the ChangeLog as well): +* Aggressive optimizations for string and number tokens. +* Minor bug fixes. + +Major changes for version 0.10.1 (see the ChangeLog as well): +* Totally rewritten for Lua 5.1.x. + +-- + +USAGE OPTIONS + +... + +Example of summary data display: + +Statistics for: LuaSrcDiet.lua -> sample/LuaSrcDiet.lua + +*** local variable optimization summary *** +---------------------------------------------------------- +Variable Unique Decl. Token Size Average +Types Names Count Count Bytes Bytes +---------------------------------------------------------- +Global 10 0 19 95 5.00 +---------------------------------------------------------- +Local (in) 88 153 683 3340 4.89 +TOTAL (in) 98 153 702 3435 4.89 +---------------------------------------------------------- +Local (out) 32 153 683 683 1.00 +TOTAL (out) 42 153 702 778 1.11 +---------------------------------------------------------- + +*** lexer-based optimizations summary *** +-------------------------------------------------------------------- +Lexical Input Input Input Output Output Output +Elements Count Bytes Average Count Bytes Average +-------------------------------------------------------------------- +TK_KEYWORD 374 1531 4.09 374 1531 4.09 +TK_NAME 795 3963 4.98 795 1306 1.64 +TK_NUMBER 54 59 1.09 54 59 1.09 +TK_STRING 152 1725 11.35 152 1717 11.30 +TK_LSTRING 7 1976 282.29 7 1976 282.29 +TK_OP 997 1092 1.10 997 1092 1.10 +TK_EOS 1 0 0.00 1 0 0.00 +-------------------------------------------------------------------- +TK_COMMENT 140 6884 49.17 1 18 18.00 +TK_LCOMMENT 7 1723 246.14 0 0 0.00 +TK_EOL 543 543 1.00 197 197 1.00 +TK_SPACE 1270 2465 1.94 263 263 1.00 +-------------------------------------------------------------------- +Total Elements 4340 21961 5.06 2841 8159 2.87 +-------------------------------------------------------------------- +Total Tokens 2380 10346 4.35 2380 7681 3.23 +-------------------------------------------------------------------- + +-- + +USING LUASRCDIET + +... + +Please see the command line help or see sample/Makefile for examples. + +This is experimental software and nothing has been done yet on a proper +installation scheme for use with normal work. A thousand apologies... + +-- + +CODE SIZE REDUCTION + +... + +-- + +OTHER OPTIONS + +... + +-- + +BEHAVIOUR NOTES + +* embedded line endings in strings and long strings always + normalized to LF +* will not optimize trailing spaces in long strings, only warns +* scientific notation generated in number optimzation is not in + canonical form, this may or may not be a bad thing, so feedback + is welcome + +-- + +ACKNOWLEDGEMENTS + +Thanks to the LuaForge people for hosting this. +Developed on SciTE http://www.scintilla.org/. Two thumbs up. + +-- + +FEEDBACK + +Feedback and contributions are welcome. Your name will be acknowledged, +as long as you are willing to comply with COPYRIGHT. If your material is +self-contained, you can retain a copyright notice for those material in +your own name, as long as you use the same Lua 5/MIT-style copyright. + +My alternative e-mail address is: keinhong AT gmail DOT com + +Enjoy!! + +Kein-Hong Man (esq.) +Kuala Lumpur +Malaysia 20080603 diff --git a/AIO_Server/Dep_LuaSrcDiet/llex.lua b/AIO_Server/Dep_LuaSrcDiet/llex.lua new file mode 100644 index 0000000..7e6fa7a --- /dev/null +++ b/AIO_Server/Dep_LuaSrcDiet/llex.lua @@ -0,0 +1,355 @@ +--[[-------------------------------------------------------------------- + + base.llex.lua: Lua 5.1 lexical analyzer in Lua + This file is part of LuaSrcDiet, based on Yueliang material. + + Copyright (c) 2008 Kein-Hong Man + The COPYRIGHT file describes the conditions + under which this software may be distributed. + + See the ChangeLog for more information. + +----------------------------------------------------------------------]] + +--[[-------------------------------------------------------------------- +-- NOTES: +-- * This is a version of the native 5.1.x lexer from Yueliang 0.4.0, +-- with significant modifications to handle LuaSrcDiet's needs: +-- (1) base.llex.error is an optional error function handler +-- (2) base.seminfo for strings include their delimiters and no +-- translation operations are performed on them +-- * ADDED shbang handling has been added to support executable scripts +-- * NO localized decimal point replacement magic +-- * NO limit to number of lines +-- * NO support for compatible long strings (LUA_COMPAT_LSTR) +-- * Please read technotes.txt for more technical details. +----------------------------------------------------------------------]] + +local base = {} +-- local base = _G +-- local string = require "string" +-- module "base.llex" + +local find = string.find +local match = string.match +local sub = string.sub + +---------------------------------------------------------------------- +-- initialize keyword list, variables +---------------------------------------------------------------------- + +local kw = {} +for v in string.gmatch([[ +and break do else elseif end false for function if in +local nil not or repeat return then true until while]], "%S+") do + kw[v] = true +end + +-- NOTE: see init() for module variables (externally visible): +-- base.tok, base.seminfo, base.tokln + +local z, -- source stream + sourceid, -- name of source + I, -- position of lexer + buff, -- buffer for strings + ln -- line number + +---------------------------------------------------------------------- +-- add information to token listing +---------------------------------------------------------------------- + +local function addtoken(token, info) + local i = #base.tok + 1 + base.tok[i] = token + base.seminfo[i] = info + base.tokln[i] = ln +end + +---------------------------------------------------------------------- +-- handles line number incrementation and end-of-line characters +---------------------------------------------------------------------- + +local function inclinenumber(i, is_tok) + local sub = sub + local old = sub(z, i, i) + i = i + 1 -- skip '\n' or '\r' + local c = sub(z, i, i) + if (c == "\n" or c == "\r") and (c ~= old) then + i = i + 1 -- skip '\n\r' or '\r\n' + old = old..c + end + if is_tok then addtoken("TK_EOL", old) end + ln = ln + 1 + I = i + return i +end + +---------------------------------------------------------------------- +-- initialize lexer for given source _z and source name _sourceid +---------------------------------------------------------------------- + +function base.init(_z, _sourceid) + z = _z -- source + sourceid = _sourceid -- name of source + I = 1 -- lexer's position in source + ln = 1 -- line number + base.tok = {} -- lexed token list* + base.seminfo = {} -- lexed semantic information list* + base.tokln = {} -- line numbers for messages* + -- (*) externally visible thru' module + -------------------------------------------------------------------- + -- initial processing (shbang handling) + -------------------------------------------------------------------- + local p, _, q, r = find(z, "^(#[^\r\n]*)(\r?\n?)") + if p then -- skip first line + I = I + #q + addtoken("TK_COMMENT", q) + if #r > 0 then inclinenumber(I, true) end + end +end + +---------------------------------------------------------------------- +-- returns a chunk name or id, no truncation for long names +---------------------------------------------------------------------- + +function base.chunkid() + if sourceid and match(sourceid, "^[=@]") then + return sub(sourceid, 2) -- remove first char + end + return "[string]" +end + +---------------------------------------------------------------------- +-- formats error message and throws error +-- * a simplified version, does not report what token was responsible +---------------------------------------------------------------------- + +function base.errorline(s, line) + local e = error or base.error + e(string.format("%s:%d: %s", base.chunkid(), line or ln, s)) +end + +------------------------------------------------------------------------ +-- count separators ("=") in a long string delimiter +------------------------------------------------------------------------ + +local function skip_sep(i) + local sub = sub + local s = sub(z, i, i) + i = i + 1 + local count = #match(z, "=*", i) -- note, take the length + i = i + count + I = i + return (sub(z, i, i) == s) and count or (-count) - 1 +end + +---------------------------------------------------------------------- +-- reads a long string or long comment +---------------------------------------------------------------------- + +local function read_long_string(is_str, sep) + local i = I + 1 -- skip 2nd '[' + local sub = sub + local c = sub(z, i, i) + if c == "\r" or c == "\n" then -- string starts with a newline? + i = inclinenumber(i) -- skip it + end + local j = i + while true do + local p, q, r = find(z, "([\r\n%]])", i) -- (long range) + if not p then + base.errorline(is_str and "unfinished long string" or + "unfinished long comment") + end + i = p + if r == "]" then -- delimiter test + if skip_sep(i) == sep then + buff = sub(z, buff, I) + I = I + 1 -- skip 2nd ']' + return buff + end + i = I + else -- newline + buff = buff.."\n" + i = inclinenumber(i) + end + end--while +end + +---------------------------------------------------------------------- +-- reads a string +---------------------------------------------------------------------- + +local function read_string(del) + local i = I + local find = find + local sub = sub + while true do + local p, q, r = find(z, "([\n\r\\\"\'])", i) -- (long range) + if p then + if r == "\n" or r == "\r" then + base.errorline("unfinished string") + end + i = p + if r == "\\" then -- handle escapes + i = i + 1 + r = sub(z, i, i) + if r == "" then break end -- (EOZ error) + p = find("abfnrtv\n\r", r, 1, true) + ------------------------------------------------------ + if p then -- special escapes + if p > 7 then + i = inclinenumber(i) + else + i = i + 1 + end + ------------------------------------------------------ + elseif find(r, "%D") then -- other non-digits + i = i + 1 + ------------------------------------------------------ + else -- \xxx sequence + local p, q, s = find(z, "^(%d%d?%d?)", i) + i = q + 1 + if s + 1 > 256 then -- UCHAR_MAX + base.errorline("escape sequence too large") + end + ------------------------------------------------------ + end--if p + else + i = i + 1 + if r == del then -- ending delimiter + I = i + return sub(z, buff, i - 1) -- return string + end + end--if r + else + break -- (error) + end--if p + end--while + base.errorline("unfinished string") +end + +------------------------------------------------------------------------ +-- main lexer function +------------------------------------------------------------------------ + +function base.llex() + local find = find + local match = match + while true do--outer + local i = I + -- inner loop allows break to be used to nicely section tests + while true do--inner + ---------------------------------------------------------------- + local p, _, r = find(z, "^([_%a][_%w]*)", i) + if p then + I = i + #r + if kw[r] then + addtoken("TK_KEYWORD", r) -- reserved word (keyword) + else + addtoken("TK_NAME", r) -- identifier + end + break -- (continue) + end + ---------------------------------------------------------------- + local p, _, r = find(z, "^(%.?)%d", i) + if p then -- numeral + if r == "." then i = i + 1 end + local _, q, r = find(z, "^%d*[%.%d]*([eE]?)", i) + i = q + 1 + if #r == 1 then -- optional exponent + if match(z, "^[%+%-]", i) then -- optional sign + i = i + 1 + end + end + local _, q = find(z, "^[_%w]*", i) + I = q + 1 + local v = sub(z, p, q) -- string equivalent + if not tonumber(v) then -- handles hex test also + base.errorline("malformed number") + end + addtoken("TK_NUMBER", v) + break -- (continue) + end + ---------------------------------------------------------------- + local p, q, r, t = find(z, "^((%s)[ \t\v\f]*)", i) + if p then + if t == "\n" or t == "\r" then -- newline + inclinenumber(i, true) + else + I = q + 1 -- whitespace + addtoken("TK_SPACE", r) + end + break -- (continue) + end + ---------------------------------------------------------------- + local r = match(z, "^%p", i) + if r then + buff = i + local p = find("-[\"\'.=<>~", r, 1, true) + if p then + -- two-level if block for punctuation/symbols + -------------------------------------------------------- + if p <= 2 then + if p == 1 then -- minus + local c = match(z, "^%-%-(%[?)", i) + if c then + i = i + 2 + local sep = -1 + if c == "[" then + sep = skip_sep(i) + end + if sep >= 0 then -- long comment + addtoken("TK_LCOMMENT", read_long_string(false, sep)) + else -- short comment + I = find(z, "[\n\r]", i) or (#z + 1) + addtoken("TK_COMMENT", sub(z, buff, I - 1)) + end + break -- (continue) + end + -- (fall through for "-") + else -- [ or long string + local sep = skip_sep(i) + if sep >= 0 then + addtoken("TK_LSTRING", read_long_string(true, sep)) + elseif sep == -1 then + addtoken("TK_OP", "[") + else + base.errorline("invalid long string delimiter") + end + break -- (continue) + end + -------------------------------------------------------- + elseif p <= 5 then + if p < 5 then -- strings + I = i + 1 + addtoken("TK_STRING", read_string(r)) + break -- (continue) + end + r = match(z, "^%.%.?%.?", i) -- .|..|... dots + -- (fall through) + -------------------------------------------------------- + else -- relational + r = match(z, "^%p=?", i) + -- (fall through) + end + end + I = i + #r + addtoken("TK_OP", r) -- for other symbols, fall through + break -- (continue) + end + ---------------------------------------------------------------- + local r = sub(z, i, i) + if r ~= "" then + I = i + 1 + addtoken("TK_OP", r) -- other single-char tokens + break + end + addtoken("TK_EOS", "") -- end of stream, + return base -- exit here + ---------------------------------------------------------------- + end--while inner + end--while outer +end + +return base diff --git a/AIO_Server/Dep_LuaSrcDiet/lparser.lua b/AIO_Server/Dep_LuaSrcDiet/lparser.lua new file mode 100644 index 0000000..f967fd8 --- /dev/null +++ b/AIO_Server/Dep_LuaSrcDiet/lparser.lua @@ -0,0 +1,1296 @@ +--[[-------------------------------------------------------------------- + + lparser.lua: Lua 5.1 base.parser in Lua + This file is part of LuaSrcDiet, based on Yueliang material. + + Copyright (c) 2008 Kein-Hong Man + The COPYRIGHT file describes the conditions + under which this software may be distributed. + + See the ChangeLog for more information. + +----------------------------------------------------------------------]] + +--[[-------------------------------------------------------------------- +-- NOTES: +-- * This is a version of the native 5.1.x base.parser from Yueliang 0.4.0, +-- with significant modifications to handle LuaSrcDiet's needs: +-- (1) needs pre-built token tables instead of a module.method +-- (2) lparser.error is an optional error handler (from llex) +-- (3) not full parsing, currently fakes raw/unlexed constants +-- (4) base.parser() returns globalinfo, localinfo tables +-- * Please read technotes.txt for more technical details. +-- * NO support for 'arg' vararg functions (LUA_COMPAT_VARARG) +-- * A lot of the base.parser is unused, but might later be useful for +-- full-on parsing and analysis for a few measly bytes saved. +----------------------------------------------------------------------]] + +local base = {} +-- local base = _G +-- local string = require "string" +-- module "lparser" +-- local _G = base.getfenv() + +--[[-------------------------------------------------------------------- +-- variable and data structure initialization +----------------------------------------------------------------------]] + +---------------------------------------------------------------------- +-- initialization: main variables +---------------------------------------------------------------------- + +local toklist, -- grammar-only token tables (token table, + seminfolist, -- semantic information table, line number + toklnlist, -- table, cross-reference table) + xreflist, + tpos, -- token position + + line, -- start line # for error messages + lastln, -- last line # for ambiguous syntax chk + tok, seminfo, ln, xref, -- token, semantic info, line + nameref, -- proper position of token + fs, -- current function state + top_fs, -- top-level function state + + globalinfo, -- global variable information table + globallookup, -- global variable name lookup table + localinfo, -- local variable information table + ilocalinfo, -- inactive locals (prior to activation) + ilocalrefs -- corresponding references to activate + +-- forward references for local functions +-- local base.explist1, base.expr, base.block, base.exp1, base.body, base.chunk + +---------------------------------------------------------------------- +-- initialization: data structures +---------------------------------------------------------------------- + +local gmatch = string.gmatch + +local block_follow = {} -- lookahead check in base.chunk(), returnstat() +for v in gmatch("else elseif end until ", "%S+") do + block_follow[v] = true +end + +local stat_call = {} -- lookup for calls in stat() +for v in gmatch("if while do for repeat function local return break", "%S+") do + stat_call[v] = v.."_stat" +end + +local binopr_left = {} -- binary operators, left priority +local binopr_right = {} -- binary operators, right priority +for op, lt, rt in gmatch([[ +{+ 6 6}{- 6 6}{* 7 7}{/ 7 7}{% 7 7} +{^ 10 9}{.. 5 4} +{~= 3 3}{== 3 3} +{< 3 3}{<= 3 3}{> 3 3}{>= 3 3} +{and 2 2}{or 1 1} +]], "{(%S+)%s(%d+)%s(%d+)}") do + binopr_left[op] = lt + 0 + binopr_right[op] = rt + 0 +end + +local unopr = { ["not"] = true, ["-"] = true, + ["#"] = true, } -- unary operators +local UNARY_PRIORITY = 8 -- priority for unary operators + +--[[-------------------------------------------------------------------- +-- support functions +----------------------------------------------------------------------]] + +---------------------------------------------------------------------- +-- formats error message and throws error (duplicated from llex) +-- * a simplified version, does not report what token was responsible +---------------------------------------------------------------------- + +local function errorline(s, line) + local e = error or base.error + e(string.format("(source):%d: %s", line or ln, s)) +end + +---------------------------------------------------------------------- +-- handles incoming token, semantic information pairs +-- * NOTE: 'nextt' is named 'next' originally +---------------------------------------------------------------------- + +-- reads in next token +local function nextt() + lastln = toklnlist[tpos] + tok, seminfo, ln, xref + = toklist[tpos], seminfolist[tpos], toklnlist[tpos], xreflist[tpos] + tpos = tpos + 1 +end + +-- peek at next token (single lookahead for table constructor) +local function lookahead() + return toklist[tpos] +end + +---------------------------------------------------------------------- +-- throws a syntax error, or if token expected is not there +---------------------------------------------------------------------- + +local function syntaxerror(msg) + local tok = tok + if tok ~= "" and tok ~= "" then + if tok == "" then tok = seminfo end + tok = "'"..tok.."'" + end + errorline(msg.." near "..tok) +end + +local function error_expected(token) + syntaxerror("'"..token.."' expected") +end + +---------------------------------------------------------------------- +-- tests for a token, returns outcome +-- * return value changed to boolean +---------------------------------------------------------------------- + +local function testnext(c) + if tok == c then nextt(); return true end +end + +---------------------------------------------------------------------- +-- check for existence of a token, throws error if not found +---------------------------------------------------------------------- + +local function check(c) + if tok ~= c then error_expected(c) end +end + +---------------------------------------------------------------------- +-- verify existence of a token, then skip it +---------------------------------------------------------------------- + +local function checknext(c) + check(c); nextt() +end + +---------------------------------------------------------------------- +-- throws error if condition not matched +---------------------------------------------------------------------- + +local function check_condition(c, msg) + if not c then syntaxerror(msg) end +end + +---------------------------------------------------------------------- +-- verifies token conditions are met or else throw error +---------------------------------------------------------------------- + +local function check_match(what, who, where) + if not testnext(what) then + if where == ln then + error_expected(what) + else + syntaxerror("'"..what.."' expected (to close '"..who.."' at line "..where..")") + end + end +end + +---------------------------------------------------------------------- +-- expect that token is a name, return the name +---------------------------------------------------------------------- + +local function str_checkname() + check("") + local ts = seminfo + nameref = xref + nextt() + return ts +end + +---------------------------------------------------------------------- +-- adds given string s in string pool, sets e as VK +---------------------------------------------------------------------- + +local function codestring(e, s) + e.k = "VK" +end + +---------------------------------------------------------------------- +-- consume a name token, adds it to string pool +---------------------------------------------------------------------- + +local function checkname(e) + codestring(e, str_checkname()) +end + +--[[-------------------------------------------------------------------- +-- variable (global|local|upvalue) handling +-- * to track locals and globals, we can extend Yueliang's minimal +-- variable management code with little trouble +-- * entry point is singlevar() for variable lookups +-- * lookup tables (bl.locallist) are maintained awkwardly in the basic +-- base.block data structures, PLUS the function data structure (this is +-- an inelegant hack, since bl is nil for the top level of a function) +----------------------------------------------------------------------]] + +---------------------------------------------------------------------- +-- register a local variable, create local variable object, set in +-- to-activate variable list +-- * used in new_localvarliteral(), parlist(), fornum(), forlist(), +-- localfunc(), localstat() +---------------------------------------------------------------------- + +local function new_localvar(name, special) + local bl = fs.bl + local locallist + -- locate locallist in current base.block object or function root object + if bl then + locallist = bl.locallist + else + locallist = fs.locallist + end + -- build local variable information object and set localinfo + local id = #localinfo + 1 + localinfo[id] = { -- new local variable object + name = name, -- local variable name + xref = { nameref }, -- xref, first value is declaration + decl = nameref, -- location of declaration, = xref[1] + } + if special then -- "self" must be not be changed + localinfo[id].isself = true + end + -- this can override a local with the same name in the same scope + -- but first, keep it inactive until it gets activated + local i = #ilocalinfo + 1 + ilocalinfo[i] = id + ilocalrefs[i] = locallist +end + +---------------------------------------------------------------------- +-- actually activate the variables so that they are visible +-- * remember Lua semantics, e.g. RHS is evaluated first, then LHS +-- * used in parlist(), forbody(), localfunc(), localstat(), base.body() +---------------------------------------------------------------------- + +local function adjustlocalvars(nvars) + local sz = #ilocalinfo + -- i goes from left to right, in order of local allocation, because + -- of something like: local a,a,a = 1,2,3 which gives a = 3 + while nvars > 0 do + nvars = nvars - 1 + local i = sz - nvars + local id = ilocalinfo[i] -- local's id + local obj = localinfo[id] + local name = obj.name -- name of local + obj.act = xref -- set activation location + ilocalinfo[i] = nil + local locallist = ilocalrefs[i] -- ref to lookup table to update + ilocalrefs[i] = nil + local existing = locallist[name] -- if existing, remove old first! + if existing then -- do not overlap, set special + obj = localinfo[existing] -- form of rem, as -id + obj.rem = -id + end + locallist[name] = id -- activate, now visible to Lua + end +end + +---------------------------------------------------------------------- +-- remove (deactivate) variables in current scope (before scope exits) +-- * zap entire locallist tables since we are not allocating registers +-- * used in leaveblock(), close_func() +---------------------------------------------------------------------- + +local function removevars() + local bl = fs.bl + local locallist + -- locate locallist in current base.block object or function root object + if bl then + locallist = bl.locallist + else + locallist = fs.locallist + end + -- enumerate the local list at current scope and deactivate 'em + for name, id in pairs(locallist) do + local obj = localinfo[id] + obj.rem = xref -- set deactivation location + end +end + +---------------------------------------------------------------------- +-- creates a new local variable given a name +-- * skips internal locals (those starting with '('), so internal +-- locals never needs a corresponding adjustlocalvars() call +-- * special is true for "self" which must not be optimized +-- * used in fornum(), forlist(), parlist(), base.body() +---------------------------------------------------------------------- + +local function new_localvarliteral(name, special) + if string.sub(name, 1, 1) == "(" then -- can skip internal locals + return + end + new_localvar(name, special) +end + +---------------------------------------------------------------------- +-- search the local variable namespace of the given fs for a match +-- * returns localinfo index +-- * used only in singlevaraux() +---------------------------------------------------------------------- + +local function searchvar(fs, n) + local bl = fs.bl + local locallist + if bl then + locallist = bl.locallist + while locallist do + if locallist[n] then return locallist[n] end -- found + bl = bl.prev + locallist = bl and bl.locallist + end + end + locallist = fs.locallist + return locallist[n] or -1 -- found or not found (-1) +end + +---------------------------------------------------------------------- +-- handle locals, globals and upvalues and related processing +-- * search mechanism is recursive, calls itself to search parents +-- * used only in singlevar() +---------------------------------------------------------------------- + +local function singlevaraux(fs, n, var) + if fs == nil then -- no more levels? + var.k = "VGLOBAL" -- default is global variable + return "VGLOBAL" + else + local v = searchvar(fs, n) -- look up at current level + if v >= 0 then + var.k = "VLOCAL" + var.id = v + -- codegen may need to deal with upvalue here + return "VLOCAL" + else -- not found at current level; try upper one + if singlevaraux(fs.prev, n, var) == "VGLOBAL" then + return "VGLOBAL" + end + -- else was LOCAL or UPVAL, handle here + var.k = "VUPVAL" -- upvalue in this level + return "VUPVAL" + end--if v + end--if fs +end + +---------------------------------------------------------------------- +-- consume a name token, creates a variable (global|local|upvalue) +-- * used in prefixexp(), funcname() +---------------------------------------------------------------------- + +local function singlevar(v) + local name = str_checkname() + singlevaraux(fs, name, v) + ------------------------------------------------------------------ + -- variable tracking + ------------------------------------------------------------------ + if v.k == "VGLOBAL" then + -- if global being accessed, keep track of it by creating an object + local id = globallookup[name] + if not id then + id = #globalinfo + 1 + globalinfo[id] = { -- new global variable object + name = name, -- global variable name + xref = { nameref }, -- xref, first value is declaration + } + globallookup[name] = id -- remember it + else + local obj = globalinfo[id].xref + obj[#obj + 1] = nameref -- add xref + end + else + -- local/upvalue is being accessed, keep track of it + local id = v.id + local obj = localinfo[id].xref + obj[#obj + 1] = nameref -- add xref + end +end + +--[[-------------------------------------------------------------------- +-- state management functions with open/close pairs +----------------------------------------------------------------------]] + +---------------------------------------------------------------------- +-- enters a code unit, initializes elements +---------------------------------------------------------------------- + +local function enterblock(isbreakable) + local bl = {} -- per-base.block state + bl.isbreakable = isbreakable + bl.prev = fs.bl + bl.locallist = {} + fs.bl = bl +end + +---------------------------------------------------------------------- +-- leaves a code unit, close any upvalues +---------------------------------------------------------------------- + +local function leaveblock() + local bl = fs.bl + removevars() + fs.bl = bl.prev +end + +---------------------------------------------------------------------- +-- opening of a function +-- * top_fs is only for anchoring the top fs, so that base.parser() can +-- return it to the caller function along with useful output +-- * used in base.parser() and base.body() +---------------------------------------------------------------------- + +local function open_func() + local new_fs -- per-function state + if not fs then -- top_fs is created early + new_fs = top_fs + else + new_fs = {} + end + new_fs.prev = fs -- linked list of function states + new_fs.bl = nil + new_fs.locallist = {} + fs = new_fs +end + +---------------------------------------------------------------------- +-- closing of a function +-- * used in base.parser() and base.body() +---------------------------------------------------------------------- + +local function close_func() + removevars() + fs = fs.prev +end + +--[[-------------------------------------------------------------------- +-- other parsing functions +-- * for table constructor, parameter list, argument list +----------------------------------------------------------------------]] + +---------------------------------------------------------------------- +-- parse a function name suffix, for function call specifications +-- * used in primaryexp(), funcname() +---------------------------------------------------------------------- + +local function field(v) + -- field -> ['.' | ':'] NAME + local key = {} + nextt() -- skip the dot or colon + checkname(key) + v.k = "VINDEXED" +end + +---------------------------------------------------------------------- +-- parse a table indexing suffix, for constructors, expressions +-- * used in recfield(), primaryexp() +---------------------------------------------------------------------- + +local function yindex(v) + -- index -> '[' base.expr ']' + nextt() -- skip the '[' + base.expr(v) + checknext("]") +end + +---------------------------------------------------------------------- +-- parse a table record (hash) field +-- * used in constructor() +---------------------------------------------------------------------- + +local function recfield(cc) + -- recfield -> (NAME | '['base.exp1']') = base.exp1 + local key, val = {}, {} + if tok == "" then + checkname(key) + else-- tok == '[' + yindex(key) + end + checknext("=") + base.expr(val) +end + +---------------------------------------------------------------------- +-- emit a set list instruction if enough elements (LFIELDS_PER_FLUSH) +-- * note: retained in this skeleton because it modifies cc.v.k +-- * used in constructor() +---------------------------------------------------------------------- + +local function closelistfield(cc) + if cc.v.k == "VVOID" then return end -- there is no list item + cc.v.k = "VVOID" +end + +---------------------------------------------------------------------- +-- parse a table list (array) field +-- * used in constructor() +---------------------------------------------------------------------- + +local function listfield(cc) + base.expr(cc.v) +end + +---------------------------------------------------------------------- +-- parse a table constructor +-- * used in funcargs(), simpleexp() +---------------------------------------------------------------------- + +local function constructor(t) + -- constructor -> '{' [ field { fieldsep field } [ fieldsep ] ] '}' + -- field -> recfield | listfield + -- fieldsep -> ',' | ';' + local line = ln + local cc = {} + cc.v = {} + cc.t = t + t.k = "VRELOCABLE" + cc.v.k = "VVOID" + checknext("{") + repeat + if tok == "}" then break end + -- closelistfield(cc) here + local c = tok + if c == "" then -- may be listfields or recfields + if lookahead() ~= "=" then -- look ahead: expression? + listfield(cc) + else + recfield(cc) + end + elseif c == "[" then -- constructor_item -> recfield + recfield(cc) + else -- constructor_part -> listfield + listfield(cc) + end + until not testnext(",") and not testnext(";") + check_match("}", "{", line) + -- lastlistfield(cc) here +end + +---------------------------------------------------------------------- +-- parse the arguments (parameters) of a function declaration +-- * used in base.body() +---------------------------------------------------------------------- + +local function parlist() + -- parlist -> [ param { ',' param } ] + local nparams = 0 + if tok ~= ")" then -- is 'parlist' not empty? + repeat + local c = tok + if c == "" then -- param -> NAME + new_localvar(str_checkname()) + nparams = nparams + 1 + elseif c == "..." then + nextt() + fs.is_vararg = true + else + syntaxerror(" or '...' expected") + end + until fs.is_vararg or not testnext(",") + end--if + adjustlocalvars(nparams) +end + +---------------------------------------------------------------------- +-- parse the parameters of a function call +-- * contrast with parlist(), used in function declarations +-- * used in primaryexp() +---------------------------------------------------------------------- + +local function funcargs(f) + local args = {} + local line = ln + local c = tok + if c == "(" then -- funcargs -> '(' [ base.explist1 ] ')' + if line ~= lastln then + syntaxerror("ambiguous syntax (function call x new statement)") + end + nextt() + if tok == ")" then -- arg list is empty? + args.k = "VVOID" + else + base.explist1(args) + end + check_match(")", "(", line) + elseif c == "{" then -- funcargs -> constructor + constructor(args) + elseif c == "" then -- funcargs -> STRING + codestring(args, seminfo) + nextt() -- must use 'seminfo' before 'next' + else + syntaxerror("function arguments expected") + return + end--if c + f.k = "VCALL" +end + +--[[-------------------------------------------------------------------- +-- mostly expression functions +----------------------------------------------------------------------]] + +---------------------------------------------------------------------- +-- parses an expression in parentheses or a single variable +-- * used in primaryexp() +---------------------------------------------------------------------- + +local function prefixexp(v) + -- prefixexp -> NAME | '(' base.expr ')' + local c = tok + if c == "(" then + local line = ln + nextt() + base.expr(v) + check_match(")", "(", line) + elseif c == "" then + singlevar(v) + else + syntaxerror("unexpected symbol") + end--if c +end + +---------------------------------------------------------------------- +-- parses a prefixexp (an expression in parentheses or a single +-- variable) or a function call specification +-- * used in simpleexp(), assignment(), base.expr_stat() +---------------------------------------------------------------------- + +local function primaryexp(v) + -- primaryexp -> + -- prefixexp { '.' NAME | '[' exp ']' | ':' NAME funcargs | funcargs } + prefixexp(v) + while true do + local c = tok + if c == "." then -- field + field(v) + elseif c == "[" then -- '[' base.exp1 ']' + local key = {} + yindex(key) + elseif c == ":" then -- ':' NAME funcargs + local key = {} + nextt() + checkname(key) + funcargs(v) + elseif c == "(" or c == "" or c == "{" then -- funcargs + funcargs(v) + else + return + end--if c + end--while +end + +---------------------------------------------------------------------- +-- parses general expression types, constants handled here +-- * used in subexpr() +---------------------------------------------------------------------- + +local function simpleexp(v) + -- simpleexp -> NUMBER | STRING | NIL | TRUE | FALSE | ... | + -- constructor | FUNCTION base.body | primaryexp + local c = tok + if c == "" then + v.k = "VKNUM" + elseif c == "" then + codestring(v, seminfo) + elseif c == "nil" then + v.k = "VNIL" + elseif c == "true" then + v.k = "VTRUE" + elseif c == "false" then + v.k = "VFALSE" + elseif c == "..." then -- vararg + check_condition(fs.is_vararg == true, + "cannot use '...' outside a vararg function"); + v.k = "VVARARG" + elseif c == "{" then -- constructor + constructor(v) + return + elseif c == "function" then + nextt() + base.body(v, false, ln) + return + else + primaryexp(v) + return + end--if c + nextt() +end + +------------------------------------------------------------------------ +-- Parse subexpressions. Includes handling of unary operators and binary +-- operators. A subexpr is given the rhs priority level of the operator +-- immediately left of it, if any (limit is -1 if none,) and if a binop +-- is found, limit is compared with the lhs priority level of the binop +-- in order to determine which executes first. +-- * recursively called +-- * used in base.expr() +------------------------------------------------------------------------ + +local function subexpr(v, limit) + -- subexpr -> (simpleexp | unop subexpr) { binop subexpr } + -- * where 'binop' is any binary operator with a priority + -- higher than 'limit' + local op = tok + local uop = unopr[op] + if uop then + nextt() + subexpr(v, UNARY_PRIORITY) + else + simpleexp(v) + end + -- expand while operators have priorities higher than 'limit' + op = tok + local binop = binopr_left[op] + while binop and binop > limit do + local v2 = {} + nextt() + -- read sub-expression with higher priority + local nextop = subexpr(v2, binopr_right[op]) + op = nextop + binop = binopr_left[op] + end + return op -- return first untreated operator +end + +---------------------------------------------------------------------- +-- Expression parsing starts here. Function subexpr is entered with the +-- left operator (which is non-existent) priority of -1, which is lower +-- than all actual operators. Expr information is returned in parm v. +-- * used in cond(), base.explist1(), index(), recfield(), listfield(), +-- prefixexp(), base.while_stat(), base.exp1() +---------------------------------------------------------------------- + +-- this is a forward-referenced local +function base.expr(v) + -- base.expr -> subexpr + subexpr(v, 0) +end + +--[[-------------------------------------------------------------------- +-- third level parsing functions +----------------------------------------------------------------------]] + +------------------------------------------------------------------------ +-- parse a variable assignment sequence +-- * recursively called +-- * used in base.expr_stat() +------------------------------------------------------------------------ + +local function assignment(v) + local e = {} + local c = v.v.k + check_condition(c == "VLOCAL" or c == "VUPVAL" or c == "VGLOBAL" + or c == "VINDEXED", "syntax error") + if testnext(",") then -- assignment -> ',' primaryexp assignment + local nv = {} -- expdesc + nv.v = {} + primaryexp(nv.v) + -- lparser.c deals with some register usage conflict here + assignment(nv) + else -- assignment -> '=' base.explist1 + checknext("=") + base.explist1(e) + return -- avoid default + end + e.k = "VNONRELOC" +end + +---------------------------------------------------------------------- +-- parse a for loop base.body for both versions of the for loop +-- * used in fornum(), forlist() +---------------------------------------------------------------------- + +local function forbody(nvars, isnum) + -- forbody -> DO base.block + checknext("do") + enterblock(false) -- scope for declared variables + adjustlocalvars(nvars) + base.block() + leaveblock() -- end of scope for declared variables +end + +---------------------------------------------------------------------- +-- parse a numerical for loop, calls forbody() +-- * used in base.for_stat() +---------------------------------------------------------------------- + +local function fornum(varname) + -- fornum -> NAME = base.exp1, base.exp1 [, base.exp1] DO base.body + local line = line + new_localvarliteral("(for index)") + new_localvarliteral("(for limit)") + new_localvarliteral("(for step)") + new_localvar(varname) + checknext("=") + base.exp1() -- initial value + checknext(",") + base.exp1() -- limit + if testnext(",") then + base.exp1() -- optional step + else + -- default step = 1 + end + forbody(1, true) +end + +---------------------------------------------------------------------- +-- parse a generic for loop, calls forbody() +-- * used in base.for_stat() +---------------------------------------------------------------------- + +local function forlist(indexname) + -- forlist -> NAME {, NAME} IN base.explist1 DO base.body + local e = {} + -- create control variables + new_localvarliteral("(for generator)") + new_localvarliteral("(for state)") + new_localvarliteral("(for control)") + -- create declared variables + new_localvar(indexname) + local nvars = 1 + while testnext(",") do + new_localvar(str_checkname()) + nvars = nvars + 1 + end + checknext("in") + local line = line + base.explist1(e) + forbody(nvars, false) +end + +---------------------------------------------------------------------- +-- parse a function name specification +-- * used in func_stat() +---------------------------------------------------------------------- + +local function funcname(v) + -- funcname -> NAME {field} [':' NAME] + local needself = false + singlevar(v) + while tok == "." do + field(v) + end + if tok == ":" then + needself = true + field(v) + end + return needself +end + +---------------------------------------------------------------------- +-- parse the single expressions needed in numerical for loops +-- * used in fornum() +---------------------------------------------------------------------- + +-- this is a forward-referenced local +function base.exp1() + -- base.exp1 -> base.expr + local e = {} + base.expr(e) +end + +---------------------------------------------------------------------- +-- parse condition in a repeat statement or an if control structure +-- * used in base.repeat_stat(), test_then_block() +---------------------------------------------------------------------- + +local function cond() + -- cond -> base.expr + local v = {} + base.expr(v) -- read condition +end + +---------------------------------------------------------------------- +-- parse part of an if control structure, including the condition +-- * used in base.if_stat() +---------------------------------------------------------------------- + +local function test_then_block() + -- test_then_block -> [IF | ELSEIF] cond THEN base.block + nextt() -- skip IF or ELSEIF + cond() + checknext("then") + base.block() -- 'then' part +end + +---------------------------------------------------------------------- +-- parse a local function statement +-- * used in base.local_stat() +---------------------------------------------------------------------- + +local function localfunc() + -- localfunc -> NAME base.body + local v, b = {} + new_localvar(str_checkname()) + v.k = "VLOCAL" + adjustlocalvars(1) + base.body(b, false, ln) +end + +---------------------------------------------------------------------- +-- parse a local variable declaration statement +-- * used in base.local_stat() +---------------------------------------------------------------------- + +local function localstat() + -- localstat -> NAME {',' NAME} ['=' base.explist1] + local nvars = 0 + local e = {} + repeat + new_localvar(str_checkname()) + nvars = nvars + 1 + until not testnext(",") + if testnext("=") then + base.explist1(e) + else + e.k = "VVOID" + end + adjustlocalvars(nvars) +end + +---------------------------------------------------------------------- +-- parse a list of comma-separated expressions +-- * used in base.return_stat(), localstat(), funcargs(), assignment(), +-- forlist() +---------------------------------------------------------------------- + +-- this is a forward-referenced local +function base.explist1(e) + -- base.explist1 -> base.expr { ',' base.expr } + base.expr(e) + while testnext(",") do + base.expr(e) + end +end + +---------------------------------------------------------------------- +-- parse function declaration base.body +-- * used in simpleexp(), localfunc(), func_stat() +---------------------------------------------------------------------- + +-- this is a forward-referenced local +function base.body(e, needself, line) + -- base.body -> '(' parlist ')' base.chunk END + open_func() + checknext("(") + if needself then + new_localvarliteral("self", true) + adjustlocalvars(1) + end + parlist() + checknext(")") + base.chunk() + check_match("end", "function", line) + close_func() +end + +---------------------------------------------------------------------- +-- parse a code base.block or unit +-- * used in base.do_stat(), base.while_stat(), forbody(), test_then_block(), +-- base.if_stat() +---------------------------------------------------------------------- + +-- this is a forward-referenced local +function base.block() + -- base.block -> base.chunk + enterblock(false) + base.chunk() + leaveblock() +end + +--[[-------------------------------------------------------------------- +-- second level parsing functions, all with '_stat' suffix +-- * since they are called via a table lookup, they cannot be local +-- functions (a lookup table of local functions might be smaller...) +-- * stat() -> *_stat() +----------------------------------------------------------------------]] + +---------------------------------------------------------------------- +-- initial parsing for a for loop, calls fornum() or forlist() +-- * removed 'line' parameter (used to set debug information only) +-- * used in stat() +---------------------------------------------------------------------- + +function base.for_stat() + -- stat -> base.for_stat -> FOR (fornum | forlist) END + local line = line + enterblock(true) -- scope for loop and control variables + nextt() -- skip 'for' + local varname = str_checkname() -- first variable name + local c = tok + if c == "=" then + fornum(varname) + elseif c == "," or c == "in" then + forlist(varname) + else + syntaxerror("'=' or 'in' expected") + end + check_match("end", "for", line) + leaveblock() -- loop scope (`break' jumps to this point) +end + +---------------------------------------------------------------------- +-- parse a while-do control structure, base.body processed by base.block() +-- * used in stat() +---------------------------------------------------------------------- + +function base.while_stat() + -- stat -> base.while_stat -> WHILE cond DO base.block END + local line = line + nextt() -- skip WHILE + cond() -- parse condition + enterblock(true) + checknext("do") + base.block() + check_match("end", "while", line) + leaveblock() +end + +---------------------------------------------------------------------- +-- parse a repeat-until control structure, base.body parsed by base.chunk() +-- * originally, repeatstat() calls breakstat() too if there is an +-- upvalue in the scope base.block; nothing is actually lexed, it is +-- actually the common code in breakstat() for closing of upvalues +-- * used in stat() +---------------------------------------------------------------------- + +function base.repeat_stat() + -- stat -> base.repeat_stat -> REPEAT base.block UNTIL cond + local line = line + enterblock(true) -- loop base.block + enterblock(false) -- scope base.block + nextt() -- skip REPEAT + base.chunk() + check_match("until", "repeat", line) + cond() + -- close upvalues at scope level below + leaveblock() -- finish scope + leaveblock() -- finish loop +end + +---------------------------------------------------------------------- +-- parse an if control structure +-- * used in stat() +---------------------------------------------------------------------- + +function base.if_stat() + -- stat -> base.if_stat -> IF cond THEN base.block + -- {ELSEIF cond THEN base.block} [ELSE base.block] END + local line = line + local v = {} + test_then_block() -- IF cond THEN base.block + while tok == "elseif" do + test_then_block() -- ELSEIF cond THEN base.block + end + if tok == "else" then + nextt() -- skip ELSE + base.block() -- 'else' part + end + check_match("end", "if", line) +end + +---------------------------------------------------------------------- +-- parse a return statement +-- * used in stat() +---------------------------------------------------------------------- + +function base.return_stat() + -- stat -> base.return_stat -> RETURN explist + local e = {} + nextt() -- skip RETURN + local c = tok + if block_follow[c] or c == ";" then + -- return no values + else + base.explist1(e) -- optional return values + end +end + +---------------------------------------------------------------------- +-- parse a break statement +-- * used in stat() +---------------------------------------------------------------------- + +function base.break_stat() + -- stat -> base.break_stat -> BREAK + local bl = fs.bl + nextt() -- skip BREAK + while bl and not bl.isbreakable do -- find a breakable base.block + bl = bl.prev + end + if not bl then + syntaxerror("no loop to break") + end +end + +---------------------------------------------------------------------- +-- parse a function call with no returns or an assignment statement +-- * the struct with .prev is used for name searching in lparse.c, +-- so it is retained for now; present in assignment() also +-- * used in stat() +---------------------------------------------------------------------- + +function base.expr_stat() + -- stat -> base.expr_stat -> func | assignment + local v = {} + v.v = {} + primaryexp(v.v) + if v.v.k == "VCALL" then -- stat -> func + -- call statement uses no results + else -- stat -> assignment + v.prev = nil + assignment(v) + end +end + +---------------------------------------------------------------------- +-- parse a function statement +-- * used in stat() +---------------------------------------------------------------------- + +function base.function_stat() + -- stat -> base.function_stat -> FUNCTION funcname base.body + local line = line + local v, b = {}, {} + nextt() -- skip FUNCTION + local needself = funcname(v) + base.body(b, needself, line) +end + +---------------------------------------------------------------------- +-- parse a simple base.block enclosed by a DO..END pair +-- * used in stat() +---------------------------------------------------------------------- + +function base.do_stat() + -- stat -> base.do_stat -> DO base.block END + local line = line + nextt() -- skip DO + base.block() + check_match("end", "do", line) +end + +---------------------------------------------------------------------- +-- parse a statement starting with LOCAL +-- * used in stat() +---------------------------------------------------------------------- + +function base.local_stat() + -- stat -> base.local_stat -> LOCAL FUNCTION localfunc + -- -> LOCAL localstat + nextt() -- skip LOCAL + if testnext("function") then -- local function? + localfunc() + else + localstat() + end +end + +--[[-------------------------------------------------------------------- +-- main functions, top level parsing functions +-- * accessible functions are: base.init(lexer), base.parser() +-- * [entry] -> base.parser() -> base.chunk() -> stat() +----------------------------------------------------------------------]] + +---------------------------------------------------------------------- +-- initial parsing for statements, calls '_stat' suffixed functions +-- * used in base.chunk() +---------------------------------------------------------------------- + +local function stat() + -- stat -> base.if_stat base.while_stat base.do_stat base.for_stat base.repeat_stat + -- base.function_stat base.local_stat base.return_stat base.break_stat + -- base.expr_stat + line = ln -- may be needed for error messages + local c = tok + local fn = stat_call[c] + -- handles: if while do for repeat function local return break + if fn then + base[fn]() + -- return or break must be last statement + if c == "return" or c == "break" then return true end + else + base.expr_stat() + end + return false +end + +---------------------------------------------------------------------- +-- parse a base.chunk, which consists of a bunch of statements +-- * used in base.parser(), base.body(), base.block(), base.repeat_stat() +---------------------------------------------------------------------- + +-- this is a forward-referenced local +function base.chunk() + -- base.chunk -> { stat [';'] } + local islast = false + while not islast and not block_follow[tok] do + islast = stat() + testnext(";") + end +end + +---------------------------------------------------------------------- +-- performs parsing, returns parsed data structure +---------------------------------------------------------------------- + +function base.parser() + open_func() + fs.is_vararg = true -- main func. is always vararg + nextt() -- read first token + base.chunk() + check("") + close_func() + return globalinfo, localinfo +end + +---------------------------------------------------------------------- +-- initialization function +---------------------------------------------------------------------- + +function base.init(tokorig, seminfoorig, toklnorig) + tpos = 1 -- token position + top_fs = {} -- reset top level function state + ------------------------------------------------------------------ + -- set up grammar-only token tables; impedance-matching... + -- note that constants returned by the lexer is source-level, so + -- for now, fake(!) constant tokens (TK_NUMBER|TK_STRING|TK_LSTRING) + ------------------------------------------------------------------ + local j = 1 + toklist, seminfolist, toklnlist, xreflist = {}, {}, {}, {} + for i = 1, #tokorig do + local tok = tokorig[i] + local yep = true + if tok == "TK_KEYWORD" or tok == "TK_OP" then + tok = seminfoorig[i] + elseif tok == "TK_NAME" then + tok = "" + seminfolist[j] = seminfoorig[i] + elseif tok == "TK_NUMBER" then + tok = "" + seminfolist[j] = 0 -- fake! + elseif tok == "TK_STRING" or tok == "TK_LSTRING" then + tok = "" + seminfolist[j] = "" -- fake! + elseif tok == "TK_EOS" then + tok = "" + else + -- non-grammar tokens; ignore them + yep = false + end + if yep then -- set rest of the information + toklist[j] = tok + toklnlist[j] = toklnorig[i] + xreflist[j] = i + j = j + 1 + end + end--for + ------------------------------------------------------------------ + -- initialize data structures for variable tracking + ------------------------------------------------------------------ + globalinfo, globallookup, localinfo = {}, {}, {} + ilocalinfo, ilocalrefs = {}, {} +end + +return base diff --git a/AIO_Server/Dep_LuaSrcDiet/optlex.lua b/AIO_Server/Dep_LuaSrcDiet/optlex.lua new file mode 100644 index 0000000..0289903 --- /dev/null +++ b/AIO_Server/Dep_LuaSrcDiet/optlex.lua @@ -0,0 +1,837 @@ +--[[-------------------------------------------------------------------- + + optlex.lua: does lexer-based optimizations + This file is part of LuaSrcDiet. + + Copyright (c) 2008 Kein-Hong Man + The COPYRIGHT file describes the conditions + under which this software may be distributed. + + See the ChangeLog for more information. + +----------------------------------------------------------------------]] + +--[[-------------------------------------------------------------------- +-- NOTES: +-- * For more lexer-based optimization ideas, see the TODO items or +-- look at technotes.txt. +-- * TODO: general string delimiter conversion optimizer +-- * TODO: (numbers) warn if overly significant digit +----------------------------------------------------------------------]] + +local base = {} +-- local base = _G +-- local string = require "string" +-- module "optlex" +local match = string.match +local sub = string.sub +local find = string.find +local rep = string.rep +local print = print +local tostring = tostring +local tonumber = tonumber + +------------------------------------------------------------------------ +-- variables and data structures +------------------------------------------------------------------------ + +-- error function, can override by setting own function into module +local error = error + +base.warn = {} -- table for warning flags + +local stoks, sinfos, stoklns -- source lists + +local is_realtoken = { -- significant (grammar) tokens + TK_KEYWORD = true, + TK_NAME = true, + TK_NUMBER = true, + TK_STRING = true, + TK_LSTRING = true, + TK_OP = true, + TK_EOS = true, +} +local is_faketoken = { -- whitespace (non-grammar) tokens + TK_COMMENT = true, + TK_LCOMMENT = true, + TK_EOL = true, + TK_SPACE = true, +} + +local opt_details -- for extra information + +------------------------------------------------------------------------ +-- true if current token is at the start of a line +-- * skips over deleted tokens via recursion +------------------------------------------------------------------------ + +local function atlinestart(i) + local tok = stoks[i - 1] + if i <= 1 or tok == "TK_EOL" then + return true + elseif tok == "" then + return atlinestart(i - 1) + end + return false +end + +------------------------------------------------------------------------ +-- true if current token is at the end of a line +-- * skips over deleted tokens via recursion +------------------------------------------------------------------------ + +local function atlineend(i) + local tok = stoks[i + 1] + if i >= #stoks or tok == "TK_EOL" or tok == "TK_EOS" then + return true + elseif tok == "" then + return atlineend(i + 1) + end + return false +end + +------------------------------------------------------------------------ +-- counts comment EOLs inside a long comment +-- * in order to keep line numbering, EOLs need to be reinserted +------------------------------------------------------------------------ + +local function commenteols(lcomment) + local sep = #match(lcomment, "^%-%-%[=*%[") + local z = sub(lcomment, sep + 1, -(sep - 1)) -- remove delims + local i, c = 1, 0 + while true do + local p, q, r, s = find(z, "([\r\n])([\r\n]?)", i) + if not p then break end -- if no matches, done + i = p + 1 + c = c + 1 + if #s > 0 and r ~= s then -- skip CRLF or LFCR + i = i + 1 + end + end + return c +end + +------------------------------------------------------------------------ +-- compares two tokens (i, j) and returns the whitespace required +-- * important! see technotes.txt for more information +-- * only two grammar/real tokens are being considered +-- * if "", no separation is needed +-- * if " ", then at least one whitespace (or EOL) is required +------------------------------------------------------------------------ + +local function checkpair(i, j) + local match = match + local t1, t2 = stoks[i], stoks[j] + -------------------------------------------------------------------- + if t1 == "TK_STRING" or t1 == "TK_LSTRING" or + t2 == "TK_STRING" or t2 == "TK_LSTRING" then + return "" + -------------------------------------------------------------------- + elseif t1 == "TK_OP" or t2 == "TK_OP" then + if (t1 == "TK_OP" and (t2 == "TK_KEYWORD" or t2 == "TK_NAME")) or + (t2 == "TK_OP" and (t1 == "TK_KEYWORD" or t1 == "TK_NAME")) then + return "" + end + if t1 == "TK_OP" and t2 == "TK_OP" then + -- for TK_OP/TK_OP pairs, see notes in technotes.txt + local op, op2 = sinfos[i], sinfos[j] + if (match(op, "^%.%.?$") and match(op2, "^%.")) or + (match(op, "^[~=<>]$") and op2 == "=") or + (op == "[" and (op2 == "[" or op2 == "=")) then + return " " + end + return "" + end + -- "TK_OP" + "TK_NUMBER" case + local op = sinfos[i] + if t2 == "TK_OP" then op = sinfos[j] end + if match(op, "^%.%.?%.?$") then + return " " + end + return "" + -------------------------------------------------------------------- + else-- "TK_KEYWORD" | "TK_NAME" | "TK_NUMBER" then + return " " + -------------------------------------------------------------------- + end +end + +------------------------------------------------------------------------ +-- repack tokens, removing deletions caused by optimization process +------------------------------------------------------------------------ + +local function repack_tokens() + local dtoks, dinfos, dtoklns = {}, {}, {} + local j = 1 + for i = 1, #stoks do + local tok = stoks[i] + if tok ~= "" then + dtoks[j], dinfos[j], dtoklns[j] = tok, sinfos[i], stoklns[i] + j = j + 1 + end + end + stoks, sinfos, stoklns = dtoks, dinfos, dtoklns +end + +------------------------------------------------------------------------ +-- number optimization +-- * optimization using string formatting functions is one way of doing +-- this, but here, we consider all cases and handle them separately +-- (possibly an idiotic approach...) +-- * scientific notation being generated is not in canonical form, this +-- may or may not be a bad thing, feedback welcome +-- * note: intermediate portions need to fit into a normal number range +-- * optimizations can be divided based on number patterns: +-- * hexadecimal: +-- (1) no need to remove leading zeros, just skip to (2) +-- (2) convert to integer if size equal or smaller +-- * change if equal size -> lose the 'x' to reduce entropy +-- (3) number is then processed as an integer +-- (4) note: does not make 0[xX] consistent +-- * integer: +-- (1) note: includes anything with trailing ".", ".0", ... +-- (2) remove useless fractional part, if present, e.g. 123.000 +-- (3) remove leading zeros, e.g. 000123 +-- (4) switch to scientific if shorter, e.g. 123000 -> 123e3 +-- * with fraction: +-- (1) split into digits dot digits +-- (2) if no integer portion, take as zero (can omit later) +-- (3) handle degenerate .000 case, after which the fractional part +-- must be non-zero (if zero, it's matched as an integer) +-- (4) remove trailing zeros for fractional portion +-- (5) p.q where p > 0 and q > 0 cannot be shortened any more +-- (6) otherwise p == 0 and the form is .q, e.g. .000123 +-- (7) if scientific shorter, convert, e.g. .000123 -> 123e-6 +-- * scientific: +-- (1) split into (digits dot digits) [eE] ([+-] digits) +-- (2) if significand has ".", shift it out so it becomes an integer +-- (3) if significand is zero, just use zero +-- (4) remove leading zeros for significand +-- (5) shift out trailing zeros for significand +-- (6) examine exponent and determine which format is best: +-- integer, with fraction, scientific +------------------------------------------------------------------------ + +local function do_number(i) + local before = sinfos[i] -- 'before' + local z = before -- working representation + local y -- 'after', if better + -------------------------------------------------------------------- + if match(z, "^0[xX]") then -- hexadecimal number + local v = tostring(tonumber(z)) + if #v <= #z then + z = v -- change to integer, AND continue + else + return -- no change; stick to hex + end + end + -------------------------------------------------------------------- + if match(z, "^%d+%.?0*$") then -- integer or has useless frac + z = match(z, "^(%d+)%.?0*$") -- int portion only + if z + 0 > 0 then + z = match(z, "^0*([1-9]%d*)$") -- remove leading zeros + local v = #match(z, "0*$") + local nv = tostring(v) + if v > #nv + 1 then -- scientific is shorter + z = sub(z, 1, #z - v).."e"..nv + end + y = z + else + y = "0" -- basic zero + end + -------------------------------------------------------------------- + elseif not match(z, "[eE]") then -- number with fraction part + local p, q = match(z, "^(%d*)%.(%d+)$") -- split + if p == "" then p = 0 end -- int part zero + if q + 0 == 0 and p == 0 then + y = "0" -- degenerate .000 case + else + -- now, q > 0 holds and p is a number + local v = #match(q, "0*$") -- remove trailing zeros + if v > 0 then + q = sub(q, 1, #q - v) + end + -- if p > 0, nothing else we can do to simplify p.q case + if p + 0 > 0 then + y = p.."."..q + else + y = "."..q -- tentative, e.g. .000123 + local v = #match(q, "^0*") -- # leading spaces + local w = #q - v -- # significant digits + local nv = tostring(#q) + -- e.g. compare 123e-6 versus .000123 + if w + 2 + #nv < 1 + #q then + y = sub(q, -w).."e-"..nv + end + end + end + -------------------------------------------------------------------- + else -- scientific number + local sig, ex = match(z, "^([^eE]+)[eE]([%+%-]?%d+)$") + ex = tonumber(ex) + -- if got ".", shift out fractional portion of significand + local p, q = match(sig, "^(%d*)%.(%d*)$") + if p then + ex = ex - #q + sig = p..q + end + if sig + 0 == 0 then + y = "0" -- basic zero + else + local v = #match(sig, "^0*") -- remove leading zeros + sig = sub(sig, v + 1) + v = #match(sig, "0*$") -- shift out trailing zeros + if v > 0 then + sig = sub(sig, 1, #sig - v) + ex = ex + v + end + -- examine exponent and determine which format is best + local nex = tostring(ex) + if ex == 0 then -- it's just an integer + y = sig + elseif ex > 0 and (ex <= 1 + #nex) then -- a number + y = sig..rep("0", ex) + elseif ex < 0 and (ex >= -#sig) then -- fraction, e.g. .123 + v = #sig + ex + y = sub(sig, 1, v).."."..sub(sig, v + 1) + elseif ex < 0 and (#nex >= -ex - #sig) then + -- e.g. compare 1234e-5 versus .01234 + -- gives: #sig + 1 + #nex >= 1 + (-ex - #sig) + #sig + -- -> #nex >= -ex - #sig + v = -ex - #sig + y = "."..rep("0", v)..sig + else -- non-canonical scientific representation + y = sig.."e"..ex + end + end--if sig + end + -------------------------------------------------------------------- + if y and y ~= sinfos[i] then + if opt_details then + print(" (line "..stoklns[i]..") "..sinfos[i].." -> "..y) + opt_details = opt_details + 1 + end + sinfos[i] = y + end +end + +------------------------------------------------------------------------ +-- string optimization +-- * note: works on well-formed strings only! +-- * optimizations on characters can be summarized as follows: +-- \a\b\f\n\r\t\v -- no change +-- \\ -- no change +-- \"\' -- depends on delim, other can remove \ +-- \[\] -- remove \ +-- \ -- general escape, remove \ +-- \ -- normalize the EOL only +-- \ddd -- if \a\b\f\n\r\t\v, change to latter +-- if other < ascii 32, keep ddd but zap leading zeros +-- if >= ascii 32, translate it into the literal, then also +-- do escapes for \\,\",\' cases +-- -- no change +-- * switch delimiters if string becomes shorter +------------------------------------------------------------------------ + +local function do_string(I) + local info = sinfos[I] + local delim = sub(info, 1, 1) -- delimiter used + local ndelim = (delim == "'") and '"' or "'" -- opposite " <-> ' + local z = sub(info, 2, -2) -- actual string + local i = 1 + local c_delim, c_ndelim = 0, 0 -- "/' counts + -------------------------------------------------------------------- + while i <= #z do + local c = sub(z, i, i) + ---------------------------------------------------------------- + if c == "\\" then -- escaped stuff + local j = i + 1 + local d = sub(z, j, j) + local p = find("abfnrtv\\\n\r\"\'0123456789", d, 1, true) + ------------------------------------------------------------ + if not p then -- \ -- remove \ + z = sub(z, 1, i - 1)..sub(z, j) + i = i + 1 + ------------------------------------------------------------ + elseif p <= 8 then -- \a\b\f\n\r\t\v\\ + i = i + 2 -- no change + ------------------------------------------------------------ + elseif p <= 10 then -- \ -- normalize EOL + local eol = sub(z, j, j + 1) + if eol == "\r\n" or eol == "\n\r" then + z = sub(z, 1, i).."\n"..sub(z, j + 2) + elseif p == 10 then -- \r case + z = sub(z, 1, i).."\n"..sub(z, j + 1) + end + i = i + 2 + ------------------------------------------------------------ + elseif p <= 12 then -- \"\' -- remove \ for ndelim + if d == delim then + c_delim = c_delim + 1 + i = i + 2 + else + c_ndelim = c_ndelim + 1 + z = sub(z, 1, i - 1)..sub(z, j) + i = i + 1 + end + ------------------------------------------------------------ + else -- \ddd -- various steps + local s = match(z, "^(%d%d?%d?)", j) + j = i + 1 + #s -- skip to location + local cv = s + 0 + local cc = string.char(cv) + local p = find("\a\b\f\n\r\t\v", cc, 1, true) + if p then -- special escapes + s = "\\"..sub("abfnrtv", p, p) + elseif cv < 32 then -- normalized \ddd + s = "\\"..cv + elseif cc == delim then -- \ + s = "\\"..cc + c_delim = c_delim + 1 + elseif cc == "\\" then -- \\ + s = "\\\\" + else -- literal character + s = cc + if cc == ndelim then + c_ndelim = c_ndelim + 1 + end + end + z = sub(z, 1, i - 1)..s..sub(z, j) + i = i + #s + ------------------------------------------------------------ + end--if p + ---------------------------------------------------------------- + else-- c ~= "\\" -- -- no change + i = i + 1 + if c == ndelim then -- count ndelim, for switching delimiters + c_ndelim = c_ndelim + 1 + end + ---------------------------------------------------------------- + end--if c + end--while + -------------------------------------------------------------------- + -- switching delimiters, a long-winded derivation: + -- (1) delim takes 2+2*c_delim bytes, ndelim takes c_ndelim bytes + -- (2) delim becomes c_delim bytes, ndelim becomes 2+2*c_ndelim bytes + -- simplifying the condition (1)>(2) --> c_delim > c_ndelim + if c_delim > c_ndelim then + i = 1 + while i <= #z do + local p, q, r = find(z, "([\'\"])", i) + if not p then break end + if r == delim then -- \ -> + z = sub(z, 1, p - 2)..sub(z, p) + i = p + else-- r == ndelim -- -> \ + z = sub(z, 1, p - 1).."\\"..sub(z, p) + i = p + 2 + end + end--while + delim = ndelim -- actually change delimiters + end + -------------------------------------------------------------------- + z = delim..z..delim + if z ~= sinfos[I] then + if opt_details then + print(" (line "..stoklns[I]..") "..sinfos[I].." -> "..z) + opt_details = opt_details + 1 + end + sinfos[I] = z + end +end + +------------------------------------------------------------------------ +-- long string optimization +-- * note: warning flagged if trailing whitespace found, not trimmed +-- * remove first optional newline +-- * normalize embedded newlines +-- * reduce '=' separators in delimiters if possible +------------------------------------------------------------------------ + +local function do_lstring(I) + local info = sinfos[I] + local delim1 = match(info, "^%[=*%[") -- cut out delimiters + local sep = #delim1 + local delim2 = sub(info, -sep, -1) + local z = sub(info, sep + 1, -(sep + 1)) -- lstring without delims + local y = "" + local i = 1 + -------------------------------------------------------------------- + while true do + local p, q, r, s = find(z, "([\r\n])([\r\n]?)", i) + -- deal with a single line + local ln + if not p then + ln = sub(z, i) + elseif p >= i then + ln = sub(z, i, p - 1) + end + if ln ~= "" then + -- flag a warning if there are trailing spaces, won't base.optimize! + if match(ln, "%s+$") then + warn.lstring = "trailing whitespace in long string near line "..stoklns[I] + end + y = y..ln + end + if not p then -- done if no more EOLs + break + end + -- deal with line endings, normalize them + i = p + 1 + if p then + if #s > 0 and r ~= s then -- skip CRLF or LFCR + i = i + 1 + end + -- skip first newline, which can be safely deleted + if not(i == 1 and i == p) then + y = y.."\n" + end + end + end--while + -------------------------------------------------------------------- + -- handle possible deletion of one or more '=' separators + if sep >= 3 then + local chk, okay = sep - 1 + -- loop to test ending delimiter with less of '=' down to zero + while chk >= 2 do + local delim = "%]"..rep("=", chk - 2).."%]" + if not match(y, delim) then okay = chk end + chk = chk - 1 + end + if okay then -- change delimiters + sep = rep("=", okay - 2) + delim1, delim2 = "["..sep.."[", "]"..sep.."]" + end + end + -------------------------------------------------------------------- + sinfos[I] = delim1..y..delim2 +end + +------------------------------------------------------------------------ +-- long comment optimization +-- * note: does not remove first optional newline +-- * trim trailing whitespace +-- * normalize embedded newlines +-- * reduce '=' separators in delimiters if possible +------------------------------------------------------------------------ + +local function do_lcomment(I) + local info = sinfos[I] + local delim1 = match(info, "^%-%-%[=*%[") -- cut out delimiters + local sep = #delim1 + local delim2 = sub(info, -sep, -1) + local z = sub(info, sep + 1, -(sep - 1)) -- comment without delims + local y = "" + local i = 1 + -------------------------------------------------------------------- + while true do + local p, q, r, s = find(z, "([\r\n])([\r\n]?)", i) + -- deal with a single line, extract and check trailing whitespace + local ln + if not p then + ln = sub(z, i) + elseif p >= i then + ln = sub(z, i, p - 1) + end + if ln ~= "" then + -- trim trailing whitespace if non-empty line + local ws = match(ln, "%s*$") + if #ws > 0 then ln = sub(ln, 1, -(ws + 1)) end + y = y..ln + end + if not p then -- done if no more EOLs + break + end + -- deal with line endings, normalize them + i = p + 1 + if p then + if #s > 0 and r ~= s then -- skip CRLF or LFCR + i = i + 1 + end + y = y.."\n" + end + end--while + -------------------------------------------------------------------- + -- handle possible deletion of one or more '=' separators + sep = sep - 2 + if sep >= 3 then + local chk, okay = sep - 1 + -- loop to test ending delimiter with less of '=' down to zero + while chk >= 2 do + local delim = "%]"..rep("=", chk - 2).."%]" + if not match(y, delim) then okay = chk end + chk = chk - 1 + end + if okay then -- change delimiters + sep = rep("=", okay - 2) + delim1, delim2 = "--["..sep.."[", "]"..sep.."]" + end + end + -------------------------------------------------------------------- + sinfos[I] = delim1..y..delim2 +end + +------------------------------------------------------------------------ +-- short comment optimization +-- * trim trailing whitespace +------------------------------------------------------------------------ + +local function do_comment(i) + local info = sinfos[i] + local ws = match(info, "%s*$") -- just look from end of string + if #ws > 0 then + info = sub(info, 1, -(ws + 1)) -- trim trailing whitespace + end + sinfos[i] = info +end + +------------------------------------------------------------------------ +-- returns true if string found in long comment +-- * this is a feature to keep copyright or license texts +------------------------------------------------------------------------ + +local function keep_lcomment(opt_keep, info) + if not opt_keep then return false end -- option not set + local delim1 = match(info, "^%-%-%[=*%[") -- cut out delimiters + local sep = #delim1 + local delim2 = sub(info, -sep, -1) + local z = sub(info, sep + 1, -(sep - 1)) -- comment without delims + if find(z, opt_keep, 1, true) then -- try to match + return true + end +end + +------------------------------------------------------------------------ +-- main entry point +-- * currently, lexer processing has 2 passes +-- * processing is done on a line-oriented basis, which is easier to +-- grok due to the next point... +-- * since there are various options that can be enabled or disabled, +-- processing is a little messy or convoluted +------------------------------------------------------------------------ + +function base.optimize(option, toklist, semlist, toklnlist) + -------------------------------------------------------------------- + -- set option flags + -------------------------------------------------------------------- + local opt_comments = option["opt-comments"] + local opt_whitespace = option["opt-whitespace"] + local opt_emptylines = option["opt-emptylines"] + local opt_eols = option["opt-eols"] + local opt_strings = option["opt-strings"] + local opt_numbers = option["opt-numbers"] + local opt_keep = option.KEEP + opt_details = option.DETAILS and 0 -- upvalues for details display + print = print or base.print + if opt_eols then -- forced settings, otherwise won't work properly + opt_comments = true + opt_whitespace = true + opt_emptylines = true + end + -------------------------------------------------------------------- + -- variable initialization + -------------------------------------------------------------------- + stoks, sinfos, stoklns -- set source lists + = toklist, semlist, toklnlist + local i = 1 -- token position + local tok, info -- current token + local prev -- position of last grammar token + -- on same line (for TK_SPACE stuff) + -------------------------------------------------------------------- + -- changes a token, info pair + -------------------------------------------------------------------- + local function settoken(tok, info, I) + I = I or i + stoks[I] = tok or "" + sinfos[I] = info or "" + end + -------------------------------------------------------------------- + -- processing loop (PASS 1) + -------------------------------------------------------------------- + while true do + tok, info = stoks[i], sinfos[i] + ---------------------------------------------------------------- + local atstart = atlinestart(i) -- set line begin flag + if atstart then prev = nil end + ---------------------------------------------------------------- + if tok == "TK_EOS" then -- end of stream/pass + break + ---------------------------------------------------------------- + elseif tok == "TK_KEYWORD" or -- keywords, identifiers, + tok == "TK_NAME" or -- operators + tok == "TK_OP" then + -- TK_KEYWORD and TK_OP can't be optimized without a big + -- optimization framework; it would be more of an optimizing + -- compiler, not a source code compressor + -- TK_NAME that are locals needs parser to analyze/base.optimize + prev = i + ---------------------------------------------------------------- + elseif tok == "TK_NUMBER" then -- numbers + if opt_numbers then + do_number(i) -- base.optimize + end + prev = i + ---------------------------------------------------------------- + elseif tok == "TK_STRING" or -- strings, long strings + tok == "TK_LSTRING" then + if opt_strings then + if tok == "TK_STRING" then + do_string(i) -- base.optimize + else + do_lstring(i) -- base.optimize + end + end + prev = i + ---------------------------------------------------------------- + elseif tok == "TK_COMMENT" then -- short comments + if opt_comments then + if i == 1 and sub(info, 1, 1) == "#" then + -- keep shbang comment, trim whitespace + do_comment(i) + else + -- safe to delete, as a TK_EOL (or TK_EOS) always follows + settoken() -- remove entirely + end + elseif opt_whitespace then -- trim whitespace only + do_comment(i) + end + ---------------------------------------------------------------- + elseif tok == "TK_LCOMMENT" then -- long comments + if keep_lcomment(opt_keep, info) then + ------------------------------------------------------------ + -- if --keep, we keep a long comment if is found; + -- this is a feature to keep copyright or license texts + if opt_whitespace then -- trim whitespace only + do_lcomment(i) + end + prev = i + elseif opt_comments then + local eols = commenteols(info) + ------------------------------------------------------------ + -- prepare opt_emptylines case first, if a disposable token + -- follows, current one is safe to dump, else keep a space; + -- it is implied that the operation is safe for '-', because + -- current is a TK_LCOMMENT, and must be separate from a '-' + if is_faketoken[stoks[i + 1]] then + settoken() -- remove entirely + tok = "" + else + settoken("TK_SPACE", " ") + end + ------------------------------------------------------------ + -- if there are embedded EOLs to keep and opt_emptylines is + -- disabled, then switch the token into one or more EOLs + if not opt_emptylines and eols > 0 then + settoken("TK_EOL", rep("\n", eols)) + end + ------------------------------------------------------------ + -- if optimizing whitespaces, force reinterpretation of the + -- token to give a chance for the space to be optimized away + if opt_whitespace and tok ~= "" then + i = i - 1 -- to reinterpret + end + ------------------------------------------------------------ + else -- disabled case + if opt_whitespace then -- trim whitespace only + do_lcomment(i) + end + prev = i + end + ---------------------------------------------------------------- + elseif tok == "TK_EOL" then -- line endings + if atstart and opt_emptylines then + settoken() -- remove entirely + elseif info == "\r\n" or info == "\n\r" then + -- normalize the rest of the EOLs for CRLF/LFCR only + -- (note that TK_LCOMMENT can change into several EOLs) + settoken("TK_EOL", "\n") + end + ---------------------------------------------------------------- + elseif tok == "TK_SPACE" then -- whitespace + if opt_whitespace then + if atstart or atlineend(i) then + -- delete leading and trailing whitespace + settoken() -- remove entirely + else + ------------------------------------------------------------ + -- at this point, since leading whitespace have been removed, + -- there should be a either a real token or a TK_LCOMMENT + -- prior to hitting this whitespace; the TK_LCOMMENT case + -- only happens if opt_comments is disabled; so prev ~= nil + local ptok = stoks[prev] + if ptok == "TK_LCOMMENT" then + -- previous TK_LCOMMENT can abut with anything + settoken() -- remove entirely + else + -- prev must be a grammar token; consecutive TK_SPACE + -- tokens is impossible when optimizing whitespace + local ntok = stoks[i + 1] + if is_faketoken[ntok] then + -- handle special case where a '-' cannot abut with + -- either a short comment or a long comment + if (ntok == "TK_COMMENT" or ntok == "TK_LCOMMENT") and + ptok == "TK_OP" and sinfos[prev] == "-" then + -- keep token + else + settoken() -- remove entirely + end + else--is_realtoken + -- check a pair of grammar tokens, if can abut, then + -- delete space token entirely, otherwise keep one space + local s = checkpair(prev, i + 1) + if s == "" then + settoken() -- remove entirely + else + settoken("TK_SPACE", " ") + end + end + end + ------------------------------------------------------------ + end + end + ---------------------------------------------------------------- + else + error("unidentified token encountered") + end + ---------------------------------------------------------------- + i = i + 1 + end--while + repack_tokens() + -------------------------------------------------------------------- + -- processing loop (PASS 2) + -------------------------------------------------------------------- + if opt_eols then + i = 1 + -- aggressive EOL removal only works with most non-grammar tokens + -- optimized away because it is a rather simple scheme -- basically + -- it just checks 'real' token pairs around EOLs + if stoks[1] == "TK_COMMENT" then + -- first comment still existing must be shbang, skip whole line + i = 3 + end + while true do + tok, info = stoks[i], sinfos[i] + -------------------------------------------------------------- + if tok == "TK_EOS" then -- end of stream/pass + break + -------------------------------------------------------------- + elseif tok == "TK_EOL" then -- consider each TK_EOL + local t1, t2 = stoks[i - 1], stoks[i + 1] + if is_realtoken[t1] and is_realtoken[t2] then -- sanity check + local s = checkpair(i - 1, i + 1) + if s == "" then + settoken() -- remove entirely + end + end + end--if tok + -------------------------------------------------------------- + i = i + 1 + end--while + repack_tokens() + end + -------------------------------------------------------------------- + if opt_details and opt_details > 0 then print() end -- spacing + return stoks, sinfos, stoklns +end + +return base diff --git a/AIO_Server/Dep_LuaSrcDiet/optparser.lua b/AIO_Server/Dep_LuaSrcDiet/optparser.lua new file mode 100644 index 0000000..68fbd99 --- /dev/null +++ b/AIO_Server/Dep_LuaSrcDiet/optparser.lua @@ -0,0 +1,566 @@ +--[[-------------------------------------------------------------------- + + optparser.lua: does parser-based optimizations + This file is part of LuaSrcDiet. + + Copyright (c) 2008 Kein-Hong Man + The COPYRIGHT file describes the conditions + under which this software may be distributed. + + See the ChangeLog for more information. + +----------------------------------------------------------------------]] + +--[[-------------------------------------------------------------------- +-- NOTES: +-- * For more parser-based optimization ideas, see the TODO items or +-- look at technotes.txt. +-- * The processing load is quite significant, but since this is an +-- off-line text processor, I believe we can wait a few seconds. +-- * TODO: might process "local a,a,a" wrongly... need tests! +-- * TODO: remove position handling if overlapped locals (rem < 0) +-- needs more study, to check behaviour +-- * TODO: there are probably better ways to do allocation, e.g. by +-- choosing better methods to sort and pick locals... +-- * TODO: we don't need 53*63 two-letter identifiers; we can make +-- do with significantly less depending on how many that are really +-- needed and improve entropy; e.g. 13 needed -> choose 4*4 instead +----------------------------------------------------------------------]] + +local base = {} +-- local base = _G +-- local string = require "string" +-- local table = require "table" +-- module "optparser" + +---------------------------------------------------------------------- +-- Letter frequencies for reducing symbol entropy (fixed version) +-- * Might help a wee bit when the output file is compressed +-- * See Wikipedia: http://en.wikipedia.org/wiki/Letter_frequencies +-- * We use letter frequencies according to a Linotype keyboard, plus +-- the underscore, and both lower case and upper case letters. +-- * The arrangement below (LC, underscore, %d, UC) is arbitrary. +-- * This is certainly not optimal, but is quick-and-dirty and the +-- process has no significant overhead +---------------------------------------------------------------------- + +local LETTERS = "etaoinshrdlucmfwypvbgkqjxz_ETAOINSHRDLUCMFWYPVBGKQJXZ" +local ALPHANUM = "etaoinshrdlucmfwypvbgkqjxz_0123456789ETAOINSHRDLUCMFWYPVBGKQJXZ" + +-- names or identifiers that must be skipped +-- * the first two lines are for keywords +local SKIP_NAME = {} +for v in string.gmatch([[ +and break do else elseif end false for function if in +local nil not or repeat return then true until while +self]], "%S+") do + SKIP_NAME[v] = true +end + +------------------------------------------------------------------------ +-- variables and data structures +------------------------------------------------------------------------ + +local toklist, seminfolist, -- token lists + globalinfo, localinfo, -- variable information tables + globaluniq, localuniq, -- unique name tables + var_new, -- index of new variable names + varlist -- list of output variables + +---------------------------------------------------------------------- +-- preprocess information table to get lists of unique names +---------------------------------------------------------------------- + +local function preprocess(infotable) + local uniqtable = {} + for i = 1, #infotable do -- enumerate info table + local obj = infotable[i] + local name = obj.name + -------------------------------------------------------------------- + if not uniqtable[name] then -- not found, start an entry + uniqtable[name] = { + decl = 0, token = 0, size = 0, + } + end + -------------------------------------------------------------------- + local uniq = uniqtable[name] -- count declarations, tokens, size + uniq.decl = uniq.decl + 1 + local xref = obj.xref + local xcount = #xref + uniq.token = uniq.token + xcount + uniq.size = uniq.size + xcount * #name + -------------------------------------------------------------------- + if obj.decl then -- if local table, create first,last pairs + obj.id = i + obj.xcount = xcount + if xcount > 1 then -- if ==1, means local never accessed + obj.first = xref[2] + obj.last = xref[xcount] + end + -------------------------------------------------------------------- + else -- if global table, add a back ref + uniq.id = i + end + -------------------------------------------------------------------- + end--for + return uniqtable +end + +---------------------------------------------------------------------- +-- calculate actual symbol frequencies, in order to reduce entropy +-- * this may help further reduce the size of compressed sources +-- * note that since parsing optimizations is put before lexing +-- optimizations, the frequency table is not exact! +-- * yes, this will miss --keep block comments too... +---------------------------------------------------------------------- + +local function recalc_for_entropy(option) + local byte = string.byte + local char = string.char + -- table of token classes to accept in calculating symbol frequency + local ACCEPT = { + TK_KEYWORD = true, TK_NAME = true, TK_NUMBER = true, + TK_STRING = true, TK_LSTRING = true, + } + if not option["opt-comments"] then + ACCEPT.TK_COMMENT = true + ACCEPT.TK_LCOMMENT = true + end + -------------------------------------------------------------------- + -- create a new table and remove any original locals by filtering + -------------------------------------------------------------------- + local filtered = {} + for i = 1, #toklist do + filtered[i] = seminfolist[i] + end + for i = 1, #localinfo do -- enumerate local info table + local obj = localinfo[i] + local xref = obj.xref + for j = 1, obj.xcount do + local p = xref[j] + filtered[p] = "" -- remove locals + end + end + -------------------------------------------------------------------- + local freq = {} -- reset symbol frequency table + for i = 0, 255 do freq[i] = 0 end + for i = 1, #toklist do -- gather symbol frequency + local tok, info = toklist[i], filtered[i] + if ACCEPT[tok] then + for j = 1, #info do + local c = byte(info, j) + freq[c] = freq[c] + 1 + end + end--if + end--for + -------------------------------------------------------------------- + -- function to re-sort symbols according to actual frequencies + -------------------------------------------------------------------- + local function resort(symbols) + local symlist = {} + for i = 1, #symbols do -- prepare table to sort + local c = byte(symbols, i) + symlist[i] = { c = c, freq = freq[c], } + end + table.sort(symlist, -- sort selected symbols + function(v1, v2) + return v1.freq > v2.freq + end + ) + local charlist = {} -- reconstitute the string + for i = 1, #symlist do + charlist[i] = char(symlist[i].c) + end + return table.concat(charlist) + end + -------------------------------------------------------------------- + LETTERS = resort(LETTERS) -- change letter arrangement + ALPHANUM = resort(ALPHANUM) +end + +---------------------------------------------------------------------- +-- returns a string containing a new local variable name to use, and +-- a flag indicating whether it collides with a global variable +-- * trapping keywords and other names like 'self' is done elsewhere +---------------------------------------------------------------------- + +local function new_var_name() + local var + local cletters, calphanum = #LETTERS, #ALPHANUM + local v = var_new + if v < cletters then -- single char + v = v + 1 + var = string.sub(LETTERS, v, v) + else -- longer names + local range, sz = cletters, 1 -- calculate # chars fit + repeat + v = v - range + range = range * calphanum + sz = sz + 1 + until range > v + local n = v % cletters -- left side cycles faster + v = (v - n) / cletters -- do first char first + n = n + 1 + var = string.sub(LETTERS, n, n) + while sz > 1 do + local m = v % calphanum + v = (v - m) / calphanum + m = m + 1 + var = var..string.sub(ALPHANUM, m, m) + sz = sz - 1 + end + end + var_new = var_new + 1 + return var, globaluniq[var] ~= nil +end + +---------------------------------------------------------------------- +-- calculate and print some statistics +-- * probably better in main source, put here for now +---------------------------------------------------------------------- + +local function stats_summary(globaluniq, localuniq, afteruniq, option) + local fmt = string.format + local opt_details = option.DETAILS + local uniq_g , uniq_li, uniq_lo, uniq_ti, uniq_to, -- stats needed + decl_g, decl_li, decl_lo, decl_ti, decl_to, + token_g, token_li, token_lo, token_ti, token_to, + size_g, size_li, size_lo, size_ti, size_to + = 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 + local function avg(c, l) -- safe average function + if c == 0 then return 0 end + return l / c + end + -------------------------------------------------------------------- + -- collect statistics (note: globals do not have declarations!) + -------------------------------------------------------------------- + for name, uniq in pairs(globaluniq) do + uniq_g = uniq_g + 1 + token_g = token_g + uniq.token + size_g = size_g + uniq.size + end + for name, uniq in pairs(localuniq) do + uniq_li = uniq_li + 1 + decl_li = decl_li + uniq.decl + token_li = token_li + uniq.token + size_li = size_li + uniq.size + end + for name, uniq in pairs(afteruniq) do + uniq_lo = uniq_lo + 1 + decl_lo = decl_lo + uniq.decl + token_lo = token_lo + uniq.token + size_lo = size_lo + uniq.size + end + uniq_ti = uniq_g + uniq_li + decl_ti = decl_g + decl_li + token_ti = token_g + token_li + size_ti = size_g + size_li + uniq_to = uniq_g + uniq_lo + decl_to = decl_g + decl_lo + token_to = token_g + token_lo + size_to = size_g + size_lo + -------------------------------------------------------------------- + -- detailed stats: global list + -------------------------------------------------------------------- + if opt_details then + local sorted = {} -- sort table of unique global names by size + for name, uniq in pairs(globaluniq) do + uniq.name = name + sorted[#sorted + 1] = uniq + end + table.sort(sorted, + function(v1, v2) + return v1.size > v2.size + end + ) + local tabf1, tabf2 = "%8s%8s%10s %s", "%8d%8d%10.2f %s" + local hl = string.rep("-", 44) + print("*** global variable list (sorted by size) ***\n"..hl) + print(fmt(tabf1, "Token", "Input", "Input", "Global")) + print(fmt(tabf1, "Count", "Bytes", "Average", "Name")) + print(hl) + for i = 1, #sorted do + local uniq = sorted[i] + print(fmt(tabf2, uniq.token, uniq.size, avg(uniq.token, uniq.size), uniq.name)) + end + print(hl) + print(fmt(tabf2, token_g, size_g, avg(token_g, size_g), "TOTAL")) + print(hl.."\n") + -------------------------------------------------------------------- + -- detailed stats: local list + -------------------------------------------------------------------- + local tabf1, tabf2 = "%8s%8s%8s%10s%8s%10s %s", "%8d%8d%8d%10.2f%8d%10.2f %s" + local hl = string.rep("-", 70) + print("*** local variable list (sorted by allocation order) ***\n"..hl) + print(fmt(tabf1, "Decl.", "Token", "Input", "Input", "Output", "Output", "Global")) + print(fmt(tabf1, "Count", "Count", "Bytes", "Average", "Bytes", "Average", "Name")) + print(hl) + for i = 1, #varlist do -- iterate according to order assigned + local name = varlist[i] + local uniq = afteruniq[name] + local old_t, old_s = 0, 0 + for j = 1, #localinfo do -- find corresponding old names and calculate + local obj = localinfo[j] + if obj.name == name then + old_t = old_t + obj.xcount + old_s = old_s + obj.xcount * #obj.oldname + end + end + print(fmt(tabf2, uniq.decl, uniq.token, old_s, avg(old_t, old_s), + uniq.size, avg(uniq.token, uniq.size), name)) + end + print(hl) + print(fmt(tabf2, decl_lo, token_lo, size_li, avg(token_li, size_li), + size_lo, avg(token_lo, size_lo), "TOTAL")) + print(hl.."\n") + end--if opt_details + -------------------------------------------------------------------- + -- display output + -------------------------------------------------------------------- + -- local tabf1, tabf2 = "%-16s%8s%8s%8s%8s%10s", "%-16s%8d%8d%8d%8d%10.2f" + -- local hl = string.rep("-", 58) + -- print("*** local variable optimization summary ***\n"..hl) + -- print(fmt(tabf1, "Variable", "Unique", "Decl.", "Token", "Size", "Average")) + -- print(fmt(tabf1, "Types", "Names", "Count", "Count", "Bytes", "Bytes")) + -- print(hl) + -- print(fmt(tabf2, "Global", uniq_g, decl_g, token_g, size_g, avg(token_g, size_g))) + -- print(hl) + -- print(fmt(tabf2, "Local (in)", uniq_li, decl_li, token_li, size_li, avg(token_li, size_li))) + -- print(fmt(tabf2, "TOTAL (in)", uniq_ti, decl_ti, token_ti, size_ti, avg(token_ti, size_ti))) + -- print(hl) + -- print(fmt(tabf2, "Local (out)", uniq_lo, decl_lo, token_lo, size_lo, avg(token_lo, size_lo))) + -- print(fmt(tabf2, "TOTAL (out)", uniq_to, decl_to, token_to, size_to, avg(token_to, size_to))) + -- print(hl.."\n") +end + +---------------------------------------------------------------------- +-- main entry point +-- * does only local variable optimization for now +---------------------------------------------------------------------- + +function base.optimize(option, _toklist, _seminfolist, _globalinfo, _localinfo) + -- set tables + toklist, seminfolist, globalinfo, localinfo + = _toklist, _seminfolist, _globalinfo, _localinfo + var_new = 0 -- reset variable name allocator + varlist = {} + ------------------------------------------------------------------ + -- preprocess global/local tables, handle entropy reduction + ------------------------------------------------------------------ + globaluniq = preprocess(globalinfo) + localuniq = preprocess(localinfo) + if option["opt-entropy"] then -- for entropy improvement + recalc_for_entropy(option) + end + ------------------------------------------------------------------ + -- build initial declared object table, then sort according to + -- token count, this might help assign more tokens to more common + -- variable names such as 'e' thus possibly reducing entropy + -- * an object knows its localinfo index via its 'id' field + -- * special handling for "self" special local (parameter) here + ------------------------------------------------------------------ + local object = {} + for i = 1, #localinfo do + object[i] = localinfo[i] + end + table.sort(object, -- sort largest first + function(v1, v2) + return v1.xcount > v2.xcount + end + ) + ------------------------------------------------------------------ + -- the special "self" function parameters must be preserved + -- * the allocator below will never use "self", so it is safe to + -- keep those implicit declarations as-is + ------------------------------------------------------------------ + local temp, j, gotself = {}, 1, false + for i = 1, #object do + local obj = object[i] + if not obj.isself then + temp[j] = obj + j = j + 1 + else + gotself = true + end + end + object = temp + ------------------------------------------------------------------ + -- a simple first-come first-served heuristic name allocator, + -- note that this is in no way optimal... + -- * each object is a local variable declaration plus existence + -- * the aim is to assign short names to as many tokens as possible, + -- so the following tries to maximize name reuse + -- * note that we preserve sort order + ------------------------------------------------------------------ + local nobject = #object + while nobject > 0 do + local varname, gcollide + repeat + varname, gcollide = new_var_name() -- collect a variable name + until not SKIP_NAME[varname] -- skip all special names + varlist[#varlist + 1] = varname -- keep a list + local oleft = nobject + ------------------------------------------------------------------ + -- if variable name collides with an existing global, the name + -- cannot be used by a local when the name is accessed as a global + -- during which the local is alive (between 'act' to 'rem'), so + -- we drop objects that collides with the corresponding global + ------------------------------------------------------------------ + if gcollide then + -- find the xref table of the global + local gref = globalinfo[globaluniq[varname].id].xref + local ngref = #gref + -- enumerate for all current objects; all are valid at this point + for i = 1, nobject do + local obj = object[i] + local act, rem = obj.act, obj.rem -- 'live' range of local + -- if rem < 0, it is a -id to a local that had the same name + -- so follow rem to extend it; does this make sense? + while rem < 0 do + rem = localinfo[-rem].rem + end + local drop + for j = 1, ngref do + local p = gref[j] + if p >= act and p <= rem then drop = true end -- in range? + end + if drop then + obj.skip = true + oleft = oleft - 1 + end + end--for + end--if gcollide + ------------------------------------------------------------------ + -- now the first unassigned local (since it's sorted) will be the + -- one with the most tokens to rename, so we set this one and then + -- eliminate all others that collides, then any locals that left + -- can then reuse the same variable name; this is repeated until + -- all local declaration that can use this name is assigned + -- * the criteria for local-local reuse/collision is: + -- A is the local with a name already assigned + -- B is the unassigned local under consideration + -- => anytime A is accessed, it cannot be when B is 'live' + -- => to speed up things, we have first/last accesses noted + ------------------------------------------------------------------ + while oleft > 0 do + local i = 1 + while object[i].skip do -- scan for first object + i = i + 1 + end + ------------------------------------------------------------------ + -- first object is free for assignment of the variable name + -- [first,last] gives the access range for collision checking + ------------------------------------------------------------------ + oleft = oleft - 1 + local obja = object[i] + i = i + 1 + obja.newname = varname + obja.skip = true + obja.done = true + local first, last = obja.first, obja.last + local xref = obja.xref + ------------------------------------------------------------------ + -- then, scan all the rest and drop those colliding + -- if A was never accessed then it'll never collide with anything + -- otherwise trivial skip if: + -- * B was activated after A's last access (last < act) + -- * B was removed before A's first access (first > rem) + -- if not, see detailed skip below... + ------------------------------------------------------------------ + if first and oleft > 0 then -- must have at least 1 access + local scanleft = oleft + while scanleft > 0 do + while object[i].skip do -- next valid object + i = i + 1 + end + scanleft = scanleft - 1 + local objb = object[i] + i = i + 1 + local act, rem = objb.act, objb.rem -- live range of B + -- if rem < 0, extend range of rem thru' following local + while rem < 0 do + rem = localinfo[-rem].rem + end + -------------------------------------------------------- + if not(last < act or first > rem) then -- possible collision + -------------------------------------------------------- + -- B is activated later than A or at the same statement, + -- this means for no collision, A cannot be accessed when B + -- is alive, since B overrides A (or is a peer) + -------------------------------------------------------- + if act >= obja.act then + for j = 1, obja.xcount do -- ... then check every access + local p = xref[j] + if p >= act and p <= rem then -- A accessed when B live! + oleft = oleft - 1 + objb.skip = true + break + end + end--for + -------------------------------------------------------- + -- A is activated later than B, this means for no collision, + -- A's access is okay since it overrides B, but B's last + -- access need to be earlier than A's activation time + -------------------------------------------------------- + else + if objb.last and objb.last >= obja.act then + oleft = oleft - 1 + objb.skip = true + end + end + end + -------------------------------------------------------- + if oleft == 0 then break end + end + end--if first + ------------------------------------------------------------------ + end--while + ------------------------------------------------------------------ + -- after assigning all possible locals to one variable name, the + -- unassigned locals/objects have the skip field reset and the table + -- is compacted, to hopefully reduce iteration time + ------------------------------------------------------------------ + local temp, j = {}, 1 + for i = 1, nobject do + local obj = object[i] + if not obj.done then + obj.skip = false + temp[j] = obj + j = j + 1 + end + end + object = temp -- new compacted object table + nobject = #object -- objects left to process + ------------------------------------------------------------------ + end--while + ------------------------------------------------------------------ + -- after assigning all locals with new variable names, we can + -- patch in the new names, and reprocess to get 'after' stats + ------------------------------------------------------------------ + for i = 1, #localinfo do -- enumerate all locals + local obj = localinfo[i] + local xref = obj.xref + if obj.newname then -- if got new name, patch it in + for j = 1, obj.xcount do + local p = xref[j] -- xrefs indexes the token list + seminfolist[p] = obj.newname + end + obj.name, obj.oldname -- adjust names + = obj.newname, obj.name + else + obj.oldname = obj.name -- for cases like 'self' + end + end + ------------------------------------------------------------------ + -- deal with statistics output + ------------------------------------------------------------------ + if gotself then -- add 'self' to end of list + varlist[#varlist + 1] = "self" + end + local afteruniq = preprocess(localinfo) + stats_summary(globaluniq, localuniq, afteruniq, option) + ------------------------------------------------------------------ +end + +return base diff --git a/AIO_Server/Dep_LuaSrcDiet/technotes.txt b/AIO_Server/Dep_LuaSrcDiet/technotes.txt new file mode 100644 index 0000000..c0bd84e --- /dev/null +++ b/AIO_Server/Dep_LuaSrcDiet/technotes.txt @@ -0,0 +1,361 @@ +Tech Notes for LuaSrcDiet +========================= + +The following are notes on the optimization process for easy reference. + + +Miscellaneous Ideas, TODO Stuff +=============================== + +Other Ideas: +(a) remove unused locals that can be removed in the source +(b) remove declarations using nil +(c) remove table constructor elements using nil +(d) extra optional semicolon removal +(e) extra comma or semicolon removal in table constructors +(f) special number forms: using ^ and * to shorten constants: 1^16 +(g) simple declaration of locals that can be merged: local a,b,c,d +(h) warn of opportunity for using a local to zap a bunch of globals +(i) warn of trailing whitespace in strings or long strings +(j) spaces to tabs in comments/long comments/long strings +(k) convert long strings to normal strings, vice versa +(l) simplify logical or relational operator expression + + +Modified Lexer Output +===================== + +The lexer is works almost exactly like llex.c in 'normal' Lua. Instead +of returning one token on each call, the lexer processes the entire +string (from an entire file) and returns. Two lists (tokens and semantic +information items) are set up in the module for use by the caller. + +For maximum flexibility during processing, the lexer returns non-grammar +lexical elements as tokens too. Non-grammar elements, such as comments, +whitespace, line endings, are classified along with 'normal' tokens. The +lexer classifies 7 kinds of grammar tokens and 4 kinds of non-grammar +tokens: + +--------------------------------------------------------------------- +TOKEN CLASS DESCRIPTION +--------------------------------------------------------------------- +"TK_KEYWORD" keywords +"TK_NAME" identifiers +"TK_NUMBER" numbers (unconverted, kept in original form) +"TK_STRING" strings (no translation is done, includes delimiters) +"TK_LSTRING" long strings (no translation is done, includes delimiters) +"TK_OP" operators and punctuation (most single-char, some double) +"TK_EOS" end-of-stream (there is only one for each file/stream) +--------------------------------------------------------------------- +"TK_SPACE" whitespace (generally, spaces, \t, \v and \f) +"TK_COMMENT" comments (includes delimiters, also includes special + first line shbang, which is handled specially in the + optimizer) +"TK_LCOMMENT" block comments (includes delimiters) +"TK_EOL" end-of-lines (excludes those embedded in strings) +--------------------------------------------------------------------- + + +Table for Lexer-Based Optimizations +=================================== + +We aim to keep lexer-based optimizations free of parser considerations, +i.e. we allow for generalized optimization of token sequences. The table +below considers the requirements for all combinations of significant +tokens. Other tokens are whitespace-like. Comments can be considered to +be a special kind of whitespace, e.g. a short comment needs to have a +following EOL token, if we do not want to optimize away short comments. + +FIRST SECOND TOKEN +TOKEN | + | V + V Keyword Name Number String LString Oper +-------------------------------------------------------- +Keyword [S] [S] [S] 0 0 0 +Name [S] [S] [S] 0 0 0 +Number [S] [S] [S] 0 0 [1] +String 0 0 0 0 0 0 +LString 0 0 0 0 0 0 +Oper 0 0 [1] 0 0 [2] +-------------------------------------------------------- + +[S] = need at least one whitespace (set as either a space or keep EOL) + +[1] = need a space if operator is a '.', all others okay; a '+' or '-' + is used as part of a floating-point spec, but there does not + appear to be any way of creating a float by joining with number + with a a '+' or '-' plus another number, because an 'e' has to + be somewhere in the first token, this can't be done + +[2] = normally there cannot be consecutive operators, but we plan to + allow for generalized optimization of token sequences, i.e. even + sequences that are grammatically illegal; so disallow adjacent + operators if: + (a) the first is in [=<>] and the second is '=' + (b) disallow dot sequences to be adjacent, but "..." first okay + (c) disallow '[' followed by '=' or '[' (not optimal) + +Also, a minus '-' cannot preceed a Comment or LComment, because comments +start with a '--' prefix. Apart from that, all Comment or LComment +tokens can be set abut with a real token. + + +Sequence of Lexer-Based Optimization Process +============================================ + +*** TODO *** + + +Description of Locals Optimization +================================== + +VARIABLE TRACKING AND LOCAL VARIABLE RENAMING + +(A) TK_NAME token class considerations +-------------------------------------- + +A TK_NAME token means a number of things, and some of these cannot be +renamed. We are interested in the use of TK_NAME in the following: + + (a) global variable access + (b) local variable declaration, includes local statements, local + functions, function parameters, implicit "self" local, etc. + (c) local variable access, including upvalue access + +TK_NAME is also used in parts of grammar as constant strings -- these +tokens cannot be optimized without user assistance. These include: + + (d) as the key in key=value pairs in table construction + (e) as field or method names in a:b or a.b syntax forms + +For local variable name optimization, we do not need to consider (d) and +(e), and while global variables cannot be renamed (since we do not have +support for user assistance), they need to be considered as part of +Lua's variable access scheme. + +(B) Lifetime of a local variable +-------------------------------- + +Take the following example: + + local string, table = string, table + +In the example, the two locals are assigned the values of the globals +with the same names. Therefore, when Lua encounters the declaration +portion: + + local string, table + +The parser cannot immediately make the two local variable available to +following code. In the parser and code generator, locals are inactive +when its entry is created. They are activated only when the function +adjustlocalvars() is called to activate the appropriate local variables. + +In the example, the two local variables are activated only after the +whole statement has been parsed, that is, after the last "table" token. +Hence, the statement works as expected. Also, once the two local +variables goes out of scope, removevars() is called to deactivate them, +allowing other variables of the same name to become visible again. + +Another example worth mentioning is: + + local a, a, a, = 1, 2, 3 + +The above will assign 3 to 'a'. + +Thus, when optimizing local variable names, (1) we need to consider +accesses of global variable names affecting the namespace, (2) for the +local variable names themselves, we need to consider when they are +declared, activated and removed, and (3) within the 'live' time of +locals, we need to know when they are accessed (since locals that are +never accessed don't really matter.) + +(C) Local variable tracking +--------------------------- + +Every local variable declaration is considered an object to be renamed. + +From the parser, we have the original name of the local variable, the +token positions for declaration, activation and removal, and the token +position for all the TK_NAME tokens which references this local. All +instances of the implicit "self" local variable are flagged as such. + +In addition to local variable information, all global variable accesses +are tabled, one object entry for one name, and each object has a +corresponding list of token positions for the TK_NAME tokens, which is +where the global variables were accessed. + +The key criteria is: Our act of renaming cannot change the visibility of +any of these locals and globals at the time they are accessed. + +Of course, if every variable has a unique name, then there is no need +for a name allocation algorithm, as there will be no conflict. But, in +order to maximize utilization of short identifier names, we want to +reuse the names as much as possible. In addition, fewer names will +likely reduce symbol entropy and may slightly improve compressibility of +the source code. + +(D) Name allocation theory +-------------------------- + +To understand the renaming algorithm, first we need to establish how +different local and global variables can operate happily without +interfering with each other. + +Consider three objects, local object A, local object B and global object +G. A and B involve declaration, activation and removal, and within the +period it is active, there may be zero or more accesses of the local. +For G, there are only global variable accesses to look into. + +Assume that we have assigned a new name to A and we wish to consider its +effects on other locals and globals, for which we choose B and G as +examples. We assume local B has not been assigned a new name as we +expect our algorithm to take care of collisions. + +A's lifetime is something like this: + + Decl Act Rem + + +-------------------------------+ + ------------------------------------------------- + +where 'Decl' is the time of declaration, 'Act' is the time of +activation, and 'Rem' is the time of removal. Between 'Act' and 'Rem', +the local is alive or 'live' and Lua can see it if its corresponding +TK_NAME identifier comes up. + + Decl Act Rem + + +-------------------------------+ + ------------------------------------------------- + * * * * + (1) (2) (3) (4) + +Recall that the key criteria is to not change the visibility of globals +and locals. Consider local and global accesses at (1), (2), (3) and (4). + +A global G of the same name as A will only collide at (3), where Lua +will see A and not G. Since G must be accessed at (3) according to what +the parser says, and we cannot modify the positions of 'Decl', 'Act' and +'Rem', it follows that A cannot have the same name as G. + + Decl Act Rem + + +-----------------------+ + --------------------------------- + (1)+ +---+ (2)+ +---+ (3)+ +---+ (4)+ +---+ + --------- --------- --------- --------- + +For the case of A and B having the same names and colliding, consider +the cases for which B is at (1), (2), (3) or (4) in the above. + +(1) and (4) means that A and B are completely isolated from each other, +hence in the two cases, A and B can safely use the same variable names. +To be specific, since we have assigned A, B is considered completely +isolated from A if B's Activation-to-Removal period is isolated from +the time of A's first access to last access, meaning B's active time +will never affect any of A's accesses. + +For (2) and (3), we have two cases where we need to consider which one +has been activated first. For (2), B is active before A, so A cannot +impose on B. But A's accesses are valid while B is active, since A can +override B. For no collision in the case of (2), we simply need to +ensure that the last access of B occurs before A is activated. + +For (3), B is activated before A, hence B can override A's accesses. For +no collision, all of A's accesses cannot happen while B is active. Thus +position (3) follows the "A is never accessed when B is active" rule in +a general way. Local variables of a child function are in the position +of (3). To illustrate, the local B can use the same name as local A and +live in a child function or block scope if each time A is accessed, Lua +sees A and not B. So we have to check all accesses of A and see whether +they collide with the active period of B. Now if A was never accessed, +then B can be active anywhere. + +The above appears to resolve all sorts of cases where the active times +of A and B overlap. If there is a more simple scheme, do let me know. +Note that in the above, the allocator does not need to know how locals +are separated according to function prototypes. Perhaps the allocator +can be simplified if knowledge of function structure is utilized. + +(E) Name allocation algorithm +----------------------------- + +To begin with, the name generator is mostly separate from the name +allocation algorithm. The name generator returns the next shortest name +for the algorithm to apply to local variables. To attempt to reduce +symbol entropy (which benefit compression algorithms), the name +generator follows English frequent letter usage. Later, there may be an +option to calculate an actual symbol entropy table from the input data. + +Since there are 53 one-character identifiers and (53*63-4) two-character +identifiers (minus a few keywords), there isn't a pressing need to +optimally maximize name reuse. Sample files show that we can eventually +get 20 tokens per identifier name, thus a source file can have over 1000 +local variable tokens that are all single character in length. + +In theory, we should need no more than 260 local identifiers by default. +Why? Since LUAI_MAXVARS is 200 and LUAI_MAXUPVALUES is 60, at any block +scope, there can be at most (LUAI_MAXVARS + LUAI_MAXUPVALUES) locals +referenced, or 260. Also, those from outer scopes not referenced in +inner scopes can reuse identifiers. The net effect of this is that a +local variable name allocation method should not allocate more than 260 +identifier names for locals. + +The current algorithm is a simple first-come first-served scheme: + + (a) One local object that use the most tokens is named first. + (b) Any other non-conflicting locals with respect to the first + object are assigned the same name. + (c) Assigned locals are removed and the procedure is repeated for + objects that have not been assigned new names. (a) to (c) + repeats until no local objects are left. + +In addition, there are a few extra issues to take care of: + + (d) Implicit "self" locals that have been flagged as such are + already "assigned to" and so they are left unmodified. + (e) The name generator skips "self" to avoid conflicts. This + is not optimal but it is unlikely a script will use so many + local variables as to reach "self". + (f) Keywords are also skipped for the name generator. + (g) Global name conflict resolution. + +For (g), global name conflict resolution is handled just after the new +name is generated. The name can still be used for some locals even if it +conflicts with other locals. To remove conflicts, global variable +accesses for the particular identifier name is checked. Any local +variables that are active when a global access is made is marked to be +skipped. The rest of the local objects can then use that name. + +The algorithm has special handling for locals that use the same name in +the same scope. For example: + + local foo = 10 -- (1) + ... + local foo = 20 -- (2) + ... + print(e) + +Since we are considering name visibility, the first 'foo' does not +really cease to exist when the second 'foo' is declared, because if we +were to make that assumption, and the first 'foo' is removed before (2), +then I should be able to use 'e' as the name for the first 'foo' and +after (2), it should not conflict with variables in the outer scope +with the same name. To illustrate: + + local e = 10 -- 'foo ' renamed to 'e' + ... + local t = 20 -- error if we assumed 'e' removed here + ... + print(e) + +Since 'e' is a global in the example, we now have an error as the +name as been taken over by a local. Thus, the first 'foo' local must +have its active time extend to the end of the current scope. If there +is no conflict between the first and second 'foo', the algorithm may +still assign the same names to them. + +The current fix to deal with the above chains local objects in order to +find the removal position. Practically, the parser can be modified to +simplify this. + + +END. diff --git a/AIO_Server/Dep_Smallfolk/LICENSE.md b/AIO_Server/Dep_Smallfolk/LICENSE.md new file mode 100644 index 0000000..80a6bf1 --- /dev/null +++ b/AIO_Server/Dep_Smallfolk/LICENSE.md @@ -0,0 +1,20 @@ +Copyright (c) 2014 Robin Wellner + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. + diff --git a/AIO_Server/Dep_Smallfolk/README.md b/AIO_Server/Dep_Smallfolk/README.md new file mode 100644 index 0000000..06c8ae0 --- /dev/null +++ b/AIO_Server/Dep_Smallfolk/README.md @@ -0,0 +1,97 @@ +Smallfolk +========= + +Smallfolk is a reasonably fast, robust, richtly-featured table serialization +library for Lua. It was specifically written to allow complex data structures +to be loaded from unsafe sources for [LÖVE](http://love2d.org/) games, but can +be used anywhere. + +You use, distribute and extend Smallfolk under the terms of the MIT license. + +Usage +----- + +Smallfolk is very simple and easy to use: + +```lua +local smallfolk = require 'smallfolk' + +print(smallfolk.dumps({"Hello", world = true})) +print(smallfolk.loads('{"foo":"bar"}').foo) +-- prints: +-- {"Hello","world":t} +-- bar +``` + +Fast +---- + +Using Serpent's benchmark code, Smallfolk's serialization speed is comparable +to that of Ser (and Ser is 33% faster than Serpent). + +It should be noted that deserialization is much slower in Smallfolk than in +most other serialization libraries, because it parses the input itself instead +of handing it over to Lua. However, if you use LuaJIT this difference is much +less, and it is not noticable for small outputs. By default, Smallfolk rejects +inputs that are too large, to prevent DOS attacks. + +Robust +------ + +Sometimes you have strange, non-euclidean geometries in your table +constructions. It happens, I don't judge. Smallfolk can deal with that, where +some other serialization libraries (or anything that produces JSON) cry "Iä! +Iä! Cthulhu fhtagn!" and give up — or worse, silently produce incorrect +data. + +```lua +local smallfolk = require 'smallfolk' + +local cthulhu = {{}, {}, {}} +cthulhu.fhtagn = cthulhu +cthulhu[1][cthulhu[2]] = cthulhu[3] +cthulhu[2][cthulhu[1]] = cthulhu[2] +cthulhu[3][cthulhu[3]] = cthulhu +print(smallfolk.dumps(cthulhu)) +-- prints: +-- {{{@2:@3}:{@4:@1}},@3,@4,"fhtagn":@1} +``` + +Secure +------ + +Smallfolk doesn't run arbitrary Lua code, so you can safely use it when you +want to read data from an untrusted source. + +Compact +------- + +Smallfolk creates really small output files compared to something like Ser when +it encounters a lot of non-tree-like data, by using numbered references rather +than item assignment. + +Tested +------ + +Check out `tests.lua` to see how Smallfolk behaves with all kinds of inputs. + +Reference +--------- + +###`smallfolk.dumps(object)` + +Returns an 8-bit string representation of `object`. Throws an error if `object` +contains any types that cannot be serialised (userdata, functions and threads). + +###`smallfolk.loads(string[, maxsize=10000])` + +Returns an object whose representation would be `string`. If the length of +`string` is larger than `maxsize`, no deserialization is attempted and instead +an error is thrown. If `string` is not a valid representation of any object, +an error is thrown. + +See also +-------- + +* [Ser](https://github.com/gvx/Ser): for trusted-source serialization +* [Lady](https://github.com/gvx/Lady): for trusted-source savegames diff --git a/AIO_Server/Dep_Smallfolk/smallfolk.lua b/AIO_Server/Dep_Smallfolk/smallfolk.lua new file mode 100644 index 0000000..4e75a1b --- /dev/null +++ b/AIO_Server/Dep_Smallfolk/smallfolk.lua @@ -0,0 +1,218 @@ +local M = {} +Smallfolk = M +local expect_object, dump_object +local error, tostring, pairs, type, floor, huge, concat = error, tostring, pairs, type, math.floor, math.huge, table.concat + +local dump_type = {} + +function dump_type:string(nmemo, memo, acc) + local nacc = #acc + acc[nacc + 1] = '"' + acc[nacc + 2] = self:gsub('"', '""') + acc[nacc + 3] = '"' + return nmemo +end + +function dump_type:number(nmemo, memo, acc) + acc[#acc + 1] = ("%.17g"):format(self) + return nmemo +end + +function dump_type:table(nmemo, memo, acc) + --[[ + if memo[self] then + acc[#acc + 1] = '@' + acc[#acc + 1] = tostring(memo[self]) + return nmemo + end + nmemo = nmemo + 1 + ]] + memo[self] = nmemo + acc[#acc + 1] = '{' + local nself = #self + for i = 1, nself do -- don't use ipairs here, we need the gaps + nmemo = dump_object(self[i], nmemo, memo, acc) + acc[#acc + 1] = ',' + end + for k, v in pairs(self) do + if type(k) ~= 'number' or floor(k) ~= k or k < 1 or k > nself then + nmemo = dump_object(k, nmemo, memo, acc) + acc[#acc + 1] = ':' + nmemo = dump_object(v, nmemo, memo, acc) + acc[#acc + 1] = ',' + end + end + acc[#acc] = acc[#acc] == '{' and '{}' or '}' + return nmemo +end + +function dump_object(object, nmemo, memo, acc) + if object == true then + acc[#acc + 1] = 't' + elseif object == false then + acc[#acc + 1] = 'f' + elseif object == nil then + acc[#acc + 1] = 'n' + elseif object ~= object then + if (''..object):sub(1,1) == '-' then + acc[#acc + 1] = 'N' + else + acc[#acc + 1] = 'Q' + end + elseif object == huge then + acc[#acc + 1] = 'I' + elseif object == -huge then + acc[#acc + 1] = 'i' + else + local t = type(object) + if not dump_type[t] then + error('cannot dump type ' .. t) + end + return dump_type[t](object, nmemo, memo, acc) + end + return nmemo +end + +function M.dumps(object) + local nmemo = 0 + local memo = {} + local acc = {} + dump_object(object, nmemo, memo, acc) + return concat(acc) +end + +local function invalid(i) + error('invalid input at position ' .. i) +end + +local nonzero_digit = {['1'] = true, ['2'] = true, ['3'] = true, ['4'] = true, ['5'] = true, ['6'] = true, ['7'] = true, ['8'] = true, ['9'] = true} +local is_digit = {['0'] = true, ['1'] = true, ['2'] = true, ['3'] = true, ['4'] = true, ['5'] = true, ['6'] = true, ['7'] = true, ['8'] = true, ['9'] = true} +local function expect_number(string, start) + local i = start + local head = string:sub(i, i) + if head == '-' then + i = i + 1 + head = string:sub(i, i) + end + if nonzero_digit[head] then + repeat + i = i + 1 + head = string:sub(i, i) + until not is_digit[head] + elseif head == '0' then + i = i + 1 + head = string:sub(i, i) + else + invalid(i) + end + if head == '.' then + local oldi = i + repeat + i = i + 1 + head = string:sub(i, i) + until not is_digit[head] + if i == oldi + 1 then + invalid(i) + end + end + if head == 'e' or head == 'E' then + i = i + 1 + head = string:sub(i, i) + if head == '+' or head == '-' then + i = i + 1 + head = string:sub(i, i) + end + if not is_digit[head] then + invalid(i) + end + repeat + i = i + 1 + head = string:sub(i, i) + until not is_digit[head] + end + return tonumber(string:sub(start, i - 1)), i +end + +local expect_object_head = { + t = function(string, i) return true, i end, + f = function(string, i) return false, i end, + n = function(string, i) return nil, i end, + Q = function(string, i) return -(0/0), i end, + N = function(string, i) return 0/0, i end, + I = function(string, i) return 1/0, i end, + i = function(string, i) return -1/0, i end, + ['"'] = function(string, i) + local nexti = i - 1 + repeat + nexti = string:find('"', nexti + 1, true) + 1 + until string:sub(nexti, nexti) ~= '"' + return string:sub(i, nexti - 2):gsub('""', '"'), nexti + end, + ['0'] = function(string, i) + return expect_number(string, i - 1) + end, + ['{'] = function(string, i, tables) + local nt, k, v = {} + local j = 1 + tables[#tables + 1] = nt + if string:sub(i, i) == '}' then + return nt, i + 1 + end + while true do + k, i = expect_object(string, i, tables) + if string:sub(i, i) == ':' then + v, i = expect_object(string, i + 1, tables) + nt[k] = v + else + nt[j] = k + j = j + 1 + end + local head = string:sub(i, i) + if head == ',' then + i = i + 1 + elseif head == '}' then + return nt, i + 1 + else + invalid(i) + end + end + end, + --[[ + ['@'] = function(string, i, tables) + local match = string:match('^%d+', i) + local ref = tonumber(match) + if tables[ref] then + return tables[ref], i + #match + end + invalid(i) + end, + ]] +} +expect_object_head['1'] = expect_object_head['0'] +expect_object_head['2'] = expect_object_head['0'] +expect_object_head['3'] = expect_object_head['0'] +expect_object_head['4'] = expect_object_head['0'] +expect_object_head['5'] = expect_object_head['0'] +expect_object_head['6'] = expect_object_head['0'] +expect_object_head['7'] = expect_object_head['0'] +expect_object_head['8'] = expect_object_head['0'] +expect_object_head['9'] = expect_object_head['0'] +expect_object_head['-'] = expect_object_head['0'] +expect_object_head['.'] = expect_object_head['0'] + +expect_object = function(string, i, tables) + local head = string:sub(i, i) + if expect_object_head[head] then + return expect_object_head[head](string, i + 1, tables) + end + invalid(i) +end + +function M.loads(string, maxsize) + if #string > (maxsize or 10000) then + error 'input too large' + end + return (expect_object(string, 1, {})) +end + +return M diff --git a/AIO_Server/Dep_crc32lua/COPYRIGHT b/AIO_Server/Dep_crc32lua/COPYRIGHT new file mode 100644 index 0000000..c42dee0 --- /dev/null +++ b/AIO_Server/Dep_crc32lua/COPYRIGHT @@ -0,0 +1,25 @@ +lua-digest-crc32lua License + +=============================================================================== + +Copyright (C) 2008, David Manura. + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. + +=============================================================================== diff --git a/AIO_Server/Dep_crc32lua/crc32lua.lua b/AIO_Server/Dep_crc32lua/crc32lua.lua new file mode 100644 index 0000000..9099844 --- /dev/null +++ b/AIO_Server/Dep_crc32lua/crc32lua.lua @@ -0,0 +1,207 @@ +--[[ + +LUA MODULE + + digest.crc32 - CRC-32 checksum implemented entirely in Lua. + +SYNOPSIS + + local CRC = require 'digest.crc32lua' + print(CRC.crc32 'test') --> 0xD87F7E0C or -662733300 + + assert(CRC.crc32('st', CRC.crc32('te')) == CRC.crc32 'test') + +DESCRIPTION + + This can be used to compute CRC-32 checksums on strings. + This is similar to [1-2]. + +API + + Note: in the functions below, checksums are 32-bit integers stored in + numbers. The number format currently depends on the bit + implementation--see DESIGN NOTES below. + + CRC.crc32_byte(byte [, crc]) --> rcrc + + Returns CRC-32 checksum `rcrc` of byte `byte` (number 0..255) appended to + a string with CRC-32 checksum `crc`. `crc` defaults to 0 (empty string) + if omitted. + + CRC.crc32_string(s, crc) --> bcrc + + Returns CRC-32 checksum `rcrc` of string `s` appended to + a string with CRC-32 checksum `crc`. `crc` defaults to 0 (empty string) + if omitted. + + CRC.crc32(o, crc) --> bcrc + + This invokes `crc32_byte` if `o` is a byte or `crc32_string` if `o` + is a string. + + CRC.bit + + This contains the underlying bit library used by the module. It + should be considered a read-only copy. + +DESIGN NOTES + + Currently, this module exposes the underlying bit array implementation in CRC + checksums returned. In BitOp, bit arrays are 32-bit signed integer numbers + (may be negative). In Lua 5.2 'bit32' and 'bit.numberlua', bit arrays are + 32-bit unsigned integer numbers (non-negative). This is subject to change + in the future but is currently done due to (unconfirmed) performance + implications. + + On platforms with 64-bit numbers, one way to normalize CRC + checksums to be unsigned is to do `crcvalue % 2^32`, + + The name of this module is inspired by Perl `Digest::CRC*`. + +DEPENDENCIES + + Requires one of the following bit libraries: + + BitOp "bit" -- bitop.luajit.org -- This is included in LuaJIT and also available + for Lua 5.1/5.2. This provides the fastest performance in LuaJIT. + Lua 5.2 "bit32" -- www.lua.org/manual/5.2 -- This is provided in Lua 5.2 + and is preferred in 5.2 (unless "bit" also happens to be installed). + "bit.numberlua" (>=000.003) -- https://github.com/davidm/lua-bit-numberlua + This is slowest and used as a last resort. + It is only a few times slower than "bit32" though. + +DOWNLOAD/INSTALLATION + + If using LuaRocks: + luarocks install lua-digest-crc32lua + + Otherwise, download . + Alternately, if using git: + git clone git://github.com/davidm/lua-digest-crc32lua.git + cd lua-digest-crc32lua + Optionally unpack: + ./util.mk + or unpack and install in LuaRocks: + ./util.mk install + +REFERENCES + + [1] http://www.axlradius.com/freestuff/CRC32.java + [2] http://www.gamedev.net/reference/articles/article1941.asp + [3] http://java.sun.com/j2se/1.5.0/docs/api/java/util/zip/CRC32.html + [4] http://www.dsource.org/projects/tango/docs/current/tango.io.digest.Crc32.html + [5] http://pydoc.org/1.5.2/zlib.html#-crc32 + [6] http://www.python.org/doc/2.5.2/lib/module-binascii.html + +LICENSE + + (c) 2008-2011 David Manura. Licensed under the same terms as Lua (MIT). + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated documentation files (the "Software"), to deal + in the Software without restriction, including without limitation the rights + to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + copies of the Software, and to permit persons to whom the Software is + furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in + all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + THE SOFTWARE. + (end license) + +--]] + + +local M = {_TYPE='module', _NAME='digest.crc32', _VERSION='0.3.20111128'} + +local type = type +local require = require +local setmetatable = setmetatable + +--[[ + Requires the first module listed that exists, else raises like `require`. + If a non-string is encountered, it is returned. + Second return value is module name loaded (or ''). + --]] +local function requireany(...) + local errs = {} + for _,name in ipairs{...} do + if type(name) ~= 'string' then return name, '' end + local ok, mod = pcall(require, name) + if ok then return mod, name end + errs[#errs+1] = mod + end + error(table.concat(errs, '\n'), 2) +end + +local bit, name_ = requireany('bit', 'bit32', 'bit.numberlua', 'bit53') +local bxor = bit.bxor +local bnot = bit.bnot +local band = bit.band +local rshift = bit.rshift + +-- CRC-32-IEEE 802.3 (V.42) +local POLY = 0xEDB88320 + +-- Memoize function pattern (like http://lua-users.org/wiki/FuncTables ). +local function memoize(f) + local mt = {} + local t = setmetatable({}, mt) + function mt:__index(k) + local v = f(k); t[k] = v + return v + end + return t +end + +-- CRC table. +local crc_table = memoize(function(i) + local crc = i + for _=1,8 do + local b = band(crc, 1) + crc = rshift(crc, 1) + if b == 1 then crc = bxor(crc, POLY) end + end + return crc +end) + + +function M.crc32_byte(byte, crc) + crc = bnot(crc or 0) + local v1 = rshift(crc, 8) + local v2 = crc_table[bxor(crc % 256, byte)] + return bnot(bxor(v1, v2)) +end +local M_crc32_byte = M.crc32_byte + + +function M.crc32_string(s, crc) + crc = crc or 0 + for i=1,#s do + crc = M_crc32_byte(s:byte(i), crc) + end + return crc +end +local M_crc32_string = M.crc32_string + + +function M.crc32(s, crc) + if type(s) == 'string' then + return M_crc32_string(s, crc) + else + return M_crc32_byte(s, crc) + end +end + + +M.bit = bit -- bit library used + + +return M diff --git a/AIO_Server/LibCompress.lua b/AIO_Server/LibCompress.lua new file mode 100644 index 0000000..8929d49 --- /dev/null +++ b/AIO_Server/LibCompress.lua @@ -0,0 +1,127 @@ +-- LibCompress.lua +-- +-- Authors: jjsheets and Galmok of European Stormrage (Horde) +-- Email: sheets.jeff@gmail.com and galmok@gmail.com +-- Licence: GPL version 2 (General Public License) +-- +-- Hacked severely by Taehl (SelfMadeSpirit@gmail.com) +---------------------------------------------------------------------------------- + +assert(not TLibCompress, "LibCompress already loaded. Possibly loading different versions of LibCompress") + +TLibCompress = {} + +local assert = assert +local type = type +local unpack = unpack or table.unpack +local tconcat = table.concat +local schar = string.char +local ssub = string.sub +local sbyte = string.byte +local mmodf = math.modf +local floor = floor or math.floor + +local function encode(x) + local bytes = {} + local xmod + repeat + x, xmod = mmodf(x/255) + xmod = xmod * 255 + bytes[#bytes + 1] = xmod + until x <= 0 + if #bytes == 1 and bytes[1] > 0 and bytes[1] < 250 then + return schar(bytes[1]) + else + for i = 1, #bytes do bytes[i] = bytes[i] + 1 end + return schar(256 - #bytes, unpack(bytes)) + end +end + +local function decode(ss,i) + i = i or 1 + local a = sbyte(ss,i,i) + if a > 249 then + local r = 0 + a = 256 - a + for n = i+a, i+1, -1 do + r = r * 255 + sbyte(ss,n,n) - 1 + end + return r, a + 1 + else + return a, 1 + end +end + +function TLibCompress.CompressLZW(uncompressed) + assert(type(uncompressed) == 'string') + local result = {'\222'} + local ressize = 1 + local w = '' + local dict = {} + local dict_size = 256 + for i = 0, 255 do + dict[schar(i)] = i + end + for i = 1, #uncompressed do + local c = ssub(uncompressed,i,i) + local wc = w..c + if dict[wc] then + w = wc + else + dict[wc] = dict_size + dict_size = dict_size +1 + local r = encode(dict[w]) + ressize = ressize + #r + result[#result + 1] = r + w = c + end + end + if w then + local r = encode(dict[w]) + ressize = ressize + #r + result[#result + 1] = r + end + if (#uncompressed+1) > ressize then + return tconcat(result) + else + return '\1'..uncompressed + end +end + +function TLibCompress.DecompressLZW(compressed) + assert(type(compressed) == 'string') + local UC + UC, compressed = ssub(compressed,1,1), ssub(compressed, 2) + if UC == '\1' then + return compressed + end + if UC ~= "\222" then + return nil, "Can only decompress LZW compressed data ("..tostring(UC)..")" + end + local dict_size = 256 + local dict = {} + for i = 0, 255 do + dict[i] = schar(i) + end + local result = {} + local t = 1 + local delta, k + k, delta = decode(compressed,t) + t = t + delta + result[#result+1] = dict[k] + local w = dict[k] + local entry + local csize = #compressed + while t <= csize do + k, delta = decode(compressed,t) + t = t + delta + entry = dict[k] or (w..ssub(w,1,1)) + result[#result+1] = entry + dict[dict_size] = w..ssub(entry,1,1) + dict_size = dict_size + 1 + w = entry + end + return tconcat(result) +end + +return TLibCompress diff --git a/AIO_Server/bit53.lua b/AIO_Server/bit53.lua new file mode 100644 index 0000000..2b5ae2d --- /dev/null +++ b/AIO_Server/bit53.lua @@ -0,0 +1,29 @@ +-- Provides compatibility for scripts using bit libs for lua versions < 5.3 +-- Using load to avoid errors when having this file in earlier lua sources than 5.3 + +-- check that lua version is higher or equal to 5.3 +local MIN_LUA_VER = 5.3 +if tonumber(_VERSION:match("%d+%.?%d*")) >= MIN_LUA_VER then + return assert(assert(load( [[ + local bit53 = {} + function bit53.band(a,b) + return a&b + end + function bit53.bor(a,b) + return a|b + end + function bit53.bxor(a,b) + return a~b + end + function bit53.bnot(a) + return ~a + end + function bit53.lshift(a, b) + return a<>b + end + return bit53 + ]], "bit53" ))()) +end diff --git a/AIO_Server/queue.lua b/AIO_Server/queue.lua new file mode 100644 index 0000000..6c54e6b --- /dev/null +++ b/AIO_Server/queue.lua @@ -0,0 +1,83 @@ +local Queue = {} +function Queue.__index(que, key) + return Queue[key] +end + +function NewQueue() + local t = {first = 0, last = -1} + setmetatable(t, Queue) + return t +end + +function Queue.pushleft(que, value) + local first = que.first - 1 + que.first = first + que[first] = value + return first +end + +function Queue.pushright(que, value) + local last = que.last + 1 + que.last = last + que[last] = value + return last +end + +function Queue.popleft(que) + local first = que.first + if first > que.last then error("que is empty") end + local value = que[first] + que[first] = nil -- to allow garbage collection + que.first = first + 1 + return value +end + +function Queue.popright(que) + local last = que.last + if que.first > last then error("que is empty") end + local value = que[last] + que[last] = nil -- to allow garbage collection + que.last = last - 1 + return value +end + +function Queue.peekleft(que) + return que[que.first] +end + +function Queue.peekright(que) + return que[que.last] +end + +function Queue.empty(que) + return que.last < que.first +end + +function Queue.size(que) + return que.last - que.first + 1 +end + +function Queue.clear(que) + local l, r = self:getrange() + for i = l, r do + que[idx] = nil + end + que.first, que.last = 0, -1 +end + +function Queue.get(que, idx) + if idx < que.first or idx > que.last then + return + end + return que[idx] +end + +function Queue.getrange(que) + return que.first, que.last +end + +function Queue.gettable(que) + return que +end + +return NewQueue diff --git a/DatatypeCheckFunction.lua b/DatatypeCheckFunction.lua new file mode 100644 index 0000000..047934e --- /dev/null +++ b/DatatypeCheckFunction.lua @@ -0,0 +1,63 @@ +--[[LIST OF FUNCTIONS WE HAVE client->Server for this protection to be enabled. +TheClassMaskingSolution/TooltipCorrectorServer.lua +tTHandler.HasSpellID(player, spellid) -- done +tTHandler.CostGrabber(player, spellid) -- done + +EnchantReRoll/EnchantReRollS.lua +MyHandlers.ReforgeItem(player,bag,slot) -- done +MyHandlers.ReforgeItem_Prep(player,bag,slot) -- done +MyHandlers.SetItem(player,bag,slot) -- done + +extra_buttons_bar/ServerEBB.lua +MyHandlers.AddStats(player, stat, s_amount) -- done +MyHandlers.ReduceStats(player, stat, s_amount) -- done +MyHandlers.SendAmountOfSpells(player, class, Spec) -- done +MyHandlers.GetAllBGs(player, ClassSpec) -- done +MyHandlers.LearnThisTalent(player, attached_talent, indexAt,ClassSpec) -- done +MyHandlers.UnLearnThisTalent(player, attached_talent, indexAt,ClassSpec) +MyHandlers.LearnThisSpell(player, got_spell, i,class,spec) -- done +MyHandlers.UnLearnThisSpell(player, got_spell, i,class,spec) -- done + +hardcore_pvp/PvPServer.lua +MyHandlers.AddPlayerItem(player, itemEntry, itemCount, object) -- done +]]-- +local valid_types = { + ["nil"] = true, + ["number"] = true, + ["string"] = true, + ["boolean"] = true, + ["table"] = true, + ["function"] = true, + ["thread"] = true, + ["userdata"] = true, +} + function DataTypeCheck(fmt, args) + for k, expected in pairs(fmt) do + local exp_type = type(expected) + if exp_type == "string" then + assert(valid_types[expected], "invalid type in fmt: "..tostring(expected)) + local typ = type(args[k]) + if typ ~= expected then + return false, string.format("%s was of type %s, %s expected", tostring(k), typ, expected) + end + elseif exp_type == "table" then + local typ = type(args[k]) + if typ ~= exp_type then + return false, string.format("%s was of type %s, %s expected", tostring(k), typ, exp_type) + end + local succ, err = DataTypeCheck(expected, args[k]) + if not succ then + return succ, err + end + else + error("unknown expecatation in fmt: "..tostring(expected)) + end + end + return true +end + + +--[[some example usage +local fmt = {"number", "string", {}, {"number", "string", ke = {}}} +local arg = {1, "asd", {}, {1,"str", ke = {}}} +print(DataTypeCheck(fmt, arg))]]-- \ No newline at end of file diff --git a/Dungeons/AoEDamage.lua~ b/Dungeons/AoEDamage.lua~ new file mode 100644 index 0000000..c124182 --- /dev/null +++ b/Dungeons/AoEDamage.lua~ @@ -0,0 +1,30 @@ +--[[local dmg = 0 + +local function Apply(eventId, delay, repeats, creature) + local people = creature:GetUnfriendlyUnitsInRange(100) + local hp2 = creature:GetHealth() + local dmg = hp1 - hp2 + for x=1,#people,1 do + people[x]:DealDamage(people[x], dmg, true, 6) + SendWorldMessage("damage applied") + end + SendWorldMessage("Hp2 is " ..hp2.. ".") + SendWorldMessage("dmg is " ..dmg.. ".") + creature:AddAura(20217, creature) +end + +local function AoE(event, creature, attacker, damage) + if creature:HasAura(465) == true and creature:HasAura(20217) == false then + creature:RegisterEvent(Apply, 10000, 1) + attacker:SendBroadcastMessage("applied event") + creature:AddAura(20217, creature) + hp1 = creature:GetHealth() + attacker:SendBroadcastMessage("current hp is " ..hp1.. ".") + end +end--]] + +local function AoE(event, creature, attacker, damage) + attacker:SendBroadcastMessage("LUA is working.") +end + +RegisterCreatureEvent( 12264, 9, AoE ) \ No newline at end of file diff --git a/Dungeons/Buff.lua b/Dungeons/Buff.lua new file mode 100644 index 0000000..081d63a --- /dev/null +++ b/Dungeons/Buff.lua @@ -0,0 +1,132 @@ +--[[local function Redo(eventId, delay, repeats, player) + Buff(event, player) + --DEBUG--player:SendBroadcastMessage("test") +end + +local timing = false + +function Buff(event, player) + -- query to select spell and map + local Buff1 = WorldDBQuery("SELECT map, spell FROM instance_buff WHERE map = " ..player:GetMapId().. ";") + if (Buff1 ~= nil) then + --so we dont dupe the same timer 100000 times + if (timing == false) then + player:RegisterEvent(Redo, 60000, 0) + --DEBUG--player:SendBroadcastMessage("timing now") + timing = true + end + local mobs = player:GetCreaturesInRange(533) + local buffspell = {} + for z=1,Buff1:GetRowCount(),1 do + buffspell[z] = Buff1:GetInt32(1) + Buff1:NextRow() + end + -- add aura based on DB query above and loop for mobs in range + for x=1,#mobs,1 do + for y=1,#buffspell,1 do + -- checks for aura first, then possible pet, then for player + if (mobs[x]:HasAura(buffspell[y]) == false) and (mobs[x]:GetPetGUID() == nil) and (mobs[x]:HasSpell(818011) == false) then + mobs[x]:AddAura(buffspell[y], mobs[x]) + end + end + end + else + -- do this because they arent in a buffed instance + timing = false + --DEBUG--player:SendBroadcastMessage("stopped timing") + end +end + +RegisterPlayerEvent(28, Buff)]]-- + +-- my edit of this script -- Need to be tested -- +local instance_buff = { + +[43]={966010}, -- WC +[389]={966010}, -- RFC +[36]={966010}, -- Deadmines +[33]={966011}, -- SFK +[48]={966011}, -- BFD +[34]={966011}, -- Stockades +[90]={966012}, -- Gnomer +[47]={966012}, -- RFK +[189]={966012}, -- SM +[129]={966013}, -- RFD +[70]={966013}, -- Uld +[209]={966013}, -- ZF +[349]={966013}, -- Mara +[109]={966014}, -- ST +[230]={966014}, -- BRD +[229]={966016}, -- Scholo +[429]={966016}, -- DM +[329]={966016}, -- Strat +[289]={966015}, -- BRS +[409]={966019}, -- MC +[249]={966020}, -- Onyxias Lair +[309]={966022}, -- Zul'Gurub +[469]={966021}, -- Blackwing Lair +[509]={966021}, -- AQ20 +[531]={966024}, -- AQ40 +[533]={966025}, -- Naxx + + + +} +local instance_flag_buff = 966026 + +local function Instance_Buff(event,player,enemy) + if not(enemy:ToCreature()) then + return false + end + + if (enemy:HasAura(instance_flag_buff)) then -- flag check + return false + end + + local Instance_Map = player:GetMap() + local Instance_Creatures_ToBuff = {} + local Instance_Buffs = {} + + if not(Instance_Map:IsDungeon()) and not(Instance_Map:IsRaid()) then + return false + end + + Instance_Buffs = instance_buff[Instance_Map:GetMapId()] + + if not(Instance_Buffs[1]) then + return false + end + + local Instance_Creatures = player:GetCreaturesInRange(300) + for id,creature in pairs(Instance_Creatures) do + if not(creature:HasAura(instance_flag_buff)) and not(creature:HasSpell(818011)) then -- flag check (replaced with special aura which works the same way as auras we have) + -- pet check -- + if (creature:GetOwner()) then + if not(creature:GetOwner():ToPlayer()) then + table.insert(Instance_Creatures_ToBuff, creature) + end + else + -- -- + table.insert(Instance_Creatures_ToBuff, creature) + end + end + end + + if not(Instance_Creatures_ToBuff[1]) then + return false + end + + for k,cre_to_buff in pairs(Instance_Creatures_ToBuff) do + for i,cre_aura in pairs(Instance_Buffs) do + if not(cre_to_buff:HasAura(cre_aura)) then + cre_to_buff:AddAura(cre_aura, cre_to_buff) + cre_to_buff:AddAura(instance_flag_buff, cre_to_buff) + --cre_to_buff:SendUnitSay("Aura Applied", 0) -- DEBUG + end + end + end + +end +--RegisterPlayerEvent(28, Instance_Buff) -- run the script on mapchange event + +RegisterPlayerEvent(33, Instance_Buff) -- on enter combat diff --git a/Dungeons/MoltenCore/ImperialThrone.lua b/Dungeons/MoltenCore/ImperialThrone.lua new file mode 100644 index 0000000..880128c --- /dev/null +++ b/Dungeons/MoltenCore/ImperialThrone.lua @@ -0,0 +1,29 @@ +RegisterGameObjectEvent( 170592, 1, function(event, go, diff) + if (diff>100) then + diff = 0 + local player = go:GetNearestPlayer(10) + if not(player) then + return false + end -- check if there is a player + + local throne = player:GetNearestGameObject(5) + if not(throne) then + return false + end + if (throne:GetEntry() ~= go:GetEntry()) then + return false + end-- check if nearest gameobject is throne we need + if not(player:GetStandState() == 5) then + return false + end -- check if player is sitting + local creature = player:GetNearestCreature(533, 9019) + if not(creature) then + return false + end -- check if there is a crature we need + if not(creature:IsAlive()) then + return false + end -- check if it is alive and we can cast spells + player:CastSpell( creature, 56685, true) + +end + end) \ No newline at end of file diff --git a/Dungeons/MoltenCore/Magmadar.lua b/Dungeons/MoltenCore/Magmadar.lua new file mode 100644 index 0000000..e24065a --- /dev/null +++ b/Dungeons/MoltenCore/Magmadar.lua @@ -0,0 +1,12 @@ +--[[local BossEntry_Magmadar = 11982 +local GameObject_LavaBomb1 = 177704 +local Spell_LavaBomb1 = 19411 +local Spell_LavaBomb2 = 20474 + +local function LavaBombSpawn(event, creature, target, spellid) + if (spellid == Spell_LavaBomb1) or (spellid == Spell_LavaBomb2) then + PerformIngameSpawn( 2, GameObject_LavaBomb1, target:GetMapId(), target:GetInstanceId(), target:GetX(), target:GetY(), target:GetZ(), target:GetO(), 0, 1800, target:GetPhaseMask()) + end +end + +RegisterCreatureEvent(BossEntry_Magmadar, 15, LavaBombSpawn)]]-- diff --git a/EnchantReRoll/EnchantReRollC.lua b/EnchantReRoll/EnchantReRollC.lua new file mode 100644 index 0000000..ae86196 --- /dev/null +++ b/EnchantReRoll/EnchantReRollC.lua @@ -0,0 +1,354 @@ +local AIO = AIO or require("AIO") + + +if AIO.AddAddon() then + return +end + + +local MyHandlers = AIO.AddHandlers("EnchantReRoll", {}) + +local Reforge_Spell = 964998 +--[[MAIN FRAME SCRIPTS]]-- +local function EnchantReRollMain_RollButton_Check(self,elapsed) + if (EnchantReRollMain.item) then +self:Enable() + else +self:Disable() + end + end +-- gets last item player locked to send slot and bug id to server +local function EnchantReRollMain_GetLastLockedItem(self,event,bag,slot) +if (bag and slot) then + if (bag == 0) then + EnchantReRollMain.Bag = 255 + EnchantReRollMain.Slot = slot+22 + else + EnchantReRollMain.Bag = bag+18 + EnchantReRollMain.Slot = slot-1 + end +elseif (bag and (slot == nil)) then +EnchantReRollMain.Bag = 255 +EnchantReRollMain.Slot = bag-1 +end + end + +local function EnchantReRollMain_Reforge_CastSuccess(self,event,unit,spellname) + local name = GetSpellInfo(964998) + if (spellname == name) and (unit == "player") then + if (EnchantReRollMain.item and EnchantReRollMain_RollButton.Bag and EnchantReRollMain_RollButton.Slot) then + AIO.Handle("EnchantReRoll", "ReforgeItem", EnchantReRollMain_RollButton.Bag, EnchantReRollMain_RollButton.Slot) + PlaySound("Glyph_MajorDestroy") + end + end +end + + function MyHandlers.EnchantReRollMain_Reforge(player,neweffect) -- AIO +--Set up strings from server +EnchantReRollMain.itemEffectName2 = GetSpellInfo(neweffect) + +if (not(EnchantReRollMain.itemEffectName2)) or (EnchantReRollMain.itemEffectName2 == "Enchanting") then + EnchantReRollMain.itemEffectName2 = "Enhant Reforged" + neweffect = 964998 + end + +EnchantReRollMain.itemEffect2 = "|Hspell:"..neweffect.."|h["..EnchantReRollMain.itemEffectName2.."]|h" +EnchantReRollMain_Item_EffectAFrame_BaseEffectAText:SetText("|cff00FF00"..EnchantReRollMain.itemEffect2.."|r") +--Play Reforge Animations +EnchantReRollMain_Item_EffectAFrame_Animgroup:Stop() +EnchantReRollMain_Item_EffectAFrame_Animgroup2:Stop() +BaseFrameFadeIn(EnchantReRollMain_Item_EffectAFrame) +EnchantReRollMain_Item_EffectAFrame_Animgroup:Play() +BaseFrameFadeIn(EnchantReRollMain_Item_EffectAFrame_ReforgeCompleteTexture) +end +---[[MAIN FRAME SETTINGS]]--- +FrameMain = CreateFrame("Frame", "EnchantReRollMain", UIParent, nil) +local EnchantReRollMain = FrameMain +EnchantReRollMain:SetSize(420,420) +EnchantReRollMain:SetPoint("CENTER") + +EnchantReRollMain:SetMovable(true) +EnchantReRollMain:EnableMouse(true) +EnchantReRollMain:RegisterForDrag("LeftButton") +EnchantReRollMain:SetClampedToScreen(true) +EnchantReRollMain:SetScript("OnDragStart", EnchantReRollMain.StartMoving) +EnchantReRollMain:SetScript("OnHide", EnchantReRollMain.StopMovingOrSizing) +EnchantReRollMain:SetScript("OnDragStop", EnchantReRollMain.StopMovingOrSizing) +EnchantReRollMain:RegisterEvent("ITEM_LOCKED") +EnchantReRollMain:SetScript("OnEvent", EnchantReRollMain_GetLastLockedItem) +--EnchantReRollMain:Hide() + +EnchantReRollMain:SetBackdrop({ + bgFile = "Interface\\AddOns\\AwAddons\\Textures\\enchant\\enchants_main", + insets = { left = -40, right = -40, top = -40, bottom = -40} +}) +EnchantReRollMain:Hide() + +local EnchantReRollMain_CloseButton = CreateFrame("Button", "EnchantReRollMain_CloseButton", EnchantReRollMain, "UIPanelCloseButton") +EnchantReRollMain_CloseButton:SetPoint("TOPRIGHT", -19, -15) +EnchantReRollMain_CloseButton:EnableMouse(true) +EnchantReRollMain_CloseButton:SetSize(25, 25) +EnchantReRollMain_CloseButton:SetScript("OnClick", function() + PlaySound("igMainMenuOptionCheckBoxOn") + EnchantReRollMain:Hide() + end) + +local EnchantReRollMain_RollButton = CreateFrame("Button", "EnchantReRollMain_RollButton", EnchantReRollMain, "UIPanelButtonTemplate") +EnchantReRollMain_RollButton:SetWidth(120) +EnchantReRollMain_RollButton:SetHeight(22) +EnchantReRollMain_RollButton:SetPoint("BOTTOM", 0,90) +EnchantReRollMain_RollButton:RegisterForClicks("AnyUp") +EnchantReRollMain_RollButton:SetText("Reforge item") +EnchantReRollMain_RollButton:Disable() +EnchantReRollMain_RollButton:RegisterEvent("UNIT_SPELLCAST_SUCCEEDED") +EnchantReRollMain_RollButton:SetScript("OnEvent", EnchantReRollMain_Reforge_CastSuccess) +EnchantReRollMain_RollButton:SetScript("OnUpdate", EnchantReRollMain_RollButton_Check) +EnchantReRollMain_RollButton:SetScript("OnMouseDown",function() + if (EnchantReRollMain.item and EnchantReRollMain_RollButton.Bag and EnchantReRollMain_RollButton.Slot) then + PlaySound("igMainMenuOptionCheckBoxOn") + AIO.Handle("EnchantReRoll", "ReforgeItem_Prep", EnchantReRollMain_RollButton.Bag, EnchantReRollMain_RollButton.Slot) +end + end) + +local EnchantReRollMain_TitleText = EnchantReRollMain:CreateFontString("EnchantReRollMain_TitleText") +EnchantReRollMain_TitleText:SetFont("Fonts\\MORPHEUS.TTF", 15) +EnchantReRollMain_TitleText:SetPoint("TOP", 0, -6) +EnchantReRollMain_TitleText:SetShadowOffset(0,0) +EnchantReRollMain_TitleText:SetText("|cff110011Enchant Reforge|r") + +local EnchantReRollMain_CostText = EnchantReRollMain:CreateFontString("EnchantReRollMain_TitleText") +EnchantReRollMain_CostText:SetFont("Fonts\\MORPHEUS.TTF", 14, "OUTLINE") +EnchantReRollMain_CostText:SetShadowOffset(1, -1) +EnchantReRollMain_CostText:SetPoint("BOTTOM", 0, 125) +EnchantReRollMain_CostText:SetShadowOffset(0,0) + +EnchantReRollMain_Item_EffectAFrame_ReforgeCompleteTexture = EnchantReRollMain:CreateTexture(nil, "ARTWORK") +EnchantReRollMain_Item_EffectAFrame_ReforgeCompleteTexture:SetHeight(EnchantReRollMain:GetHeight()+80) +EnchantReRollMain_Item_EffectAFrame_ReforgeCompleteTexture:SetWidth(EnchantReRollMain:GetWidth()+80) +EnchantReRollMain_Item_EffectAFrame_ReforgeCompleteTexture:SetTexture("Interface\\AddOns\\AwAddons\\Textures\\enchant\\enchants_ReforgeEffect") +EnchantReRollMain_Item_EffectAFrame_ReforgeCompleteTexture:SetPoint("CENTER",EnchantReRollMain,0,0) +EnchantReRollMain_Item_EffectAFrame_ReforgeCompleteTexture:SetBlendMode("ADD") +EnchantReRollMain_Item_EffectAFrame_ReforgeCompleteTexture:Hide() + +--[[ITEM FRAME SCRIPTS]]-- + function MyHandlers.EnchantReRoll_PlaceItem(player,item,nameeffect,cost,bag,slot) -- AIO +--Setting up item to the button +PlaySound("Glyph_MajorCreate") +local name, itemlink, _, _, _, _, _, _, _, texture, _ = GetItemInfo(item) +ClearCursor() +EnchantReRollMain_Item.Button:SetNormalTexture(texture) +EnchantReRollMain.item = item +EnchantReRollMain.itemEffectName = GetSpellInfo(nameeffect) + +if (not(EnchantReRollMain.itemEffectName)) or (EnchantReRollMain.itemEffectName == "Enchanting") then + EnchantReRollMain.itemEffectName = "This item is ready to be enchanted" + nameeffect = 964998 + end + +EnchantReRollMain.itemEffect = "|Hspell:"..nameeffect.."|h["..EnchantReRollMain.itemEffectName.."]|h" +EnchantReRollMain.itemCost = cost +--For Reforge +EnchantReRollMain_RollButton.Slot = slot +EnchantReRollMain_RollButton.Bag = bag +--cost + local gold,silver,copper = GetGoldForMoney(EnchantReRollMain.itemCost) +--Play animations +EnchantReRollMain_Item_EffectFrame_BaseEffectText:SetText("|cff00FF00"..EnchantReRollMain.itemEffect.."|r") +EnchantReRollMain_CostText:SetText("|cffE1AB18Reforge cost: |cffFFFFFF"..gold.."|TInterface\\MONEYFRAME\\UI-GoldIcon.blp:11:11:0:-1|t "..silver.."|TInterface\\MONEYFRAME\\UI-SilverIcon.blp:11:11:0:-1|t "..copper.."|TInterface\\MONEYFRAME\\UI-CopperIcon.blp:11:11:0:-1|t|r") +EnchantReRollMain_Item_BackgroundTexture:SetAlpha(1.0) +BaseFrameFadeIn(EnchantReRollMain_Item_BackgroundTexture_Effect) +BaseFrameFadeIn(EnchantReRollMain_Item_EffectFrame) +EnchantReRollMain_Item_EffectFrame_Animgroup:Play() +end + +local function EnchantReRoll_ShowLink(self) + if (EnchantReRollMain.item) then +GameTooltip:SetOwner(self, "ANCHOR_RIGHT") +GameTooltip:SetHyperlink(EnchantReRollMain.item) +GameTooltip:Show() + end + end + + function MyHandlers.EnchantReRoll_Init(player) + PlaySound("Glyph_MajorCreate") +BaseFrameFadeIn(EnchantReRollMain) +end + function MyHandlers.EnchantReRoll_Close(player) + if (EnchantReRollMain:IsVisible()) then + PlaySound("igMainMenuOptionCheckBoxOn") + EnchantReRollMain:Hide() +end +end +---[[ITEM FRAME SETTINGS]]--- + +local EnchantReRollMain_Item = CreateFrame("Frame", "EnchantReRollMain_Item", EnchantReRollMain, nil) +EnchantReRollMain_Item:SetSize(108,108) +EnchantReRollMain_Item:SetPoint("CENTER", 0, 130) +EnchantReRollMain_Item:SetFrameStrata("HIGH") +EnchantReRollMain_Item:SetBackdrop({ + bgFile = "Interface\\AddOns\\AwAddons\\Textures\\enchant\\itemslot", + }) + +EnchantReRollMain_Item.Button = CreateFrame("Button", "EnchantReRollMain_Item.Button", EnchantReRollMain_Item, nil) +EnchantReRollMain_Item.Button:SetSize(34, 34) +EnchantReRollMain_Item.Button:SetPoint("CENTER",0,0) +EnchantReRollMain_Item.Button:EnableMouse(true) +EnchantReRollMain_Item.Button:SetFrameStrata("HIGH") +--EnchantReRollMain_Item.Button:SetNormalTexture("Interface\\Icons\\INV_Chest_Samurai") +EnchantReRollMain_Item.Button:SetHighlightTexture("Interface\\BUTTONS\\ButtonHilight-Square") +--EnchantReRollMain_Item.Button:SetPushedTexture("Interface/BUTTONS/UI-SpellbookIcon-NextPage-Down") +EnchantReRollMain_Item.Button:SetScript("OnMouseDown",function() + local Type, data, subType, subData = GetCursorInfo() + if (Type == "item") and EnchantReRollMain.Bag and EnchantReRollMain.Slot then + AIO.Handle("EnchantReRoll", "SetItem", EnchantReRollMain.Bag, EnchantReRollMain.Slot) -- AIO part + else + --Remove Item and animations +EnchantReRollMain_Item.Button:SetNormalTexture(nil) +EnchantReRollMain.item = nil +EnchantReRollMain_Item_BackgroundTexture:SetAlpha(0.6) +EnchantReRollMain_CostText:SetText("") +BaseFrameFadeOut(EnchantReRollMain_Item_BackgroundTexture_Effect) +BaseFrameFadeOut(EnchantReRollMain_Item_EffectFrame) + end + end) +EnchantReRollMain_Item.Button:SetScript("OnEnter",EnchantReRoll_ShowLink) +EnchantReRollMain_Item.Button:SetScript("OnLeave", function() + GameTooltip:Hide() +end) + +EnchantReRollMain_Item_Border = EnchantReRollMain_Item.Button:CreateTexture(nil, "OVERLAY") +EnchantReRollMain_Item_Border:SetSize(EnchantReRollMain_Item:GetSize()) +EnchantReRollMain_Item_Border:SetTexture("Interface\\AddOns\\AwAddons\\Textures\\enchant\\itemborder") +EnchantReRollMain_Item_Border:SetPoint("CENTER",1,-2) + +EnchantReRollMain_Item_Background = CreateFrame("FRAME","EnchantReRollMain_Item_Background",EnchantReRollMain) +EnchantReRollMain_Item_Background:SetSize(EnchantReRollMain:GetSize()) +EnchantReRollMain_Item_Background:SetPoint("CENTER") +EnchantReRollMain_Item_Background:SetFrameStrata("MEDIUM") + +EnchantReRollMain_Item_BackgroundTexture = EnchantReRollMain_Item_Background:CreateTexture(nil, "BACKGROUND") +EnchantReRollMain_Item_BackgroundTexture:SetSize(256,64) +EnchantReRollMain_Item_BackgroundTexture:SetTexture("Interface\\AddOns\\AwAddons\\Textures\\enchant\\itemHighlight") +EnchantReRollMain_Item_BackgroundTexture:SetPoint("CENTER",EnchantReRollMain_Item,0,-5) +EnchantReRollMain_Item_BackgroundTexture:SetBlendMode("ADD") +EnchantReRollMain_Item_BackgroundTexture:SetAlpha(0.6) + +EnchantReRollMain_Item_BackgroundTexture_Effect = CreateFrame("Model", "EnchantReRollMain_Item_BackgroundTexture_Effect", EnchantReRollMain_Item_Background) +EnchantReRollMain_Item_BackgroundTexture_Effect:SetWidth(256); +EnchantReRollMain_Item_BackgroundTexture_Effect:SetHeight(256); +EnchantReRollMain_Item_BackgroundTexture_Effect:SetPoint("CENTER", EnchantReRollMain_Item, "CENTER", 0, -20) +EnchantReRollMain_Item_BackgroundTexture_Effect:SetModel("World\\Expansion01\\doodads\\netherstorm\\crackeffects\\netherstormcracksmokeblue.m2") +EnchantReRollMain_Item_BackgroundTexture_Effect:SetModelScale(0.07) +EnchantReRollMain_Item_BackgroundTexture_Effect:SetCamera(0) +EnchantReRollMain_Item_BackgroundTexture_Effect:SetPosition(0.08,0.10,0) +--EnchantReRollMain_Item_BackgroundTexture_Effect:SetAlpha(0.8) +EnchantReRollMain_Item_BackgroundTexture_Effect:SetFacing(0.1) +EnchantReRollMain_Item_BackgroundTexture_Effect:Hide() + +--[ITEM FRAME EFFECT SCRIPTS]-- +local function EnchantReRollMain_Item_EffectFrame_ShowLink(self) +GameTooltip:SetOwner(self, "ANCHOR_RIGHT") +GameTooltip:SetHyperlink(EnchantReRollMain.itemEffect) +GameTooltip:Show() + end + +local function EnchantReRollMain_Item_EffectAFrame_ShowLink(self) +GameTooltip:SetOwner(self, "ANCHOR_RIGHT") +GameTooltip:SetHyperlink(EnchantReRollMain.itemEffect2) +GameTooltip:Show() +end + +local function EnchantReRollMain_Item_EffectAFrame_Animgroup_End(self) +BaseFrameFadeOut(EnchantReRollMain_Item_EffectAFrame) +BaseFrameFadeOut(EnchantReRollMain_Item_EffectAFrame_ReforgeCompleteTexture) +EnchantReRollMain.itemEffect = EnchantReRollMain.itemEffect2 +EnchantReRollMain_Item_EffectFrame_BaseEffectText:SetText("|cff00FF00"..EnchantReRollMain.itemEffect.."|r") + end +--[ITEM FRAME EFFECT]-- + +local EnchantReRollMain_Item_EffectFrame = CreateFrame("Frame", "EnchantReRollMain_Item_EffectFrame", EnchantReRollMain, nil) +EnchantReRollMain_Item_EffectFrame:SetSize(100,44) +EnchantReRollMain_Item_EffectFrame:SetPoint("CENTER", 0, 57) +EnchantReRollMain_Item_EffectFrame:SetFrameStrata("HIGH") +EnchantReRollMain_Item_EffectFrame:EnableMouse(true) +EnchantReRollMain_Item_EffectFrame:SetScript("OnEnter", EnchantReRollMain_Item_EffectFrame_ShowLink) +EnchantReRollMain_Item_EffectFrame:SetScript("OnLeave", function() + GameTooltip:Hide() + end) +EnchantReRollMain_Item_EffectFrame:Hide() + +local EnchantReRollMain_Item_EffectFrame_BackgroundTexture = EnchantReRollMain_Item_EffectFrame:CreateTexture(nil, "BACKGROUND") +EnchantReRollMain_Item_EffectFrame_BackgroundTexture:SetSize(EnchantReRollMain:GetSize()) +EnchantReRollMain_Item_EffectFrame_BackgroundTexture:SetTexture("Interface\\AddOns\\AwAddons\\Textures\\enchant\\enchants_textH") +EnchantReRollMain_Item_EffectFrame_BackgroundTexture:SetPoint("CENTER",EnchantReRollMain,0,0) +--EnchantReRollMain_Item_EffectFrame_BackgroundTexture:SetBlendMode("ADD") + +EnchantReRollMain_Item_EffectFrame_BaseEffectText = EnchantReRollMain_Item_EffectFrame:CreateFontString("EnchantReRollMain_TitleText") +EnchantReRollMain_Item_EffectFrame_BaseEffectText:SetFont("Fonts\\MORPHEUS.TTF", 14, "OUTLINE") +EnchantReRollMain_Item_EffectFrame_BaseEffectText:SetShadowOffset(1, -1) +EnchantReRollMain_Item_EffectFrame_BaseEffectText:SetSize(200,14) +EnchantReRollMain_Item_EffectFrame_BaseEffectText:SetPoint("CENTER", EnchantReRollMain, 0, 57) +EnchantReRollMain_Item_EffectFrame_BaseEffectText:SetShadowOffset(0,0) + +--effect animations +EnchantReRollMain_Item_EffectFrame_Animgroup2 = EnchantReRollMain_Item_EffectFrame:CreateAnimationGroup() +local EnchantReRollMain_Item_EffectFrame_Scale2 = EnchantReRollMain_Item_EffectFrame_Animgroup2:CreateAnimation("Scale") +EnchantReRollMain_Item_EffectFrame_Scale2:SetDuration(0.5) +EnchantReRollMain_Item_EffectFrame_Scale2:SetOrder(1) +EnchantReRollMain_Item_EffectFrame_Scale2:SetEndDelay(0) +EnchantReRollMain_Item_EffectFrame_Scale2:SetScale(10,1) + +EnchantReRollMain_Item_EffectFrame_Animgroup = EnchantReRollMain_Item_EffectFrame:CreateAnimationGroup() +local EnchantReRollMain_Item_EffectFrame_Scale1 = EnchantReRollMain_Item_EffectFrame_Animgroup:CreateAnimation("Scale") +EnchantReRollMain_Item_EffectFrame_Scale1:SetDuration(0) +EnchantReRollMain_Item_EffectFrame_Scale1:SetOrder(1) +EnchantReRollMain_Item_EffectFrame_Scale1:SetEndDelay(0.5) +EnchantReRollMain_Item_EffectFrame_Scale1:SetScale(0.1,1) +EnchantReRollMain_Item_EffectFrame_Animgroup:SetScript("OnPlay", function() + EnchantReRollMain_Item_EffectFrame_Animgroup2:Play() + end) + +--[ITEM FRAME APPLIED EFFECT]-- +local EnchantReRollMain_Item_EffectAFrame = CreateFrame("Frame", "EnchantReRollMain_Item_EffectAFrame", EnchantReRollMain, nil) +EnchantReRollMain_Item_EffectAFrame:SetSize(100,44) +EnchantReRollMain_Item_EffectAFrame:SetPoint("CENTER", 0, -20) +EnchantReRollMain_Item_EffectAFrame:SetFrameStrata("MEDIUM") +EnchantReRollMain_Item_EffectAFrame:EnableMouse(true) +EnchantReRollMain_Item_EffectAFrame:SetScript("OnEnter", EnchantReRollMain_Item_EffectAFrame_ShowLink) +EnchantReRollMain_Item_EffectAFrame:SetScript("OnLeave", function() + GameTooltip:Hide() + end) +EnchantReRollMain_Item_EffectAFrame:Hide() + +local EnchantReRollMain_Item_EffectAFrame_BackgroundTexture = EnchantReRollMain_Item_EffectAFrame:CreateTexture(nil, "BACKGROUND") +EnchantReRollMain_Item_EffectAFrame_BackgroundTexture:SetSize(EnchantReRollMain:GetSize()) +EnchantReRollMain_Item_EffectAFrame_BackgroundTexture:SetTexture("Interface\\AddOns\\AwAddons\\Textures\\enchant\\enchants_textH") +EnchantReRollMain_Item_EffectAFrame_BackgroundTexture:SetPoint("CENTER",EnchantReRollMain,0,-67) +EnchantReRollMain_Item_EffectAFrame_BackgroundTexture:SetBlendMode("ADD") + +EnchantReRollMain_Item_EffectAFrame_BaseEffectAText = EnchantReRollMain_Item_EffectAFrame:CreateFontString("EnchantReRollMain_TitleText") +EnchantReRollMain_Item_EffectAFrame_BaseEffectAText:SetFont("Fonts\\MORPHEUS.TTF", 14, "OUTLINE") +EnchantReRollMain_Item_EffectAFrame_BaseEffectAText:SetShadowOffset(1, -1) +EnchantReRollMain_Item_EffectAFrame_BaseEffectAText:SetSize(200,14) +EnchantReRollMain_Item_EffectAFrame_BaseEffectAText:SetPoint("CENTER", EnchantReRollMain, 0,-11) +EnchantReRollMain_Item_EffectAFrame_BaseEffectAText:SetShadowOffset(0,0) + +--effectA animations +EnchantReRollMain_Item_EffectAFrame_Animgroup2 = EnchantReRollMain_Item_EffectAFrame:CreateAnimationGroup() +local EnchantReRollMain_Item_EffectAFrame_Scale2 = EnchantReRollMain_Item_EffectAFrame_Animgroup2:CreateAnimation("Scale") +EnchantReRollMain_Item_EffectAFrame_Scale2:SetDuration(1.5) +EnchantReRollMain_Item_EffectAFrame_Scale2:SetOrder(1) +EnchantReRollMain_Item_EffectAFrame_Scale2:SetEndDelay(2) +EnchantReRollMain_Item_EffectAFrame_Scale2:SetScale(10,1) +EnchantReRollMain_Item_EffectAFrame_Scale2:SetScript("OnFinished", EnchantReRollMain_Item_EffectAFrame_Animgroup_End) +EnchantReRollMain_Item_EffectAFrame_Scale2:SetScript("OnStop", EnchantReRollMain_Item_EffectAFrame_Animgroup_End) + +EnchantReRollMain_Item_EffectAFrame_Animgroup = EnchantReRollMain_Item_EffectAFrame:CreateAnimationGroup() +local EnchantReRollMain_Item_EffectAFrame_Scale1 = EnchantReRollMain_Item_EffectAFrame_Animgroup:CreateAnimation("Scale") +EnchantReRollMain_Item_EffectAFrame_Scale1:SetDuration(0) +EnchantReRollMain_Item_EffectAFrame_Scale1:SetOrder(1) +EnchantReRollMain_Item_EffectAFrame_Scale1:SetEndDelay(3.5) +EnchantReRollMain_Item_EffectAFrame_Scale1:SetScale(0.1,1) +EnchantReRollMain_Item_EffectAFrame_Animgroup:SetScript("OnPlay", function() + EnchantReRollMain_Item_EffectAFrame_Animgroup2:Play() + end) \ No newline at end of file diff --git a/EnchantReRoll/EnchantReRollS.lua b/EnchantReRoll/EnchantReRollS.lua new file mode 100644 index 0000000..41fb1bf --- /dev/null +++ b/EnchantReRoll/EnchantReRollS.lua @@ -0,0 +1,228 @@ +local AIO = AIO or require("AIO") + + +local MyHandlers = AIO.AddHandlers("EnchantReRoll", {}) + +local ReforgeAltar = 8000051 +local ReforgeAltar_menu = 45004 + +--gossip part + function enchantReRoll_CloseMenu(msg,player) + + return msg:Add("EnchantReRoll", "EnchantReRoll_Close") +end + + function enchantReRoll_OpenMenu(msg,player) + return msg:Add("EnchantReRoll", "EnchantReRoll_Init") +end + +local function OnGossipHello_ReforgeAltar(event, player, Altar) +player:GossipClearMenu() +enchantReRoll_OpenMenu(AIO.Msg(), player):Send(player) +player:GossipSendMenu(1, Altar, ReforgeAltar_menu) +player:GossipComplete() +end +RegisterGameObjectGossipEvent(ReforgeAltar, 1, OnGossipHello_ReforgeAltar) + + function GameobjectCheck(player) + local altar = nil + altar = player:GetNearestGameObject(10, ReforgeAltar) + if (altar) then + return true + end + enchantReRoll_CloseMenu(AIO.Msg(), player):Send(player) + return false + end + +local function PlayerIsFar(event, go, diff) + for k,player in pairs(go:GetPlayersInRange(60)) do + GameobjectCheck(player) + end +end + RegisterGameObjectEvent(ReforgeAltar, 1, PlayerIsFar) +--gossip part + +function EnchantItemCheck(player,item) + if not(GameobjectCheck(player)) then + return false + end + if (item:GetClass() == 2 or item:GetClass() == 4) then + if (item:GetQuality() >= 3) then + return true + end + end + + player:SendBroadcastMessage("This item can't be reforged") + return false +end + +function EnchantItemCost(item) + local cost = nil + cost = item:GetItemLevel() * 2285 -- Temporary was 2285 + return cost +end + +--[[function EnchantItemTier(item, player) + local Tier = 1 + local rlevel = item:GetItemLevel() + local ilevel = item:GetRequiredLevel() + + if (1 <= rlevel) and (rlevel <=10) then + Tier = 1 + elseif (11 <= rlevel) and (rlevel <=20) then + Tier = 2 + elseif (21 <= rlevel) and (rlevel <=30) then + Tier = 3 + elseif (31 <= rlevel) and (rlevel <=40) then + Tier = 4 + elseif (41 <= rlevel) and (rlevel <=50) then + Tier = 5 + elseif (51 <= rlevel) and (rlevel <=59) then + Tier = 6 + elseif (rlevel == 60) and ( (ilevel >= 50) and (ilevel <= 55) ) then + Tier = 7 + elseif (rlevel == 60) and ( (ilevel >= 56) and (ilevel <= 63) ) then + Tier = 8 + elseif (rlevel == 60) and ( (ilevel >= 64) and (ilevel <= 71) ) then + Tier = 9 + elseif (rlevel == 60) and ( (ilevel >= 72) and (ilevel <= 78) ) then + Tier = 10 + elseif (rlevel == 60) and ( (ilevel >= 79) and (ilevel <= 83) ) then + Tier = 11 + elseif (rlevel == 60) and (ilevel >= 84) then + Tier = 12 + end + return Tier +end]]-- +--MAIN SET ITEM FUNCTION + function MyHandlers.SetItem(player,bag,slot) + --AIO ADDITIONAL CHECK-- + local expectedData = {"number","number"} + local values = {bag,slot} + if not(DataTypeCheck(expectedData, values)) then + return false + end + --MAIN ACTION-- + local item = player:GetItemByPos(bag,slot) + if not(item) then + return false + end + if (EnchantItemCheck(player,item)) then + local itemlink = GetItemLink(item:GetEntry()) + local effect = nil + local cost = EnchantItemCost(item) + + if (item:GetEnchantmentSpellId(5)) then + effect = item:GetEnchantmentSpellId(5) + else + effect = 964998 + end + + enchantReRoll_PlaceItem(AIO.Msg(), player,itemlink, effect, cost,bag,slot):Send(player) + end +end + + function enchantReRoll_PlaceItem(msg,player,item,effect,cost,bag,slot) + return msg:Add("EnchantReRoll", "EnchantReRoll_PlaceItem", item,effect,cost,bag,slot) +end +--end + +--MAIN REFORGE ITEM FUNCTION +function MyHandlers.ReforgeItem_Prep(player,bag,slot) + --AIO ADDITIONAL CHECK-- + local expectedData = {"number","number"} + local values = {bag,slot} + if not(DataTypeCheck(expectedData, values)) then + return false + end + --MAIN ACTION-- +local item = player:GetItemByPos(bag,slot) + if not(item) then + return false + end + if (EnchantItemCheck(player,item)) then + local cost = EnchantItemCost(item) + + if (cost > player:GetCoinage()) then + player:SendBroadcastMessage("You don't have enough money to do that") + return false + end + + player:CastSpell(player, 964998) + end +end + +function MyHandlers.ReforgeItem(player,bag,slot) + --AIO ADDITIONAL CHECK-- + local expectedData = {"number","number"} + local values = {bag,slot} + if not(DataTypeCheck(expectedData, values)) then + return false + end + --MAIN ACTION-- + local item = player:GetItemByPos(bag,slot) + if not(item) then + return false + end + if (EnchantItemCheck(player,item)) then + + local cost = EnchantItemCost(item) + local enchant = nil + --local class = item:GetClass() + --local enchantTier = EnchantItemTier(item, player) + --local neweffect = math.random(1,10) + --local neweffectSQL = nil + + --[[if (class == 4) then + class = "ANY" + elseif (class == 2) then + class = "WEAPON" + end]]-- + + if (cost > player:GetCoinage()) then + player:SendBroadcastMessage("You don't have enough money to do that") + return false + else + player:SetCoinage(player:GetCoinage() - cost) + end + + --[[local enchantTierSQL = WorldDBQuery("SELECT tier FROM item_enchantment_random_tiers WHERE enchantID = "..effect..";") + if not(enchantTierSQL) then + player:SendBroadcastMessage("Reforge Failed") + return false + else + enchantTier = enchantTierSQL:GetInt32(0) + end]]-- + + --[[if (class == "ANY") then + neweffectSQL = WorldDBQuery("SELECT enchantID FROM item_enchantment_random_tiers WHERE tier = "..enchantTier.." AND class = '"..class.."';") + else + neweffectSQL = WorldDBQuery("SELECT enchantID FROM item_enchantment_random_tiers WHERE tier = "..enchantTier..";") + end]]-- + --choosing random row from our query + + enchant = RollEnchant(item, player) + if (enchant) then + --[[if (neweffectSQL:GetRowCount()>1) then + for i = 1, math.random(1, (neweffectSQL:GetRowCount()-1)) do + neweffectSQL:NextRow() + end + end]]-- + --neweffect = neweffectSQL:GetInt32(0) + item:SetEnchantment(enchant, 5) -- ATTEMPT TO FIND A REASON OF CRASHES + enchantReRoll_Reforge(AIO.Msg(),player,item):Send(player) + else + player:SendBroadcastMessage("Reforge Failed") + end + end +end + +function enchantReRoll_Reforge(msg,player,item) + local neweffect = nil + if (item:GetEnchantmentSpellId(5)) then + neweffect = item:GetEnchantmentSpellId(5) + else + neweffect = 964998 + end + return msg:Add("EnchantReRoll", "EnchantReRollMain_Reforge", neweffect) +end \ No newline at end of file diff --git a/Ironman.lua b/Ironman.lua new file mode 100644 index 0000000..e65ecd1 --- /dev/null +++ b/Ironman.lua @@ -0,0 +1,102 @@ +local function stayDead(event, player) + if(player:GetQuestStatus(68934) == 6 or player:GetQuestStatus(689340) == 6) then + player:AddAura(8326, player) + player:SetHealth(0) + player:KillPlayer() + end +end + +local function stayDeadLogin(event, player, msg, Type, lang) + if((player:GetQuestStatus(68934) == 6 or player:GetQuestStatus(689340) == 6) and player:HasAura(8326) == true) then + player:SetHealth(0) + player:KillPlayer() + player:CastSpell(player, 50768) + end +end + +local function removeMeFromGroup(event, delay, pCall, player) + player:RemoveFromGroup() +end + +local function CheckSurvivalistGroup(player) + local survivalistGroup = false + if (player:IsInGroup()) then + local group = player:GetGroup() + local t_GroupMembers = group:GetMembers() + for i, groupMember in ipairs(t_GroupMembers) do + if (groupMember:GetQuestStatus(689340) == 6) then + survivalistGroup = true + break + end + end + return survivalistGroup + else + return false + end +end + +local function GroupingLogic(event, group, guid) + local newPlayer = GetPlayerByGUID(guid) + local t_GroupMembers = group:GetMembers() + if (newPlayer:GetQuestStatus(68934) == 6) then + newPlayer:RegisterEvent(removeMeFromGroup, 75, 1, newPlayer) + for i, groupMember in ipairs(t_GroupMembers) do + if (groupMember:GetQuestStatus(68934) == 6) then + groupMember:RegisterEvent(removeMeFromGroup, 50, 1, groupMember) + end + groupMember:SendBroadcastMessage("|cffff0000Ironmen can't join groups!|r") + end + + else + local survivalistGroup = CheckSurvivalistGroup(newPlayer) + + if (survivalistGroup) then + for i, groupMember in ipairs(t_GroupMembers) do + if (groupMember:GetQuestStatus(689340) ~= 6) then + groupMember:RegisterEvent(removeMeFromGroup, 50, 1, groupMember) + end + groupMember:SendBroadcastMessage("|cffff0000Survivalists can only join other Survivalists!|r") + end + end + end +end + +local function FailIronmanQuest(event, delay, pCall, player) + player:SendBroadcastMessage("|cffff0000You have lost the ability to become an Ironman!|r") + player:SetQuestStatus(68934, 5) + player:FailQuest(68934) +end + +local function FailSurvivalistQuest(event, delay, pCall, player) + player:SendBroadcastMessage("|cffff0000You have lost the ability to become a Survivalist!|r") + player:SetQuestStatus(689340, 5) + player:FailQuest(689340) +end + +local function IronmanCannotCarryQuestForward(event, player, oldLevel) + if (player:HasQuest(68934) and (player:GetQuestStatus(68934) == 1 or player:GetQuestStatus(68934) == 3)) then + player:RegisterEvent(FailIronmanQuest, 1000, 1, player) + end + + if (player:HasQuest(689340) and (player:GetQuestStatus(689340) == 1 or player:GetQuestStatus(689340) == 3)) then + PrintError("Fail quest") + player:RegisterEvent(FailSurvivalistQuest, 1000, 1, player) + end + + if (((player:HasQuest(68934) and player:GetQuestStatus(68934) == 6) or (player:HasAura(8326) == true)) and player:IsInGroup()) then + player:RegisterEvent(removeMeFromGroup, 50, 1, player) + end + + if (((player:HasQuest(689340) and player:GetQuestStatus(689340) == 6)) and player:IsInGroup()) then + local survivalistGroup = CheckSurvivalistGroup(player) + PrintError("Survivalist = "..survivalistGroup) + if (survivalistGroup) then + player:RegisterEvent(removeMeFromGroup, 50, 1, player) + end + end +end + +RegisterPlayerEvent(36, stayDead) +RegisterPlayerEvent(3, stayDeadLogin) +RegisterGroupEvent(1, GroupingLogic) +RegisterPlayerEvent(13, IronmanCannotCarryQuestForward) \ No newline at end of file diff --git a/Misc/DailyEvents.lua b/Misc/DailyEvents.lua new file mode 100644 index 0000000..1f9f866 --- /dev/null +++ b/Misc/DailyEvents.lua @@ -0,0 +1,33 @@ +local function DailyGloryFlush(event, player) + local Stime2 = tostring(GetGameTime()) + -- readies for next timer + WorldDBQuery("DELETE FROM timestamps WHERE state = 1") + WorldDBQuery("INSERT INTO timestamps VALUES ( 1, " ..Stime2.. ");") + player:UnbindInstance(409) +end + +local function ResetCheck(event, player) + -- the time, in seconds + -- use integers that divide evenly into the "save players interval" value in world.conf for best results + local Stime = GetGameTime() + local timerdaily = 86400 + local GUpdate1 = WorldDBQuery("SELECT * FROM timestamps WHERE state = 1") + if (player == nil) then + print("[Eluna]: Error pushing timestamps on reset. No players are online. See: DailyEvents.lua.") + return false + elseif (GUpdate1 == nil) then + if (player:IsGM() == true) then + -- sends an error message to GMs and server if there is no flush time in the DB + player:SendBroadcastMessage("The daily timer system has broken! Contact an administrator ASAP!") + print("[Eluna]: Error loading LUA script: DailyEvents.lua - There is a nil value in the database `timestamps`. Check entries!") + return false + end + return false + elseif (Stime >= GUpdate1:GetInt32(1) + timerdaily) then + DailyGloryFlush(event, player) + else + return false + end +end + +RegisterPlayerEvent(25, ResetCheck) \ No newline at end of file diff --git a/Misc/DuelEnd.lua b/Misc/DuelEnd.lua new file mode 100644 index 0000000..3b0525f --- /dev/null +++ b/Misc/DuelEnd.lua @@ -0,0 +1,13 @@ +--function Player:Safety() +-- local shield = 67251 + +-- Self:AddAura(shield) +--end + +--function OnDuelEnd(event, winner, loser, type) + --winner:SendBroadcastMessage("Test 1") + --loser:SendBroadcastMessage("Test 2") + --winner:CastSpell(winner, 67251) + --loser:CastSpell(loser, 67251) +--end +--RegisterPlayerEvent(11, OnDuelEnd) \ No newline at end of file diff --git a/Misc/Flight.lua b/Misc/Flight.lua new file mode 100644 index 0000000..fc5d8c8 --- /dev/null +++ b/Misc/Flight.lua @@ -0,0 +1,136 @@ +-- Name: Custom Flight Master Script for cMangos. +-- Details: With option to require gold or custom item as price for taxi service & configurable conditions. +-- Easy to configure. Copy a the Flight[#] {} and enter the correct config for each flight path +-- You can add Player conditions to your flight paths. See for reference: http://eluna.emudevs.com/Player/index.html +-- Website: https://github.com/RStijn + +-- Config +local NPC_FLIGHTMASTER = 5000220 -- Creature ID. CreatureType must be 3 & NpcFlags 512 or higher. +local MOUNT_DISPLAYID_A = 28135 -- Display ID of flying mount for Alliance +local MOUNT_DISPLAYID_H = 28135 -- Display ID of flying mount for Horde + +-- To leave costs or tokens out, remove them from the list or set them as nil +local FLIGHT = { + -- Basic flight path + { + label = "Take me up that mountain.", -- NPC Gossip Menu Text + cost = 2500, -- Cost for taxi services 10000 = 1 Gold default: 0 + token = 500000, -- Custom item ID as cost price default: 0 + token_count = 50, -- Amount of custom item to take default: 0 + waypoints = { + { + path = { + {0, -13838, 3098, 5}, -- WAYPOINT 1 + {0, -13947, 3106, 180}, -- WAYPOINT 2 + {0, -14099, 3111, 188}, + }, + }, + }, + }, + + -- Flight path with conditions + { + -- condition predicate function list that return true if the player can see this option + conditions = { + function(player) + return player:GetLevel() >= 30 + end, + }, + + label = "Take me to Stranglethorn Vale.", -- NPC Gossip Menu Text + cost = 2500, -- Cost for taxi services 10000 = 1 Gold + token = 500000, -- Custom item ID as cost price + token_count = 50, -- Amount of custom item to take + waypoints = { + { + -- condition predicate functions that return true if the player can use this route + conditions = { + Player.IsAlliance, + }, + path = { + {0, -13838, 3098, 5}, + {0, -13800, 2913, 60}, -- WAYPOINT 1 + {0, -11758, 107, 134}, -- WAYPOINT 2 + {0, -11614, -41, 12}, + }, + }, + { + -- condition predicate functions that return true if the player can use this route + conditions = { + Player.IsHorde, + }, + path = { + {0, -13838, 3098, 5}, + {0, -13800, 2913, 60}, -- WAYPOINT 2 + {0, -12438, 296, 25}, -- WAYPOINT 2 + {0, -12391, 196, 4}, + }, + }, + }, + }, +} + +-- Create flight paths from points and save their IDs to the FLIGHT table at FLIGHT[intid].waypoints[i].path +for k,v in ipairs(FLIGHT) do + if (v.waypoints) then + for k2,v2 in ipairs(v.waypoints) do + if (v2.path) then + v2.path = AddTaxiPath(v2.path, MOUNT_DISPLAYID_A, MOUNT_DISPLAYID_H) + end + end + end +end + +-- Functions +local function TestConditions(conds, player) + if (not conds) then + return true + end + if (not player) then + return false + end + for k,v in ipairs(conds) do + if (not v(player)) then + return false + end + end + return true +end + +local function startFlight(player, flight) + -- check if player can afford cost + if ((not flight.cost or player:GetCoinage() >= flight.cost) and (not flight.token or player:GetItemCount(flight.token) >= (flight.token_count or 0))) then + if (flight.cost) then + player:ModifyMoney(-flight.cost) + end + if (flight.token) then + player:RemoveItem(flight.token, flight.token_count or 0) + end + + for k,v in ipairs(flight.waypoints) do + if (TestConditions(v.conditions, player)) then + player:StartTaxi(v.path) + break -- stop on first valid path + end + end + else + player:SendNotification("You can't afford to take this flight") + end +end + +local function On_Gossip(event, player, unit) + for k,v in ipairs(FLIGHT) do + if (TestConditions(v.conditions, player)) then + player:GossipMenuAddItem(0, v.label, 0, k, nil, nil, v.cost) + end + end + player:GossipSendMenu(1, unit) +end + +local function On_Select(event, player, unit, sender, intid, code) + startFlight(player, FLIGHT[intid]) + player:GossipComplete() +end + +RegisterCreatureGossipEvent(NPC_FLIGHTMASTER, 1, On_Gossip) +RegisterCreatureGossipEvent(NPC_FLIGHTMASTER, 2, On_Select) \ No newline at end of file diff --git a/Misc/ForceGuild.lua~ b/Misc/ForceGuild.lua~ new file mode 100644 index 0000000..76d00f5 --- /dev/null +++ b/Misc/ForceGuild.lua~ @@ -0,0 +1,9 @@ +function ForceGuild(event, player) + --print("Test Phase 1 Complete") + if (player:IsInGuild() == false) then + --print("Test Phase 2 Complete") + GetGuildByName("Awakening Beta"):AddMember(player, 4) + end + +end +RegisterPlayerEvent(30, ForceGuild) diff --git a/Misc/FrostNova_Stealth_fix.lua b/Misc/FrostNova_Stealth_fix.lua new file mode 100644 index 0000000..1c53b95 --- /dev/null +++ b/Misc/FrostNova_Stealth_fix.lua @@ -0,0 +1,23 @@ +-- Radius 10x10 + +local stealth = {1784, 58984, 66} +local frost = 122 + +local function OnNova(event, player, spell, skipCheck) + if (spell:GetEntry() == frost) then + local target = player:GetPlayersInRange(10, 1) + --print("test 1") + for _, t in pairs(target) do + for k, v in pairs(stealth) do + if(t:HasAura(v)) then + --print("test 2") + t:RemoveAura(v) + --t:AddAura(122) + --print("test 3") + end + end + end +end +end + +RegisterPlayerEvent(5, OnNova) \ No newline at end of file diff --git a/Misc/GlorySystem.lua b/Misc/GlorySystem.lua new file mode 100644 index 0000000..8e33c29 --- /dev/null +++ b/Misc/GlorySystem.lua @@ -0,0 +1,106 @@ +-- How it works: +-- Each week it should run a check that will remove 5% of player's glory +-- For each kill player gets 50 glory +-- Each 30 secs time event for player checks if player has enough glory for title +-- if yes, it learns title to a player, otherwise it ulearns a title +-- Titles goes according to array Asc_Glory_Titles = {titleid, cost, hordetitleid} +-- Glory goes according to colum in character DB +-- Check goes according to table in character DB + +--[[local Asc_Glory_Titles = { + [1] = {1, 1500, 15}, + [2] = {2, 2500, 16}, + [3] = {3, 5000, 17}, + [4] = {4, 7500, 18}, + [5] = {5, 10000, 19}, + [6] = {6, 15000, 20}, + [7] = {7, 20000, 21}, + [8] = {8, 22500, 22}, + [9] = {9, 25000, 23}, + [10] = {10, 30000, 24}, + [11] = {11, 32500, 25}, + [12] = {12, 35000, 26}, + [13] = {13, 40000, 27}, + [14] = {14, 50000, 28}, + [15] = {230, 51000, 229}, +} + +local Asc_Reduce_Amount = 5 + +local Asc_Kill_Reward = 50 + +local Asc_Time_ToCheck = 0 + +local function Asc_Glory_SQL(glory, guid) +local glorySQL = CharDBQuery("SELECT gloryPoints FROM characters WHERE guid = "..guid..";") +if not(glorySQL) then + CharDBQuery("UPDATE characters SET gloryPoints = "..glory.." WHERE guid = "..guid..";") + else + local glory = glorySQL:GetInt32(0)+glory + CharDBQuery("UPDATE characters SET gloryPoints = "..glory.." WHERE guid = "..guid..";") + end + end + +function Asc_Glory_Check(eventId, delay, repeats, player) -- function registered in Sanctuaryfix.lua + local enoughGlory = false + local pGUID = player:GetGUIDLow() + local glorySQL = CharDBQuery("SELECT gloryPoints FROM characters WHERE guid = "..pGUID..";") + + if not(glorySQL) then + return false + end + + local glory = glorySQL:GetInt32(0) + + for k,titles in pairs(Asc_Glory_Titles) do + local Title = nil + + if (glory >= titles[2]) then -- check for enough glory + enoughGlory = true + else + enoughGlory = false + end + + + if player:IsAlliance() then --set correct title entry + Title = titles[1] + else + Title = titles[3] + end + + + if (player:HasTitle(Title)) then -- main check to learn/unlearn title + if not(enoughGlory) then + player:UnsetKnownTitle(Title) + end + else + if (enoughGlory) then + player:SetKnownTitle(Title) + end + end + end + + --player:SendBroadcastMessage("DEBUG Glory = "..glory) +end + +local function Asc_Glory_HonorKill(event, killer, killed) + local kLevel = killer:GetLevel() + local vLevel = killed:GetLevel() + local kGUID = killer:GetGUIDLow() + local isHonoredKill_glorycount = -Asc_Kill_Reward + + if kLevel <= (vLevel+5) then + isHonoredKill_glorycount = Asc_Kill_Reward + end + + Asc_Glory_SQL(isHonoredKill_glorycount, kGUID) + + end + +RegisterPlayerEvent(6, Asc_Glory_HonorKill) + +local function Asc_Glory_BG(event, bg, bgId, instanceId, winner) + print(winner) + end + +RegisterBGEvent(2, Asc_Glory_BG)]]-- \ No newline at end of file diff --git a/Misc/LevelBroadcast.lua b/Misc/LevelBroadcast.lua new file mode 100644 index 0000000..f38416b --- /dev/null +++ b/Misc/LevelBroadcast.lua @@ -0,0 +1,8 @@ +local function OnLevel(event, player, oldLevel) +if (player:GetLevel() == 10) then + player:SendBroadcastMessage("You can now pick your first talents!") +elseif (player:GetLevel() == 2) then + player:SendBroadcastMessage("You can now pick your first ability in the Character Advancement page.") + end +end +RegisterPlayerEvent(13, OnLevel) \ No newline at end of file diff --git a/Misc/NewAuras.lua b/Misc/NewAuras.lua new file mode 100644 index 0000000..d9e0de4 --- /dev/null +++ b/Misc/NewAuras.lua @@ -0,0 +1,10 @@ +local function NewAuras1(event, player) + player:AddAura(974994, player) + player:AddAura(974995, player) + player:AddAura(974996, player) + player:AddAura(974997, player) + player:AddAura(974998, player) + player:AddAura(974999, player) +end + +RegisterPlayerEvent( 3, NewAuras1 ) \ No newline at end of file diff --git a/Misc/On_Stealth_Remove_Starfall.lua b/Misc/On_Stealth_Remove_Starfall.lua new file mode 100644 index 0000000..257188d --- /dev/null +++ b/Misc/On_Stealth_Remove_Starfall.lua @@ -0,0 +1,15 @@ +local stealth = {1784, 58984, 66} +local starfall = {48505, 53199, 53200, 53201, 75} + +local function OnStealth(event, player, spell, skipCheck) + for _, t in pairs(stealth) do + for k, v in pairs(starfall) do + if (player:HasAura(t) and player:HasAura(v)) then + --print("Test 1") + player:RemoveAura(v) + --print("test 2") + end + end + end +end +RegisterPlayerEvent(5, OnStealth) \ No newline at end of file diff --git a/Misc/OrcFix.lua b/Misc/OrcFix.lua new file mode 100644 index 0000000..3c17122 --- /dev/null +++ b/Misc/OrcFix.lua @@ -0,0 +1,11 @@ +--TEMP USED THIS ONE FOR FIXING SEABISCUIT LEARN SPELL-- +RegisterPlayerEvent(28, function(event,player) + if (player:HasSpell(966004)) then + player:LearnSpell(966002) + player:RemoveSpell(966004) + end + + if not(player:HasSpell(500000)) then -- Father asked me to make this always learned + player:LearnSpell(500000) + end + end) \ No newline at end of file diff --git a/Misc/Poisons.lua b/Misc/Poisons.lua new file mode 100644 index 0000000..c0333ea --- /dev/null +++ b/Misc/Poisons.lua @@ -0,0 +1,11 @@ +local function PoisonMaxSkill(event, player) + local x = player:GetSkillValue(40) + local level = player:GetLevel() + local mult = (level * 5) + if player:HasSpell(2842) then + player:SetSkill(40, 0, x, mult) + end +end + +RegisterPlayerEvent( 3, PoisonMaxSkill) +RegisterPlayerEvent( 13, PoisonMaxSkill) \ No newline at end of file diff --git a/Misc/RemoveSprintOnMapchange.lua b/Misc/RemoveSprintOnMapchange.lua new file mode 100644 index 0000000..3a0809c --- /dev/null +++ b/Misc/RemoveSprintOnMapchange.lua @@ -0,0 +1,8 @@ +local sprint = 818012 + +local function OnMapChange(event, player) + if player:HasAura(sprint) then + player:RemoveAura(sprint) + end +end +RegisterPlayerEvent(28, OnMapChange) \ No newline at end of file diff --git a/Misc/Scholo.lua~ b/Misc/Scholo.lua~ new file mode 100644 index 0000000..7b05433 --- /dev/null +++ b/Misc/Scholo.lua~ @@ -0,0 +1,28 @@ +local function SpookyItUp(eventId, delay, repeats, player) + player:GetCreaturesInRange(100, 10475, 0, 0) + for x=1,#mobs,1 do + local x = mobs[x]:GetX() + local y = mobs[x]:GetY() + local z = mobs[x]:GetZ() + local o = mobs[x]:GetO() + if mobs[x]:IsDead() == false then + mobs[x]:Kill(mobs[x]) + end + mobs[x]:SpawnCreature(11547, x, y, z, o, 6, 60000) + end +end + +local function Spooky(event, player, item, target) + local dummy = player:GetNearestCreature(100, 750018, 0, 0) + local cx = dummy:GetX() + local cy = dummy:GetY() + local cz = dummy:GetZ() + local co = dummy:GetO() + player:SummonGameObject(177304, cx, cy, cz, co) + local gambit = player:GetNearestGameobject(10, 177304) + gambit:RemoveFromWorld(true) + player:RegisterEvent(14000, SpookyItUp, 1) + player:SendBroadcastMessage("gambit removed: " ..gambit.. ".") +end + +RegisterItemEvent(17191, 2, Spooky) \ No newline at end of file diff --git a/Misc/ScrollOfUnlearningMailGift.lua b/Misc/ScrollOfUnlearningMailGift.lua new file mode 100644 index 0000000..a0e99b3 --- /dev/null +++ b/Misc/ScrollOfUnlearningMailGift.lua @@ -0,0 +1,9 @@ +local Gift_Text = "Your feats in Azeroth will never be forgotten. We hope that this humble reward will help you along your way!" +local Gift_Subject = "To the Great Hero of Azeroth!" +local function ScrollGift(event, player, oldLevel) + if ((oldLevel+1)%10 == 0) then + SendMail( Gift_Subject, Gift_Text, player:GetGUIDLow(), 0, 61, 0, 0, 0, 1101243, 1) + end +end + +RegisterPlayerEvent(13, ScrollGift) \ No newline at end of file diff --git a/Misc/SpiritHealer.lua~ b/Misc/SpiritHealer.lua~ new file mode 100644 index 0000000..93b21e1 --- /dev/null +++ b/Misc/SpiritHealer.lua~ @@ -0,0 +1,35 @@ +local function SpiritHello(event, player, creature) + player:GossipClearMenu() + creature:ClearCreatureGossipEvents(6491) + player:GossipMenuAddItem(0, "Pepsi", 83, 1) + player:GossipMenuAddItem(0, "Coke", 83, 7) + player:GossipSendMenu(83, creature, MenuId) +end + +local function SpiritSelect(event, player, creature, sender, intid, code) + -- teleport based on gossip option + player:SendBroadcastMessage("The intid is " ..intid.. ".") + if (intid == 1) then + local RQuery1 = WorldDBQuery("SELECT race, map, x, y, z, o FROM player_resurrect_locations WHERE race = " ..player:GetRace().. ";") + if (RQuery1:GetInt32(0) ~= nil) then + -- add rez sickness, destroy items equipped, resurrect player + player:Teleport(RQuery1:GetInt32(1), RQuery1:GetInt32(2), RQuery1:GetInt32(3), RQuery1:GetInt32(4), RQuery1:GetInt32(5)) + player:ResurrectPlayer(50, true) + player:DurabilityLossAll(100, false) + player:AddAura(15007, player) + else + player:SendBroadcastMessage("An error has occurred within script:SpiritHealer.lua. Please report this to an administrator.") + end + elseif (intid == 7) then + player:ResurrectPlayer(25, true) + player:AddAura(15007, player) + player:DurabilityLossAll(25, true) + else + player:ResurrectPlayer(25, true) + player:AddAura(15007, player) + player:DurabilityLossAll(25, true) + end +end + +RegisterCreatureGossipEvent(6491, 1, SpiritHello) +RegisterCreatureGossipEvent(6491, 2, SpiritSelect) diff --git a/Misc/TMLock.lua b/Misc/TMLock.lua new file mode 100644 index 0000000..c48e3c6 --- /dev/null +++ b/Misc/TMLock.lua @@ -0,0 +1,41 @@ +local function TMLock1(event, player) -- prevent using spells by gms rank 2 + if (player:GetGMRank() < 2) or (player:GetGMRank() > 3) then + return false + else + --player:AddAura(6462, player) + --player:AddAura(42201, player) + player:SetFlag(150,0x00800000) + end +end + +local function TMLock2(event, player, newZone, newArea) -- Teleport rank2 gms to gmisland + if (player:GetGMRank() ~= 2) then + return false + elseif (player:GetZoneId() == 876) then + return false + else + player:Teleport(1, 16225.9, 16255, 13.0438, 4.35969) + end +end + +local function TMLock3(eventId, delay, repeats, player) + --player:AddAura(6462, player) + --player:AddAura(42201, player) + --player:SetFlag(150,0x00800000) + if (player:IsGMVisible()) then + player:SetGMVisible(false) + player:AddAura(37800, player) + end +end + +RegisterPlayerEvent(27, TMLock2) -- zonechange event +RegisterPlayerEvent(3, TMLock1) -- onlogin event + +local function TimingChecks_GM(event,player) -- rank 3 .gm vis off all the time + if (player:GetGMRank() ~= 3) then + return false + end + player:RegisterEvent(TMLock3, 2000, 0) +end +RegisterPlayerEvent(28, TimingChecks_GM) +--RegisterPlayerEvent(3, TimingChecks_GM) \ No newline at end of file diff --git a/Misc/TeleportRevive.lua~ b/Misc/TeleportRevive.lua~ new file mode 100644 index 0000000..e4f9696 --- /dev/null +++ b/Misc/TeleportRevive.lua~ @@ -0,0 +1,19 @@ +local function Teleport(event, player) + -- on revive, teleport + local RQuery1 = WorldDBQuery("SELECT race, map, x, y, z, o FROM player_resurrect_locations WHERE race = " ..player:GetRace().. ";") + if (RQuery1:GetInt32(0) ~= nil) then + player:Teleport(RQuery1:GetInt32(1), RQuery1:GetInt32(2), RQuery1:GetInt32(3), RQuery1:GetInt32(4), RQuery1:GetInt32(5)) + else + player:SendBroadcastMessage("An error has occurred within script:Revive.lua. Please report this to an administrator.") + end +end + +local function Rez(event, killer, killed) + -- check to see if player is in BG, Arena, or instance. If no, revive. + if (killed:InBattleground() == false) and (killed:InArena() == false) and (killed:GetInstanceId() == 0) then + killed:ResurrectPlayer(50, false) + end +end + +RegisterPlayerEvent(36, Teleport) +RegisterPlayerEvent(8, Rez) \ No newline at end of file diff --git a/Misc/TestReturn.lua b/Misc/TestReturn.lua new file mode 100644 index 0000000..10b8d6b --- /dev/null +++ b/Misc/TestReturn.lua @@ -0,0 +1,35 @@ +local aura = 818052 -- put Test Aura ID here +local function TestReturn(event, player, newZone, NewArea) + if (newZone ~= 3817 and NewArea ~= 3817) then -- Test ZoneID and AreaID + if player:HasAura(aura) then + player:Teleport(13, -5.723160, -6.920650, -144.709000, 3.462120) -- Test Zone Coords + end + end +end +RegisterPlayerEvent(27, TestReturn) + +local testnpc = 212341 + +function On_Gossip(event, player, unit) + player:GossipMenuAddItem(0, "Add Test Aura", 0, 1) + player:GossipMenuAddItem(0, "Remove Test Aura", 0, 2) + player:GossipSendMenu(1, unit) +end + +function On_Select(event, player, unit, sender, intid, code) + if (intid == 1) then + player:AddAura(818052, player) + player:GossipComplete() + unit:SendUnitSay(""..player:GetName().." now has the Test aura and is now locked to this map.", 7) + --player:SendBroadcastMessage("You now have a Test Aura, you will not be allowed anywhere else until removed.") + else + player:RemoveAura(818052, player) + player:GossipComplete() + unit:SendUnitSay(""..player:GetName().." has removed the Test aura and is free to return to Azeroth.", 7) + --player:SendBroadcastMessage("Your Test aura has been removed, you're welcome to go back to Azeroth") +end + player:GossipComplete() +end + +RegisterCreatureGossipEvent(testnpc, 1, On_Gossip) +RegisterCreatureGossipEvent(testnpc, 2, On_Select) \ No newline at end of file diff --git a/Misc/Unlearn.lua b/Misc/Unlearn.lua new file mode 100644 index 0000000..6d137b0 --- /dev/null +++ b/Misc/Unlearn.lua @@ -0,0 +1,37 @@ +local function UnlearnHello(event, player, creature) + player:GossipMenuAddItem(0, "Alchemy", 900017, 1, false, "Are you sure you want to unlearn this profession?") + player:GossipMenuAddItem(0, "Blacksmithing", 900017, 2, false, "Are you sure you want to unlearn this profession?") + player:GossipMenuAddItem(0, "Enchanting", 900017, 3, false, "Are you sure you want to unlearn this profession?") + player:GossipMenuAddItem(0, "Engineering", 900017, 4, false, "Are you sure you want to unlearn this profession?") + player:GossipMenuAddItem(0, "Herbalism", 900017, 5, false, "Are you sure you want to unlearn this profession?") + player:GossipMenuAddItem(0, "Leatherworking", 900017, 6, false, "Are you sure you want to unlearn this profession?") + player:GossipMenuAddItem(0, "Mining", 900017, 7, false, "Are you sure you want to unlearn this profession?") + player:GossipMenuAddItem(0, "Skinning", 900017, 8, false, "Are you sure you want to unlearn this profession?") + player:GossipMenuAddItem(0, "Tailoring", 900017, 9, false, "Are you sure you want to unlearn this profession?") + player:GossipMenuAddItem(0, "Nevermind", 900017, 0) + player:GossipSendMenu(900017, creature, MenuId) +end + +local function UnlearnSelect(event, player, creature, sender, intid, code) + if (intid > 0) then + local UnQuery1 = WorldDBQuery("SELECT intid, spell FROM gossip_options_lua WHERE intid = " ..intid.. ";") + local spellid = UnQuery1:GetInt32(1) + player:GossipComplete() + if (UnQuery1 ~= nil) then + if (player:HasSpell(spellid) == true) then + player:RemoveSpell(spellid) + else + player:SendBroadcastMessage("You do not know that profession!") + end + else + player:SendBroadcastMessage("Sorry, but the action you are trying to perform cannot be finished. Please report this to an administrator.") + end + else + player:GossipComplete() + end +end + +RegisterCreatureGossipEvent(9999999, 1, UnlearnHello) +RegisterCreatureGossipEvent(9999999, 2, UnlearnSelect) +RegisterCreatureGossipEvent(9999998, 1, UnlearnHello) +RegisterCreatureGossipEvent(9999998, 2, UnlearnSelect) \ No newline at end of file diff --git a/Misc/XPLock.lua~ b/Misc/XPLock.lua~ new file mode 100644 index 0000000..9c1cee6 --- /dev/null +++ b/Misc/XPLock.lua~ @@ -0,0 +1,38 @@ +local function Lock(event, player, oldLevel) + -- on level up, does loop to check if quest has been completed by level (represented as y). if yes, halt code. if not, continue to add aura. + local questID = { +-- {req. level, questid} + {10, 899}, + {20, 4921}, + } + for y=1,#questID,1 do + if (player:GetQuestStatus(questID[y][2]) == 6) and (player:GetLevel() == questID[y][1]) then + return true + elseif (player:GetLevel() == questID[y][1]) then + player:AddAura(818057, player) + return false + end + end +end + +RegisterPlayerEvent(13, Lock) + +local function TimedCheck(event, player) + -- a timer based on the player save interval that will remove the aura if character has completed quests in loop + if (player:HasAura(818057) == false) then + return false + end + local questID = { +-- {req. level, questid} + {10, 899}, + {20, 4921}, + } + for y=1,#questID,1 do + if (player:GetQuestStatus(questID[y][2]) == 6) and (player:GetLevel() == questID[y][1]) then + player:RemoveAura(818057) + return true + end + end +end + +RegisterPlayerEvent(25, TimedCheck) \ No newline at end of file diff --git a/Misc/items/DedicatedScroll.lua b/Misc/items/DedicatedScroll.lua new file mode 100644 index 0000000..6f6f973 --- /dev/null +++ b/Misc/items/DedicatedScroll.lua @@ -0,0 +1,7 @@ +local function Scroll(event, player, item, target) + player:SetKnownTitle(257) + player:SendNotification("|cffFF6600 Thanks for the Support! |r") + player:CastSpell(player, 55420, false) +end + +RegisterItemEvent(977121, 2, Scroll) \ No newline at end of file diff --git a/Misc/items/FounderScroll.lua b/Misc/items/FounderScroll.lua new file mode 100644 index 0000000..3fd04f3 --- /dev/null +++ b/Misc/items/FounderScroll.lua @@ -0,0 +1,7 @@ +local function Scroll(event, player, item, target) + player:SetKnownTitle(210) + player:SendNotification("|cffFF6600 Thanks for becoming a founder! |r") + player:CastSpell(player, 55420, false) +end + +RegisterItemEvent(977020, 2, Scroll) \ No newline at end of file diff --git a/Misc/items/MaraStaff.lua b/Misc/items/MaraStaff.lua new file mode 100644 index 0000000..1e4ea09 --- /dev/null +++ b/Misc/items/MaraStaff.lua @@ -0,0 +1,8 @@ +local function MaraStaff(event, player, item, target) + local goober = player:GetNearestGameObject( 0.1, 178386) + if (goober ~= nil) then + player:CastSpell(player, 21127, true) + end +end + +RegisterItemEvent(17191, 2, MaraStaff) \ No newline at end of file diff --git a/Misc/items/SupporterScroll.lua b/Misc/items/SupporterScroll.lua new file mode 100644 index 0000000..c8ecc2a --- /dev/null +++ b/Misc/items/SupporterScroll.lua @@ -0,0 +1,7 @@ +local function Scroll(event, player, item, target) + player:SetKnownTitle(258) + player:SendNotification("|cffFF6600 Thanks for the Support! |r") + player:CastSpell(player, 55420, false) +end + +RegisterItemEvent(977120, 2, Scroll) \ No newline at end of file diff --git a/Misc/items/TaxiCheatScroll.lua b/Misc/items/TaxiCheatScroll.lua new file mode 100644 index 0000000..302ec91 --- /dev/null +++ b/Misc/items/TaxiCheatScroll.lua @@ -0,0 +1,17 @@ +local function TaxiCheatScroll(event, player, item, target) + player:SetTaxiCheat(true) + player:SendNotification("|cffFF6600 You're now free to choose any flight path you want! |r") + player:CastSpell(player, 51908, false) + --player:RemoveAura(70571) + if not(CharDBQuery("SELECT guid FROM custom_taxicheat WHERE guid = "..player:GetGUIDLow()..";")) then + CharDBExecute("INSERT INTO custom_taxicheat VALUES ("..player:GetGUIDLow()..");") + end +end + +RegisterItemEvent(977025, 2, TaxiCheatScroll) + +RegisterPlayerEvent(3, function(event,player) + if CharDBQuery("SELECT guid FROM custom_taxicheat WHERE guid = "..player:GetGUIDLow()..";") then + player:SetTaxiCheat(true) + end + end) \ No newline at end of file diff --git a/Misc/items/ZFGong.lua b/Misc/items/ZFGong.lua new file mode 100644 index 0000000..da88388 --- /dev/null +++ b/Misc/items/ZFGong.lua @@ -0,0 +1,11 @@ +local function ZFGong(event, player, item, target) + local goober = player:GetNearestGameObject( 5, 141832) + if (goober == nil) then + return false; + else + player:SpawnCreature(7273, 1665.56, 1187.32, 11.64, 3.9, 7) + end +end + + +RegisterItemEvent(9240, 2, ZFGong) \ No newline at end of file diff --git a/Misc/quests/Mankrik.lua b/Misc/quests/Mankrik.lua new file mode 100644 index 0000000..03d902b --- /dev/null +++ b/Misc/quests/Mankrik.lua @@ -0,0 +1,8 @@ +local function DeadBeatWife(event, player, creature) + player:GossipSendMenu(9999997, creature, MenuId) + if player:HasQuest(4921) then + player:CompleteQuest(4921) + end +end + +RegisterCreatureGossipEvent(9999997, 1, DeadBeatWife) \ No newline at end of file diff --git a/Misc/spells/DivineVanish.lua b/Misc/spells/DivineVanish.lua new file mode 100644 index 0000000..bfc98fa --- /dev/null +++ b/Misc/spells/DivineVanish.lua @@ -0,0 +1,7 @@ +local function DivineDebuff(event, player, spell, skipCheck) + if (spell:GetEntry() >= 1856) and (spell:GetEntry() <= 1857) then + player:RemoveAura(642) + end +end + +RegisterPlayerEvent(5, DivineDebuff) \ No newline at end of file diff --git a/Misc/spells/NoSummon.lua b/Misc/spells/NoSummon.lua new file mode 100644 index 0000000..366b2a7 --- /dev/null +++ b/Misc/spells/NoSummon.lua @@ -0,0 +1,12 @@ +local function NoSummon(event, player, spell, skipCheck) + if (player:GetInstanceId() == 0) then + return false + elseif (spell:GetEntry() ~= 698) then + return false + else + spell:Cancel() + end +end + + +RegisterPlayerEvent(5, NoSummon) \ No newline at end of file diff --git a/PvP/CityPvP.lua b/PvP/CityPvP.lua new file mode 100644 index 0000000..74101c4 --- /dev/null +++ b/PvP/CityPvP.lua @@ -0,0 +1,13 @@ +local cityDictionary = {[1637] = true, [1638] = true, [1497] = true, [3487] = true, [1519] = true, [1537] = true, [1657] = true, [3557] = true } + +local function killedPlayer(event, killer, killed) + if (killer == killed) then + return false + end + thisArea = killer:GetAreaId() + if (cityDictionary[thisArea] == true) then + killer:AddItem(880000, 1) + end +end + +RegisterPlayerEvent(6, killedPlayer) \ No newline at end of file diff --git a/PvP/Guildwars.lua.disable b/PvP/Guildwars.lua.disable new file mode 100644 index 0000000..1b6fdbe --- /dev/null +++ b/PvP/Guildwars.lua.disable @@ -0,0 +1,2557 @@ +print("Guild Wars System Loading:\n") + + +local start = os.clock() + +if(GetLuaEngine()~="ElunaEngine")then + print("err: "..GetLuaEngine().." Detected.\n"); + print("!!..LOAD HALTED..?!!"); + print("\nXXX XXX XXX XXX XXX XXX XXX XXX XXX"); + print("-----------------------------------"); + return false; +else + print("Approved: Eluna Detected.\n"); +end + +local Guard_Died_Drop = 20558; -- wsg's +local table_version = 2.75; +local core_version = 6.65; +local pigpayz_version = 2.50; +local tele_version = 1.50; +local pvp_version = 4.80; +local vendor_version = 1.52; + +local SERVER_GUILD_NAME = "SERVER"; +local SERVER_GUILD_ID = 0; +local SERVER_PRE_MESSAGE = "[Guild Wars]"; + +local guild_warz_DB = "guild_warz_335"; -- Must match unique name if running on multiple cores i.e. guild_warz_335_1 + +-- ----------------------------------------------------- +-- built-in vendors operational switches and item tables +-- ----------------------------------------------------- +local vendor1 = 1; -- use built-in vendor 1 0/1 no/yes. +local vendor2 = 1; -- use built-in vendor 2 0/1 no/yes. +local vendor3 = 1; -- use built-in vendor 3 0/1 no/yes. + +-- vendor buffs {spell_id, "menu selection name"}, last entry must be the `{0, "good bye"}` entry -- vendor1 +local Vendor1 = {{23767, "Armor + 10%"},{23768, "Damage + (1 - 10)%"},{23769, "Resistances + 25"},{23736, "Agility + 10%"},{23766, "Intelligence + 10%"},{23738, "Spirit + 10%"},{23735, "Strength + 10%"},{23737, "Stamina + 10%"},{25840, "Heal Me"},{0, "good bye"},}; + +-- vendor items {item_id, custom_cost}, if no custom cost then use 0.(vendor item limit = 10 items per page, limit 15 pages) -- vendor2, vendor3 +local Vendor2 = {{7734,0},{6948,0},{49912,0},{34498,0},{46693,0},{34499,0},{35557,0},{37431,0},{17202,0},{21038,0},{46783,0},}; -- funny items +local Vendor3 = {{32837,0},{32838,0},{22736,0},{19019,0},{51858,0},{24550,0},{2000,0},{50730,0},{50070,0},{34196,0},{30906,0},}; -- misc gear +-- ----------------------------------------------------- + +GWCOMM = {}; +GWARZ = {}; +GWHELP = {}; +GGWC = {}; +GGW = {}; + +local function LoadGWtable() + +local Ghsql = WorldDBQuery("SELECT * FROM "..guild_warz_DB..".help;"); + + if(Ghsql)then + + repeat + GWHELP[Ghsql:GetUInt32(0)] = { + entry = Ghsql:GetUInt32(0), + command = Ghsql:GetString(1), + description = Ghsql:GetString(2), + example = Ghsql:GetString(3), + command_level = Ghsql:GetUInt32(4), + }; + until not Ghsql:NextRow() + end + +local Gcsql = WorldDBQuery("SELECT * FROM "..guild_warz_DB..".commands;"); + + if(Gcsql)then + repeat + GWCOMM[Gcsql:GetUInt32(1)] = { + guild = Gcsql:GetString(0), + guild_id = Gcsql:GetUInt32(1), + team = Gcsql:GetUInt8(2), + commands = Gcsql:GetString(3), + info_loc = Gcsql:GetString(4), + list_loc = Gcsql:GetString(5), + tele = Gcsql:GetString(6), + version = Gcsql:GetString(7), + GLD_lvlb = Gcsql:GetUInt8(8), + GLD_lvls = Gcsql:GetUInt8(9), + respawn_flag = Gcsql:GetString(10), + details_loc = Gcsql:GetString(11), + table = Gcsql:GetString(12), + GM_admin = Gcsql:GetUInt8(13), + GM_minimum = Gcsql:GetUInt8(14), + currency = Gcsql:GetUInt32(15), + pig_payz = Gcsql:GetUInt32(16), + pig_payz_timer = Gcsql:GetUInt32(17), + gift_count = Gcsql:GetUInt16(18), + flag_require = Gcsql:GetUInt8(19), + Server = Gcsql:GetString(20), + command_set = Gcsql:GetString(21), + anarchy = Gcsql:GetUInt8(22), + flag_timer = Gcsql:GetUInt8(23), + spawn_timer = Gcsql:GetUInt32(24), + guild_invite = Gcsql:GetUInt8(25), + loc = Gcsql:GetString(26), + loc_cost = Gcsql:GetUInt8(27), + flag_id = Gcsql:GetUInt32(28), + farm = Gcsql:GetString(29), + farm_cost = Gcsql:GetUInt8(30), + farm_L = Gcsql:GetUInt8(31), + farm_id = Gcsql:GetUInt32(32), + barrack = Gcsql:GetString(33), + barrack_cost = Gcsql:GetUInt8(34), + barrack_L = Gcsql:GetUInt8(35), + barrack_id = Gcsql:GetUInt32(36), + hall = Gcsql:GetString(37), + hall_cost = Gcsql:GetUInt8(38), + hall_L = Gcsql:GetUInt8(39), + hall_id = Gcsql:GetUInt32(40), + pig = Gcsql:GetString(41), + pig_cost = Gcsql:GetUInt8(42), + pig_L = Gcsql:GetUInt8(43), + pig_id = Gcsql:GetUInt32(44), + guard = Gcsql:GetString(45), + guard_cost = Gcsql:GetUInt8(46), + guard_L = Gcsql:GetUInt8(47), + guard_id = Gcsql:GetUInt32(48), + vendor1 = Gcsql:GetString(49), + vendor1_cost = Gcsql:GetUInt8(50), + vendor1_L = Gcsql:GetUInt8(51), + vendor1_id = Gcsql:GetUInt32(52), + vendor2 = Gcsql:GetString(53), + vendor2_cost = Gcsql:GetUInt8(54), + vendor2_L = Gcsql:GetUInt8(55), + vendor2_id = Gcsql:GetUInt32(56), + vendor3 = Gcsql:GetString(57), + vendor3_cost = Gcsql:GetUInt8(58), + vendor3_L = Gcsql:GetUInt8(59), + vendor3_id = Gcsql:GetUInt32(60), + cannon = Gcsql:GetString(61), + cannon_cost = Gcsql:GetUInt8(62), + cannon_L = Gcsql:GetUInt8(63), + cannon_id = Gcsql:GetUInt32(64), + vault = Gcsql:GetString(65), + vault_cost = Gcsql:GetUInt8(66), + vault_L = Gcsql:GetUInt8(67), + vault_id = Gcsql:GetUInt32(68), + mailbox = Gcsql:GetString(69), + mailbox_cost = Gcsql:GetUInt8(70), + mailbox_L = Gcsql:GetUInt8(71), + mailbox_id = Gcsql:GetUInt32(72), + setup = Gcsql:GetString(73), + color_1 = Gcsql:GetString(74), + color_2 = Gcsql:GetString(75), + color_3 = Gcsql:GetString(76), + color_4 = Gcsql:GetString(77), + color_5 = Gcsql:GetString(78), + color_6 = Gcsql:GetString(79), + color_7 = Gcsql:GetString(80), + color_8 = Gcsql:GetString(81), + color_9 = Gcsql:GetString(82), + color_10 = Gcsql:GetString(83), + color_11 = Gcsql:GetString(84), + color_12 = Gcsql:GetString(85), + color_13 = Gcsql:GetString(86), + color_14 = Gcsql:GetString(87), + color_15 = Gcsql:GetString(88), + }; + until not Gcsql:NextRow(); + end + + local Gwsql = WorldDBQuery("SELECT * FROM "..guild_warz_DB..".zones;"); + + if(Gwsql)then + repeat + GWARZ[Gwsql:GetUInt32(0)] = { + entry = Gwsql:GetUInt32(0), + map_id = Gwsql:GetUInt32(1), + area_id = Gwsql:GetUInt32(2), + zone_id = Gwsql:GetUInt32(3), + guild_name = Gwsql:GetString(4), + team = Gwsql:GetUInt8(5), + x = Gwsql:GetFloat(6), + y = Gwsql:GetFloat(7), + z = Gwsql:GetFloat(8), + farm_count = Gwsql:GetUInt32(9), + barrack_count = Gwsql:GetUInt32(10), + hall_count = Gwsql:GetUInt32(11), + pig_count = Gwsql:GetUInt32(12), + guard_count = Gwsql:GetUInt32(13), + vendor1_count = Gwsql:GetUInt32(14), + vendor2_count = Gwsql:GetUInt32(15), + vendor3_count = Gwsql:GetUInt32(16), + cannon_count = Gwsql:GetUInt32(17), + vault_count = Gwsql:GetUInt32(18), + mailbox_count = Gwsql:GetUInt32(19), + flag_id = Gwsql:GetUInt32(20), + spawn_time = Gwsql:GetUInt32(21), + guild_id = Gwsql:GetUInt32(22), + }; + until not Gwsql:NextRow(); + end +end + +LoadGWtable() + +local function LoadGWCOMMTable(id) + +local Gcsql = WorldDBQuery("SELECT * FROM "..guild_warz_DB..".commands WHERE `guild_id`='"..id.."';"); + + if(Gcsql)then + GWCOMM[Gcsql:GetUInt32(1)] = { + guild = Gcsql:GetString(0), + guild_id = Gcsql:GetUInt32(1), + team = Gcsql:GetUInt8(2), + commands = Gcsql:GetString(3), + info_loc = Gcsql:GetString(4), + list_loc = Gcsql:GetString(5), + tele = Gcsql:GetString(6), + version = Gcsql:GetString(7), + GLD_lvlb = Gcsql:GetUInt8(8), + GLD_lvls = Gcsql:GetUInt8(9), + respawn_flag = Gcsql:GetString(10), + details_loc = Gcsql:GetString(11), + table = Gcsql:GetString(12), + GM_admin = Gcsql:GetUInt8(13), + GM_minimum = Gcsql:GetUInt8(14), + currency = Gcsql:GetUInt32(15), + pig_payz = Gcsql:GetUInt32(16), + pig_payz_timer = Gcsql:GetUInt32(17), + gift_count = Gcsql:GetUInt16(18), + flag_require = Gcsql:GetUInt8(19), + Server = Gcsql:GetString(20), + command_set = Gcsql:GetString(21), + anarchy = Gcsql:GetUInt8(22), + flag_timer = Gcsql:GetUInt8(23), + spawn_timer = Gcsql:GetUInt32(24), + guild_invite = Gcsql:GetUInt8(25), + loc = Gcsql:GetString(26), + loc_cost = Gcsql:GetUInt8(27), + flag_id = Gcsql:GetUInt32(28), + farm = Gcsql:GetString(29), + farm_cost = Gcsql:GetUInt8(30), + farm_L = Gcsql:GetUInt8(31), + farm_id = Gcsql:GetUInt32(32), + barrack = Gcsql:GetString(33), + barrack_cost = Gcsql:GetUInt8(34), + barrack_L = Gcsql:GetUInt8(35), + barrack_id = Gcsql:GetUInt32(36), + hall = Gcsql:GetString(37), + hall_cost = Gcsql:GetUInt8(38), + hall_L = Gcsql:GetUInt8(39), + hall_id = Gcsql:GetUInt32(40), + pig = Gcsql:GetString(41), + pig_cost = Gcsql:GetUInt8(42), + pig_L = Gcsql:GetUInt8(43), + pig_id = Gcsql:GetUInt32(44), + guard = Gcsql:GetString(45), + guard_cost = Gcsql:GetUInt8(46), + guard_L = Gcsql:GetUInt8(47), + guard_id = Gcsql:GetUInt32(48), + vendor1 = Gcsql:GetString(49), + vendor1_cost = Gcsql:GetUInt8(50), + vendor1_L = Gcsql:GetUInt8(51), + vendor1_id = Gcsql:GetUInt32(52), + vendor2 = Gcsql:GetString(53), + vendor2_cost = Gcsql:GetUInt8(54), + vendor2_L = Gcsql:GetUInt8(55), + vendor2_id = Gcsql:GetUInt32(56), + vendor3 = Gcsql:GetString(57), + vendor3_cost = Gcsql:GetUInt8(58), + vendor3_L = Gcsql:GetUInt8(59), + vendor3_id = Gcsql:GetUInt32(60), + cannon = Gcsql:GetString(61), + cannon_cost = Gcsql:GetUInt8(62), + cannon_L = Gcsql:GetUInt8(63), + cannon_id = Gcsql:GetUInt32(64), + vault = Gcsql:GetString(65), + vault_cost = Gcsql:GetUInt8(66), + vault_L = Gcsql:GetUInt8(67), + vault_id = Gcsql:GetUInt32(68), + mailbox = Gcsql:GetString(69), + mailbox_cost = Gcsql:GetUInt8(70), + mailbox_L = Gcsql:GetUInt8(71), + mailbox_id = Gcsql:GetUInt32(72), + setup = Gcsql:GetString(73), + color_1 = Gcsql:GetString(74), + color_2 = Gcsql:GetString(75), + color_3 = Gcsql:GetString(76), + color_4 = Gcsql:GetString(77), + color_5 = Gcsql:GetString(78), + color_6 = Gcsql:GetString(79), + color_7 = Gcsql:GetString(80), + color_8 = Gcsql:GetString(81), + color_9 = Gcsql:GetString(82), + color_10 = Gcsql:GetString(83), + color_11 = Gcsql:GetString(84), + color_12 = Gcsql:GetString(85), + color_13 = Gcsql:GetString(86), + color_14 = Gcsql:GetString(87), + color_15 = Gcsql:GetString(88), + }; + end +end + +print("Guild Warz tables version: "..table_version); + +local Currencyname = GetItemLink(GWCOMM[SERVER_GUILD_ID].currency); + +-- ****************************************************** +-- ************** CORE : custom functions *************** +-- ****************************************************** + +local function GetLocationId(player) + for i = 1, #GWARZ do + if(GWARZ[i].map_id == player:GetMapId() and GWARZ[i].area_id == player:GetAreaId() and GWARZ[i].zone_id == player:GetZoneId()) then + return i; + end + end +end + +local function PreparedStatements(key, ...) + local Query = { + [1] = "UPDATE "..guild_warz_DB..".zones SET `%s` = '%s' WHERE `entry` = '%s';", + [2] = "DELETE FROM %s WHERE `guid` = '%s';", + [3] = "UPDATE "..guild_warz_DB..".commands SET `%s` = '%s' WHERE `guild` = '%s';", + [4] = "DELETE FROM "..guild_warz_DB..".commands WHERE `%s` = '%s';", + } + + if(key == 1) then + local subtable, value, loc = ...; + local qs = string.format(Query[key], subtable, value, loc) + WorldDBQuery(qs) + GWARZ[loc][subtable] = value; + end + + if(key == 2) then + local qs = string.format(Query[key], ...) + WorldDBQuery(qs) + end + + if(key == 3) then + local subtable, value, guild = ...; + local qs = string.format(Query[key], ...) + WorldDBQuery(qs) + GWCOMM[guild][subtable] = value; + end + + if(key == 4) then + local subtable, name = ...; + local qs = string.format(Query[key], ...) + GWCOMM[subtable] = nil; + WorldDBQuery(qs) + end + +end + +function CreateLocation(map, area, zone) + local CLentry = (#GWARZ+1) + WorldDBQuery("INSERT INTO "..guild_warz_DB..".zones SET `entry` = '"..CLentry.."';"); + LoadGWtable() + print("Location: "..CLentry.." : created.") + + -- Push values to Table Update after creation + PreparedStatements(1, "map_id", map, CLentry) + PreparedStatements(1, "area_id", area, CLentry) + PreparedStatements(1, "zone_id", zone, CLentry) + PreparedStatements(1, "guild_name", SERVER_GUILD_ID, CLentry) + PreparedStatements(1, "team", 2, CLentry) + PreparedStatements(1, "x", 0, CLentry) + PreparedStatements(1, "y", 0, CLentry) + PreparedStatements(1, "z", 0, CLentry) + PreparedStatements(1, "farm_count", 0, CLentry) + PreparedStatements(1, "pig_count", 0, CLentry) + PreparedStatements(1, "guard_count", 0, CLentry) + PreparedStatements(1, "flag_id", 0, CLentry) + PreparedStatements(1, "guild_id", SERVER_GUILD_ID, CLentry) + return CLentry; +end + +function CreateGcommands(guild, name) + local gid = guild:GetId(); + local CLentry = (#GWCOMM+1) -- should create varchar entry of guild name + + WorldDBQuery("INSERT INTO "..guild_warz_DB..".commands SET `guild_id` = '"..gid.."';") + LoadGWCOMMTable(gid) + PreparedStatements(3, "guild", name, gid) + print("commands for: "..name.." : created.") + return guild; +end + +local GW_version = ((table_version+core_version+pigpayz_version+tele_version+pvp_version+vendor_version)/4); + +function Newguildgift(eventId, guild, leader, name) -- idea provided by creativextent . wrote by BlackWolf + CreateGcommands(guild, name) + leader:AddItem(GWCOMM[SERVER_GUILD_ID].currency, GWCOMM[SERVER_GUILD_ID].gift_count) + SendWorldMessage(GWCOMM[SERVER_GUILD_ID].color_13.."The Guild "..name.." lead by "..leader:GetName().." has entered exsistance..!! NOW Prepair to hold your lands!!|r") +end + +RegisterGuildEvent(5, Newguildgift) + +local function OnGuildDelete(event, guild) -- clears a guilds commands from the table since guild id can be re-used. + local PLAYER_GUILD_NAME = guild:GetName(); + PreparedStatements(4, "guild", PLAYER_GUILD_NAME) +end + +RegisterGuildEvent(6, OnGuildDelete) + +function PlrFaction(eventId, player) + +local xFaction = player:GetFaction() + +GGW[player:GetAccountId()] = { + faction = xFaction, + team = player:GetTeam(), +}; + + if(player:GetGuildName())then + + local PLAYER_GUILD_ID = player:GetGuildId(); + local Guild = player:GetGuild(); + + if(GWCOMM[PLAYER_GUILD_ID] == nil)then + Gcommands = CreateGcommands(Guild, PLAYER_GUILD_ID) + end + + player:SendBroadcastMessage(GWCOMM[SERVER_GUILD_ID].color_14.."Use '/guild "..GWCOMM[SERVER_GUILD_ID].commands.."' for a list of GGW commands.") + end +end + +RegisterPlayerEvent(3, PlrFaction) + +local function DespawnCreature(event, creature) + + if(GGWC[creature:GetGUIDLow()] == 1)then + creature:DespawnOrUnsummon(); + end +end + +RegisterCreatureEvent(GWCOMM[SERVER_GUILD_ID].cannon_id, 5, DespawnCreature) +RegisterCreatureEvent(GWCOMM[SERVER_GUILD_ID].cannon_id+1, 5, DespawnCreature) + +-- **************************************************** +-- ******************* CORE ENGINE ******************** +-- **************************************************** + +function GWcommands(event, player, msg, type, language) +local k = 0 +local ChatCache = {} + + for word in string.gmatch(msg, "[%w_]+") do + k = k+1 + ChatCache[k] = word + end + +math.randomseed(tonumber(os.time()*os.time())) + +local guild = player:GetGuild(); +local PLAYER_GUILD_NAME = player:GetGuildName(); +local PLAYER_GUILD_ID = player:GetGuildId(); +local PLAYER_TEAM_ID = player:GetTeam(); +local LocId = GetLocationId(player); +local pGuildRank = player:GetGuildRank(); +local pGMRank = player:GetGMRank(); +local pName = player:GetName(); + + if(LocId == nil)then + LocId = CreateLocation(player:GetMapId(), player:GetAreaId(), player:GetZoneId()) + end + + if(GWCOMM[PLAYER_GUILD_ID] == nil)then + Gcommands = CreateGcommands(guild, PLAYER_GUILD_ID) + end + + local Zoneprice = (GWCOMM[SERVER_GUILD_ID].loc_cost)+(GWCOMM[SERVER_GUILD_ID].farm_cost*GWARZ[LocId].farm_count)+(GWCOMM[SERVER_GUILD_ID].barrack_cost*GWARZ[LocId].barrack_count)+(GWCOMM[SERVER_GUILD_ID].hall_cost*GWARZ[LocId].hall_count)+(GWCOMM[SERVER_GUILD_ID].pig_cost*GWARZ[LocId].pig_count)+(GWCOMM[SERVER_GUILD_ID].vendor1_cost*GWARZ[LocId].vendor1_count)+(GWCOMM[SERVER_GUILD_ID].vendor2_cost*GWARZ[LocId].vendor2_count)+(GWCOMM[SERVER_GUILD_ID].vendor3_cost*GWARZ[LocId].vendor3_count)+(GWCOMM[SERVER_GUILD_ID].cannon_cost*GWARZ[LocId].cannon_count)+(GWCOMM[SERVER_GUILD_ID].vault_cost*GWARZ[LocId].vault_count)+(GWCOMM[SERVER_GUILD_ID].mailbox_cost*GWARZ[LocId].mailbox_count); + local yentry = 0 + local ypigcnt = 0 + local yvalue = 0 + +-- **************************************************** +-- ************** CORE : Guild Commands *************** +-- **************************************************** + + if(player:IsInGuild()==true)then + + if(ChatCache[1] == GWCOMM[PLAYER_GUILD_ID].commands)then + + player:SendBroadcastMessage(GWCOMM[PLAYER_GUILD_ID].color_9.."*********************************************"); + player:SendBroadcastMessage(GWCOMM[PLAYER_GUILD_ID].color_8.."* -Guild Wars Commands:- *"); + player:SendBroadcastMessage(GWCOMM[PLAYER_GUILD_ID].color_9.."*********************************************"); + player:SendBroadcastMessage("(Guild: "..PLAYER_GUILD_NAME..")"); + player:SendBroadcastMessage("(Name: "..pName..") (Guild Rank: "..pGuildRank..") (GAME Rank: "..pGMRank..")"); + player:SendBroadcastMessage(GWCOMM[PLAYER_GUILD_ID].color_9.."************************************************************"); + player:SendBroadcastMessage(GWCOMM[PLAYER_GUILD_ID].color_8.." Guild Member Commands:"); + player:SendBroadcastMessage(GWCOMM[PLAYER_GUILD_ID].color_9.."-------------------------------------------"); + player:SendBroadcastMessage(GWCOMM[PLAYER_GUILD_ID].color_1..""..GWCOMM[PLAYER_GUILD_ID].commands.."|r "..GWCOMM[PLAYER_GUILD_ID].color_3.."list guild commands."); + player:SendBroadcastMessage(GWCOMM[PLAYER_GUILD_ID].color_1..""..GWCOMM[PLAYER_GUILD_ID].info_loc.."|r "..GWCOMM[PLAYER_GUILD_ID].color_3.."lists area info."); + player:SendBroadcastMessage(GWCOMM[PLAYER_GUILD_ID].color_1..""..GWCOMM[PLAYER_GUILD_ID].list_loc.."|r "..GWCOMM[PLAYER_GUILD_ID].color_3.."lists areas owned"); + player:SendBroadcastMessage(GWCOMM[PLAYER_GUILD_ID].color_1.."|r "..GWCOMM[PLAYER_GUILD_ID].color_3.."by your guild.|r"); + player:SendBroadcastMessage(GWCOMM[PLAYER_GUILD_ID].color_1..""..GWCOMM[PLAYER_GUILD_ID].tele.." `location_id`|r "..GWCOMM[PLAYER_GUILD_ID].color_3.."teleport to area"); + player:SendBroadcastMessage(GWCOMM[PLAYER_GUILD_ID].color_1.."|r "..GWCOMM[PLAYER_GUILD_ID].color_3.."by location id.|r"); + player:SendBroadcastMessage(GWCOMM[PLAYER_GUILD_ID].color_1.."|cff00cc00"..GWCOMM[PLAYER_GUILD_ID].version.."|r "..GWCOMM[PLAYER_GUILD_ID].color_3.."-displays Core versions.|r"); + player:SendBroadcastMessage(GWCOMM[PLAYER_GUILD_ID].color_1.."|cff00cc00"..GWCOMM[PLAYER_GUILD_ID].setup.."|r "..GWCOMM[PLAYER_GUILD_ID].color_3.."-displays System base setup.|r"); + player:SendBroadcastMessage(GWCOMM[PLAYER_GUILD_ID].color_9.."************************************************************"); + + if(pGuildRank <= GWCOMM[PLAYER_GUILD_ID].GLD_lvlb)then + player:SendBroadcastMessage(GWCOMM[PLAYER_GUILD_ID].color_1.."buy "..GWCOMM[PLAYER_GUILD_ID].color_8.."Guild Master level Commands:Rank: "..GWCOMM[PLAYER_GUILD_ID].color_2..GWCOMM[PLAYER_GUILD_ID].GLD_lvlb..GWCOMM[PLAYER_GUILD_ID].color_8.." access."); + player:SendBroadcastMessage(GWCOMM[PLAYER_GUILD_ID].color_9.."-------------------------------------------"); + player:SendBroadcastMessage(GWCOMM[PLAYER_GUILD_ID].color_1.."buy "..GWCOMM[PLAYER_GUILD_ID].loc.."|r "..GWCOMM[PLAYER_GUILD_ID].color_3.."- purchase area."); + player:SendBroadcastMessage(GWCOMM[PLAYER_GUILD_ID].color_1.."buy "..GWCOMM[PLAYER_GUILD_ID].farm.."|r "..GWCOMM[PLAYER_GUILD_ID].color_3.."- purchase a guild farm.|r"); + player:SendBroadcastMessage(GWCOMM[PLAYER_GUILD_ID].color_1.."buy "..GWCOMM[PLAYER_GUILD_ID].barrack.."|r "..GWCOMM[PLAYER_GUILD_ID].color_3.."- purchase a barracks for guards.|r"); + player:SendBroadcastMessage(GWCOMM[PLAYER_GUILD_ID].color_1.."buy "..GWCOMM[PLAYER_GUILD_ID].hall.."|r "..GWCOMM[PLAYER_GUILD_ID].color_3.."- purchase a guild hall.|r"); + player:SendBroadcastMessage(GWCOMM[PLAYER_GUILD_ID].color_1.."buy "..GWCOMM[PLAYER_GUILD_ID].pig.."|r "..GWCOMM[PLAYER_GUILD_ID].color_3.."- purchase a pig.|r"); + player:SendBroadcastMessage(GWCOMM[PLAYER_GUILD_ID].color_1.."buy "..GWCOMM[PLAYER_GUILD_ID].guard.."|r "..GWCOMM[PLAYER_GUILD_ID].color_3.."- purchase a disposable guard."); + + if(GWCOMM[SERVER_GUILD_ID].cannon_id > 0)then player:SendBroadcastMessage(GWCOMM[PLAYER_GUILD_ID].color_1.."buy "..GWCOMM[PLAYER_GUILD_ID].cannon.."|r "..GWCOMM[PLAYER_GUILD_ID].color_3.."- purchase a cannon.");end + if(GWCOMM[SERVER_GUILD_ID].vendor1_id > 0)then player:SendBroadcastMessage(GWCOMM[PLAYER_GUILD_ID].color_1.."buy "..GWCOMM[PLAYER_GUILD_ID].vendor1.."|r "..GWCOMM[PLAYER_GUILD_ID].color_3.."- purchase vendor1.");end + if(GWCOMM[SERVER_GUILD_ID].vendor2_id > 0)then player:SendBroadcastMessage(GWCOMM[PLAYER_GUILD_ID].color_1.."buy "..GWCOMM[PLAYER_GUILD_ID].vendor2.."|r "..GWCOMM[PLAYER_GUILD_ID].color_3.."- purchase vendor2.");end + if(GWCOMM[SERVER_GUILD_ID].vendor3_id > 0)then player:SendBroadcastMessage(GWCOMM[PLAYER_GUILD_ID].color_1.."buy "..GWCOMM[PLAYER_GUILD_ID].vendor3.."|r "..GWCOMM[PLAYER_GUILD_ID].color_3.."- purchase vendor3.");end + + player:SendBroadcastMessage(GWCOMM[PLAYER_GUILD_ID].color_9.."************************************************************"); + end + + if(pGuildRank <= GWCOMM[PLAYER_GUILD_ID].GLD_lvls)then + player:SendBroadcastMessage(GWCOMM[PLAYER_GUILD_ID].color_1.."sell "..GWCOMM[PLAYER_GUILD_ID].color_8.."Guild Master level Commands:Rank: "..GWCOMM[PLAYER_GUILD_ID].color_2..GWCOMM[PLAYER_GUILD_ID].GLD_lvls..GWCOMM[PLAYER_GUILD_ID].color_8.." access.|r"); + player:SendBroadcastMessage(GWCOMM[PLAYER_GUILD_ID].color_9.."-------------------------------------------"); + player:SendBroadcastMessage(GWCOMM[PLAYER_GUILD_ID].color_1.."sell "..GWCOMM[PLAYER_GUILD_ID].loc.."|r "..GWCOMM[PLAYER_GUILD_ID].color_3.."- sell area for its TOTAL value.|r"); + player:SendBroadcastMessage(GWCOMM[PLAYER_GUILD_ID].color_1.."sell "..GWCOMM[PLAYER_GUILD_ID].farm.."|r "..GWCOMM[PLAYER_GUILD_ID].color_3.."- sell farm.|r") ; + player:SendBroadcastMessage(GWCOMM[PLAYER_GUILD_ID].color_1.."sell "..GWCOMM[PLAYER_GUILD_ID].barrack.."|r "..GWCOMM[PLAYER_GUILD_ID].color_3.."- sell barracks.|r"); + player:SendBroadcastMessage(GWCOMM[PLAYER_GUILD_ID].color_1.."sell "..GWCOMM[PLAYER_GUILD_ID].hall.."|r "..GWCOMM[PLAYER_GUILD_ID].color_3.."- sell hall.|r"); + player:SendBroadcastMessage(GWCOMM[PLAYER_GUILD_ID].color_1.."sell "..GWCOMM[PLAYER_GUILD_ID].pig.."|r "..GWCOMM[PLAYER_GUILD_ID].color_3.."- sell a pig to market.|r"); + player:SendBroadcastMessage(GWCOMM[PLAYER_GUILD_ID].color_1.."sell "..GWCOMM[PLAYER_GUILD_ID].guard.."|r "..GWCOMM[PLAYER_GUILD_ID].color_3.."- removes a selected guard.|r"); + player:SendBroadcastMessage(GWCOMM[PLAYER_GUILD_ID].color_1.."|r "..GWCOMM[PLAYER_GUILD_ID].color_3.."guards are disposable.|r"); + player:SendBroadcastMessage(GWCOMM[PLAYER_GUILD_ID].color_1.."|r "..GWCOMM[PLAYER_GUILD_ID].color_3.."no cash back.|r"); + + if(GWCOMM[SERVER_GUILD_ID].cannon_id > 0)then player:SendBroadcastMessage(GWCOMM[PLAYER_GUILD_ID].color_1.."sell "..GWCOMM[PLAYER_GUILD_ID].cannon.."|r "..GWCOMM[PLAYER_GUILD_ID].color_3.."- sell a selected cannon.|r");end + if(GWCOMM[SERVER_GUILD_ID].vendor1_id > 0)then player:SendBroadcastMessage(GWCOMM[PLAYER_GUILD_ID].color_1.."|cff00cc00sell "..GWCOMM[PLAYER_GUILD_ID].vendor1.."|r "..GWCOMM[PLAYER_GUILD_ID].color_3.."- sells a selected vendor1.|r");end + if(GWCOMM[SERVER_GUILD_ID].vendor2_id > 0)then player:SendBroadcastMessage(GWCOMM[PLAYER_GUILD_ID].color_1.."|cff00cc00sell "..GWCOMM[PLAYER_GUILD_ID].vendor2.."|r "..GWCOMM[PLAYER_GUILD_ID].color_3.."- sells a selected vendor2.|r");end + if(GWCOMM[SERVER_GUILD_ID].vendor3_id > 0)then player:SendBroadcastMessage(GWCOMM[PLAYER_GUILD_ID].color_1.."|cff00cc00sell "..GWCOMM[PLAYER_GUILD_ID].vendor3.."|r "..GWCOMM[PLAYER_GUILD_ID].color_3.."- sells a selected vendor3.|r");end + + player:SendBroadcastMessage(GWCOMM[PLAYER_GUILD_ID].color_1.."sell "..GWCOMM[PLAYER_GUILD_ID].vault.."|r "..GWCOMM[PLAYER_GUILD_ID].color_3.."- sells a guild vault.|r"); + player:SendBroadcastMessage(GWCOMM[PLAYER_GUILD_ID].color_1.."sell "..GWCOMM[PLAYER_GUILD_ID].mailbox.."|r "..GWCOMM[PLAYER_GUILD_ID].color_3.."- sells a guild mailbox.|r"); + + player:SendBroadcastMessage(GWCOMM[PLAYER_GUILD_ID].color_9.."************************************************************"); + end + + if(pGuildRank == 0)then + player:SendBroadcastMessage(GWCOMM[PLAYER_GUILD_ID].color_8.."Guild Master settings:"); + player:SendBroadcastMessage(GWCOMM[PLAYER_GUILD_ID].color_9.."-------------------------------------------"); + player:SendBroadcastMessage(GWCOMM[PLAYER_GUILD_ID].color_1.."Guild Buy. minimum required guild rank|r: "..GWCOMM[PLAYER_GUILD_ID].color_2..""..GWCOMM[PLAYER_GUILD_ID].GLD_lvlb..""); + player:SendBroadcastMessage(GWCOMM[PLAYER_GUILD_ID].color_1.."Guild Sell. minimum required guild rank|r: "..GWCOMM[PLAYER_GUILD_ID].color_2..""..GWCOMM[PLAYER_GUILD_ID].GLD_lvls..""); + player:SendBroadcastMessage(GWCOMM[PLAYER_GUILD_ID].color_1.."Guild invite system|r: "..GWCOMM[PLAYER_GUILD_ID].color_2..""..GWCOMM[PLAYER_GUILD_ID].guild_invite.."|r "..GWCOMM[PLAYER_GUILD_ID].color_3.."0 = off 1 = on.|r"); + player:SendBroadcastMessage(GWCOMM[PLAYER_GUILD_ID].color_9.."************************************************************") + end + + if(pGuildRank == 0)or(pGMRank == GWCOMM[SERVER_GUILD_ID].GM_admin)then + player:SendBroadcastMessage(GWCOMM[PLAYER_GUILD_ID].color_8.."Guild Master/Game Master/Admin special Commands:") + player:SendBroadcastMessage(GWCOMM[PLAYER_GUILD_ID].color_9.."-------------------------------------------"); + player:SendBroadcastMessage(GWCOMM[PLAYER_GUILD_ID].color_1..""..GWCOMM[SERVER_GUILD_ID].command_set.."|r "..GWCOMM[PLAYER_GUILD_ID].color_3.."used to modify commands and settings.|r") + player:SendBroadcastMessage(GWCOMM[PLAYER_GUILD_ID].color_1.."help "..GWCOMM[SERVER_GUILD_ID].command_set.."|r "..GWCOMM[PLAYER_GUILD_ID].color_3.."lists commands and settings you may change.|r") + player:SendBroadcastMessage(GWCOMM[PLAYER_GUILD_ID].color_9.."************************************************************") + end + + if(pGuildRank <= GWCOMM[PLAYER_GUILD_ID].GLD_lvlb)or(pGMRank >= GWCOMM[SERVER_GUILD_ID].GM_minimum)then + player:SendBroadcastMessage(GWCOMM[PLAYER_GUILD_ID].color_8.."Prices in "..Currencyname..""..GWCOMM[PLAYER_GUILD_ID].color_8.."'s:|r"); + player:SendBroadcastMessage(GWCOMM[PLAYER_GUILD_ID].color_9.."-------------------------------------------"); + player:SendBroadcastMessage(GWCOMM[PLAYER_GUILD_ID].color_1.."Zone price|r: "..GWCOMM[PLAYER_GUILD_ID].color_2..""..GWCOMM[SERVER_GUILD_ID].loc_cost.."|r "..GWCOMM[PLAYER_GUILD_ID].color_3.."base location price.|r"); + player:SendBroadcastMessage(GWCOMM[PLAYER_GUILD_ID].color_1.."Farm price|r: "..GWCOMM[PLAYER_GUILD_ID].color_2..""..GWCOMM[SERVER_GUILD_ID].farm_cost.."|r"); + player:SendBroadcastMessage(GWCOMM[PLAYER_GUILD_ID].color_1.."Barracks price|r: "..GWCOMM[PLAYER_GUILD_ID].color_2..""..GWCOMM[SERVER_GUILD_ID].barrack_cost.."|r"); + player:SendBroadcastMessage(GWCOMM[PLAYER_GUILD_ID].color_1.."Hall price|r: "..GWCOMM[PLAYER_GUILD_ID].color_2..""..GWCOMM[SERVER_GUILD_ID].hall_cost.."|r"); + player:SendBroadcastMessage(GWCOMM[PLAYER_GUILD_ID].color_1.."Pig price|r: "..GWCOMM[PLAYER_GUILD_ID].color_2..""..GWCOMM[SERVER_GUILD_ID].pig_cost.."|r"); + player:SendBroadcastMessage(GWCOMM[PLAYER_GUILD_ID].color_1.."Guard price|r: "..GWCOMM[PLAYER_GUILD_ID].color_2..""..GWCOMM[SERVER_GUILD_ID].guard_cost.."|r - "..GWCOMM[PLAYER_GUILD_ID].color_14.."These Dont increase location price."); + + if(GWCOMM[SERVER_GUILD_ID].cannon_id > 0)then player:SendBroadcastMessage(GWCOMM[PLAYER_GUILD_ID].color_1.."cannon price|r: "..GWCOMM[PLAYER_GUILD_ID].color_2..""..GWCOMM[SERVER_GUILD_ID].cannon_cost.."|r");end + if(GWCOMM[SERVER_GUILD_ID].vendor1_id > 0)then player:SendBroadcastMessage(GWCOMM[PLAYER_GUILD_ID].color_1.."vendor1 price|r: "..GWCOMM[PLAYER_GUILD_ID].color_2..""..GWCOMM[SERVER_GUILD_ID].vendor1_cost.."|r");end + if(GWCOMM[SERVER_GUILD_ID].vendor2_id > 0)then player:SendBroadcastMessage(GWCOMM[PLAYER_GUILD_ID].color_1.."vendor2 price|r: "..GWCOMM[PLAYER_GUILD_ID].color_2..""..GWCOMM[SERVER_GUILD_ID].vendor2_cost.."|r");end + if(GWCOMM[SERVER_GUILD_ID].vendor3_id > 0)then player:SendBroadcastMessage(GWCOMM[PLAYER_GUILD_ID].color_1.."vendor3 price|r: "..GWCOMM[PLAYER_GUILD_ID].color_2..""..GWCOMM[SERVER_GUILD_ID].vendor3_cost.."|r");end + + player:SendBroadcastMessage(GWCOMM[PLAYER_GUILD_ID].color_1.."Vault price|r: "..GWCOMM[PLAYER_GUILD_ID].color_2..""..GWCOMM[SERVER_GUILD_ID].vault_cost.."|r "..GWCOMM[PLAYER_GUILD_ID].color_14.."|r"); + player:SendBroadcastMessage(GWCOMM[PLAYER_GUILD_ID].color_1.."Mailbox price|r: "..GWCOMM[PLAYER_GUILD_ID].color_2..""..GWCOMM[SERVER_GUILD_ID].mailbox_cost.."|r "..GWCOMM[PLAYER_GUILD_ID].color_14.."|r"); + + player:SendBroadcastMessage(GWCOMM[PLAYER_GUILD_ID].color_9.."************************************************************") + end + + if(pGuildRank <= GWCOMM[PLAYER_GUILD_ID].GLD_lvlb)or(pGMRank >= GWCOMM[SERVER_GUILD_ID].GM_minimum)then + player:SendBroadcastMessage(GWCOMM[PLAYER_GUILD_ID].color_8.."Location Limits:"); + player:SendBroadcastMessage(GWCOMM[PLAYER_GUILD_ID].color_9.."-------------------------------------------"); + player:SendBroadcastMessage(GWCOMM[PLAYER_GUILD_ID].color_1.."Farm limit|r: "..GWCOMM[PLAYER_GUILD_ID].color_2..""..GWCOMM[SERVER_GUILD_ID].farm_L.."|r "..GWCOMM[PLAYER_GUILD_ID].color_3.."per location.|r"); + player:SendBroadcastMessage(GWCOMM[PLAYER_GUILD_ID].color_1.."Pig limit|r: "..GWCOMM[PLAYER_GUILD_ID].color_2..""..GWCOMM[SERVER_GUILD_ID].pig_L.."|r "..GWCOMM[PLAYER_GUILD_ID].color_3.."per farm. Require a farm.|r"); + player:SendBroadcastMessage(GWCOMM[PLAYER_GUILD_ID].color_1.."Barrack limit|r: "..GWCOMM[PLAYER_GUILD_ID].color_2..""..GWCOMM[SERVER_GUILD_ID].barrack_L.."|r "..GWCOMM[PLAYER_GUILD_ID].color_3.."per farm. Require a farm.|r"); + player:SendBroadcastMessage(GWCOMM[PLAYER_GUILD_ID].color_1.."Guard limit|r: "..GWCOMM[PLAYER_GUILD_ID].color_2..""..GWCOMM[SERVER_GUILD_ID].guard_L.."|r "..GWCOMM[PLAYER_GUILD_ID].color_3.."per barrack. Require a barrack.|r"); + player:SendBroadcastMessage(GWCOMM[PLAYER_GUILD_ID].color_1.."Hall limit|r: "..GWCOMM[PLAYER_GUILD_ID].color_2..""..GWCOMM[SERVER_GUILD_ID].hall_L.."|r "..GWCOMM[PLAYER_GUILD_ID].color_3.."per location. Require a barrack.|r"); + + if(GWCOMM[SERVER_GUILD_ID].vendor1_id > 0)then player:SendBroadcastMessage(GWCOMM[PLAYER_GUILD_ID].color_1.."Vendor1 limit|r: "..GWCOMM[PLAYER_GUILD_ID].color_2..""..GWCOMM[SERVER_GUILD_ID].vendor1_L.."|r "..GWCOMM[PLAYER_GUILD_ID].color_3.."per location. Require a hall.|r");end + if(GWCOMM[SERVER_GUILD_ID].vendor2_id > 0)then player:SendBroadcastMessage(GWCOMM[PLAYER_GUILD_ID].color_1.."Vendor2 limit|r: "..GWCOMM[PLAYER_GUILD_ID].color_2..""..GWCOMM[SERVER_GUILD_ID].vendor2_L.."|r "..GWCOMM[PLAYER_GUILD_ID].color_3.."per location. Require a hall.|r");end + if(GWCOMM[SERVER_GUILD_ID].vendor3_id > 0)then player:SendBroadcastMessage(GWCOMM[PLAYER_GUILD_ID].color_1.."Vendor3 limit|r: "..GWCOMM[PLAYER_GUILD_ID].color_2..""..GWCOMM[SERVER_GUILD_ID].vendor3_L.."|r "..GWCOMM[PLAYER_GUILD_ID].color_3.."per location. Require a hall.|r");end + if(GWCOMM[SERVER_GUILD_ID].cannon_id > 0)then player:SendBroadcastMessage(GWCOMM[PLAYER_GUILD_ID].color_1.."Cannon limit|r: "..GWCOMM[PLAYER_GUILD_ID].color_2..""..GWCOMM[SERVER_GUILD_ID].cannon_L.."|r "..GWCOMM[PLAYER_GUILD_ID].color_3.."per hall. Require a hall.|r");end + + player:SendBroadcastMessage(GWCOMM[PLAYER_GUILD_ID].color_1.."Guild Vault limit|r: "..GWCOMM[PLAYER_GUILD_ID].color_2..""..GWCOMM[SERVER_GUILD_ID].vault_L.."|r "..GWCOMM[PLAYER_GUILD_ID].color_3.."per location. Require a hall.|r"); + player:SendBroadcastMessage(GWCOMM[PLAYER_GUILD_ID].color_1.."Guild MailBox limit|r: "..GWCOMM[PLAYER_GUILD_ID].color_2..""..GWCOMM[SERVER_GUILD_ID].mailbox_L.."|r "..GWCOMM[PLAYER_GUILD_ID].color_3.."per location. Require a hall.|r"); + + player:SendBroadcastMessage(GWCOMM[PLAYER_GUILD_ID].color_9.."************************************************************"); + end + + if(pGMRank >= GWCOMM[SERVER_GUILD_ID].GM_minimum)then + player:SendBroadcastMessage(GWCOMM[PLAYER_GUILD_ID].color_8.."Game Master Commands:") + player:SendBroadcastMessage(GWCOMM[PLAYER_GUILD_ID].color_9.."-------------------------------------------"); + player:SendBroadcastMessage(GWCOMM[PLAYER_GUILD_ID].color_1..""..GWCOMM[SERVER_GUILD_ID].details_loc.."|r "..GWCOMM[PLAYER_GUILD_ID].color_3.."-location info.|r"); + player:SendBroadcastMessage(GWCOMM[PLAYER_GUILD_ID].color_1.."reset "..GWCOMM[SERVER_GUILD_ID].loc.."|r "..GWCOMM[PLAYER_GUILD_ID].color_3.."- Resets location to server.|r"); + player:SendBroadcastMessage(GWCOMM[PLAYER_GUILD_ID].color_1.."reload "..GWCOMM[SERVER_GUILD_ID].table.."|r "..GWCOMM[PLAYER_GUILD_ID].color_3.."- Reloads GW tables.|r"); + player:SendBroadcastMessage(GWCOMM[PLAYER_GUILD_ID].color_1.."reset "..GWCOMM[SERVER_GUILD_ID].farm.."|r "..GWCOMM[PLAYER_GUILD_ID].color_3.."- Resets location farm count to 0.|r"); + player:SendBroadcastMessage(GWCOMM[PLAYER_GUILD_ID].color_1.."reset "..GWCOMM[SERVER_GUILD_ID].barrack.."|r "..GWCOMM[PLAYER_GUILD_ID].color_3.."- Resets location barrack count to 0.|r"); + player:SendBroadcastMessage(GWCOMM[PLAYER_GUILD_ID].color_1.."reset "..GWCOMM[SERVER_GUILD_ID].hall.."|r "..GWCOMM[PLAYER_GUILD_ID].color_3.."- Resets location hall count to 0.|r"); + player:SendBroadcastMessage(GWCOMM[PLAYER_GUILD_ID].color_1.."reset "..GWCOMM[SERVER_GUILD_ID].pig.."|r "..GWCOMM[PLAYER_GUILD_ID].color_3.."- Resets location pig count to 0.|r"); + player:SendBroadcastMessage(GWCOMM[PLAYER_GUILD_ID].color_1.."reset "..GWCOMM[SERVER_GUILD_ID].guard.."|r "..GWCOMM[PLAYER_GUILD_ID].color_3.."- Resets location guard count to 0.|r"); + + player:SendBroadcastMessage(GWCOMM[PLAYER_GUILD_ID].color_1.."reset "..GWCOMM[SERVER_GUILD_ID].vendor1.."|r "..GWCOMM[PLAYER_GUILD_ID].color_3.."- Resets location vendor 1 count to 0.|r"); + player:SendBroadcastMessage(GWCOMM[PLAYER_GUILD_ID].color_1.."reset "..GWCOMM[SERVER_GUILD_ID].vendor2.."|r "..GWCOMM[PLAYER_GUILD_ID].color_3.."- Resets location vendor 2 count to 0.|r"); + player:SendBroadcastMessage(GWCOMM[PLAYER_GUILD_ID].color_1.."reset "..GWCOMM[SERVER_GUILD_ID].vendor3.."|r "..GWCOMM[PLAYER_GUILD_ID].color_3.."- Resets location vendor 3 count to 0.|r"); + player:SendBroadcastMessage(GWCOMM[PLAYER_GUILD_ID].color_1.."reset "..GWCOMM[SERVER_GUILD_ID].cannon.."|r "..GWCOMM[PLAYER_GUILD_ID].color_3.."- Resets location cannon count to 0.|r"); + player:SendBroadcastMessage(GWCOMM[PLAYER_GUILD_ID].color_1.."reset "..GWCOMM[SERVER_GUILD_ID].vault.."|r "..GWCOMM[PLAYER_GUILD_ID].color_3.."- Resets location vault count to 0.|r"); + player:SendBroadcastMessage(GWCOMM[PLAYER_GUILD_ID].color_1.."reset "..GWCOMM[SERVER_GUILD_ID].mailbox.."|r "..GWCOMM[PLAYER_GUILD_ID].color_3.."- Resets location mailbox count to 0.|r"); + + player:SendBroadcastMessage(GWCOMM[PLAYER_GUILD_ID].color_1.."spawn "..GWCOMM[SERVER_GUILD_ID].respawn_flag.."|r "..GWCOMM[PLAYER_GUILD_ID].color_3.."- Spawns new flag if current|r"); + player:SendBroadcastMessage(GWCOMM[PLAYER_GUILD_ID].color_1.."|r "..GWCOMM[PLAYER_GUILD_ID].color_3.."flag is missing.|r"); + player:SendBroadcastMessage(GWCOMM[PLAYER_GUILD_ID].color_1.."lock "..GWCOMM[SERVER_GUILD_ID].loc.."|r "..GWCOMM[PLAYER_GUILD_ID].color_3.."- locks a location from purchase.|r"); + player:SendBroadcastMessage(GWCOMM[PLAYER_GUILD_ID].color_9.."************************************************************"); + end + + if(pGMRank == GWCOMM[SERVER_GUILD_ID].GM_admin)then + player:SendBroadcastMessage(GWCOMM[PLAYER_GUILD_ID].color_8.."ADMIN settings:") + player:SendBroadcastMessage(GWCOMM[PLAYER_GUILD_ID].color_9.."-------------------------------------------"); + player:SendBroadcastMessage(GWCOMM[PLAYER_GUILD_ID].color_1.."ADMIN Level Access|r: "..GWCOMM[PLAYER_GUILD_ID].color_2..""..GWCOMM[SERVER_GUILD_ID].GM_admin.."|r"); + player:SendBroadcastMessage(GWCOMM[PLAYER_GUILD_ID].color_1.."Minimum GM Level Access|r: "..GWCOMM[PLAYER_GUILD_ID].color_2..""..GWCOMM[SERVER_GUILD_ID].GM_minimum.."|r"); + player:SendBroadcastMessage(GWCOMM[PLAYER_GUILD_ID].color_1.."Pig Payz|r: "..GWCOMM[PLAYER_GUILD_ID].color_2..""..GWCOMM[SERVER_GUILD_ID].pig_payz.."|r "..GWCOMM[PLAYER_GUILD_ID].color_3.."copper.|r"); + player:SendBroadcastMessage(GWCOMM[PLAYER_GUILD_ID].color_1.."New Guild Gift amount|r: "..GWCOMM[PLAYER_GUILD_ID].color_2..""..GWCOMM[SERVER_GUILD_ID].gift_count.."|r"); + player:SendBroadcastMessage(GWCOMM[PLAYER_GUILD_ID].color_1.."Flag require|r: "..GWCOMM[PLAYER_GUILD_ID].color_2..""..GWCOMM[SERVER_GUILD_ID].flag_require.."|r"); + player:SendBroadcastMessage(GWCOMM[PLAYER_GUILD_ID].color_1.."Anarchy|r: "..GWCOMM[PLAYER_GUILD_ID].color_2..""..GWCOMM[SERVER_GUILD_ID].anarchy.."|r"); + player:SendBroadcastMessage(GWCOMM[PLAYER_GUILD_ID].color_1.."No-Tag-Flag|r: "..GWCOMM[PLAYER_GUILD_ID].color_2..""..GWCOMM[SERVER_GUILD_ID].flag_timer.."|r"); + player:SendBroadcastMessage(GWCOMM[PLAYER_GUILD_ID].color_1.."No-Tag-Flag-Timer|r: "..GWCOMM[PLAYER_GUILD_ID].color_2..""..GWCOMM[SERVER_GUILD_ID].spawn_timer.."|r "..GWCOMM[PLAYER_GUILD_ID].color_3.."- in seconds"); + player:SendBroadcastMessage(GWCOMM[PLAYER_GUILD_ID].color_9.."************************************************************") + end + return false; + end + + if((ChatCache[1]==GWCOMM[PLAYER_GUILD_ID].setup)and not(ChatCache[2]))then + player:SendBroadcastMessage(GWCOMM[PLAYER_GUILD_ID].color_9.."****************************"); + player:SendBroadcastMessage(GWCOMM[PLAYER_GUILD_ID].color_8.."System setup details:"); + player:SendBroadcastMessage(GWCOMM[PLAYER_GUILD_ID].color_9.."-------------------------------------------"); + player:SendBroadcastMessage(GWCOMM[PLAYER_GUILD_ID].color_8.."Costs:|r"); + player:SendBroadcastMessage(GWCOMM[PLAYER_GUILD_ID].color_8.."Prices in "..Currencyname..""..GWCOMM[PLAYER_GUILD_ID].color_8.."'s:|r"); + player:SendBroadcastMessage(GWCOMM[PLAYER_GUILD_ID].color_9.."---------------------------------"); + player:SendBroadcastMessage(GWCOMM[PLAYER_GUILD_ID].color_1.."Zone price|r: "..GWCOMM[PLAYER_GUILD_ID].color_2..""..GWCOMM[SERVER_GUILD_ID].loc_cost.."|r "..GWCOMM[PLAYER_GUILD_ID].color_3.."base location price.|r"); + player:SendBroadcastMessage(GWCOMM[PLAYER_GUILD_ID].color_1.."Farm price|r: "..GWCOMM[PLAYER_GUILD_ID].color_2..""..GWCOMM[SERVER_GUILD_ID].farm_cost.."|r"); + player:SendBroadcastMessage(GWCOMM[PLAYER_GUILD_ID].color_1.."Barracks price|r: "..GWCOMM[PLAYER_GUILD_ID].color_2..""..GWCOMM[SERVER_GUILD_ID].barrack_cost.."|r"); + player:SendBroadcastMessage(GWCOMM[PLAYER_GUILD_ID].color_1.."Hall price|r: "..GWCOMM[PLAYER_GUILD_ID].color_2..""..GWCOMM[SERVER_GUILD_ID].hall_cost.."|r"); + player:SendBroadcastMessage(GWCOMM[PLAYER_GUILD_ID].color_1.."Pig price|r: "..GWCOMM[PLAYER_GUILD_ID].color_2..""..GWCOMM[SERVER_GUILD_ID].pig_cost.."|r"); + player:SendBroadcastMessage(GWCOMM[PLAYER_GUILD_ID].color_1.."Guard price|r: "..GWCOMM[PLAYER_GUILD_ID].color_2..""..GWCOMM[SERVER_GUILD_ID].guard_cost.."|r - "..GWCOMM[PLAYER_GUILD_ID].color_14.."These Dont increase location price."); + + if(GWCOMM[SERVER_GUILD_ID].cannon_id > 0)then player:SendBroadcastMessage(GWCOMM[PLAYER_GUILD_ID].color_1.."cannon price|r: "..GWCOMM[PLAYER_GUILD_ID].color_2..""..GWCOMM[SERVER_GUILD_ID].cannon_cost.."|r");end + if(GWCOMM[SERVER_GUILD_ID].vendor1_id > 0)then player:SendBroadcastMessage(GWCOMM[PLAYER_GUILD_ID].color_1.."vendor1 price|r: "..GWCOMM[PLAYER_GUILD_ID].color_2..""..GWCOMM[SERVER_GUILD_ID].vendor1_cost.."|r");end + if(GWCOMM[SERVER_GUILD_ID].vendor2_id > 0)then player:SendBroadcastMessage(GWCOMM[PLAYER_GUILD_ID].color_1.."vendor2 price|r: "..GWCOMM[PLAYER_GUILD_ID].color_2..""..GWCOMM[SERVER_GUILD_ID].vendor2_cost.."|r");end + if(GWCOMM[SERVER_GUILD_ID].vendor3_id > 0)then player:SendBroadcastMessage(GWCOMM[PLAYER_GUILD_ID].color_1.."vendor3 price|r: "..GWCOMM[PLAYER_GUILD_ID].color_2..""..GWCOMM[SERVER_GUILD_ID].vendor3_cost.."|r");end + + player:SendBroadcastMessage(GWCOMM[PLAYER_GUILD_ID].color_1.."Vault price|r: "..GWCOMM[PLAYER_GUILD_ID].color_2..""..GWCOMM[SERVER_GUILD_ID].vault_cost.."|r "..GWCOMM[PLAYER_GUILD_ID].color_14.."|r"); + player:SendBroadcastMessage(GWCOMM[PLAYER_GUILD_ID].color_1.."Mailbox price|r: "..GWCOMM[PLAYER_GUILD_ID].color_2..""..GWCOMM[SERVER_GUILD_ID].mailbox_cost.."|r "..GWCOMM[PLAYER_GUILD_ID].color_14.."|r"); + player:SendBroadcastMessage(GWCOMM[PLAYER_GUILD_ID].color_9.."-------------------------------------------"); + player:SendBroadcastMessage(GWCOMM[PLAYER_GUILD_ID].color_8.."Location Limits:"); + player:SendBroadcastMessage(GWCOMM[PLAYER_GUILD_ID].color_1.."Farm limit|r: "..GWCOMM[PLAYER_GUILD_ID].color_2..""..GWCOMM[SERVER_GUILD_ID].farm_L.."|r "..GWCOMM[PLAYER_GUILD_ID].color_3.."per location.|r"); + player:SendBroadcastMessage(GWCOMM[PLAYER_GUILD_ID].color_1.."Pig limit|r: "..GWCOMM[PLAYER_GUILD_ID].color_2..""..GWCOMM[SERVER_GUILD_ID].pig_L.."|r "..GWCOMM[PLAYER_GUILD_ID].color_3.."per farm. Require a farm.|r"); + player:SendBroadcastMessage(GWCOMM[PLAYER_GUILD_ID].color_1.."Barrack limit|r: "..GWCOMM[PLAYER_GUILD_ID].color_2..""..GWCOMM[SERVER_GUILD_ID].barrack_L.."|r "..GWCOMM[PLAYER_GUILD_ID].color_3.."per farm. Require a farm.|r"); + player:SendBroadcastMessage(GWCOMM[PLAYER_GUILD_ID].color_1.."Guard limit|r: "..GWCOMM[PLAYER_GUILD_ID].color_2..""..GWCOMM[SERVER_GUILD_ID].guard_L.."|r "..GWCOMM[PLAYER_GUILD_ID].color_3.."per barrack. Require a barrack.|r"); + player:SendBroadcastMessage(GWCOMM[PLAYER_GUILD_ID].color_1.."Hall limit|r: "..GWCOMM[PLAYER_GUILD_ID].color_2..""..GWCOMM[SERVER_GUILD_ID].hall_L.."|r "..GWCOMM[PLAYER_GUILD_ID].color_3.."per location. Require a barrack.|r"); + + if(GWCOMM[SERVER_GUILD_ID].vendor1_id > 0)then player:SendBroadcastMessage(GWCOMM[PLAYER_GUILD_ID].color_1.."Vendor1 limit|r: "..GWCOMM[PLAYER_GUILD_ID].color_2..""..GWCOMM[SERVER_GUILD_ID].vendor1_L.."|r "..GWCOMM[PLAYER_GUILD_ID].color_3.."per location. Require a hall.|r");end + if(GWCOMM[SERVER_GUILD_ID].vendor2_id > 0)then player:SendBroadcastMessage(GWCOMM[PLAYER_GUILD_ID].color_1.."Vendor2 limit|r: "..GWCOMM[PLAYER_GUILD_ID].color_2..""..GWCOMM[SERVER_GUILD_ID].vendor2_L.."|r "..GWCOMM[PLAYER_GUILD_ID].color_3.."per location. Require a hall.|r");end + if(GWCOMM[SERVER_GUILD_ID].vendor3_id > 0)then player:SendBroadcastMessage(GWCOMM[PLAYER_GUILD_ID].color_1.."Vendor3 limit|r: "..GWCOMM[PLAYER_GUILD_ID].color_2..""..GWCOMM[SERVER_GUILD_ID].vendor3_L.."|r "..GWCOMM[PLAYER_GUILD_ID].color_3.."per location. Require a hall.|r");end + if(GWCOMM[SERVER_GUILD_ID].cannon_id > 0)then player:SendBroadcastMessage(GWCOMM[PLAYER_GUILD_ID].color_1.."Cannon limit|r: "..GWCOMM[PLAYER_GUILD_ID].color_2..""..GWCOMM[SERVER_GUILD_ID].cannon_L.."|r "..GWCOMM[PLAYER_GUILD_ID].color_3.."per hall. Require a hall.|r");end + + player:SendBroadcastMessage(GWCOMM[PLAYER_GUILD_ID].color_1.."Guild Vault limit|r: "..GWCOMM[PLAYER_GUILD_ID].color_2..""..GWCOMM[SERVER_GUILD_ID].vault_L.."|r "..GWCOMM[PLAYER_GUILD_ID].color_3.."per location. Require a hall.|r"); + player:SendBroadcastMessage(GWCOMM[PLAYER_GUILD_ID].color_1.."Guild MailBox limit|r: "..GWCOMM[PLAYER_GUILD_ID].color_2..""..GWCOMM[SERVER_GUILD_ID].mailbox_L.."|r "..GWCOMM[PLAYER_GUILD_ID].color_3.."per location. Require a hall.|r"); + player:SendBroadcastMessage(GWCOMM[PLAYER_GUILD_ID].color_9.."-------------------------------------------"); + player:SendBroadcastMessage(GWCOMM[PLAYER_GUILD_ID].color_8.."Rewards:|r"); + player:SendBroadcastMessage(GWCOMM[PLAYER_GUILD_ID].color_1.."Pig Payz|r: "..GWCOMM[PLAYER_GUILD_ID].color_2..""..GWCOMM[SERVER_GUILD_ID].pig_payz.."|r "..GWCOMM[PLAYER_GUILD_ID].color_3.."copper every |r"..GWCOMM[PLAYER_GUILD_ID].color_2..""..((GWCOMM[SERVER_GUILD_ID].pig_payz_timer / 1000) / 60).."|r"..GWCOMM[PLAYER_GUILD_ID].color_3.." minutes."); + player:SendBroadcastMessage(GWCOMM[PLAYER_GUILD_ID].color_1.."New Guild Gift amount|r: "..GWCOMM[PLAYER_GUILD_ID].color_2..""..GWCOMM[SERVER_GUILD_ID].gift_count.."|r"..GWCOMM[PLAYER_GUILD_ID].color_8.." "..Currencyname..""..GWCOMM[PLAYER_GUILD_ID].color_8.."'s:|r"); + player:SendBroadcastMessage(GWCOMM[PLAYER_GUILD_ID].color_9.."-------------------------------------------"); + player:SendBroadcastMessage(GWCOMM[PLAYER_GUILD_ID].color_8.."System features:|r"); + + if(GWCOMM[SERVER_GUILD_ID].flag_require~=0)then player:SendBroadcastMessage(GWCOMM[PLAYER_GUILD_ID].color_1.."Flag require|r: "..GWCOMM[PLAYER_GUILD_ID].color_2.."Enabled. |r"..GWCOMM[PLAYER_GUILD_ID].color_3.."All guards MUST be cleared before a flag can be tagged.|r");end; + if(GWCOMM[SERVER_GUILD_ID].anarchy~=0)then player:SendBroadcastMessage(GWCOMM[PLAYER_GUILD_ID].color_1.."Anarchy|r: "..GWCOMM[PLAYER_GUILD_ID].color_2.."Enabled. |r"..GWCOMM[PLAYER_GUILD_ID].color_3.."Same faction invasions allowed.|r");end; + + if(GWCOMM[SERVER_GUILD_ID].flag_timer ~= 0)then + player:SendBroadcastMessage(GWCOMM[PLAYER_GUILD_ID].color_1.."No-Tag-Flag|r: Enabled. |r"..GWCOMM[PLAYER_GUILD_ID].color_3.."un-taggable flag Cooldown timer."); + player:SendBroadcastMessage(GWCOMM[PLAYER_GUILD_ID].color_1.."No-Tag-Flag-Timer Duration|r: "..GWCOMM[PLAYER_GUILD_ID].color_2..""..GWCOMM[SERVER_GUILD_ID].spawn_timer.."|r "..GWCOMM[PLAYER_GUILD_ID].color_3.."- in seconds"); + end; + + player:SendBroadcastMessage(GWCOMM[PLAYER_GUILD_ID].color_9.."-------------------------------------------"); + + player:SendBroadcastMessage(GWCOMM[PLAYER_GUILD_ID].color_9.."****************************"); + return false; + end + + if(ChatCache[1]==GWCOMM[PLAYER_GUILD_ID].info_loc)then + player:SendBroadcastMessage(GWCOMM[PLAYER_GUILD_ID].color_9.."****************************"); + player:SendBroadcastMessage(GWCOMM[PLAYER_GUILD_ID].color_8.."Location details:"); + player:SendBroadcastMessage(GWCOMM[PLAYER_GUILD_ID].color_9.."---------------------------------"); + player:SendBroadcastMessage(GWCOMM[PLAYER_GUILD_ID].color_1.."|cff00cc00Loc ID:|r "..GWCOMM[PLAYER_GUILD_ID].color_2..""..GWARZ[LocId].entry.."|r"); + + if(GWARZ[LocId].team==0)then player:SendBroadcastMessage(GWCOMM[PLAYER_GUILD_ID].color_1.."Owner|r: "..GWCOMM[PLAYER_GUILD_ID].color_4..""..GWARZ[LocId].guild_name.."|r.");end; + if(GWARZ[LocId].team==1)then player:SendBroadcastMessage(GWCOMM[PLAYER_GUILD_ID].color_1.."Owner|r: "..GWCOMM[PLAYER_GUILD_ID].color_5..""..GWARZ[LocId].guild_name.."|r.");end; + if(GWARZ[LocId].team==2)then player:SendBroadcastMessage(GWCOMM[PLAYER_GUILD_ID].color_1.."Owner|r: "..GWCOMM[PLAYER_GUILD_ID].color_6..""..GWARZ[LocId].guild_name.."|r.");end; + if(GWARZ[LocId].team==3)then player:SendBroadcastMessage(GWCOMM[PLAYER_GUILD_ID].color_1.."Owner|r: "..GWCOMM[PLAYER_GUILD_ID].color_7..""..GWARZ[LocId].guild_name.."|r.");end; + + if(GWARZ[LocId].team==0)then player:SendBroadcastMessage(GWCOMM[PLAYER_GUILD_ID].color_1.."Faction|r: "..GWCOMM[PLAYER_GUILD_ID].color_4.."Alliance.|r");end; + if(GWARZ[LocId].team==1)then player:SendBroadcastMessage(GWCOMM[PLAYER_GUILD_ID].color_1.."Faction|r: "..GWCOMM[PLAYER_GUILD_ID].color_5.."Horde.|r");end; + if(GWARZ[LocId].team==2)then player:SendBroadcastMessage(GWCOMM[PLAYER_GUILD_ID].color_1.."Faction|r: "..GWCOMM[PLAYER_GUILD_ID].color_6.."For Sale.|r");end; + if(GWARZ[LocId].team==3)then player:SendBroadcastMessage(GWCOMM[PLAYER_GUILD_ID].color_1.."Faction|r: "..GWCOMM[PLAYER_GUILD_ID].color_7.."LOCKED|r");end; + + player:SendBroadcastMessage(GWCOMM[PLAYER_GUILD_ID].color_1.."|cff00cc00Farms|r: "..GWCOMM[PLAYER_GUILD_ID].color_2..""..GWARZ[LocId].farm_count.."|r"); + player:SendBroadcastMessage(GWCOMM[PLAYER_GUILD_ID].color_1.."|cff00cc00Hall|r: "..GWCOMM[PLAYER_GUILD_ID].color_2..""..GWARZ[LocId].hall_count.."|r"); + player:SendBroadcastMessage(GWCOMM[PLAYER_GUILD_ID].color_1.."|cff00cc00pigs|r: "..GWCOMM[PLAYER_GUILD_ID].color_2..""..GWARZ[LocId].pig_count.."|r"); + player:SendBroadcastMessage(GWCOMM[PLAYER_GUILD_ID].color_1.."|cff00cc00Value|r: "..GWCOMM[PLAYER_GUILD_ID].color_2..""..Zoneprice.." "..GWCOMM[PLAYER_GUILD_ID].color_3..""..Currencyname.."'s.|r"); + player:SendBroadcastMessage(GWCOMM[PLAYER_GUILD_ID].color_9.."****************************"); + return false; + end + + if(ChatCache[1]==GWCOMM[PLAYER_GUILD_ID].list_loc)then + local Glocdb = WorldDBQuery("SELECT `entry` FROM "..guild_warz_DB..".zones WHERE `guild_id` = '"..PLAYER_GUILD_ID.."';"); + + if(Glocdb==nil)then + player:SendBroadcastMessage("Your guild does not own any land"); + end + + if(Glocdb~=nil)then + player:SendBroadcastMessage(GWCOMM[PLAYER_GUILD_ID].color_9.."**********************************************************************"); + player:SendBroadcastMessage(GWCOMM[PLAYER_GUILD_ID].color_1.."Loc ID: farm: barracks: Hall: Guards: Pigs: Zone value:|r"); + + repeat + local Gloc = Glocdb:GetUInt32(0) + local Xzoneprice=(GWCOMM[SERVER_GUILD_ID].loc_cost)+(GWCOMM[SERVER_GUILD_ID].farm_cost*GWARZ[Gloc].farm_count)+(GWCOMM[SERVER_GUILD_ID].barrack_cost*GWARZ[Gloc].barrack_count)+(GWCOMM[SERVER_GUILD_ID].hall_cost*GWARZ[Gloc].hall_count)+(GWCOMM[SERVER_GUILD_ID].pig_cost*GWARZ[Gloc].pig_count)+(GWCOMM[SERVER_GUILD_ID].vendor1_cost*GWARZ[Gloc].vendor1_count)+(GWCOMM[SERVER_GUILD_ID].cannon_cost*GWARZ[Gloc].cannon_count); + player:SendBroadcastMessage(GWCOMM[PLAYER_GUILD_ID].color_2..""..Gloc.." "..GWARZ[Gloc].farm_count.." "..GWARZ[Gloc].barrack_count.." "..GWARZ[Gloc].hall_count.." "..GWARZ[Gloc].guard_count.." "..GWARZ[Gloc].pig_count.." "..Xzoneprice.."|r"); + yentry = yentry+1; + ypigcnt = ypigcnt+GWARZ[Gloc].pig_count; + yvalue = yvalue+Xzoneprice; + until Glocdb:NextRow()~=true; + + player:SendBroadcastMessage(GWCOMM[PLAYER_GUILD_ID].color_9.."**********************************************************************"); + player:SendBroadcastMessage(GWCOMM[PLAYER_GUILD_ID].color_1.."total locations: "..GWCOMM[PLAYER_GUILD_ID].color_2..""..yentry.."|r "..GWCOMM[PLAYER_GUILD_ID].color_1.."total pigs:|r "..GWCOMM[PLAYER_GUILD_ID].color_2..""..ypigcnt.."|r "..GWCOMM[PLAYER_GUILD_ID].color_1.."Total value:|r "..GWCOMM[PLAYER_GUILD_ID].color_2..""..yvalue.."|r "..GWCOMM[PLAYER_GUILD_ID].color_1..""..Currencyname.."'s.|r"); + player:SendBroadcastMessage(GWCOMM[PLAYER_GUILD_ID].color_9.."**********************************************************************"); + end + return false; + end + + if(ChatCache[1]==GWCOMM[PLAYER_GUILD_ID].version)then + player:SendBroadcastMessage(GWCOMM[PLAYER_GUILD_ID].color_9.."****************************************"); + player:SendBroadcastMessage(GWCOMM[PLAYER_GUILD_ID].color_9.."* "..GWCOMM[PLAYER_GUILD_ID].color_1.."Eluna "..GWCOMM[PLAYER_GUILD_ID].color_9.."*"); + player:SendBroadcastMessage(GWCOMM[PLAYER_GUILD_ID].color_1.."Guild Wars. VER : "..GW_version.."|r"); + player:SendBroadcastMessage(GWCOMM[PLAYER_GUILD_ID].color_1.."Core :: "..core_version..".|r"); + player:SendBroadcastMessage(GWCOMM[PLAYER_GUILD_ID].color_1.."PigPayz :: "..pigpayz_version..".|r"); + player:SendBroadcastMessage(GWCOMM[PLAYER_GUILD_ID].color_1.."Teleport :: "..tele_version..".|r"); + player:SendBroadcastMessage(GWCOMM[PLAYER_GUILD_ID].color_1.."PvP :: "..pvp_version..".|r"); + player:SendBroadcastMessage(GWCOMM[PLAYER_GUILD_ID].color_1.."Vendor :: "..vendor_version..".|r"); + player:SendBroadcastMessage(GWCOMM[PLAYER_GUILD_ID].color_9.."****************************************"); + return false; + end + + if (ChatCache[1] == GWCOMM[SERVER_GUILD_ID].command_set) then + + if(ChatCache[2])then + + for i = 1, #GWHELP do + + if(ChatCache[2]==tostring(GWHELP[i].command))then + + if(ChatCache[3])then + + if(GWHELP[i].command_level<=4)then + + if(pGuildRank == 0)then + PreparedStatements(3, ChatCache[2], ChatCache[3], PLAYER_GUILD_ID) + player:SendBroadcastMessage("guild cmd "..ChatCache[2].." set to "..ChatCache[3].."."); + return false; + else + + player:SendBroadcastMessage(GWCOMM[PLAYER_GUILD_ID].color_15.."GLD CMD ACCESS ERROR.:|r "..pGuildRank); + player:SendBroadcastMessage(GWCOMM[PLAYER_GUILD_ID].color_15.."CMD ERROR:|r "..ChatCache[1].." "..ChatCache[2].." "..ChatCache[3]); + return false; + end + end + + if(GWHELP[i].command_level<=6)and(GWHELP[i].command_level>=5)then + + if(pGMRank == GWCOMM[SERVER_GUILD_ID].GM_admin)then + PreparedStatements(3, ChatCache[2], ChatCache[3], SERVER_GUILD_ID) + player:SendBroadcastMessage(GWCOMM[PLAYER_GUILD_ID].color_10.."GM cmd "..ChatCache[2].." set to "..ChatCache[3].."|r."); + return false; + else + player:SendBroadcastMessage(GWCOMM[PLAYER_GUILD_ID].color_15.."GM CMD ACCESS ERROR.: |r"..pGMRank); + player:SendBroadcastMessage(GWCOMM[PLAYER_GUILD_ID].color_15.."CMD ERROR:|r "..ChatCache[1].." "..ChatCache[2].." "..ChatCache[3]); + return false; + end + end + + else + player:SendBroadcastMessage(GWCOMM[PLAYER_GUILD_ID].color_15.."CMD ERROR:|r "..ChatCache[1].." "..ChatCache[2]..""..GWCOMM[PLAYER_GUILD_ID].color_15.." NO value entered."); + return false; + end + + return false; + end + end + else + player:SendBroadcastMessage(GWCOMM[PLAYER_GUILD_ID].color_15.."CMD ERROR:|r "..ChatCache[1]..""..GWCOMM[PLAYER_GUILD_ID].color_15.." NO target command entered."); + return false; + end + player:SendBroadcastMessage(GWCOMM[PLAYER_GUILD_ID].color_15.."CMD ERROR:|r "..ChatCache[1]); + end + + if (ChatCache[1] == "help")then + + for i = 1, #GWHELP do + + if(ChatCache[2] == GWCOMM[SERVER_GUILD_ID].command_set)and(ChatCache[3]==nil)then + player:SendBroadcastMessage(GWCOMM[PLAYER_GUILD_ID].color_10.."command id - description"); + + for b = 1, #GWHELP do + + if((pGuildRank == 0)and(GWHELP[b].command_level<=4))then + player:SendBroadcastMessage(GWCOMM[PLAYER_GUILD_ID].color_10..""..GWHELP[b].command.." - "..GWCOMM[PLAYER_GUILD_ID].color_11..""..GWHELP[b].description.."|r"); + end + + if(pGMRank == GWCOMM[SERVER_GUILD_ID].GM_admin)and(GWHELP[b].command_level>=5)and(GWHELP[b].command_level<=6)then + player:SendBroadcastMessage(GWCOMM[PLAYER_GUILD_ID].color_10..""..GWHELP[b].command.." - "..GWCOMM[PLAYER_GUILD_ID].color_11..""..GWHELP[b].description.."|r"); + end + end + return false; + end + + if(ChatCache[3] == tostring(GWHELP[i].command))then + + if(pGuildRank == 0)and(GWHELP[i].command_level<=4)then + player:SendBroadcastMessage(GWCOMM[PLAYER_GUILD_ID].color_10..""..GWHELP[i].command.." - |cff00cc00"..GWHELP[i].description.."|r"); + player:SendBroadcastMessage(GWCOMM[PLAYER_GUILD_ID].color_10.."Example:|r /g "..GWCOMM[PLAYER_GUILD_ID].color_11..""..GWHELP[i].example..""); + player:SendBroadcastMessage(GWCOMM[PLAYER_GUILD_ID].color_10.."Current:|r "..GWCOMM[PLAYER_GUILD_ID].color_13..""..GWCOMM[PLAYER_GUILD_ID][GWHELP[i].command]..""); + return false; + end + + if(pGMRank == GWCOMM[SERVER_GUILD_ID].GM_admin)and(GWHELP[i].command_level>=5)and(GWHELP[i].command_level<=6)then + player:SendBroadcastMessage(GWCOMM[PLAYER_GUILD_ID].color_10..""..GWHELP[i].command.." - |cff00cc00"..GWHELP[i].description.."|r"); + player:SendBroadcastMessage(GWCOMM[PLAYER_GUILD_ID].color_10.."Example:|r /g "..GWCOMM[PLAYER_GUILD_ID].color_11..""..GWHELP[i].example..""); + player:SendBroadcastMessage(GWCOMM[PLAYER_GUILD_ID].color_10.."Current:|r "..GWCOMM[PLAYER_GUILD_ID].color_13..""..GWCOMM[PLAYER_GUILD_ID][GWHELP[i].command]..""); + return false; + end + end + end + player:SendBroadcastMessage("err..."); + return false; + end + +-- **************************************************** +-- ************ CORE: Guild Master Commands *********** +-- **************************************************** + + if(pGuildRank <= GWCOMM[PLAYER_GUILD_ID].GLD_lvlb and ChatCache[1] == "buy")then + +-- ******************* Buy commands ******************* + + if(ChatCache[2] == GWCOMM[PLAYER_GUILD_ID].loc)then + + if(GWARZ[LocId].guild_id ~= SERVER_GUILD_ID)then + player:SendBroadcastMessage(GWCOMM[PLAYER_GUILD_ID].color_15.."You cannot purchase this area.") + player:SendBroadcastMessage(GWCOMM[PLAYER_GUILD_ID].color_14..""..GWARZ[LocId].guild_name.." owns this area."); + return false; + + else + + if(player:GetItemCount(GWCOMM[SERVER_GUILD_ID].currency) < Zoneprice)then + player:SendBroadcastMessage(GWCOMM[PLAYER_GUILD_ID].color_15.."You do not have enough "..Currencyname.."'s."); + return false; + else + + if(GWARZ[LocId].team==3)then + player:SendBroadcastMessage(GWCOMM[PLAYER_GUILD_ID].color_15.."THIS AREA IS OFF LIMITS") + return false; + else + + local Gflag = PerformIngameSpawn(2, (GWCOMM[SERVER_GUILD_ID].flag_id + PLAYER_TEAM_ID), (player:GetMapId()), player:GetInstanceId(), player:GetX(), player:GetY(), player:GetZ(), player:GetO(), true, 0, player:GetPhaseMaskForSpawn()); -- , true, 0, 1); + local GflagId = Gflag:GetDBTableGUIDLow(); + + PreparedStatements(1, "guild_name", PLAYER_GUILD_NAME, LocId) + PreparedStatements(1, "team", PLAYER_TEAM_ID, LocId) + PreparedStatements(1, "x", player:GetX(), LocId) + PreparedStatements(1, "y", player:GetY(), LocId) + PreparedStatements(1, "z", player:GetZ(), LocId) + PreparedStatements(1, "flag_id", GflagId, LocId) + PreparedStatements(1, "fs_time", GetCurrTime(), LocId) + PreparedStatements(1, "guild_id", PLAYER_GUILD_ID, LocId) + + player:RemoveItem(GWCOMM[SERVER_GUILD_ID].currency, Zoneprice) + + if(player:GetGender()==0)then + player:SendBroadcastMessage(GWCOMM[PLAYER_GUILD_ID].color_14.."Congratulations King "..pName..". you have expanded "..PLAYER_GUILD_NAME.."'s land.|r"); + else + player:SendBroadcastMessage(GWCOMM[PLAYER_GUILD_ID].color_14.."Congratulations Queen "..pName..". you have expanded "..PLAYER_GUILD_ID.."'s land.|r"); + end + return false; + end + end + end + end + + if(ChatCache[2] == GWCOMM[PLAYER_GUILD_ID].farm)then + + if(GWARZ[LocId].guild_id ~= PLAYER_GUILD_ID)then + player:SendBroadcastMessage(GWCOMM[PLAYER_GUILD_ID].color_15.."Your Guild does not own this land."); + return false; + else + + if(player:GetItemCount(GWCOMM[SERVER_GUILD_ID].currency) < GWCOMM[SERVER_GUILD_ID].farm_cost)then + player:SendBroadcastMessage(GWCOMM[PLAYER_GUILD_ID].color_15.."You require more "..Currencyname.."'s."); + return false; + else + + if(GWARZ[LocId].farm_count >= GWCOMM[SERVER_GUILD_ID].farm_L)then + player:SendBroadcastMessage(GWCOMM[PLAYER_GUILD_ID].color_15.."You have "..GWARZ[LocId].farm_count.." farm\'s at this location."); + player:SendBroadcastMessage(GWCOMM[PLAYER_GUILD_ID].color_15.."You can only purchase "..GWCOMM[SERVER_GUILD_ID].farm_L.." farm\'s per location."); + return false; + else + + if(GWARZ[LocId].pig_count < (GWARZ[LocId].farm_count * GWCOMM[SERVER_GUILD_ID].pig_L))then + player:SendBroadcastMessage(GWCOMM[PLAYER_GUILD_ID].color_15.."you still need to finish populating your other farm."); + return false; + else + + PerformIngameSpawn(2, GWCOMM[SERVER_GUILD_ID].farm_id+GWARZ[LocId].team, (player:GetMapId()), player:GetInstanceId(), player:GetX(), player:GetY(), player:GetZ(), player:GetO(), true, 0, player:GetPhaseMaskForSpawn()); + + PreparedStatements(1, "farm_count", GWARZ[LocId].farm_count+1, LocId) + + player:RemoveItem(GWCOMM[SERVER_GUILD_ID].currency, GWCOMM[SERVER_GUILD_ID].farm_cost) + + player:SendBroadcastMessage(GWCOMM[PLAYER_GUILD_ID].color_14.."Congratulations Grunt "..pName..".|r"); + player:SendBroadcastMessage(GWCOMM[PLAYER_GUILD_ID].color_14..""..PLAYER_GUILD_NAME.." has added a farm at location: "..LocId..".|r"); + return false; + end + end + end + end + end + + if(ChatCache[2] == GWCOMM[PLAYER_GUILD_ID].barrack)then + + if(GWARZ[LocId].guild_id ~= PLAYER_GUILD_ID)then + player:SendBroadcastMessage(GWCOMM[PLAYER_GUILD_ID].color_15.."Your Guild does not own this land."); + return false; + else + + if(player:GetItemCount(GWCOMM[SERVER_GUILD_ID].currency) < GWCOMM[SERVER_GUILD_ID].barrack_cost)then + player:SendBroadcastMessage(GWCOMM[PLAYER_GUILD_ID].color_15.."You require more "..Currencyname.."'s."); + return false; + else + + if(GWARZ[LocId].barrack_count >= (GWCOMM[SERVER_GUILD_ID].farm_L * GWCOMM[SERVER_GUILD_ID].barrack_L))then + player:SendBroadcastMessage(GWCOMM[PLAYER_GUILD_ID].color_15.."You have "..GWARZ[LocId].barrack_count.." barrack\'s at this location."); + player:SendBroadcastMessage(GWCOMM[PLAYER_GUILD_ID].color_15.."You can only purchase "..GWCOMM[SERVER_GUILD_ID].farm_L*GWCOMM[SERVER_GUILD_ID].barrack_L.." barrack\'s per location."); + return false; + else + + if(GWARZ[LocId].barrack_count >= GWARZ[LocId].farm_count*GWCOMM[SERVER_GUILD_ID].barrack_L)then + player:SendBroadcastMessage(GWCOMM[PLAYER_GUILD_ID].color_15.."Each farm supports "..GWCOMM[SERVER_GUILD_ID].barrack_L.." barracks. You need another farm."); + return false; + else + + PerformIngameSpawn(2, GWCOMM[SERVER_GUILD_ID].barrack_id+GWARZ[LocId].team, player:GetMapId(), player:GetInstanceId(), player:GetX(), player:GetY(), player:GetZ(), player:GetO(), true, 0, player:GetPhaseMaskForSpawn()); + + PreparedStatements(1, "barrack_count", GWARZ[LocId].barrack_count+1, LocId) + + player:RemoveItem(GWCOMM[SERVER_GUILD_ID].currency, GWCOMM[SERVER_GUILD_ID].barrack_cost) + + player:SendBroadcastMessage(GWCOMM[PLAYER_GUILD_ID].color_14.."Congratulations Commander "..pName..".|r"); + player:SendBroadcastMessage(GWCOMM[PLAYER_GUILD_ID].color_14..""..PLAYER_GUILD_NAME.." has added a barracks at location: "..LocId..".|r"); + return false; + end + end + end + end + end + + if(ChatCache[2] == GWCOMM[PLAYER_GUILD_ID].hall)then + + if(PLAYER_GUILD_ID ~= GWARZ[LocId].guild_id)then + player:SendBroadcastMessage(GWCOMM[PLAYER_GUILD_ID].color_15.."Your Guild does not own this land."); + return false; + else + + if(player:GetItemCount(GWCOMM[SERVER_GUILD_ID].currency) < GWCOMM[SERVER_GUILD_ID].hall_cost)then + player:SendBroadcastMessage(GWCOMM[PLAYER_GUILD_ID].color_15.."Each hall costs "..GWCOMM[SERVER_GUILD_ID].hall_cost.." "..Currencyname..". You dont have eough."); + return false; + else + + if(GWARZ[LocId].hall_count >= GWCOMM[SERVER_GUILD_ID].hall_L)then + player:SendBroadcastMessage(GWCOMM[PLAYER_GUILD_ID].color_15.."You have "..GWARZ[LocId].hall_count.." hall at this location."); + player:SendBroadcastMessage(GWCOMM[PLAYER_GUILD_ID].color_15.."You can only have "..GWCOMM[SERVER_GUILD_ID].hall_L.." hall per area."); + return false; + else + + if(GWARZ[LocId].barrack_count == 0)then + player:SendBroadcastMessage(GWCOMM[PLAYER_GUILD_ID].color_15.."Each Hall require's 1 barracks per location to provide guards for defensive support."); + player:SendBroadcastMessage(GWCOMM[PLAYER_GUILD_ID].color_15.."Gotta protect your HQ."); + return false; + else + + PerformIngameSpawn(2, GWCOMM[SERVER_GUILD_ID].hall_id+GWARZ[LocId].team, player:GetMapId(), player:GetInstanceId(), player:GetX(), player:GetY(), player:GetZ(), player:GetO(), true, 0, player:GetPhaseMaskForSpawn()); + + PreparedStatements(1, "hall_count", GWARZ[LocId].hall_count+1, LocId) + + player:RemoveItem(GWCOMM[SERVER_GUILD_ID].currency, GWCOMM[SERVER_GUILD_ID].hall_cost) + + player:SendBroadcastMessage(GWCOMM[PLAYER_GUILD_ID].color_14.."Congradulations!.|r"); + player:SendBroadcastMessage(GWCOMM[PLAYER_GUILD_ID].color_14.."Commandant "..pName..".|r"); + return false; + end + end + end + end + end + + if(ChatCache[2] == GWCOMM[PLAYER_GUILD_ID].pig)then + + if(GWARZ[LocId].guild_id ~= PLAYER_GUILD_ID)then + player:SendBroadcastMessage(GWCOMM[PLAYER_GUILD_ID].color_15.."Your Guild does not own this land."); + return false; + else + + if(player:GetItemCount(GWCOMM[SERVER_GUILD_ID].currency) < GWCOMM[SERVER_GUILD_ID].pig_cost)then + player:SendBroadcastMessage(GWCOMM[PLAYER_GUILD_ID].color_15.."Each pig costs "..GWCOMM["SERVER"].pig_cost.." "..Currencyname.."."); + return false; + else + + if(GWARZ[LocId].pig_count >= (GWCOMM[SERVER_GUILD_ID].pig_L * GWCOMM[SERVER_GUILD_ID].farm_L))then + player:SendBroadcastMessage(GWCOMM[PLAYER_GUILD_ID].color_15.."You have "..(GWARZ[LocId].pig_count*GWCOMM[SERVER_GUILD_ID].farm_L).." pigs at this location.") ; + player:SendBroadcastMessage(GWCOMM[PLAYER_GUILD_ID].color_15.."You can only have "..GWCOMM[SERVER_GUILD_ID].pig_L.." pig's per farm and "..GWCOMM[SERVER_GUILD_ID].farm_L.." farm's per location.") ; + return false; + else + + if(GWARZ[LocId].pig_count < GWCOMM[SERVER_GUILD_ID].pig_L)and(GWARZ[LocId].farm_count==0)then + player:SendBroadcastMessage(GWCOMM[PLAYER_GUILD_ID].color_15.."You must first have a farm here before you can add pigs."); + player:SendBroadcastMessage(GWCOMM[PLAYER_GUILD_ID].color_15.."Piggies gotta live somewhere..."); + return false; + else + + if(GWARZ[LocId].pig_count >= (GWARZ[LocId].farm_count * GWCOMM[SERVER_GUILD_ID].pig_L))then + player:SendBroadcastMessage(GWCOMM[PLAYER_GUILD_ID].color_15.."You require another farm before you can add any more pigs."); + return false; + else + + PerformIngameSpawn(1, GWCOMM[SERVER_GUILD_ID].pig_id+GWARZ[LocId].team, player:GetMapId(), player:GetInstanceId(), player:GetX(), player:GetY(), player:GetZ(), player:GetO(), true, 0, player:GetPhaseMaskForSpawn()); + + PreparedStatements(1, "pig_count", GWARZ[LocId].pig_count+1, LocId); + + player:RemoveItem(GWCOMM[SERVER_GUILD_ID].currency, GWCOMM[SERVER_GUILD_ID].pig_cost); + + player:SendBroadcastMessage(GWCOMM[PLAYER_GUILD_ID].color_14.."Congradulations!.|r"); + player:SendBroadcastMessage(GWCOMM[PLAYER_GUILD_ID].color_14.."Farmer "..pName..".|r"); + return false; + end + end + end + end + end + end + + if(ChatCache[2] == GWCOMM[PLAYER_GUILD_ID].guard)then + + if(GWARZ[LocId].guild_id ~= PLAYER_GUILD_ID)then + player:SendBroadcastMessage(GWCOMM[PLAYER_GUILD_ID].color_15.."Your Guild does not own this land."); + return false; + else + + if(player:GetItemCount(GWCOMM[SERVER_GUILD_ID].currency) < GWCOMM[SERVER_GUILD_ID].guard_cost)then + player:SendBroadcastMessage(GWCOMM[PLAYER_GUILD_ID].color_15.."Each guard costs "..GWCOMM[SERVER_GUILD_ID].guard_cost.." "..Currencyname.."."); + return false; + else + + if(GWARZ[LocId].guard_count >= (GWCOMM[SERVER_GUILD_ID].guard_L * (GWCOMM[SERVER_GUILD_ID].barrack_L * GWCOMM[SERVER_GUILD_ID].farm_L)))then + player:SendBroadcastMessage(GWCOMM[PLAYER_GUILD_ID].color_15.."You have "..GWARZ[LocId].guard_count.." guards at this location."); + player:SendBroadcastMessage(GWCOMM[PLAYER_GUILD_ID].color_15.."You can only have "..(GWCOMM[SERVER_GUILD_ID].guard_L*GWCOMM[SERVER_GUILD_ID].farm_L).." per location."); + return false; + else + + if(GWARZ[LocId].guard_count >= (GWARZ[LocId].barrack_count * GWCOMM[SERVER_GUILD_ID].guard_L))then + player:SendBroadcastMessage(GWCOMM[PLAYER_GUILD_ID].color_15.."You must add another barracks to produce more guards."); + return false; + else + + PerformIngameSpawn(1, GWCOMM[SERVER_GUILD_ID].guard_id+GWARZ[LocId].team, player:GetMapId(), player:GetInstanceId(), player:GetX(), player:GetY(), player:GetZ(), player:GetO(), true, 0, player:GetPhaseMaskForSpawn()); + + PreparedStatements(1, "guard_count", GWARZ[LocId].guard_count+1, LocId); + + player:RemoveItem(GWCOMM[SERVER_GUILD_ID].currency, GWCOMM[SERVER_GUILD_ID].guard_cost); + + player:SendBroadcastMessage(GWCOMM[PLAYER_GUILD_ID].color_14.."Guard added by Commander "..pName..".|r"); + return false; + end + end + end + end + end + + if(ChatCache[2] == GWCOMM[PLAYER_GUILD_ID].vendor1)then + + if(GWCOMM[SERVER_GUILD_ID].vendor1_id > 0)then + + if(GWARZ[LocId].guild_id ~= PLAYER_GUILD_ID)then + player:SendBroadcastMessage(GWCOMM[PLAYER_GUILD_ID].color_15.."Your Guild does not own this land."); + return false; + else + + if(player:GetItemCount(GWCOMM[SERVER_GUILD_ID].currency) < GWCOMM[SERVER_GUILD_ID].vendor1_cost)then + player:SendBroadcastMessage(GWCOMM[PLAYER_GUILD_ID].color_15.."Each vendor1 costs "..GWCOMM[SERVER_GUILD_ID].vendor1_cost.." "..Currencyname.."."); + return false; + else + + if(GWARZ[LocId].vendor1_count >= GWCOMM[SERVER_GUILD_ID].vendor1_L)then + player:SendBroadcastMessage(GWCOMM[PLAYER_GUILD_ID].color_15.."You have "..GWARZ[LocId].vendor1_count.." vendor1's at this location."); + player:SendBroadcastMessage(GWCOMM[PLAYER_GUILD_ID].color_15.."You can only have "..GWCOMM[SERVER_GUILD_ID].vendor1_L.." per location."); + return false; + else + + PerformIngameSpawn(1, GWCOMM[SERVER_GUILD_ID].vendor1_id+GWARZ[LocId].team, player:GetMapId(), player:GetInstanceId(), player:GetX(), player:GetY(), player:GetZ(), player:GetO(), true, 0, player:GetPhaseMaskForSpawn()); + + PreparedStatements(1, "vendor1_count", GWARZ[LocId].vendor1_count+1, LocId); + + player:RemoveItem(GWCOMM[SERVER_GUILD_ID].currency, GWCOMM[SERVER_GUILD_ID].vendor1_cost); + + player:SendBroadcastMessage(GWCOMM[PLAYER_GUILD_ID].color_14.."Vendor1 added by Commander "..pName..".|r"); + return false; + end + end + end + else + player:SendBroadcastMessage("Vendor1 is NOT enabled..") + return false; + end + end + + if(ChatCache[2] == GWCOMM[PLAYER_GUILD_ID].vendor2)then + + if(GWCOMM[SERVER_GUILD_ID].vendor2_id > 0)then + + if(GWARZ[LocId].guild_id ~= PLAYER_GUILD_ID)then + player:SendBroadcastMessage(GWCOMM[PLAYER_GUILD_ID].color_15.."Your Guild does not own this land."); + return false; + else + + if(player:GetItemCount(GWCOMM[SERVER_GUILD_ID].currency) < GWCOMM[SERVER_GUILD_ID].vendor2_cost)then + player:SendBroadcastMessage(GWCOMM[PLAYER_GUILD_ID].color_15.."Each vendor2 costs "..GWCOMM[SERVER_GUILD_ID].vendor2_cost.." "..Currencyname.."."); + return false; + else + + if(GWARZ[LocId].vendor2_count >= GWCOMM[SERVER_GUILD_ID].vendor2_L)then + player:SendBroadcastMessage(GWCOMM[PLAYER_GUILD_ID].color_15.."You have "..GWARZ[LocId].vendor2_count.." vendor2's at this location."); + player:SendBroadcastMessage(GWCOMM[PLAYER_GUILD_ID].color_15.."You can only have "..GWCOMM[SERVER_GUILD_ID].vendor2_L.." per location."); + return false; + else + + PerformIngameSpawn(1, GWCOMM[SERVER_GUILD_ID].vendor2_id+GWARZ[LocId].team, player:GetMapId(), player:GetInstanceId(), player:GetX(), player:GetY(), player:GetZ(), player:GetO(), true, 0, player:GetPhaseMaskForSpawn()); + + PreparedStatements(1, "vendor2_count", GWARZ[LocId].vendor2_count+1, LocId) + + player:RemoveItem(GWCOMM[SERVER_GUILD_ID].currency, GWCOMM[SERVER_GUILD_ID].vendor2_cost) + + player:SendBroadcastMessage(GWCOMM[PLAYER_GUILD_ID].color_14.."Vendor2 added by Commander "..pName..".|r"); + return false; + end + end + end + else + player:SendBroadcastMessage("Vendor2 is NOT enabled..") + return false; + end + end + + if(ChatCache[2] == GWCOMM[PLAYER_GUILD_ID].vendor3)then + + if(GWCOMM[SERVER_GUILD_ID].vendor3_id > 0)then + + if(GWARZ[LocId].guild_id ~= PLAYER_GUILD_ID)then + player:SendBroadcastMessage(GWCOMM[PLAYER_GUILD_ID].color_15.."Your Guild does not own this land."); + return false; + else + if(player:GetItemCount(GWCOMM[SERVER_GUILD_ID].currency) < GWCOMM[SERVER_GUILD_ID].vendor3_cost)then + player:SendBroadcastMessage(GWCOMM[PLAYER_GUILD_ID].color_15.."Each vendor3 costs "..GWCOMM[SERVER_GUILD_ID].vendor3_cost.." "..Currencyname.."."); + return false; + else + if(GWARZ[LocId].vendor3_count >= GWCOMM[SERVER_GUILD_ID].vendor3_L)then + player:SendBroadcastMessage(GWCOMM[PLAYER_GUILD_ID].color_15.."You have "..GWARZ[LocId].vendor3_count.." vendor3's at this location."); + player:SendBroadcastMessage(GWCOMM[PLAYER_GUILD_ID].color_15.."You can only have "..GWCOMM[SERVER_GUILD_ID].vendor3_L.." per location."); + return false; + else + PerformIngameSpawn(1, GWCOMM[SERVER_GUILD_ID].vendor3_id+GWARZ[LocId].team, player:GetMapId(), player:GetInstanceId(), player:GetX(), player:GetY(), player:GetZ(), player:GetO(), true, 0, player:GetPhaseMaskForSpawn()); + + PreparedStatements(1, "vendor3_count", GWARZ[LocId].vendor3_count+1, LocId); + + player:RemoveItem(GWCOMM[SERVER_GUILD_ID].currency, GWCOMM[SERVER_GUILD_ID].vendor3_cost); + + player:SendBroadcastMessage(GWCOMM[PLAYER_GUILD_ID].color_14.."Vendor3 added by Commander "..pName..".|r"); + return false; + end + end + end + else + player:SendBroadcastMessage("Vendor3 is NOT enabled..") + return false; + end + end + + if(ChatCache[2] == GWCOMM[PLAYER_GUILD_ID].cannon)then + + if(GWCOMM[SERVER_GUILD_ID].cannon_id > 0)then + + if(GWARZ[LocId].guild_id ~= PLAYER_GUILD_ID)then + player:SendBroadcastMessage(GWCOMM[PLAYER_GUILD_ID].color_15.."Your Guild does not own this land."); + return false; + else + if(player:GetItemCount(GWCOMM[SERVER_GUILD_ID].currency) < GWCOMM[SERVER_GUILD_ID].cannon_cost)then + player:SendBroadcastMessage(GWCOMM[PLAYER_GUILD_ID].color_15.."Each cannon costs "..GWCOMM[SERVER_GUILD_ID].cannon_cost.." "..Currencyname.."."); + return false; + else + if(GWARZ[LocId].cannon_count >= GWCOMM[SERVER_GUILD_ID].cannon_L)then + player:SendBroadcastMessage(GWCOMM[PLAYER_GUILD_ID].color_15.."You have "..GWARZ[LocId].cannon_count.." "..GWCOMM[PLAYER_GUILD_ID].cannon.."'s at this location."); + player:SendBroadcastMessage(GWCOMM[PLAYER_GUILD_ID].color_15.."You can only have "..GWCOMM[SERVER_GUILD_ID].cannon_L.." per location."); + return false; + else + if(GWARZ[LocId].hall_count == 0)then + player:SendBroadcastMessage(GWCOMM[PLAYER_GUILD_ID].color_15.."Cannons require a Hall per location."); + return false; + else + PerformIngameSpawn(1, GWCOMM[SERVER_GUILD_ID].cannon_id+GWARZ[LocId].team, player:GetMapId(), player:GetInstanceId(), player:GetX(), player:GetY(), player:GetZ(), player:GetO(), true, 0, player:GetPhaseMaskForSpawn()); + + PreparedStatements(1, "cannon_count", GWARZ[LocId].cannon_count+1, LocId); + + player:RemoveItem(GWCOMM[SERVER_GUILD_ID].currency, GWCOMM[SERVER_GUILD_ID].cannon_cost); + + player:SendBroadcastMessage(GWCOMM[PLAYER_GUILD_ID].color_14.."cannon added by Commander "..pName..".|r"); + player:SendBroadcastMessage(GWCOMM[PLAYER_GUILD_ID].color_14.."!! Its a cannon !!|r"); + return false; + end + end + end + end + else + player:SendBroadcastMessage("cannon's NOT enabled..") + return false; + end + end + + if(ChatCache[2] == GWCOMM[PLAYER_GUILD_ID].vault)then + + if(GWARZ[LocId].guild_id ~= PLAYER_GUILD_ID)then + player:SendBroadcastMessage(GWCOMM[PLAYER_GUILD_ID].color_15.."Your Guild does not own this land."); + return false; + else + if(player:GetItemCount(GWCOMM[SERVER_GUILD_ID].currency) < GWCOMM[SERVER_GUILD_ID].vault_cost)then + player:SendBroadcastMessage(GWCOMM[PLAYER_GUILD_ID].color_15.."Each vault costs "..GWCOMM[SERVER_GUILD_ID].cannon_cost.." "..Currencyname.."."); + return false; + else + if(GWARZ[LocId].vault_count >= GWCOMM[SERVER_GUILD_ID].vault_L * GWARZ[LocId].hall_count)then + player:SendBroadcastMessage(GWCOMM[PLAYER_GUILD_ID].color_15.."You have "..GWARZ[LocId].vault_count.." "..GWCOMM[PLAYER_GUILD_ID].vault.."'s at this location."); + player:SendBroadcastMessage(GWCOMM[PLAYER_GUILD_ID].color_15.."You can only have "..GWCOMM[SERVER_GUILD_ID].vault_L.." per hall."); + return false; + else + if(GWARZ[LocId].hall_count == 0)then + player:SendBroadcastMessage(GWCOMM[PLAYER_GUILD_ID].color_15.."Vaults require a Hall."); + return false; + else + PerformIngameSpawn(2, GWCOMM[SERVER_GUILD_ID].vault_id+GWARZ[LocId].team, player:GetMapId(), player:GetInstanceId(), player:GetX(), player:GetY(), player:GetZ(), player:GetO(), true, 0, player:GetPhaseMaskForSpawn()); + + PreparedStatements(1, "vault_count", GWARZ[LocId].vault_count+1, LocId) + + player:RemoveItem(GWCOMM[SERVER_GUILD_ID].currency, GWCOMM[SERVER_GUILD_ID].vault_cost) + + player:SendBroadcastMessage(GWCOMM[PLAYER_GUILD_ID].color_14.."Vault added by Comissioner "..pName..".|r"); + return false; + end + end + end + end + end + + if(ChatCache[2] == GWCOMM[PLAYER_GUILD_ID].mailbox)then + + if(GWARZ[LocId].guild_id ~= PLAYER_GUILD_ID)then + player:SendBroadcastMessage(GWCOMM[PLAYER_GUILD_ID].color_15.."Your Guild does not own this land."); + return false; + else + if(player:GetItemCount(GWCOMM[SERVER_GUILD_ID].currency) < GWCOMM[SERVER_GUILD_ID].mailbox_cost)then + player:SendBroadcastMessage(GWCOMM[PLAYER_GUILD_ID].color_15.."Each mailbox costs "..GWCOMM[SERVER_GUILD_ID].mailbox_cost.." "..Currencyname.."."); + return false; + else + if(GWARZ[LocId].mailbox_count >= GWCOMM[SERVER_GUILD_ID].mailbox_L * GWARZ[LocId].hall_count)then + player:SendBroadcastMessage(GWCOMM[PLAYER_GUILD_ID].color_15.."You have "..GWARZ[LocId].mailbox_count.." "..GWCOMM[PLAYER_GUILD_ID].mailbox.."'s at this location."); + player:SendBroadcastMessage(GWCOMM[PLAYER_GUILD_ID].color_15.."You can only have "..GWCOMM[SERVER_GUILD_ID].mailbox_L.." per hall."); + return false; + else + if(GWARZ[LocId].hall_count == 0)then + player:SendBroadcastMessage(GWCOMM[PLAYER_GUILD_ID].color_15.."Mailboxs require a Hall."); + return false; + else + PerformIngameSpawn(2, GWCOMM[SERVER_GUILD_ID].mailbox_id+GWARZ[LocId].team, player:GetMapId(), player:GetInstanceId(), player:GetX(), player:GetY(), player:GetZ(), player:GetO(), true, 0, player:GetPhaseMaskForSpawn()); + + PreparedStatements(1, "mailbox_count", GWARZ[LocId].mailbox_count+1, LocId); + + player:RemoveItem(GWCOMM[SERVER_GUILD_ID].currency, GWCOMM[SERVER_GUILD_ID].mailbox_cost); + + player:SendBroadcastMessage(GWCOMM[PLAYER_GUILD_ID].color_14.."Mailbox added by Comissioner "..pName..".|r"); + return false; + end + end + end + end + end + + player:SendBroadcastMessage(GWCOMM[PLAYER_GUILD_ID].color_15.."CMD ERROR:|r "..ChatCache[1].." "..ChatCache[2]); + return false; + end + +-- ******************* Sell commands ****************** + + if(pGuildRank <= GWCOMM[PLAYER_GUILD_ID].GLD_lvls)and(ChatCache[1] == "sell")then + + if(ChatCache[2] == GWCOMM[PLAYER_GUILD_ID].loc)then + + if(GWARZ[LocId].guild_id ~= PLAYER_GUILD_ID)then + player:SendBroadcastMessage(GWCOMM[PLAYER_GUILD_ID].color_15.."Your guild does not own this land."); + return false; + else + + if(player:GetNearestGameObject(1, GWCOMM[SERVER_GUILD_ID].flag_id+player:GetTeam()) == nil)then + player:SendBroadcastMessage(GWCOMM[PLAYER_GUILD_ID].color_15.."You must be next to your guild flag."); + player:SendBroadcastMessage(GWCOMM[PLAYER_GUILD_ID].color_15.."move closer and try again."); + return false; + else + + local flag = player:GetNearestGameObject(1, (GWCOMM[SERVER_GUILD_ID].flag_id+player:GetTeam())); + local flagid = flag:GetGUIDLow(); + + flag:Despawn(); + flag:RemoveFromWorld(1); + + PreparedStatements(1, "guild_name", SERVER_GUILD_NAME, LocId); + PreparedStatements(1, "team", 2, LocId); + PreparedStatements(1, "flag_id", 0, LocId); + PreparedStatements(1, "fs_time", 0, LocId); + PreparedStatements(1, "guild_id", SERVER_GUILD_ID, LocId); + + player:AddItem(GWCOMM[SERVER_GUILD_ID].currency, Zoneprice); + + player:SendBroadcastMessage(GWCOMM[PLAYER_GUILD_ID].color_14.."!Congratulations! Realtor "..pName.." has sold this land. For "..Zoneprice.." "..Currencyname.."'s.|r"); + return false; + end + end + end + + if(ChatCache[2] == GWCOMM[PLAYER_GUILD_ID].farm)then + + if(PLAYER_GUILD_ID ~= GWARZ[LocId].guild_id)then + player:SendBroadcastMessage(GWCOMM[PLAYER_GUILD_ID].color_15.."Your guild does not own this land."); + return false; + else + if(GWARZ[LocId].farm_count == 0)then + player:SendBroadcastMessage(GWCOMM[PLAYER_GUILD_ID].color_15.."Your guild does not own a farm at this location."); + return false; + else + + if(GWARZ[LocId].pig_count > ((GWCOMM[SERVER_GUILD_ID].pig_L) * (GWARZ[LocId].farm_count-1)))then + player:SendBroadcastMessage(GWCOMM[PLAYER_GUILD_ID].color_15.."You must sell off all the pigs first before removing there housing."); + return false; + else + + if(((player:GetNearestGameObject(5, GWCOMM[SERVER_GUILD_ID].farm_id))or(player:GetNearestGameObject(5, GWCOMM[SERVER_GUILD_ID].farm_id+1))) == nil)then + player:SendBroadcastMessage(GWCOMM[PLAYER_GUILD_ID].color_15.."You must be closer.") + return false; + else + + local farm = (player:GetNearestGameObject(5, GWCOMM[SERVER_GUILD_ID].farm_id))or(player:GetNearestGameObject(5, GWCOMM[SERVER_GUILD_ID].farm_id+1)); + local farmspawnid = farm:GetGUIDLow(); -- use this to avoid ghost respawns + + farm:Despawn(); + farm:RemoveFromWorld(1); + + PreparedStatements(2, "gameobject", farmspawnid); + PreparedStatements(1, "farm_count", GWARZ[LocId].farm_count-1, LocId); + + player:AddItem(GWCOMM[SERVER_GUILD_ID].currency, GWCOMM[SERVER_GUILD_ID].farm_cost); + + player:SendBroadcastMessage(GWCOMM[PLAYER_GUILD_ID].color_14.."!Congratulations!"..PLAYER_GUILD_NAME.." has sold a guild farm. For "..GWCOMM[SERVER_GUILD_ID].farm_cost.." "..Currencyname.."'s.|r"); + return false; + end + end + end + end + end + + if(ChatCache[2] == GWCOMM[PLAYER_GUILD_ID].barrack)then + + if(PLAYER_GUILD_ID ~= GWARZ[LocId].guild_id)then + player:SendBroadcastMessage(GWCOMM[PLAYER_GUILD_ID].color_15.."Your guild does not own this land."); + return false; + else + + if(GWARZ[LocId].barrack_count == 0)then + player:SendBroadcastMessage(GWCOMM[PLAYER_GUILD_ID].color_15.."Your guild does not own a barracks at this location."); + return false; + else + + if(GWARZ[LocId].guard_count > ((GWCOMM[SERVER_GUILD_ID].guard_L) * (GWARZ[LocId].barrack_count-1)))then + player:SendBroadcastMessage(GWCOMM[PLAYER_GUILD_ID].color_15.."You must remove more guards before removing there housing."); + return false; + else + + if(((player:GetNearestGameObject(5, GWCOMM[SERVER_GUILD_ID].barrack_id))or(player:GetNearestGameObject(5, GWCOMM[SERVER_GUILD_ID].barrack_id+1))) == nil)then + player:SendBroadcastMessage(GWCOMM[PLAYER_GUILD_ID].color_15.."You must be closer."); + return false; + else + + local barrack = (player:GetNearestGameObject(5, GWCOMM[SERVER_GUILD_ID].barrack_id))or(player:GetNearestGameObject(5, GWCOMM[SERVER_GUILD_ID].barrack_id+1)); + local barrackspawnid = barrack:GetGUIDLow() -- use this to avoid ghost respawns + + barrack:Despawn(); + barrack:RemoveFromWorld(1); + + PreparedStatements(2, "gameobject", barrackspawnid) + PreparedStatements(1, "barrack_count", GWARZ[LocId].barrack_count-1, LocId) + + player:AddItem(GWCOMM[SERVER_GUILD_ID].currency, GWCOMM[SERVER_GUILD_ID].barrack_cost) + + player:SendBroadcastMessage(GWCOMM[PLAYER_GUILD_ID].color_15.."!Congratulations! Builder "..PLAYER_GUILD_NAME.." has sold a garrison. For "..GWCOMM[SERVER_GUILD_ID].barrack_cost.." "..Currencyname.."'s.|r"); + return false; + end + end + end + end + end + + if(ChatCache[2] == GWCOMM[PLAYER_GUILD_ID].hall)then + + if(PLAYER_GUILD_ID ~= GWARZ[LocId].guild_id)then + player:SendBroadcastMessage(GWCOMM[PLAYER_GUILD_ID].color_15.."Your guild does not own this land."); + return false; + else + + if(GWARZ[LocId].hall_count <= 0)then + player:SendBroadcastMessage(GWCOMM[PLAYER_GUILD_ID].color_15.."Your guild does not own a hall at this location."); + return false; + else + + if(((player:GetNearestGameObject(7, GWCOMM[SERVER_GUILD_ID].hall_id))or(player:GetNearestGameObject(7, GWCOMM[SERVER_GUILD_ID].hall_id+1))) == nil)then + player:SendBroadcastMessage(GWCOMM[PLAYER_GUILD_ID].color_15.."You must be near to your hall to sell it."); + return false; + else + + local hall = ((player:GetNearestGameObject(7, GWCOMM[SERVER_GUILD_ID].hall_id))or(player:GetNearestGameObject(7, GWCOMM[SERVER_GUILD_ID].hall_id+1))); + local hallspawnid = hall:GetGUIDLow(); -- use this to avoid ghost respawns + + hall:Despawn(); + hall:RemoveFromWorld(1); + + PreparedStatements(2, "gameobject", hallspawnid) + PreparedStatements(1, "hall_count", GWARZ[LocId].hall_count-1, LocId) + + player:AddItem(GWCOMM[SERVER_GUILD_ID].currency, GWCOMM[SERVER_GUILD_ID].hall_cost) + + player:SendBroadcastMessage(GWCOMM[PLAYER_GUILD_ID].color_14.."!Congratulations!"..PLAYER_GUILD_NAME.." has sold a Hall. For "..GWCOMM[SERVER_GUILD_ID].hall_cost.." "..Currencyname.."'s.|r"); + return false; + end + end + end + end + + if(ChatCache[2] == GWCOMM[PLAYER_GUILD_ID].pig)then + + if(PLAYER_GUILD_ID ~= GWARZ[LocId].guild_id)then + player:SendBroadcastMessage(GWCOMM[PLAYER_GUILD_ID].color_15.."Your guild does not own this land."); + return false; + else + if(GWARZ[LocId].pig_count == 0)then + player:SendBroadcastMessage(GWCOMM[PLAYER_GUILD_ID].color_15.."You DONT have any pigs in this area."); + return false; + else + if(player:GetSelection() == nil)then + player:SendBroadcastMessage(GWCOMM[PLAYER_GUILD_ID].color_15.."You must select a pig."); + return false; + else + + local Pnpc = player:GetSelection():GetEntry(); + local pig = GWCOMM[SERVER_GUILD_ID].pig_id; + + if not((Pnpc == pig)or(Pnpc == pig+1))then + player:SendBroadcastMessage(GWCOMM[PLAYER_GUILD_ID].color_15.."you must select a guild pig."); + return false; + else + + local pigspawnid = player:GetSelection():GetGUIDLow(); + + player:GetSelection():DespawnOrUnsummon(); + + PreparedStatements(2, "creature", pigspawnid); + PreparedStatements(1, "pig_count", GWARZ[LocId].pig_count-1, LocId); + + player:AddItem(GWCOMM[SERVER_GUILD_ID].currency, GWCOMM[SERVER_GUILD_ID].pig_cost); + + player:SendBroadcastMessage(GWCOMM[PLAYER_GUILD_ID].color_14.."Butcher "..pName.." sold 1 pig to the market.|r"); + return false; + end + end + end + end + end + + if(ChatCache[2] == GWCOMM[PLAYER_GUILD_ID].guard)then + + if(PLAYER_GUILD_ID ~= GWARZ[LocId].guild_id)then + player:SendBroadcastMessage(GWCOMM[PLAYER_GUILD_ID].color_15.."Your guild does not own this land."); + return false; + else + + if(GWARZ[LocId].guard_count == 0)then + player:SendBroadcastMessage(GWCOMM[PLAYER_GUILD_ID].color_15.."You DONT have any guards in this area."); + return false; + else + + if(player:GetSelection() == nil)then + player:SendBroadcastMessage(GWCOMM[PLAYER_GUILD_ID].color_15.."You must select a guard."); + return false; + else + + local Gnpc = player:GetSelection():GetEntry(); + local guard = GWCOMM[SERVER_GUILD_ID].guard_id; + + if not((Gnpc == guard)or(Gnpc == guard+1))then + player:SendBroadcastMessage(GWCOMM[PLAYER_GUILD_ID].color_15.."You must select a guild guard."); + return false; + else + + local guardspawnid = player:GetSelection():GetGUIDLow(); + player:GetSelection():SetPhaseMask(0); + player:GetSelection():DespawnOrUnsummon(); + + PreparedStatements(2, "creature", guardspawnid); + PreparedStatements(1, "guard_count", GWARZ[LocId].guard_count-1, LocId); + + player:SendBroadcastMessage(GWCOMM[PLAYER_GUILD_ID].color_14.."Guard removed.|r"); + return false; + end + end + end + end + end + + if(ChatCache[2] == GWCOMM[PLAYER_GUILD_ID].vendor1)then + + if(GWCOMM[SERVER_GUILD_ID].vendor1_id > 0)then + + if(PLAYER_GUILD_ID ~= GWARZ[LocId].guild_id)then + + player:SendBroadcastMessage(GWCOMM[PLAYER_GUILD_ID].color_15.."Your guild does not own this land."); + return false; + else + + if(GWARZ[LocId].vendor1_count == 0)then + player:SendBroadcastMessage(GWCOMM[PLAYER_GUILD_ID].color_15.."You DONT have any vendor1's in this area."); + return false; + else + + if(player:GetSelection() == nil)then + player:SendBroadcastMessage(GWCOMM[PLAYER_GUILD_ID].color_15.."You must select a Vendor1."); + return false; + else + + local Bnpc = player:GetSelection():GetEntry(); + local vendor1 = GWCOMM[SERVER_GUILD_ID].vendor1_id; + + if not((Bnpc == vendor1)or(Bnpc == vendor1+1))then + player:SendBroadcastMessage(GWCOMM[PLAYER_GUILD_ID].color_15.."You must select a Vendor1."); + return false; + else + + local vendorspawnid1 = player:GetSelection():GetGUIDLow(); + player:GetSelection():SetPhaseMask(0); + player:GetSelection():DespawnOrUnsummon(); + + PreparedStatements(2, "creature", vendorspawnid1); + PreparedStatements(1, "vendor1_count", GWARZ[LocId].vendor1_count-1, LocId); + + player:AddItem(GWCOMM[SERVER_GUILD_ID].currency, GWCOMM[SERVER_GUILD_ID].vendor1_cost); + + player:SendBroadcastMessage(GWCOMM[PLAYER_GUILD_ID].color_14.."Vendor1 sold.|r"); + return false; + end + end + end + end + else + player:SendBroadcastMessage("Vendor1 is NOT enabled..") + return false; + end + end + + if(ChatCache[2] == GWCOMM[PLAYER_GUILD_ID].vendor2)then + + if(GWCOMM[SERVER_GUILD_ID].vendor2_id > 0)then + + if(PLAYER_GUILD_ID ~= GWARZ[LocId].guild_id)then + player:SendBroadcastMessage(GWCOMM[PLAYER_GUILD_ID].color_15.."Your guild does not own this land."); + return false; + else + + if(GWARZ[LocId].vendor2_count == 0)then + player:SendBroadcastMessage(GWCOMM[PLAYER_GUILD_ID].color_15.."You DONT have any vendor2's in this area."); + return false; + else + + if(player:GetSelection() == nil)then + player:SendBroadcastMessage(GWCOMM[PLAYER_GUILD_ID].color_15.."You must select a Vendor2."); + return false; + else + + local Bnpc = player:GetSelection():GetEntry(); + local vendor2 = GWCOMM[SERVER_GUILD_ID].vendor2_id; + + if not((Bnpc == vendor2)or(Bnpc == vendor2+1))then + player:SendBroadcastMessage(GWCOMM[PLAYER_GUILD_ID].color_15.."You must select a Vendor2."); + return false; + else + + local vendorspawnid2 = player:GetSelection():GetGUIDLow(); + player:GetSelection():SetPhaseMask(0); + player:GetSelection():DespawnOrUnsummon(); + + PreparedStatements(2, "creature", vendorspawnid2); + PreparedStatements(1, "vendor2_count", GWARZ[LocId].vendor2_count-1, LocId); + + player:AddItem(GWCOMM[SERVER_GUILD_ID].currency, GWCOMM[SERVER_GUILD_ID].vendor2_cost); + + player:SendBroadcastMessage(GWCOMM[PLAYER_GUILD_ID].color_14.."Vendor2 sold.|r"); + return false; + end + end + end + end + else + player:SendBroadcastMessage("Vendor2 is NOT enabled..") + return false; + end + end + + if(ChatCache[2] == GWCOMM[PLAYER_GUILD_ID].vendor3)then + + if(GWCOMM[SERVER_GUILD_ID].vendor3_id > 0)then + + if(PLAYER_GUILD_ID ~= GWARZ[LocId].guild_id)then + player:SendBroadcastMessage(GWCOMM[PLAYER_GUILD_ID].color_15.."Your guild does not own this land."); + return false; + else + + if(GWARZ[LocId].vendor3_count == 0)then + player:SendBroadcastMessage(GWCOMM[PLAYER_GUILD_ID].color_15.."You DONT have any vendor3's in this area."); + return false; + else + + if(player:GetSelection() == nil)then + player:SendBroadcastMessage(GWCOMM[PLAYER_GUILD_ID].color_15.."You must select a Vendor3."); + return false; + else + + local Bnpc = player:GetSelection():GetEntry(); + local vendor3 = GWCOMM[SERVER_GUILD_ID].vendor3_id; + + if not((Bnpc == vendor3)or(Bnpc == vendor3+1))then + player:SendBroadcastMessage(GWCOMM[PLAYER_GUILD_ID].color_15.."You must select a Vendor3."); + return false; + else + + local vendorspawnid3 = player:GetSelection():GetGUIDLow(); + player:GetSelection():SetPhaseMask(0); + player:GetSelection():DespawnOrUnsummon(); + + PreparedStatements(2, "creature", vendorspawnid3); + PreparedStatements(1, "vendor3_count", GWARZ[LocId].vendor3_count-1, LocId); + + player:AddItem(GWCOMM[SERVER_GUILD_ID].currency, GWCOMM[SERVER_GUILD_ID].vendor3_cost); + + player:SendBroadcastMessage(GWCOMM[PLAYER_GUILD_ID].color_14.."Vendor3 sold.|r"); + return false; + end + end + end + end + else + player:SendBroadcastMessage("Vendor3 is NOT enabled..") + return false; + end + end + + if(ChatCache[2] == GWCOMM[PLAYER_GUILD_ID].cannon)then + + if(GWCOMM[SERVER_GUILD_ID].cannon_id > 0)then + + if(PLAYER_GUILD_ID ~= GWARZ[LocId].guild_id)then + player:SendBroadcastMessage(GWCOMM[PLAYER_GUILD_ID].color_15.."Your guild does not own this land."); + return false; + else + + if(GWARZ[LocId].cannon_count == 0)then + player:SendBroadcastMessage(GWCOMM[PLAYER_GUILD_ID].color_15.."You DONT have any cannon's in this area."); + return false; + else + + if(player:GetSelection() == nil)then + player:SendBroadcastMessage(GWCOMM[PLAYER_GUILD_ID].color_15.."You must select a cannon."); + return false; + else + + local Cnnn = player:GetSelection():GetEntry(); + local cannon = GWCOMM[SERVER_GUILD_ID].cannon_id; + + if not((Cnnn == cannon)or(Cnnn == cannon+1))then + player:SendBroadcastMessage(GWCOMM[PLAYER_GUILD_ID].color_15.."You must select a cannon."); + return false; + else + + local cCannon = player:GetSelection(); + local cannonspawnid = cCannon:GetGUIDLow(); + GGWC[cannonspawnid] = 1; + cCannon:DespawnOrUnsummon(); + + PreparedStatements(2, "creature", cannonspawnid); + PreparedStatements(1, "cannon_count", GWARZ[LocId].cannon_count-1, LocId); + + player:AddItem(GWCOMM[SERVER_GUILD_ID].currency, GWCOMM[SERVER_GUILD_ID].cannon_cost); + + player:SendBroadcastMessage(GWCOMM[PLAYER_GUILD_ID].color_14.."Cannon sold.|r"); + return false; + end + end + end + end + else + player:SendBroadcastMessage("Cannon's NOT enabled..") + return false; + end + end + + if(ChatCache[2] == GWCOMM[PLAYER_GUILD_ID].vault)then + + if(PLAYER_GUILD_ID ~= GWARZ[LocId].guild_id)then + player:SendBroadcastMessage(GWCOMM[PLAYER_GUILD_ID].color_15.."Your guild does not own this land."); + return false; + else + + if(GWARZ[LocId].vault_count <= 0)then + player:SendBroadcastMessage(GWCOMM[PLAYER_GUILD_ID].color_15.."Your guild does not own a vault at this location."); + return false; + else + + if(((player:GetNearestGameObject(2, GWCOMM[SERVER_GUILD_ID].vault_id))or(player:GetNearestGameObject(2, GWCOMM[SERVER_GUILD_ID].vault_id+1))) == nil)then + player:SendBroadcastMessage(GWCOMM[PLAYER_GUILD_ID].color_15.."You must be near to your vault to sell it."); + return false; + else + + local vault = ((player:GetNearestGameObject(2, GWCOMM[SERVER_GUILD_ID].vault_id))or(player:GetNearestGameObject(2, GWCOMM[SERVER_GUILD_ID].vault_id+1))); + local vaultspawnid = vault:GetGUIDLow(); -- use this to avoid ghost respawns + vault:Despawn(); + vault:RemoveFromWorld(); + + PreparedStatements(2, "gameobject", vaultspawnid); + PreparedStatements(1, "vault_count", GWARZ[LocId].vault_count-1, LocId); + + player:AddItem(GWCOMM[SERVER_GUILD_ID].currency, GWCOMM[SERVER_GUILD_ID].vault_cost); + + player:SendBroadcastMessage(GWCOMM[PLAYER_GUILD_ID].color_14.."!Congratulations!"..pName.." has sold a vault. For "..GWCOMM[SERVER_GUILD_ID].vault_cost.." "..Currencyname.."'s.|r"); + return false; + end + end + end + end + + if(ChatCache[2] == GWCOMM[PLAYER_GUILD_ID].mailbox)then + + if(PLAYER_GUILD_ID ~= GWARZ[LocId].guild_id)then + player:SendBroadcastMessage(GWCOMM[PLAYER_GUILD_ID].color_15.."Your guild does not own this land."); + return false; + else + + if(GWARZ[LocId].mailbox_count <= 0)then + player:SendBroadcastMessage(GWCOMM[PLAYER_GUILD_ID].color_15.."Your guild does not own a mailbox at this location."); + return false; + else + + if(((player:GetNearestGameObject(2, GWCOMM[SERVER_GUILD_ID].mailbox_id))or(player:GetNearestGameObject(2, GWCOMM[SERVER_GUILD_ID].mailbox_id+1))) == nil)then + player:SendBroadcastMessage(GWCOMM[PLAYER_GUILD_ID].color_15.."You must be near to your mailbox to sell it."); + return false; + else + + local mailbox = ((player:GetNearestGameObject(2, GWCOMM[SERVER_GUILD_ID].mailbox_id))or(player:GetNearestGameObject(2, GWCOMM[SERVER_GUILD_ID].mailbox_id+1))); + local mailboxspawnid = mailbox:GetGUIDLow(); -- use this to avoid ghost respawns + mailbox:Despawn(); + mailbox:RemoveFromWorld(); + + PreparedStatements(2, "gameobject", mailboxspawnid); + PreparedStatements(1, "mailbox_count", GWARZ[LocId].mailbox_count-1, LocId); + + player:AddItem(GWCOMM[SERVER_GUILD_ID].currency, GWCOMM[SERVER_GUILD_ID].mailbox_cost); + + player:SendBroadcastMessage(GWCOMM[PLAYER_GUILD_ID].color_14.."!Congratulations!"..pName.." has sold a mailbox. For "..GWCOMM[SERVER_GUILD_ID].vault_cost.." "..Currencyname.."'s.|r"); + return false; + end + end + end + end + + player:SendBroadcastMessage(GWCOMM[PLAYER_GUILD_ID].color_15.."CMD ERROR:|r "..ChatCache[1].." "..ChatCache[2]); + return false; + end + +-- **************************************************** +-- **************** Game Master Commands ************** +-- **************************************************** + + if(pGMRank >= GWCOMM[SERVER_GUILD_ID].GM_minimum)then + + if(ChatCache[1] == "lock")and(ChatCache[2] == GWCOMM[SERVER_GUILD_ID].loc)then + PreparedStatements(1, "guild_id", SERVER_GUILD_ID, LocId) + PreparedStatements(1, "guild_name", SERVER_GUILD_NAME, LocId) + PreparedStatements(1, "team", 3, LocId) + PreparedStatements(1, "flag_id", 0, LocId) + PreparedStatements(1, "fs_time", 0, LocId) + player:SendBroadcastMessage(GWCOMM[PLAYER_GUILD_ID].color_14.."Area: "..GWARZ[LocId].entry.." succesfully |r"..GWCOMM[PLAYER_GUILD_ID].color_7.."LOCKED|r."); + return false; + end +-- + if(ChatCache[1] == "reset")then + + if(ChatCache[2] == GWCOMM[SERVER_GUILD_ID].loc)then + PreparedStatements(1, "guild_id", SERVER_GUILD_ID, LocId) + PreparedStatements(1, "guild_name", SERVER_GUILD_NAME, LocId) + PreparedStatements(1, "team", 2, LocId) + PreparedStatements(1, "flag_id", 0, LocId) + PreparedStatements(1, "fs_time", 0, LocId) + player:SendBroadcastMessage(GWCOMM[PLAYER_GUILD_ID].color_14.."Area: "..GWARZ[LocId].entry.." succesfully reset.|r"); + return false; + end + + if(ChatCache[2] == GWCOMM[SERVER_GUILD_ID].farm)then + PreparedStatements(1, "farm_count", 0, LocId) + player:SendBroadcastMessage("|cff00cc00Area: "..GWARZ[LocId].entry.." farm count reset.|r"); + return false; + end + + if(ChatCache[2] == GWCOMM[SERVER_GUILD_ID].barrack)then + PreparedStatements(1, "barrack_count", 0, LocId) + player:SendBroadcastMessage("|cff00cc00Area: "..GWARZ[LocId].entry.." barrack count reset.|r"); + return false; + end + + if(ChatCache[2] == GWCOMM[SERVER_GUILD_ID].hall)then + PreparedStatements(1, "hall_count", 0, LocId) + player:SendBroadcastMessage("|cff00cc00Area: "..GWARZ[LocId].entry.." hall count reset.|r"); + return false; + end + + if(ChatCache[2] == GWCOMM[SERVER_GUILD_ID].pig)then + PreparedStatements(1, "pig_count", 0, LocId) + player:SendBroadcastMessage("|cff00cc00Area: "..GWARZ[LocId].entry.." pig count reset.|r"); + return false; + end + + if(ChatCache[2] == GWCOMM[SERVER_GUILD_ID].guard)then + PreparedStatements(1, "guard_count", 0, LocId) + player:SendBroadcastMessage("|cff00cc00Area: "..GWARZ[LocId].entry.." guard count reset.|r"); + return false; + end + + if(ChatCache[2] == GWCOMM[SERVER_GUILD_ID].vendor1)then + PreparedStatements(1, "vendor1_count", 0, LocId) + player:SendBroadcastMessage("|cff00cc00Area: "..GWARZ[LocId].entry.." vendor1 count reset.|r"); + return false; + end + + if(ChatCache[2] == GWCOMM[SERVER_GUILD_ID].vendor2)then + PreparedStatements(1, "vendor2_count", 0, LocId) + player:SendBroadcastMessage("|cff00cc00Area: "..GWARZ[LocId].entry.." vendor2 count reset.|r"); + return false; + end + + if(ChatCache[2] == GWCOMM[SERVER_GUILD_ID].vendor3)then + PreparedStatements(1, "vendor3_count", 0, LocId) + player:SendBroadcastMessage("|cff00cc00Area: "..GWARZ[LocId].entry.." vendor3 count reset.|r"); + return false; + end + + if(ChatCache[2] == GWCOMM[SERVER_GUILD_ID].cannon)then + PreparedStatements(1, "cannon_count", 0, LocId) + player:SendBroadcastMessage("|cff00cc00Area: "..GWARZ[LocId].entry.." cannon count reset.|r"); + return false; + end + + if(ChatCache[2] == GWCOMM[SERVER_GUILD_ID].vault)then + PreparedStatements(1, "vault_count", 0, LocId) + player:SendBroadcastMessage("|cff00cc00Area: "..GWARZ[LocId].entry.." vault count reset.|r"); + return false; + end + + if(ChatCache[2] == GWCOMM[SERVER_GUILD_ID].mailbox)then + PreparedStatements(1, "mailbox_count", 0, LocId) + player:SendBroadcastMessage("|cff00cc00Area: "..GWARZ[LocId].entry.." mailbox count reset.|r"); + return false; + end + + if(ChatCache[1] == "reset")then + player:SendBroadcastMessage(GWCOMM[PLAYER_GUILD_ID].color_15.."CMD ERROR:|r "..ChatCache[1].." "..ChatCache[2]); + return false; + end + end +-- + if(ChatCache[1] == "reload")then + + if(ChatCache[2] == GWCOMM[SERVER_GUILD_ID].table)then + GWtable = {}; + LoadGWtable(); + player:SendBroadcastMessage("|cff00cc00Grumbo\'z Guild Warz Tables Reloaded.|r"); + return false; + end + + player:SendBroadcastMessage(GWCOMM[PLAYER_GUILD_ID].color_15.."CMD ERROR:|r "..ChatCache[1].." "..ChatCache[2]); + return false; + end +-- + if(ChatCache[1]=="spawn")then + + if(ChatCache[2]=="flag")then + + if(GWARZ[LocId].team >= 2)then + player:SendBroadcastMessage("|cffFF0000The SERVER_GUILD_ID controls This Land. !! NO NEW FLAG SPAWNED !!|r"); + + else + local GMFlag = PerformIngameSpawn(2, (GWCOMM[SERVER_GUILD_ID].flag_id + GWARZ[LocId].team), (player:GetMapId()), player:GetInstanceId(), player:GetX(), player:GetY(), player:GetZ(), player:GetO(), true, 0, player:GetPhaseMaskForSpawn()); -- , true, 0, 1); + local GMFlagid = GMFlag:GetDBTableGUIDLow(); + + PreparedStatements(1, "flag_id", GMFlagid, LocId) + PreparedStatements(1, "fs_time", GetGameTime(), LocId) + + player:SendBroadcastMessage("|cff00cc00New flag spawned for Guild Warz location: "..GWARZ[LocId].entry.."|r"); + return false; + end + player:SendBroadcastMessage(GWCOMM[PLAYER_GUILD_ID].color_15.."CMD ERROR:|r "..ChatCache[1].." "..ChatCache[2]); + return false; + end + end +-- + if(ChatCache[1] == GWCOMM[SERVER_GUILD_ID].details_loc)then + player:SendBroadcastMessage(GWCOMM[PLAYER_GUILD_ID].color_9.."*************************************"); + player:SendBroadcastMessage(GWCOMM[PLAYER_GUILD_ID].color_8.."Location details:"); + player:SendBroadcastMessage(GWCOMM[PLAYER_GUILD_ID].color_1.."Location ID:|r "..GWCOMM[PLAYER_GUILD_ID].color_2..""..GWARZ[LocId].entry.."|r."); + + if(GWARZ[LocId].team==0)then player:SendBroadcastMessage(GWCOMM[PLAYER_GUILD_ID].color_1.."Guild Name|r: "..GWCOMM[PLAYER_GUILD_ID].color_4..""..GWARZ[LocId].guild_name.."|r.");end + if(GWARZ[LocId].team==1)then player:SendBroadcastMessage(GWCOMM[PLAYER_GUILD_ID].color_1.."Guild Name|r: "..GWCOMM[PLAYER_GUILD_ID].color_5..""..GWARZ[LocId].guild_name.."|r.");end + if(GWARZ[LocId].team==2)then player:SendBroadcastMessage(GWCOMM[PLAYER_GUILD_ID].color_1.."Guild Name|r: "..GWCOMM[PLAYER_GUILD_ID].color_6..""..GWARZ[LocId].guild_name.."|r.");end + if(GWARZ[LocId].team==3)then player:SendBroadcastMessage(GWCOMM[PLAYER_GUILD_ID].color_1.."Guild Name|r: "..GWCOMM[PLAYER_GUILD_ID].color_7..""..GWARZ[LocId].guild_name.."|r.");end + + if(GWARZ[LocId].team==0)then player:SendBroadcastMessage(GWCOMM[PLAYER_GUILD_ID].color_1.."Faction|r: "..GWCOMM[PLAYER_GUILD_ID].color_4.."Alliance.|r");end + if(GWARZ[LocId].team==1)then player:SendBroadcastMessage(GWCOMM[PLAYER_GUILD_ID].color_1.."Faction|r: "..GWCOMM[PLAYER_GUILD_ID].color_5.."Horde.|r");end + if(GWARZ[LocId].team==2)then player:SendBroadcastMessage(GWCOMM[PLAYER_GUILD_ID].color_1.."Faction|r: "..GWCOMM[PLAYER_GUILD_ID].color_6.."For Sale.|r");end + if(GWARZ[LocId].team==3)then player:SendBroadcastMessage(GWCOMM[PLAYER_GUILD_ID].color_1.."Faction|r: "..GWCOMM[PLAYER_GUILD_ID].color_7.."LOCKED|r");end + + player:SendBroadcastMessage(GWCOMM[PLAYER_GUILD_ID].color_1.."Team:|r "..GWCOMM[PLAYER_GUILD_ID].color_2..""..GWARZ[LocId].team.."|r."); + + player:SendBroadcastMessage(GWCOMM[PLAYER_GUILD_ID].color_1.."Farm count|r: "..GWCOMM[PLAYER_GUILD_ID].color_2..""..GWARZ[LocId].farm_count.."|r."); + player:SendBroadcastMessage(GWCOMM[PLAYER_GUILD_ID].color_1.."Barrack count|r: "..GWCOMM[PLAYER_GUILD_ID].color_2..""..GWARZ[LocId].barrack_count.."|r."); + player:SendBroadcastMessage(GWCOMM[PLAYER_GUILD_ID].color_1.."Hall count|r: "..GWCOMM[PLAYER_GUILD_ID].color_2..""..GWARZ[LocId].hall_count.."|r."); + player:SendBroadcastMessage(GWCOMM[PLAYER_GUILD_ID].color_1.."Pig count|r: "..GWCOMM[PLAYER_GUILD_ID].color_2..""..GWARZ[LocId].pig_count.."|r."); + player:SendBroadcastMessage(GWCOMM[PLAYER_GUILD_ID].color_1.."guard count|r: "..GWCOMM[PLAYER_GUILD_ID].color_2..""..GWARZ[LocId].guard_count.."|r."); + player:SendBroadcastMessage(GWCOMM[PLAYER_GUILD_ID].color_1.."cannon count|r: "..GWCOMM[PLAYER_GUILD_ID].color_2..""..GWARZ[LocId].cannon_count.."|r."); + + if(GWCOMM[SERVER_GUILD_ID].vendor1_id > 0)then player:SendBroadcastMessage(GWCOMM[PLAYER_GUILD_ID].color_1.."vendor1 count|r: "..GWCOMM[PLAYER_GUILD_ID].color_2..""..GWARZ[LocId].vendor1_count.."|r.");end + if(GWCOMM[SERVER_GUILD_ID].vendor2_id > 0)then player:SendBroadcastMessage(GWCOMM[PLAYER_GUILD_ID].color_1.."vendor2 count|r: "..GWCOMM[PLAYER_GUILD_ID].color_2..""..GWARZ[LocId].vendor2_count.."|r.");end + if(GWCOMM[SERVER_GUILD_ID].vendor3_id > 0)then player:SendBroadcastMessage(GWCOMM[PLAYER_GUILD_ID].color_1.."vendor3 count|r: "..GWCOMM[PLAYER_GUILD_ID].color_2..""..GWARZ[LocId].vendor3_count.."|r.");end + + player:SendBroadcastMessage(GWCOMM[PLAYER_GUILD_ID].color_1.."vault count|r: "..GWCOMM[PLAYER_GUILD_ID].color_2..""..GWARZ[LocId].vault_count.."|r."); + player:SendBroadcastMessage(GWCOMM[PLAYER_GUILD_ID].color_1.."mailbox count|r: "..GWCOMM[PLAYER_GUILD_ID].color_2..""..GWARZ[LocId].mailbox_count.."|r."); + player:SendBroadcastMessage(GWCOMM[PLAYER_GUILD_ID].color_1.."flag spawn id|r: "..GWCOMM[PLAYER_GUILD_ID].color_2..""..GWARZ[LocId].flag_id.."|r."); + player:SendBroadcastMessage(GWCOMM[PLAYER_GUILD_ID].color_1.."flag spawn time|r: "..GWCOMM[PLAYER_GUILD_ID].color_2..""..GWARZ[LocId].spawn_time.."|r."); + player:SendBroadcastMessage(GWCOMM[PLAYER_GUILD_ID].color_1.."Guild ID|r: "..GWCOMM[PLAYER_GUILD_ID].color_2..""..GWARZ[LocId].guild_id.."|r."); + player:SendBroadcastMessage(GWCOMM[PLAYER_GUILD_ID].color_1.."Game Time|r: "..GWCOMM[PLAYER_GUILD_ID].color_2..""..GetCurrTime().."|r."); + player:SendBroadcastMessage(GWCOMM[PLAYER_GUILD_ID].color_9.."*************************************"); + return false; + end + end + end +end + +RegisterPlayerEvent(21, GWcommands) + +print ("Guild Warz core version: "..core_version) + +-- **************************************************** +-- Pig Payz System -- Ty rochet2 of EmuDevs.com Vork is gonna luv this . +-- **************************************************** + +local function pig_payz(eventid, timer, cycles, player) + + if(player:IsInGuild() == true)then + + local pig = 0 + local Glocdb = WorldDBQuery("SELECT `entry` FROM "..guild_warz_DB..".zones WHERE `guild_name` = '"..player:GetGuildName().."' AND `pig_count` > '0';"); + + if(Glocdb==nil)then + player:SendBroadcastMessage("PigPayz: 0 gold.", 0); + player:SendBroadcastMessage(SERVER_PRE_MESSAGE.."Zorkster says:Your guild does not own any pigs.", 0); + player:SendBroadcastMessage(SERVER_PRE_MESSAGE.."Zorkster says:Inform Your guild master to start some farms.", 0); + else + repeat + local Gloc = Glocdb:GetUInt32(0) + local Pigcnt = GWARZ[Gloc].pig_count + pig = (pig+Pigcnt) + + until Glocdb:NextRow()~=true; + + Pigpayz = (GWCOMM[SERVER_GUILD_ID].pig_payz*pig); + player:ModifyMoney(Pigpayz); + player:SendBroadcastMessage(SERVER_PRE_MESSAGE.."DemiiGods says:|cff00cc00Your Guild\'s hard work pays off.|r"); + player:SendBroadcastMessage("|cff00cc00PigPayz: "..Pigpayz / '10000'.." gold.|r"); + end + return false; + else + player:SendBroadcastMessage(SERVER_PRE_MESSAGE.."Requin shouts:|cffff0000Join a guild to earn hourly rewards from Grumbo\'z Guild Warz.|r"); + end +end + +local function pig_payz_timer(eventid, player) + + player:RegisterEvent(pig_payz, GWCOMM[SERVER_GUILD_ID].pig_payz_timer, 0) + +end + +RegisterPlayerEvent(3, pig_payz_timer) + +print ("Pig Payz version: "..pigpayz_version); + +-- **************************************************** +-- ********** Guild Warz teleporter system ************ +-- ** a mild mutation of Grandelf1's guild teleporter * +-- **************************************************** + +function Guildteleport(event, player, message, type, language) + +local ChatMsg = GWCOMM[player:GetGuildId()].tele +local startpos, endpos = string.find(message, ChatMsg) + + if(startpos == 1) then + local text = message:gsub(ChatMsg, "") + + if(player:IsInGuild()==true)then + local Loc = tonumber(text) + + if(GWARZ[Loc]==nil)then + player:SendBroadcastMessage(SERVER_PRE_MESSAGE.."Grumbo says:|cffcc0000error.... teleport entry doesn't exsist.|r"); + + else + + if(GWARZ[Loc].guild_name == player:GetGuildName())or((player:IsGM())and(player:GetGMRank() >= GWCOMM[SERVER_GUILD_ID].GM_minimum))then + player:Teleport(GWARZ[Loc].map_id, GWARZ[Loc].x, GWARZ[Loc].y, GWARZ[Loc].z, 1.0) + + player:SendBroadcastMessage(SERVER_PRE_MESSAGE.."DeadByDawn says:|cff00cc00Teleport complete.|r"); + + else + player:SendBroadcastMessage(SERVER_PRE_MESSAGE.."Raider says:Your guild doesn't own that area."); + player:SendBroadcastMessage(SERVER_PRE_MESSAGE.."Raider says:You cannot teleport there."); + end + end + end + return false; + end +end + +RegisterPlayerEvent(21, Guildteleport) + +print("Teleporter version: "..tele_version); + +-- **************************************************** +-- *************** GUILD WARZ PvP System ************** +-- **************************************************** + +-- ************* Guild Warz Flag actions ************** + +function TransferFlag(player, locid, go) + +local locid = GetLocationId(player); +local gGuid = go:GetDBTableGUIDLow(); + + if(gGuid ~= GWARZ[locid].flag_id)then + + go:Despawn(); + go:RemoveFromWorld(1); + + player:SendBroadcastMessage(SERVER_PRE_MESSAGE..":|cffcc0000error.... Phantom flag removed.|r"); + PreparedStatements(2, "gameobject", gGuid) + + return false; + end + + if(player:IsInGuild()==false)then + + if(GWCOMM[GWARZ[locid].guild_name].guild_invite == 1)then + player:SendBroadcastMessage("|cff00cc00Grumbo\'z Guild Warz System:|r") + player:SendBroadcastMessage("|cff00cc00"..GWARZ[locid].guild_name.." own\'s this location "..player:GetName()..".|r"); + player:SendBroadcastMessage("|cff00cc00Join a Guild to participate in Grumbo\'z Guild Warz System.|r"); + player:SendBroadcastMessage("|cff00cc00Brought to you by Grumbo.|r"); + Gwarz_Guild_Flag_Hello(1, player, go) + return false; + else + player:SendBroadcastMessage("|cff00cc00Grumbo\'z Guild Warz System:|r"); + player:SendBroadcastMessage("|cff00cc00"..GWARZ[locid].guild_name.." own\'s this location "..player:GetName()..".|r"); + player:SendBroadcastMessage("|cff00cc00Join a Guild to participate in Grumbo\'z Guild Warz System.|r"); + player:SendBroadcastMessage("|cff00cc00Brought to you by Grumbo.|r"); + player:SendBroadcastMessage("|cff00cc00This Guild Master has disabled the guild\'s invite system.|r"); + return false; + end + end + + if((player:GetGuildName()==GWARZ[locid].guild_name)or((GWCOMM[SERVER_GUILD_ID].anarchy==0)and(player:GetTeam()==GWARZ[locid].team)))then + player:SendBroadcastMessage("|cff00cc00"..GWARZ[locid].guild_name.." own\'s this location.|r"); + player:SendBroadcastMessage("|cff00cc00Grumbo\'z Guild Warz System.|r"); + return false; + end + + if((player:GetTeam()~=GWARZ[locid].team)and(player:IsInGuild()==true))or((player:GetTeam()==GWARZ[locid].team)and(player:IsInGuild()==true)and(GWCOMM[SERVER_GUILD_ID].anarchy==1))then + + if((GWARZ[locid].spawn_time+GWCOMM[SERVER_GUILD_ID].spawn_timer > GetGameTime())and(GWCOMM[SERVER_GUILD_ID].flag_timer==1))then + player:SendBroadcastMessage(SERVER_PRE_MESSAGE.."|cffff0000!!..Cooldown Timer in Affect..!!|r"); + else + + if(GWARZ[locid].guard_count~=0)and(GWCOMM[SERVER_GUILD_ID].flag_require==1)then -- this lil check added to make it tougher to take the land. idea by renatokeys + player:SendBroadcastMessage(SERVER_PRE_MESSAGE.."!!..You must clear ALL guards..!!"); + else + if( player:GetNearestGameObject(2, (GWCOMM[SERVER_GUILD_ID].flag_id+GWARZ[locid].team)))then + + if(((GWARZ[locid].guard_count==0)and(GWCOMM[SERVER_GUILD_ID].flag_require==1))or(GWCOMM[SERVER_GUILD_ID].flag_require==0))then + + player:GetNearestGameObject(2, (GWCOMM[SERVER_GUILD_ID].flag_id+GWARZ[locid].team)):Despawn(); + Nflag = (PerformIngameSpawn(2, (GWCOMM[SERVER_GUILD_ID].flag_id)+(player:GetTeam()), player:GetMapId(), 0, player:GetX(), player:GetY(), player:GetZ(), player:GetO(), 1, 0, 1):GetGUIDLow()); + + PreparedStatements(2, "gameobject", go:GetGUIDLow()); + PreparedStatements(1, "guild_name", player:GetGuildName(), locid); + PreparedStatements(1, "team", player:GetTeam(), locid); + PreparedStatements(1, "x", player:GetX(), locid); + PreparedStatements(1, "y", player:GetY(), locid); + PreparedStatements(1, "z", player:GetZ(), locid); + PreparedStatements(1, "flag_id", Nflag, locid); + PreparedStatements(1, "flag_id", Nflag, locid); + PreparedStatements(1, "fs_time", GetGameTime(), locid); + PreparedStatements(1, "guild_id", player:GetGuildId(), locid); + + SendWorldMessage(SERVER_PRE_MESSAGE.."|cffff0000!! "..player:GetGuildName().." takes location:"..GWARZ[locid].entry.." from "..GWARZ[locid].guild_name.." !!|r", 1); + end + end + end + end + end + return false; +end + +function Tagflag(event, player, go) + if(player ~= nil)then + local LocId = GetLocationId(player) + TransferFlag(player, LocId, go) + end +end + +RegisterGameObjectGossipEvent(GWCOMM[SERVER_GUILD_ID].flag_id, 1, Tagflag) +RegisterGameObjectGossipEvent(GWCOMM[SERVER_GUILD_ID].flag_id+1, 1, Tagflag) + +-- *********** Guild Invite Flag Action *********** + +function Gwarz_Guild_Flag_Hello(eventid, player, object) + local locid = GetLocationId(player) + player:GossipClearMenu() + player:GossipMenuAddItem(1,"Join "..GWARZ[locid].guild_name..".",0,10) + player:GossipMenuAddItem(1,"Nevermind.",0,11) + player:GossipSendMenu(1, object) +end + +function Gwarz_Guild_Flag_Select(eventid, player, object, sender, intid, code) +local locid = GetLocationId(player) + if (intid == 10) then + GetGuildByName(GWARZ[locid].guild_name):AddMember(player, 255) -- attempts to add the new member at lowest(255) guild level. + end + if (intid == 11) then + end +player:GossipComplete() +end + +RegisterGameObjectGossipEvent(GWCOMM[SERVER_GUILD_ID].flag_id, 2, Gwarz_Guild_Flag_Select) +RegisterGameObjectGossipEvent(GWCOMM[SERVER_GUILD_ID].flag_id+1, 2, Gwarz_Guild_Flag_Select) + +-- *********** Guild Guard combat actions ************* +-- these are just basic scripts for the guards. if some one can script a good guard script with the idea in mind to have them guard the flag. I would love to add it. + +local function FactionReset(event, timer, cycle, player) + +local LocId = GetLocationId(player); +local guild = player:GetGuildName(); +local acctid = player:GetAccountId(); + + if(LocId == nil)then + LocId = CreateLocation(player:GetMapId(), player:GetAreaId(), player:GetZoneId()) + end + + if(faction_reset)then player:RemoveEventById(faction_reset);end + + if((guild ~= GWARZ[LocId].guild_name)and(GWARZ[LocId].team < 2))then + + local faction_reset = player:RegisterEvent(FactionReset, 10000, 1) + else + + player:SetFFA(0) + player:SetPvP(0) + player:SetFaction(GGW[acctid].faction) + end +end + +local function Watcher(eventid, creature, player) + +local LocId = GetLocationId(player); + + if(player:GetObjectType()=="Player")then + + local Pteam = GGW[player:GetAccountId()].team; + local LocId = GetLocationId(player); + + if(LocId == nil)then + LocId = CreateLocation(player:GetMapId(), player:GetAreaId(), player:GetZoneId()) + end + + if(player:IsInGuild()==true)then + + local guildname = player:GetGuildName(); + + if(guildname ~= GWARZ[LocId].guild_name)then + + if(Pteam == GWARZ[LocId].team)then + + creature:SetFaction(84-Pteam); -- 84 A + else + creature:SetFaction(83+Pteam); -- 83 H + end + else + creature:SetFaction(84+Pteam); + end + + if((Pteam~=GWARZ[LocId].team)and(guildname~=GWARZ[LocId].guild_name))or((GWCOMM[SERVER_GUILD_ID].anarchy==1)and(Pteam==GWARZ[LocId].team)and(guildname~=GWARZ[LocId].guild_name))then + + player:SetFFA(1) + player:SetPvP(1) + + if(GWARZ[LocId].team < 2)then + + if(creature:IsWithinDistInMap(player, 50))then + + if(GWARZ[LocId].team==0)then + + player:SetFaction(85) + local faction_reset = player:RegisterEvent(FactionReset, 10000, 1) + else + + player:SetFaction(84) + local faction_reset = player:RegisterEvent(FactionReset, 10000, 1) + end + end + else + end + end + else + end + else + end +end + +RegisterCreatureEvent(GWCOMM[SERVER_GUILD_ID].pig_id, 27, Watcher) +RegisterCreatureEvent(GWCOMM[SERVER_GUILD_ID].pig_id+1, 27, Watcher) + +if(GWCOMM[SERVER_GUILD_ID].cannon_id > 0)then + RegisterCreatureEvent(GWCOMM[SERVER_GUILD_ID].cannon_id, 27, Watcher) + RegisterCreatureEvent(GWCOMM[SERVER_GUILD_ID].cannon_id+1, 27, Watcher) +end + +local function Cannondied(eventid, creature, player) + + local LocId = GetLocationId(creature) + + GGWC[creature:GetGUIDLow()] = 1; + creature:DespawnOrUnsummon(); + PreparedStatements(2, "creature", creature:GetGUIDLow()) + PreparedStatements(1, "cannon_count", GWARZ[LocId].cannon_count-1, LocId) +end + +RegisterCreatureEvent(GWCOMM[SERVER_GUILD_ID].cannon_id, 4, Cannondied) +RegisterCreatureEvent(GWCOMM[SERVER_GUILD_ID].cannon_id+1, 4, Cannondied) + +function Guardffa(eventid, creature, player) + + if(player:GetObjectType()=="Player")then + + local Pteam = GGW[player:GetAccountId()].team + local LocId = GetLocationId(player) + + if(LocId == nil)then + LocId = CreateLocation(player:GetMapId(), player:GetAreaId(), player:GetZoneId()) + end + + if(player:IsInGuild()==true)then + + if((Pteam~=GWARZ[LocId].team)and(player:GetGuildName()~=GWARZ[LocId].guild_name))or((GWCOMM[SERVER_GUILD_ID].anarchy==1)and(Pteam==GWARZ[LocId].team)and(player:GetGuildName()~=GWARZ[LocId].guild_name))then + + if(GWARZ[LocId].team < 2)then + + if(creature:IsWithinDistInMap(player, 40))then + + if(GWARZ[LocId].team==0)then -- ally faction 84 team 0 :: horde faction 83 team 1 + player:SetFaction(2) -- 83 + local faction_reset = player:RegisterEvent(FactionReset, 10000, 1) + creature:AttackStart(player) + else + player:SetFaction(1) -- 84 + local faction_reset = player:RegisterEvent(FactionReset, 10000, 1) + creature:AttackStart(player) + end + end + else + end + else + end + else + end + else + end +end + +RegisterCreatureEvent(GWCOMM[SERVER_GUILD_ID].guard_id, 27, Guardffa) +RegisterCreatureEvent(GWCOMM[SERVER_GUILD_ID].guard_id+1, 27, Guardffa) + +function Guardcombat(eventid, creature, player) + + if(player:GetObjectType()=="Player")then + + local LocId = GetLocationId(creature) + + if(LocId == nil)then + LocId = CreateLocation(creature:GetMapId(), creature:GetAreaId(), creature:GetZoneId()) + end + + for _, v in ipairs(GetPlayersInWorld()) do + + if(v and v:GetGuildName()==GWARZ[LocId].guild_name) then + v:SendBroadcastMessage("|cffff0000!!LOCATION "..GWARZ[LocId].entry.." IS UNDER ATTACK!!|r"); + end + end + end +end + +RegisterCreatureEvent(GWCOMM[SERVER_GUILD_ID].guard_id, 1, Guardcombat) +RegisterCreatureEvent(GWCOMM[SERVER_GUILD_ID].guard_id+1, 1, Guardcombat) + +function Guarddied(eventid, creature, player) + + local LocId = GetLocationId(creature) + + PreparedStatements(2, "creature", creature:GetGUIDLow()) + PreparedStatements(1, "guard_count", GWARZ[LocId].guard_count-1, LocId) + + local Drop = (math.random(1, 4)) + + for _, v in ipairs(GetPlayersInWorld()) do + + if(v and v:GetGuildName()==GWARZ[LocId].guild_name) then + v:SendBroadcastMessage("|cffcc0000!! I HAVE FAILED AT DEFENDING LOCATION "..LocId.." !!|r"); + end + end + + if(Drop==4)then + player:AddItem(Guard_Died_Drop, math.random(1, 4)) + end + + creature:DespawnOrUnsummon() +end + +RegisterCreatureEvent(GWCOMM[SERVER_GUILD_ID].guard_id, 4, Guarddied) +RegisterCreatureEvent(GWCOMM[SERVER_GUILD_ID].guard_id+1, 4, Guarddied) + +function Guardhit(eventid, creature, attacker, damage) + + if(attacker:GetObjectType()=="Player")then + + local LocId = GetLocationId(creature) + + if(LocId == nil)then + LocId = CreateLocation(creature:GetMapId(), creature:GetAreaId(), creature:GetZoneId()) + end + + if(attacker:GetObjectType()=="Player")then + local a = (math.random(1, 4)) + + if(a==4)then + + for _, v in ipairs(GetPlayersInWorld()) do + + if(v and v:GetGuildName()==GWARZ[LocId].guild_name) then + v:SendBroadcastMessage("|cffff0000!!HURRY!! I NEED ASSISTANCE AT LOCATION "..LocId.."...!!HURRY!!|r"); + end + end + end + end + end +end + +RegisterCreatureEvent(GWCOMM[SERVER_GUILD_ID].guard_id, 9, Guardhit) +RegisterCreatureEvent(GWCOMM[SERVER_GUILD_ID].guard_id+1, 9, Guardhit) + +function Guardkill(eventid, creature, victim) + + local LocId = GetLocationId(creature) + + for _, v in ipairs(GetPlayersInWorld()) do + + if(v and v:GetGuildName()==GWARZ[LocId].guild_name) then + + v:SendBroadcastMessage("|cff00cc00!! I HAVE KILLED A "..victim:GetObjectType().." INTRUDEING AT LOCATION "..GWARZ[LocId].entry.." !!|r"); + v:SendBroadcastMessage("|cff00cc00I found some gold on him.|r"); + v:ModifyMoney(math.random(100000, 1000000)) + end + end +end + +RegisterCreatureEvent(GWCOMM[SERVER_GUILD_ID].guard_id, 3, Guardkill) +RegisterCreatureEvent(GWCOMM[SERVER_GUILD_ID].guard_id+1, 3, Guardkill) + +print ("PVP core: "..pvp_version) + +-- **************************************************** +-- NPC Vendor functions +-- **************************************************** + +if(vendor1 == 1)then + + local function vendor1_menu(event, player, creature) + + local LocId = GetLocationId(creature) + + if(GWARZ[LocId].guild_name ~= player:GetGuildName())then + creature:SendUnitYell("!!Evil do`r!!", 0) + else + + player:GossipClearMenu() + + for menu=1,#Vendor1 do + + player:GossipMenuAddItem(0, Vendor1[menu][2], 0, menu); + end + player:GossipSendMenu(1, creature) + end + end + + local function vendor1_Select(event, player, creature, sender, intid, code) + + local LocId = GetLocationId(creature) + + if(GWARZ[LocId].guild_name ~= player:GetGuildName())then + creature:SendUnitYell("!!Evil do`r!!", 0) + else + + if(intid <= (#Vendor1-1))then + + player:AddAura(Vendor1[intid][1], player); + vendor1_menu(1, player, creature); + else + player:GossipComplete(); -- last intid should be for `goodbye` + end + end + end + + RegisterCreatureGossipEvent(GWCOMM[SERVER_GUILD_ID].vendor1_id, 1, vendor1_menu); + RegisterCreatureGossipEvent(GWCOMM[SERVER_GUILD_ID].vendor1_id+1, 1, vendor1_menu); + RegisterCreatureGossipEvent(GWCOMM[SERVER_GUILD_ID].vendor1_id, 2, vendor1_Select); + RegisterCreatureGossipEvent(GWCOMM[SERVER_GUILD_ID].vendor1_id+1, 2, vendor1_Select); + print("buff vendor1 loaded."); +else + print("vendor 1 disabled.") +end + +if(vendor2 == 1)and(GWCOMM[SERVER_GUILD_ID].vendor2_id > 0)then + + local function vendor2_menu(event, player, creature) + + local LocId = GetLocationId(creature) + local npc2id = creature:GetEntry(); + + VendorRemoveAllItems(npc2id); + + if(GWARZ[LocId].guild_id ~= player:GetGuildId())then + creature:SendUnitYell("!!Evil do`r!!", 0); + else + + for item2=1,#Vendor2 do + AddVendorItem(npc2id, Vendor2[item2][1], 1, 1, Vendor2[item2][2]); + end + player:SendListInventory(creature); + end + end + + RegisterCreatureGossipEvent(GWCOMM[SERVER_GUILD_ID].vendor2_id, 1,vendor2_menu) + RegisterCreatureGossipEvent(GWCOMM[SERVER_GUILD_ID].vendor2_id+1, 1,vendor2_menu) + print("fun vendor2 loaded.") +else + print("vendor2 disabled.") +end + +if(vendor3 == 1)and(GWCOMM[SERVER_GUILD_ID].vendor3_id > 0)then + + local function vendor3_menu(event, player, creature) + + local LocId = GetLocationId(creature) + local npc3id = creature:GetEntry(); + + VendorRemoveAllItems(npc3id) + + if(GWARZ[LocId].guild_name ~= player:GetGuildName())then + creature:SendUnitYell("!!Evil do`r!!", 0) + else + + for item3=1,#Vendor3 do + AddVendorItem(npc3id, Vendor3[item3][1], 1, 1, Vendor3[item3][2]); + end + player:SendListInventory(creature) + end + end + + RegisterCreatureGossipEvent(GWCOMM[SERVER_GUILD_ID].vendor3_id, 1, vendor3_menu) + RegisterCreatureGossipEvent(GWCOMM[SERVER_GUILD_ID].vendor3_id+1, 1, vendor3_menu) + print("misc vendor3 loaded."); +else + print("vendor3 disabled."); +end + +print ("Vendor core: "..vendor_version); + +-- **************************************************** +-- ******************** End OF Line ******************* +-- **************************************************** + +print ("GUILD WARZ ver: "..GW_version.." Loaded."); +local duration = (string.format("Load Time: %0.03f seconds.", os.clock() - start)); +print(duration); +print("-----------------------------------\n"); \ No newline at end of file diff --git a/PvP/PvPExp2.lua b/PvP/PvPExp2.lua new file mode 100644 index 0000000..f3e21df --- /dev/null +++ b/PvP/PvPExp2.lua @@ -0,0 +1,83 @@ +--[[ + ToDO: +1. Reduce decimal places on timer + + + + + +]]-- + +local function KillReset(event, delay, repeats, pKiller) + CharDBExecute("DELETE FROM character_kill_count WHERE killerguid = "..killerguid.." AND victimguid = "..victimguid) +end + +local function PvPExp(event, pKiller, pKilled) + --EXP Formula + local exp1 = pKiller:GetLevel() + local exp2 = pKilled:GetLevel() + local mod = exp1 - exp2 + local ExpBase = (exp2 * 5 + 45) * (1 + 0.05 * mod) * PvPExpRate + --Kill Table stuff + local killerguid = pKiller:GetGUIDLow() + local victimguid = pKilled:GetGUIDLow() + local check = CharDBQuery("SELECT victimguid FROM character_kill_count WHERE killerguid = "..killerguid) + local cap = 5 -- set cap + if(pKiller ~= pKilled) then + if(check == nil) then -- if player has not killed anyone yet: + print("Player has no kill data") + CharDBExecute("INSERT INTO character_kill_count(killerguid, victimguid, count) VALUES("..killerguid..","..victimguid..",1)") + if (exp2 >= exp1 - 10 and exp2 <= exp1 + 10) then + -- check for group and if group above max party count (so raid) + local group = pKiller:GetGroup() + if (group ~= nil) then + local groupmem = group:GetMembersCount() + if (groupmem <= 5) then + local partymember = group:GetMembers() + for x=1,#partymember,1 do + partymember[x]:GiveXP(ExpBase / groupmem) + end + end + else + pKiller:GiveXP(ExpBase) + end + end + else + local kills = CharDBQuery("SELECT count FROM character_kill_count WHERE killerguid = "..killerguid.." AND victimguid = "..victimguid):GetInt32(0) + local AddKill = kills + 1 + if(pKiller:GetMap():GetMapId() == 0 or pKiller:GetMap():GetMapId() == 1) then + if (kills < cap) then + if (exp2 >= exp1 - 10 and exp2 <= exp1 + 10) then + -- check for group and if group above max party count (so raid) + local group = pKiller:GetGroup() + if (group ~= nil) then + local groupmem = group:GetMembersCount() + if (groupmem <= 5) then + local partymember = group:GetMembers() + for x=1,#partymember,1 do + partymember[x]:GiveXP(ExpBase / groupmem) + end + end + else + pKiller:GiveXP(ExpBase) + CharDBQuery("UPDATE character_kill_count SET count = "..AddKill.." WHERE killerguid = "..killerguid.." AND victimguid = "..victimguid) + end + end + elseif (kills >= cap) then + CharDBQuery("UPDATE character_kill_count SET count = "..AddKill.." WHERE killerguid = "..killerguid.." AND victimguid = "..victimguid) + if(pKiller:GetLuaCooldown() == 0) then -- Check if cooldown is present + pKiller:SetLuaCooldown(86400) -- Set cooldown in seconds for kills. Default: 24hrs = 86400 + local timer = math.floor( pKiller:GetLuaCooldown() / 3600 ) + pKiller:SendBroadcastMessage("You have killed this player to many times and will no longer receive exp from this player for "..timer.." hours.") + pKiller:RegisterEvent(KillReset, 86400000, 1) + else + local timer = math.floor( pKiller:GetLuaCooldown() / 3600 ) + pKiller:SendBroadcastMessage("You have killed this player to many times and will no longer receive exp from this player for "..timer.." hours.") + end + end + end + end + end +end + +RegisterPlayerEvent(6, PvPExp) \ No newline at end of file diff --git a/README.md b/README.md new file mode 100644 index 0000000..032cb06 --- /dev/null +++ b/README.md @@ -0,0 +1,10 @@ +Awakening +======== +All of the eluna server code is in this repo! + +***Added - Contents*** +This is the entirety of the LUA scripts used on the World of Warcraft private server, Ascension. The term Awakening is the predecessor of Ascension. The last date of this repository is June 4th, 2017. + +None of these commits were edited. + +Ascension is currently using Eluna, and AIO, two products which are listed under the GPL 2.0 License, also known as the GENERAL PUBLIC USE LICENSE, which explicitly restricts Ascension from monetizing or privatizing their content. diff --git a/SafeSlots/SafeSlotsClient.lua b/SafeSlots/SafeSlotsClient.lua new file mode 100644 index 0000000..bcc4996 --- /dev/null +++ b/SafeSlots/SafeSlotsClient.lua @@ -0,0 +1,372 @@ +local AIO = AIO or require("AIO") + + +if AIO.AddAddon() then + return +end + + +local SlotIsuranceClient = AIO.AddHandlers("SlotIsurance", {}) + +local Slots = { + [1] = {"Head", "SafeSlot1", false}, + [2] = {"Neck", "SafeSlot2", false}, + [3] = {"Shoulder", "SafeSlot3", false}, + [4] = {"Body", "SafeSlot6", false}, + [5] = {"Chest", "SafeSlot5", false}, + [6] = {"Waist", "SafeSlot10", false}, + [7] = {"Legs", "SafeSlot11", false}, + [8] = {"Feet", "SafeSlot12", false}, + [9] = {"Wrist", "SafeSlot8", false}, + [10] = {"Hand", "SafeSlot9", false}, + [11] = {"Finger", "SafeSlot13", false}, + [12] = {"Finger", "SafeSlot14", false}, + [13] = {"Trinket", "SafeSlot15", false}, + [14] = {"Trinket", "SafeSlot16", false}, + [15] = {"Back", "SafeSlot4", false}, + [16] = {"Main Hand", "SafeSlot17", false}, + [17] = {"Off Hand", "SafeSlot18", false}, + [18] = {"Ranged", "SafeSlot19", false}, + [19] = {"Tabard", "SafeSlot7", false}, +} +--name, button, is slot currently activated +local InsureCurrency = 98461 +local SafeCostModifier = 3540 +local function SafeSlotGetLostCost(itemlink) + local cost = nil + local _, _, _, iLevel = GetItemInfo(itemlink) + cost = iLevel * SafeCostModifier + return cost +end + + --MAIN FRAME +local SafeSlots_Main = CreateFrame("FRAME", "SafeSlots_Main", UIParent,nil) +SafeSlots_Main:SetSize(512,512) +SafeSlots_Main:SetPoint("CENTER") + +SafeSlots_Main:SetMovable(true) +SafeSlots_Main:EnableMouse(true) +SafeSlots_Main:RegisterForDrag("LeftButton") +SafeSlots_Main:SetClampedToScreen(true) +SafeSlots_Main:SetScript("OnDragStart", SafeSlots_Main.StartMoving) +SafeSlots_Main:SetScript("OnDragStop", SafeSlots_Main.StopMovingOrSizing) +SafeSlots_Main:SetFrameStrata("HIGH") + +SafeSlots_Main:SetBackdrop({ + bgFile = "Interface\\AddOns\\AwAddons\\Textures\\SafeSlots\\SafeSlots", + --insets = { left = -256, right = -256, top = -5, bottom = -5} +}) + +local SafeSlots_Main_CloseButton = CreateFrame("Button", "SafeSlots_Main_CloseButton", SafeSlots_Main, "UIPanelCloseButton") +SafeSlots_Main_CloseButton:SetPoint("TOPRIGHT", -82, -45) +SafeSlots_Main_CloseButton:EnableMouse(true) +--SafeSlots_Main_CloseButton:SetSize(29, 29) +SafeSlots_Main_CloseButton:SetScript("OnMouseUp", function() + PlaySound("TalentScreenOpen") + SafeSlots_Main:Hide() + end) +local SafeSlots_Main_TitleText = SafeSlots_Main:CreateFontString("SafeSlots_Main_TitleText") +SafeSlots_Main_TitleText:SetFont("Fonts\\FRIZQT__.TTF", 11) +SafeSlots_Main_TitleText:SetFontObject(GameFontNormal) +SafeSlots_Main_TitleText:SetPoint("TOP", 0, -55) +SafeSlots_Main_TitleText:SetShadowOffset(1,-1) +SafeSlots_Main_TitleText:SetText("Fel Commutation") + +SafeSlots_Main:Hide() + --END OF MAIN FRAME + + --MAIN FRAME SCRIPTS-- + + --END OF MAIN FRAME SCRIPTS-- + + --SLOT BUTTONS-- +--loading same settings for all of the slot buttons +for i = 1, 16 do +_G["SafeSlot"..i] = CreateFrame("Button", "SafeSlot"..i, SafeSlots_Main, nil) +_G["SafeSlot"..i]:SetNormalTexture("Interface\\AddOns\\AwAddons\\Textures\\SafeSlots\\SlotBorder") +_G["SafeSlot"..i]:SetHighlightTexture("Interface\\AddOns\\AwAddons\\Textures\\SafeSlots\\SlotBorder_H") +_G["SafeSlot"..i]:SetSize(54,54) +end +for i = 17, 19 do +_G["SafeSlot"..i] = CreateFrame("Button", "SafeSlot"..i, SafeSlots_Main, nil) +_G["SafeSlot"..i]:SetNormalTexture("Interface\\AddOns\\AwAddons\\Textures\\SafeSlots\\SlotBorder") +_G["SafeSlot"..i]:SetHighlightTexture("Interface\\AddOns\\AwAddons\\Textures\\SafeSlots\\SlotBorder_H") +_G["SafeSlot"..i]:SetSize(60,60) +end +--additional button textures +for i = 1, 19 do +_G["SafeSlot"..i.."_GlowTex"] = _G["SafeSlot"..i]:CreateTexture("SafeSlot"..i.."_GlowTex", "OVERLAY") +_G["SafeSlot"..i.."_GlowTex"]:SetTexture("Interface\\AddOns\\AwAddons\\Textures\\SafeSlots\\SlotBorder_active") +_G["SafeSlot"..i.."_GlowTex"]:SetSize(_G["SafeSlot"..i]:GetSize()) +_G["SafeSlot"..i.."_GlowTex"]:SetPoint("CENTER") +_G["SafeSlot"..i.."_GlowTex"]:SetBlendMode("ADD") +_G["SafeSlot"..i.."_GlowTex"]:Hide() +end +--setting up each button properly +SafeSlot1:SetPoint("CENTER", -100, 144) +SafeSlot2:SetPoint("CENTER", -121, 106) +SafeSlot3:SetPoint("CENTER", -134, 64) +SafeSlot4:SetPoint("CENTER", -140, 22) +SafeSlot5:SetPoint("CENTER", -140, -22) +SafeSlot6:SetPoint("CENTER", -134, -64) +SafeSlot7:SetPoint("CENTER", -121, -106) +SafeSlot8:SetPoint("CENTER", -100, -144) + +SafeSlot9:SetPoint("CENTER", 103, 144) +SafeSlot10:SetPoint("CENTER", 124, 106) +SafeSlot11:SetPoint("CENTER", 137, 64) +SafeSlot12:SetPoint("CENTER", 143, 22) +SafeSlot13:SetPoint("CENTER", 143, -22) +SafeSlot14:SetPoint("CENTER", 137, -64) +SafeSlot15:SetPoint("CENTER", 124, -106) +SafeSlot16:SetPoint("CENTER", 103, -144) + +SafeSlot17:SetPoint("CENTER", -43, -161) +SafeSlot18:SetPoint("CENTER", 3, -161) +SafeSlot19:SetPoint("CENTER", 46, -161) + --END OF SLOT BUTTONS + + --SLOT BUTTONS SCRIPTS-- +for i = 1, 19 do + _G["SafeSlot"..i]:SetScript("OnClick", function(self) -- main action + if not(SafeSlots_Main_Confirm:IsVisible()) then + SafeSlots_Main_Confirm:Show() + SafeSlots_Main_Confirm_ItemIcon.slot = self.slot + elseif (SafeSlots_Main_Confirm_ItemIcon.slot) and SafeSlots_Main_Confirm_ItemIcon.slot == self.slot then + SafeSlots_Main_Confirm:Hide() + else + SafeSlots_Main_Confirm_ItemIcon.slot = self.slot + end + end) + + + _G["SafeSlot"..i]:SetScript("OnEnter", function(self) -- default tooltip text + GameTooltip:SetOwner(self, "ANCHOR_RIGHT") + GameTooltip:SetText("|cffFFFFFF"..Slots[self.slot][1]) + if not(Slots[self.slot][3]) then + GameTooltip:AddLine("Click on this slot to insure it") + end + GameTooltip:Show() + end) + + _G["SafeSlot"..i]:SetScript("OnLeave", function(self) -- onleave script + GameTooltip:Hide() + end) +end + --END OF SLOT BUTTONS SCRIPTS-- + + --MODEL OF CHARACTER-- +local SafeSlots_Main_PlayerModel = CreateFrame("PlayerModel", "SafeSlots_Main_PlayerModel", SafeSlots_Main) +SafeSlots_Main_PlayerModel:SetWidth(192); +SafeSlots_Main_PlayerModel:SetHeight(256); +SafeSlots_Main_PlayerModel:SetPoint("CENTER", 0, -22) +SafeSlots_Main_PlayerModel:SetUnit("player") +SafeSlots_Main_PlayerModel:SetModelScale(1) +SafeSlots_Main_PlayerModel:SetPosition(0.0,0.0,0) +SafeSlots_Main_PlayerModel:SetCamera(1) + --END OF THE MODEL OF CHARACTER-- + + --MODEL OF CHARACTER SCRIPTS-- +SafeSlots_Main_PlayerModel:RegisterEvent("UNIT_MODEL_CHANGED") +SafeSlots_Main_PlayerModel:SetScript("OnEvent", function(self,event,arg) + if arg == "player" then + self:RefreshUnit() + end + end) + --END OF MODEL OF CHARACTER SCRIPTS-- + + --Confirm Frame-- +SafeSlots_Main_Confirm = CreateFrame("FRAME", "SafeSlots_Main_Confirm", SafeSlots_Main,nil) +SafeSlots_Main_Confirm:SetSize(512,512) +SafeSlots_Main_Confirm:SetPoint("CENTER") +SafeSlots_Main_Confirm:SetBackdrop({ + bgFile = "Interface\\AddOns\\AwAddons\\Textures\\SafeSlots\\SafeSlots_Window", + --insets = { left = -256, right = -256, top = -5, bottom = -5} +}) +SafeSlots_Main_Confirm:SetFrameStrata("DIALOG") +SafeSlots_Main_Confirm:Hide() + +--[[local SafeSlots_Main_Confirm_CloseButton = CreateFrame("Button", "SafeSlots_Main_Confirm_CloseButton", SafeSlots_Main_Confirm, "UIPanelCloseButton") +SafeSlots_Main_Confirm_CloseButton:SetPoint("CENTER", 90, -2) +SafeSlots_Main_Confirm_CloseButton:EnableMouse(true) +SafeSlots_Main_Confirm_CloseButton:SetSize(25, 25) +SafeSlots_Main_Confirm_CloseButton:SetScript("OnMouseUp", function() + PlaySound("TalentScreenOpen") + SafeSlots_Main_Confirm:Hide() + end)]]-- + +-- version of frame if your slot is activated +local SafeSlots_Main_Confirm_UnInsureButton = CreateFrame("Button", "SafeSlots_Main_Confirm_UnInsureButton", SafeSlots_Main_Confirm, "UIPanelButtonTemplate") +SafeSlots_Main_Confirm_UnInsureButton:SetWidth(120) +SafeSlots_Main_Confirm_UnInsureButton:SetHeight(21) +SafeSlots_Main_Confirm_UnInsureButton:SetPoint("CENTER", 0,-54) +SafeSlots_Main_Confirm_UnInsureButton:RegisterForClicks("AnyUp") +SafeSlots_Main_Confirm_UnInsureButton:SetText("Remove Commutation") + + +local SafeSlots_Main_Confirm_InsureButton = CreateFrame("Button", "SafeSlots_Main_Confirm_InsureButton", SafeSlots_Main_Confirm, "UIPanelButtonTemplate") +SafeSlots_Main_Confirm_InsureButton:SetWidth(120) +SafeSlots_Main_Confirm_InsureButton:SetHeight(21) +SafeSlots_Main_Confirm_InsureButton:SetPoint("CENTER", 0,-54) +SafeSlots_Main_Confirm_InsureButton:RegisterForClicks("AnyUp") +SafeSlots_Main_Confirm_InsureButton:SetText("Commute slot") + + +SafeSlots_Main_Confirm_ItemIcon = CreateFrame("Button", "SafeSlots_Main_Confirm_ItemIcon", SafeSlots_Main_Confirm, "SecureActionButtonTemplate") +SafeSlots_Main_Confirm_ItemIcon:SetSize(34, 34) +SafeSlots_Main_Confirm_ItemIcon:SetPoint("CENTER",-80,-23) +SafeSlots_Main_Confirm_ItemIcon:EnableMouse(true) +SafeSlots_Main_Confirm_ItemIcon:SetNormalTexture("Interface\\PaperDoll\\UI-Backpack-EmptySlot") +SafeSlots_Main_Confirm_ItemIcon:SetHighlightTexture("Interface\\BUTTONS\\ButtonHilight-Square") + +local SafeSlots_Main_CostText = SafeSlots_Main_Confirm:CreateFontString("SafeSlots_Main_CostText") +SafeSlots_Main_CostText:SetFont("Fonts\\FRIZQT__.TTF", 12) +SafeSlots_Main_CostText:SetFontObject(GameFontNormal) +SafeSlots_Main_CostText:SetPoint("CENTER", 0, -15) +SafeSlots_Main_CostText:SetShadowOffset(1,-1) +-- + --END OF CONFIRM FRAME-- + + --Confirm Frame Scripts-- +-- main frame scripts-- +SafeSlots_Main_Confirm:SetScript("OnUpdate", function(self) + if (Slots[SafeSlots_Main_Confirm_ItemIcon.slot][3]) then-- player has insured slot + local Link = GetInventoryItemLink("player", SafeSlots_Main_Confirm_ItemIcon.slot) + if (Link) then + local _, _, _, _, _, _, _, _, _, texture = GetItemInfo(Link) + local gold,silver,copper = GetGoldForMoney(SafeSlotGetLostCost(Link)) + SafeSlots_Main_Confirm_ItemIcon:SetNormalTexture(texture) + SafeSlots_Main_CostText:SetText("Losing this item\nwill cost you|r\n\n|cffFFFFFF"..gold.."|TInterface\\MONEYFRAME\\UI-GoldIcon.blp:11:11:0:-1|t "..silver.."|TInterface\\MONEYFRAME\\UI-SilverIcon.blp:11:11:0:-1|t "..copper.."|TInterface\\MONEYFRAME\\UI-CopperIcon.blp:11:11:0:-1|t|r") + else + SafeSlots_Main_Confirm_ItemIcon:SetNormalTexture("Interface\\PaperDoll\\UI-Backpack-EmptySlot") + SafeSlots_Main_CostText:SetText("This slot is empty") + end + + SafeSlots_Main_Confirm_UnInsureButton:Show() + SafeSlots_Main_Confirm_InsureButton:Hide() + else-- player has not insured slot + SafeSlots_Main_Confirm_ItemIcon:SetNormalTexture("Interface\\icons\\inv_custom_demonstears") + SafeSlots_Main_CostText:SetText("Commutation cost:\n\n|cffa335ee[Demon's Tears]|r |cffFFFFFFx1|r") + SafeSlots_Main_Confirm_UnInsureButton:Hide() + SafeSlots_Main_Confirm_InsureButton:Show() + end + end) +-- main frame scripts-- + +--item icon scripts-- +SafeSlots_Main_Confirm_ItemIcon:SetScript("OnEnter", function(self) + GameTooltip:SetOwner(self, "ANCHOR_RIGHT") + local itemlink = GetInventoryItemLink("player", self.slot) + if (itemlink and Slots[self.slot][3]) then + GameTooltip:SetHyperlink(GetInventoryItemLink("player", self.slot)) + elseif Slots[self.slot][3] then + GameTooltip:AddLine("Slot is empty") + else + end + GameTooltip:Show() + end) +SafeSlots_Main_Confirm_ItemIcon:SetScript("OnLeave", function() + GameTooltip:Hide() + end) + +--insure item button script +SafeSlots_Main_Confirm_InsureButton:SetScript("OnUpdate", function(self) + if ( GetItemCount(InsureCurrency) > 0) then + self:Enable() + else + self:Disable() + end + end) +--end + --End Confirm Frame Scripts-- + +--ANIMATIONS-- +SafeSlots_Main_Complete = SafeSlots_Main:CreateTexture(nil, "ARTWORK") +SafeSlots_Main_Complete:SetSize(SafeSlots_Main:GetSize()) +SafeSlots_Main_Complete:SetTexture("Interface\\AddOns\\AwAddons\\Textures\\SafeSlots\\SafeSlotsHighlight") +SafeSlots_Main_Complete:SetPoint("CENTER") +SafeSlots_Main_Complete:SetBlendMode("ADD") +SafeSlots_Main_Complete:Hide() + +SafeSlots_Main_Complete_Dialog = SafeSlots_Main_Confirm:CreateTexture(nil, "OVERLAY") +SafeSlots_Main_Complete_Dialog:SetSize(SafeSlots_Main:GetSize()) +SafeSlots_Main_Complete_Dialog:SetTexture("Interface\\AddOns\\AwAddons\\Textures\\SafeSlots\\SafeSlots_confirmH") +SafeSlots_Main_Complete_Dialog:SetPoint("CENTER") +SafeSlots_Main_Complete_Dialog:SetBlendMode("ADD") +SafeSlots_Main_Complete_Dialog:Hide() + +local function SafeSlots_Main_Animgroup_End() + BaseFrameFadeOut(SafeSlots_Main_Complete) + BaseFrameFadeOut(SafeSlots_Main_Complete_Dialog) + AIO.Handle("SlotIsurance", "GetSlotList") +end +SafeSlots_Main_Animgroup = SafeSlots_Main:CreateAnimationGroup() +local SafeSlots_Main_BlankAnim = SafeSlots_Main_Animgroup:CreateAnimation("Scale") +SafeSlots_Main_BlankAnim:SetDuration(0.5) +SafeSlots_Main_BlankAnim:SetOrder(1) +SafeSlots_Main_BlankAnim:SetEndDelay(0) +--SafeSlots_Main_BlankAnim:SetScale(1,1) +SafeSlots_Main_BlankAnim:SetScript("OnFinished", SafeSlots_Main_Animgroup_End) +SafeSlots_Main_BlankAnim:SetScript("OnStop", SafeSlots_Main_Animgroup_End) +SafeSlots_Main_BlankAnim:SetScript("OnPlay", function() + BaseFrameFadeIn(SafeSlots_Main_Complete) + BaseFrameFadeIn(SafeSlots_Main_Complete_Dialog) + end) + +local function SafeSlots_Init() + SafeSlots_Main_PlayerModel:SetUnit("player") + SafeSlots_Main_PlayerModel:SetCamera(1) -- model settings + SafeSlots_Main_Confirm:Hide() + for k,v in pairs(Slots) do + if v[3] then + BaseFrameFadeIn(_G[v[2].."_GlowTex"]) + else + if (_G[v[2].."_GlowTex"]:IsVisible()) then + BaseFrameFadeOut(_G[v[2].."_GlowTex"]) + else + _G[v[2].."_GlowTex"]:Hide() + end + end + _G[v[2]].slot = k -- button settings + + end +end +--END OF ANIMATIONS-- + + --AIO STUFF, SENDING PART-- + + +SafeSlots_Main:SetScript("OnShow", function() + AIO.Handle("SlotIsurance", "GetSlotList") + end) + +SafeSlots_Main_Confirm_UnInsureButton:SetScript("OnMouseDown",function(self) + if (SafeSlots_Main_Confirm_ItemIcon.slot) then + SafeSlots_Main_Animgroup:Stop() + SafeSlots_Main_Animgroup:Play() + AIO.Handle("SlotIsurance", "UnInsureSlot", SafeSlots_Main_Confirm_ItemIcon.slot) + end + end) +SafeSlots_Main_Confirm_InsureButton:SetScript("OnMouseDown",function(self) + if ( GetItemCount(InsureCurrency) > 0) then + SafeSlots_Main_Animgroup:Stop() + SafeSlots_Main_Animgroup:Play() + if (SafeSlots_Main_Confirm_ItemIcon.slot) then + AIO.Handle("SlotIsurance", "InsureSlot", SafeSlots_Main_Confirm_ItemIcon.slot) + end + end + end) + + --AIO STUFF, GETTING PART-- +function SlotIsuranceClient.SafeSlots_GetList(player, slotlist) + Slots = slotlist + SafeSlots_Init() +end + +function SlotIsuranceClient.SafeSlots_Close(player) + SafeSlots_Main:Hide() +end + +function SlotIsuranceClient.SafeSlots_Init(player) + SafeSlots_Main:Show() +end \ No newline at end of file diff --git a/SafeSlots/SafeSlotsServer.lua b/SafeSlots/SafeSlotsServer.lua new file mode 100644 index 0000000..3959ed8 --- /dev/null +++ b/SafeSlots/SafeSlotsServer.lua @@ -0,0 +1,188 @@ +local AIO = AIO or require("AIO") + +local SlotIsuranceServer = AIO.AddHandlers("SlotIsurance", {}) +--!NOTE: SERVERSIDE SLOTS STARTS FROM 0, NOT FROM 1. +--!SO HEAD AND OTHER SLOTS HAVE SLOTNUMBER-1 + +--Slot table Structure: +--PLAYERGUID, head, neck, shoulder etc (0 or 1) +local InsureCurrency = 98461 + +--[[ +SET FOREIGN_KEY_CHECKS=0; + +-- ---------------------------- +-- Table structure for custom_iteminsurance +-- ---------------------------- +DROP TABLE IF EXISTS `custom_iteminsurance`; +CREATE TABLE `custom_iteminsurance` ( + `playerguid` int(30) NOT NULL DEFAULT '0', + `slot0` int(1) NOT NULL DEFAULT '0', + `slot1` int(1) NOT NULL DEFAULT '0', + `slot2` int(1) NOT NULL DEFAULT '0', + `slot3` int(1) NOT NULL DEFAULT '0', + `slot4` int(1) NOT NULL DEFAULT '0', + `slot5` int(1) NOT NULL DEFAULT '0', + `slot6` int(1) NOT NULL DEFAULT '0', + `slot7` int(1) NOT NULL DEFAULT '0', + `slot8` int(1) NOT NULL DEFAULT '0', + `slot9` int(1) NOT NULL DEFAULT '0', + `slot10` int(1) NOT NULL DEFAULT '0', + `slot11` int(1) NOT NULL DEFAULT '0', + `slot12` int(1) NOT NULL DEFAULT '0', + `slot13` int(1) NOT NULL DEFAULT '0', + `slot14` int(1) NOT NULL DEFAULT '0', + `slot15` int(1) NOT NULL DEFAULT '0', + `slot16` int(1) NOT NULL DEFAULT '0', + `slot17` int(1) NOT NULL DEFAULT '0', + `slot18` int(1) NOT NULL DEFAULT '0', + PRIMARY KEY (`playerguid`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1; +]]-- + +function SlotIsuranceServer.GetSlotList(player) + if not(GreedyDemonCheck(player)) then + return false + end + + local Slots = { -- Empty ARRAY + [1] = {"Head", "SafeSlot1", false}, + [2] = {"Neck", "SafeSlot2", false}, + [3] = {"Shoulder", "SafeSlot3", false}, + [4] = {"Body", "SafeSlot6", false}, + [5] = {"Chest", "SafeSlot5", false}, + [6] = {"Waist", "SafeSlot10", false}, + [7] = {"Legs", "SafeSlot11", false}, + [8] = {"Feet", "SafeSlot12", false}, + [9] = {"Wrist", "SafeSlot8", false}, + [10] = {"Hand", "SafeSlot9", false}, + [11] = {"Finger", "SafeSlot13", false}, + [12] = {"Finger", "SafeSlot14", false}, + [13] = {"Trinket", "SafeSlot15", false}, + [14] = {"Trinket", "SafeSlot16", false}, + [15] = {"Back", "SafeSlot4", false}, + [16] = {"Main Hand", "SafeSlot17", false}, + [17] = {"Off Hand", "SafeSlot18", false}, + [18] = {"Ranged", "SafeSlot19", false}, + [19] = {"Tabard", "SafeSlot7", false}, + } + + local SlotlistSQL = CharDBQuery("SELECT slot0, slot1, slot2, slot3, slot4, slot5, slot6, slot7, slot8, slot9, slot10, slot11, slot12, slot13, slot14, slot15, slot16, slot17, slot18 FROM custom_iteminsurance WHERE playerguid = "..player:GetGUIDLow()..";") + + if (SlotlistSQL) then + for i = 0, 18 do + if (SlotlistSQL:GetInt32(i) == 1) then + Slots[i+1][3] = true + end + end + end + SafeSlots_SendList(AIO.Msg(), player,Slots):Send(player) + end + + function SafeSlots_SendList(msg,player,SlotList) + return msg:Add("SlotIsurance", "SafeSlots_GetList", SlotList) +end + +function SlotIsuranceServer.InsureSlot(player,slot) + --AIO ADDITIONAL CHECK-- + local expectedData = {"number"} + local values = {slot} + if not(DataTypeCheck(expectedData, values)) then + return false + end + --MAIN ACTION-- + if not(GreedyDemonCheck(player)) then + return false + end + + slot = slot - 1 + if (player:GetItemCount(InsureCurrency) < 1) then + player:SendBroadcastMessage("You don't have enough Demon's Tears to do that!") + return false + end + + local SlotSQL = CharDBQuery("SELECT slot"..slot.." FROM custom_iteminsurance WHERE playerguid = "..player:GetGUIDLow()..";") + if (SlotSQL and (SlotSQL:GetInt32(0) == 1)) then + player:SendBroadcastMessage("You have already insured that slot") + return false + end + + player:RemoveItem(InsureCurrency, 1) + + if (SlotSQL) then + CharDBExecute("UPDATE custom_iteminsurance SET slot"..slot.." = 1 WHERE playerguid = "..player:GetGUIDLow()..";") + else + CharDBExecute("INSERT IGNORE INTO custom_iteminsurance (playerguid, slot"..slot..") VALUES ("..player:GetGUIDLow()..", 1);") + end + + --SlotIsuranceServer.GetSlotList(player) + end + +function SlotIsuranceServer.UnInsureSlot(player,slot) + --AIO ADDITIONAL CHECK-- + local expectedData = {"number"} + local values = {slot} + if not(DataTypeCheck(expectedData, values)) then + return false + end + --MAIN ACTION-- + if not(GreedyDemonCheck(player)) then + return false + end + + slot = slot - 1 + local SlotSQL = CharDBQuery("SELECT slot"..slot.." FROM custom_iteminsurance WHERE playerguid = "..player:GetGUIDLow()..";") + + if not(SlotSQL) then + return false + end + + if (SlotSQL:GetInt32(0) == 0) then + player:SendBroadcastMessage("You have already removed insurance from that slot") + return false + end + + CharDBExecute("UPDATE custom_iteminsurance SET slot"..slot.." = 0 WHERE playerguid = "..player:GetGUIDLow()..";") + player:AddItem(InsureCurrency) + --SlotIsuranceServer.GetSlotList(player) +end + + +--GOSSIP PART +local GreedyDemon = 75120 +local GreedyDemon_menu = 45004 + + function SafeSlots_CloseMenu(msg,player) + return msg:Add("SlotIsurance", "SafeSlots_Close") +end + + function SafeSlots_OpenMenu(msg,player) + return msg:Add("SlotIsurance", "SafeSlots_Init") +end + +local function OnGossipHello_GreedyDemon(event, player, Demon) +player:GossipClearMenu() +if (Demon:GetOwner() == player) then +SafeSlots_OpenMenu(AIO.Msg(), player):Send(player) +end +player:GossipSendMenu(1, Demon, GreedyDemon_menu) +player:GossipComplete() +end +RegisterCreatureGossipEvent(GreedyDemon, 1, OnGossipHello_GreedyDemon) + + function GreedyDemonCheck(player) + local Demon = nil + Demon = player:GetNearestCreature(3, GreedyDemon) + if (Demon) and (Demon:GetOwner() == player) then + return true + end + SafeSlots_CloseMenu(AIO.Msg(), player):Send(player) + return false + end + +local function PlayerIsFar(event, creature, unit) + for k,player in pairs(creature:GetPlayersInRange(20)) do + GreedyDemonCheck(player) + end +end + RegisterCreatureEvent(GreedyDemon, 27, PlayerIsFar) \ No newline at end of file diff --git a/TheClassMaskingSolution/TooltipCorrector.lua b/TheClassMaskingSolution/TooltipCorrector.lua new file mode 100644 index 0000000..6fca444 --- /dev/null +++ b/TheClassMaskingSolution/TooltipCorrector.lua @@ -0,0 +1,2154 @@ +local AIO = AIO or require ("AIO") + +if AIO.AddAddon() then + return +end + +local tTHandler = AIO.AddHandlers ("TooltipAIO", {}) + +local TipNum + +local TipID + +local spellCheck = false + +local modCost + +local modCastTime + +local modRange + +local modCooldown + +local tempNum + +local pTemplateTable + +local skipCheck + +currentlyProcessing = false + + +--TODO: Polish passes on spell entries +--TODO: Deal with "request interference" +--TODO: make the tooltips pretty(?) + + +--used to read tooltip +local tab = {} + +--format: [spellid] = templateNumber +--templateNumber refers to the templateTable. +local TaggedSpells = +{ + [100] = 1, + [6178] = 1, + [11578] = 1, + [772] = 2, + [6546] = 2, + [6547] = 2, + [6548] = 2, + [11572] = 2, + [11573] = 2, + [11574] = 2, + [25208] = 2, + [46845] = 2, + [47465] = 2, + [6343] = 3, + [8198] = 3, + [8204] = 3, + [8205] = 3, + [11580] = 3, + [11581] = 3, + [25264] = 3, + [47501] = 3, + [47501] = 3, + [6673] = 4, + [5242] = 4, + [6192] = 4, + [11549] = 4, + [11550] = 4, + [11551] = 4, + [25289] = 4, + [2048] = 4, + [47436] = 4, + [34428] = 5, + [72] = 6, + [1671] = 6, + [1672] = 6, + [29704] = 6, + [78] = 4, + [284] = 4, + [285] = 4, + [1608] = 4, + [11564] = 4, + [11565] = 4, + [11566] = 4, + [11567] = 4, + [25286] = 4, + [29707] = 4, + [30324] = 4, + [47449] = 4, + [47450] = 4, + [469] = 4, + [47439] = 4, + [47440] = 4, + [676] = 6, + [694] = 6, + [7400] = 6, + [7402] = 6, + [20559] = 6, + [20560] = 6, + [25266] = 6, + [47504] = 6, + [845] = 4, + [7369] = 4, + [11608] = 4, + [11609] = 4, + [20569] = 4, + [25231] = 4, + [47519] = 4, + [47520] = 4, + [871] = 7, + [1160] = 4, + [6190] = 4, + [11554] = 4, + [11555] = 4, + [11556] = 4, + [25202] = 4, + [25203] = 4, + [47437] = 4, + [1161] = 3, + [1464] = 8, + [8820] = 8, + [11604] = 8, + [11605] = 8, + [25241] = 8, + [25242] = 8, + [47474] = 8, + [47475] = 8, + [1680] = 3, + [1715] = 2, + [1719] = 9, + [2565] = 9, + [2687] = 10, + [3411] = 6, + [5246] = 6, + [5308] = 2, + [20658] = 2, + [20660] = 2, + [20661] = 2, + [20662] = 2, + [25234] = 2, + [25236] = 2, + [47470] = 2, + [47471] = 2, + [6552] = 6, + [6554] = 6, + [6572] = 6, + [6574] = 6, + [7379] = 6, + [11600] = 6, + [11601] = 6, + [25288] = 6, + [25269] = 6, + [30357] = 6, + [57823] = 6, + [7384] = 6, + [7887] = 6, + [11584] = 6, + [11585] = 6, + [18499] = 7, + [20230] = 9, + [20252] = 6, + [20616] = 6, + [20617] = 6, + [25272] = 6, + [25275] = 6, + [12294] = 6, + [21551] = 6, + [21552] = 6, + [21553] = 6, + [25248] = 6, + [30330] = 6, + [47485] = 6, + [47486] = 6, + [23920] = 3, + [23922] = 6, + [23923] = 6, + [23924] = 6, + [23925] = 6, + [25258] = 6, + [30356] = 6, + [47487] = 6, + [47488] = 6, + [20243] = 2, + [30016] = 2, + [30022] = 2, + [47497] = 2, + [47498] = 2, + [55694] = 3, + [57755] = 1, + [64382] = 11, + [498] = 12, + [635] = 13, + [639] = 13, + [647] = 13, + [1026] = 13, + [1042] = 13, + [3472] = 13, + [10328] = 13, + [10329] = 13, + [25292] = 13, + [27135] = 13, + [27136] = 13, + [48781] = 13, + [48782] = 13, + [24132] = 14, --wyvern sting r2 add test by Nerf + [19740] = 14, + [19834] = 14, + [19835] = 14, + [19836] = 14, + [19837] = 14, + [19838] = 14, + [25291] = 14, + [27140] = 14, + [48931] = 14, + [48932] = 14, + [19742] = 14, + [19850] = 14, + [19852] = 14, + [19853] = 14, + [19854] = 14, + [25290] = 14, + [27142] = 14, + [48935] = 14, + [48936] = 14, + [20911] = 14, + [25898] = 14, + [25782] = 14, + [25916] = 14, + [27141] = 14, + [48933] = 14, + [48934] = 14, + [25899] = 14, + [25894] = 14, + [25918] = 14, + [27143] = 14, + [48937] = 14, + [48938] = 14, + [1044] = 15, + [1038] = 15, + [1022] = 15, + [5599] = 15, + [10278] = 15, + [6940] = 15, + [20271] = 15, + [633] = 1, + [2800] = 1, + [10310] = 1, + [27154] = 1, + [48788] = 1, + [642] = 12, + [853] = 15, + [5588] = 15, + [5589] = 15, + [10308] = 15, + [879] = 16, + [5614] = 16, + [5615] = 16, + [10312] = 16, + [10313] = 16, + [10314] = 16, + [27138] = 16, + [48800] = 16, + [48801] = 16, + [1152] = 14, + [4987] = 14, + [2812] = 12, + [10318] = 12, + [27139] = 12, + [48816] = 12, + [48817] = 12, + [7328] = 13, + [10322] = 13, + [10324] = 13, + [20772] = 13, + [20773] = 13, + [48949] = 13, + [48950] = 13, + [10326] = 13, + [19750] = 13, + [19939] = 13, + [19940] = 13, + [19941] = 13, + [19942] = 13, + [19943] = 13, + [27137] = 13, + [48784] = 13, + [48785] = 13, + [19752] = 1, + [20116] = 12, + [26573] = 12, + [20922] = 12, + [20923] = 12, + [20924] = 12, + [27173] = 12, + [48818] = 12, + [48819] = 12, + [20164] = 17, + [20165] = 17, + [20166] = 17, + [20217] = 14, + [20925] = 12, + [20927] = 12, + [20928] = 12, + [27179] = 12, + [48951] = 12, + [48952] = 12, + [20473] = 18, + [20929] = 18, + [20930] = 18, + [27174] = 18, + [33072] = 18, + [48824] = 18, + [48825] = 18, + [24275] = 16, + [24274] = 16, + [24239] = 16, + [27180] = 16, + [48805] = 16, + [48806] = 16, + [31789] = 1, + [31884] = 12, + [31935] = 15, + [32699] = 15, + [32700] = 15, + [48826] = 15, + [48827] = 15, + [53407] = 16, + [53408] = 16, + [53600] = 15, + [61411] = 15, + [53601] = 14, + [53720] = 17, + [54428] = 9, + [62124] = 15, + [116] = 13, + [205] = 13, + [837] = 13, + [7322] = 13, + [8406] = 13, + [8407] = 13, + [8408] = 13, + [10179] = 13, + [10180] = 13, + [10181] = 13, + [25304] = 13, + [27071] = 13, + [27072] = 13, + [38697] = 13, + [42841] = 13, + [42842] = 13, + [133] = 13, + [143] = 13, + [145] = 13, + [3140] = 13, + [8400] = 13, + [8401] = 13, + [8402] = 13, + [10148] = 13, + [10149] = 13, + [10150] = 13, + [10151] = 13, + [25306] = 13, + [27070] = 13, + [38692] = 13, + [42832] = 13, + [42833] = 13, + [1459] = 14, + [1460] = 14, + [1461] = 14, + [10156] = 14, + [10157] = 14, + [27126] = 14, + [42995] = 14, + [2136] = 15, + [2137] = 15, + [2138] = 15, + [8412] = 15, + [8413] = 15, + [10197] = 15, + [10199] = 15, + [27078] = 15, + [27079] = 15, + [42872] = 15, + [42873] = 15, + [10] = 13, + [6141] = 13, + [8427] = 13, + [10185] = 13, + [10186] = 13, + [10187] = 13, + [27085] = 13, + [42939] = 13, + [42940] = 13, + [66] = 12, + [118] = 13, + [12824] = 13, + [12825] = 13, + [12826] = 13, + [28271] = 13, + [28272] = 13, + [61025] = 13, + [61305] = 13, + [61721] = 13, + [61780] = 13, + [71319] = 13, + [120] = 12, + [8492] = 12, + [10159] = 12, + [10160] = 12, + [10161] = 12, + [27087] = 12, + [42930] = 12, + [42931] = 12, + [122] = 12, + [865] = 12, + [6131] = 12, + [10230] = 12, + [27088] = 12, + [42917] = 12, + [130] = 14, + [475] = 14, + [543] = 12, + [8457] = 12, + [8458] = 12, + [10223] = 12, + [10225] = 12, + [27128] = 12, + [43010] = 12, + [6143] = 12, + [8461] = 12, + [8462] = 12, + [10177] = 12, + [28609] = 12, + [32796] = 12, + [43012] = 12, + [604] = 14, + [8450] = 14, + [8451] = 14, + [10173] = 14, + [10174] = 14, + [33944] = 14, + [43015] = 14, + [759] = 19, + [5513] = 19, + [8007] = 19, + [8008] = 19, + [22044] = 19, + [33312] = 19, + [5349] = 19, + [1113] = 19, + [1487] = 19, + [990] = 19, + [8075] = 19, + [8076] = 19, + [22895] = 19, + [22019] = 19, + [5350] = 19, + [2288] = 19, + [3772] = 19, + [8077] = 19, + [8078] = 19, + [8079] = 19, + [30703] = 19, + [22018] = 19, + [1008] = 14, + [8455] = 14, + [10169] = 14, + [10170] = 14, + [27130] = 14, + [33946] = 14, + [43017] = 14, + [1449] = 17, + [8437] = 17, + [8438] = 17, + [8439] = 17, + [10201] = 17, + [10202] = 17, + [27080] = 17, + [27082] = 17, + [42920] = 17, + [42921] = 17, + [1463] = 17, + [8494] = 17, + [8495] = 17, + [10191] = 17, + [10192] = 17, + [10193] = 17, + [27131] = 17, + [43019] = 17, + [43020] = 17, + [1953] = 12, + [2120] = 13, + [2121] = 13, + [8422] = 13, + [8423] = 13, + [10215] = 13, + [10216] = 13, + [27086] = 13, + [42925] = 13, + [42926] = 13, + [2139] = 15, + [2948] = 13, + [8444] = 13, + [8445] = 13, + [8446] = 13, + [10205] = 13, + [10206] = 13, + [10207] = 13, + [27073] = 13, + [27074] = 13, + [42858] = 13, + [42859] = 13, + [5143] = 14, + [5144] = 14, + [5145] = 14, + [8416] = 14, + [8417] = 14, + [10211] = 14, + [10212] = 14, + [25345] = 14, + [27075] = 14, + [38699] = 14, + [38704] = 14, + [42843] = 14, + [42846] = 14, + [6117] = 17, + [22782] = 17, + [22783] = 17, + [27125] = 17, + [43023] = 17, + [43024] = 17, + [168] = 17, + [7300] = 17, + [7301] = 17, + [7302] = 17, + [7320] = 17, + [10219] = 17, + [10220] = 17, + [27124] = 17, + [43008] = 17, + [12051] = 9, + [11366] = 13, + [12505] = 13, + [12522] = 13, + [12523] = 13, + [12524] = 13, + [12525] = 13, + [12526] = 13, + [18809] = 13, + [27132] = 13, + [33938] = 13, + [42890] = 13, + [42891] = 13, + [11113] = 12, + [13018] = 12, + [13019] = 12, + [13020] = 12, + [13021] = 12, + [27133] = 12, + [33933] = 12, + [42944] = 12, + [42945] = 12, + [11426] = 12, + [13031] = 12, + [13032] = 12, + [13033] = 12, + [27134] = 12, + [33405] = 12, + [43038] = 12, + [43039] = 12, + [23028] = 14, + [27127] = 14, + [43002] = 14, + [30449] = 14, + [30451] = 13, + [42894] = 13, + [42896] = 13, + [42897] = 13, + [30455] = 14, + [42913] = 14, + [42914] = 14, + [30482] = 17, + [43045] = 17, + [43046] = 17, + [31661] = 12, + [33041] = 12, + [33042] = 12, + [33043] = 12, + [42949] = 12, + [42950] = 12, + [42955] = 19, + [43523] = 19, + [43987] = 12, + [58659] = 12, + [44614] = 13, + [47610] = 13, + [44425] = 14, + [44780] = 14, + [44781] = 14, + [45438] = 12, + [55342] = 12, + [44457] = 14, + [55359] = 14, + [55360] = 14, + [172] = 14, + [6222] = 14, + [6223] = 14, + [7648] = 14, + [11671] = 14, + [11672] = 14, + [25311] = 14, + [27216] = 14, + [47812] = 14, + [47813] = 14, + [348] = 13, + [707] = 13, + [1094] = 13, + [2941] = 13, + [11665] = 13, + [11667] = 13, + [11668] = 13, + [25309] = 13, + [27215] = 13, + [47810] = 13, + [47811] = 13, + [688] = 19, + [697] = 19, + [712] = 19, + [691] = 19, + [30146] = 19, + [686] = 13, + [695] = 13, + [705] = 13, + [1088] = 13, + [1106] = 13, + [7641] = 13, + [11659] = 13, + [11660] = 13, + [11661] = 13, + [25307] = 13, + [27209] = 13, + [47808] = 13, + [47809] = 13, + [702] = 14, + [1108] = 14, + [6205] = 14, + [7646] = 14, + [11707] = 14, + [11708] = 14, + [27224] = 14, + [30909] = 14, + [50511] = 14, + [126] = 19, + [132] = 14, + [603] = 15, + [30910] = 15, + [47867] = 15, + [689] = 14, + [699] = 14, + [709] = 14, + [7651] = 14, + [11699] = 14, + [11700] = 14, + [27219] = 14, + [27220] = 14, + [47857] = 14, + [693] = 19, + [16892] = 19, + [16893] = 19, + [16895] = 19, + [16896] = 19, + [22116] = 19, + [36895] = 19, + [687] = 17, + [696] = 17, + [706] = 17, + [1086] = 17, + [11733] = 17, + [11734] = 17, + [11735] = 17, + [27260] = 17, + [47793] = 17, + [47889] = 17, + [698] = 12, + [710] = 13, + [18647] = 13, + [755] = 20, + [3698] = 20, + [3699] = 20, + [3700] = 20, + [11693] = 20, + [11694] = 20, + [11695] = 20, + [27259] = 20, + [47856] = 20, + [980] = 14, + [1014] = 14, + [6217] = 14, + [11711] = 14, + [11712] = 14, + [11713] = 14, + [27218] = 14, + [47863] = 14, + [47864] = 14, + [1098] = 13, + [11725] = 13, + [11726] = 13, + [61191] = 13, + [1120] = 14, + [8288] = 14, + [8289] = 14, + [11675] = 14, + [27217] = 14, + [47855] = 14, + [1490] = 14, + [11721] = 14, + [11722] = 14, + [27228] = 14, + [47865] = 14, + [1714] = 14, + [11719] = 14, + [1949] = 17, + [11683] = 17, + [11684] = 17, + [27213] = 17, + [47823] = 17, + [2362] = 19, + [41192] = 19, + [41193] = 19, + [41194] = 19, + [41195] = 19, + [41196] = 19, + [6366] = 19, + [41169] = 19, + [41171] = 19, + [41172] = 19, + [40773] = 19, + [41173] = 19, + [41174] = 19, + [5138] = 14, + [5484] = 19, + [17928] = 19, + [5576] = 13, + [17919] = 13, + [17920] = 13, + [17921] = 13, + [17922] = 13, + [17923] = 13, + [27210] = 13, + [30459] = 13, + [47814] = 13, + [47815] = 13, + [5697] = 14, + [6201] = 19, + [6202] = 19, + [5699] = 19, + [11729] = 19, + [11730] = 19, + [27230] = 19, + [47871] = 19, + [47878] = 19, + [5740] = 14, + [6219] = 14, + [11677] = 14, + [11678] = 14, + [27212] = 14, + [47819] = 14, + [47820] = 14, + [5782] = 13, + [6213] = 13, + [6215] = 13, + [6229] = 12, + [11739] = 12, + [11740] = 12, + [28610] = 12, + [47890] = 12, + [47891] = 12, + [6353] = 13, + [17924] = 13, + [27211] = 13, + [30545] = 13, + [47824] = 13, + [47825] = 13, + [6789] = 15, + [17925] = 15, + [17926] = 15, + [27223] = 15, + [47859] = 15, + [47860] = 15, + [17877] = 15, + [18867] = 15, + [18868] = 15, + [18869] = 15, + [18870] = 15, + [18871] = 15, + [27263] = 15, + [30546] = 15, + [47826] = 15, + [47827] = 15, + [18220] = 5, + [18937] = 5, + [18938] = 5, + [27265] = 5, + [59092] = 5, + [27243] = 13, + [47835] = 13, + [47836] = 13, + [28176] = 17, + [28189] = 17, + [47892] = 17, + [47893] = 17, + [29722] = 13, + [32231] = 13, + [47837] = 13, + [47838] = 13, + [29858] = 10, + [29893] = 15, + [58887] = 15, + [30108] = 13, + [30404] = 13, + [30405] = 13, + [47841] = 13, + [47843] = 13, + [30283] = 15, + [30413] = 15, + [30414] = 15, + [47846] = 15, + [47847] = 15, + [47897] = 12, + [61290] = 12, + [48018] = 19, + [48020] = 15, + [48181] = 15, + [59161] = 15, + [59163] = 15, + [59164] = 15, + [50796] = 16, + [59170] = 16, + [59171] = 16, + [59172] = 16, + [53] = 21, + [921] = 5, + [1757] = 21, + [1752] = 21, + [1776] = 22, + [1784] = 9, + [408] = 22, + [703] = 21, + [1725] = 22, + [1758] = 21, + [1759] = 21, + [1760] = 21, + [1766] = 22, + [1785] = 9, + [1786] = 9, + [1787] = 9, + [1804] = 23, + [1833] = 21, + [1842] = 23, + [1856] = 9, + [1857] = 9, + [1860] = 24, + [1966] = 22, + [2070] = 21, + [2094] = 22, + [2589] = 21, + [2590] = 21, + [2591] = 21, + [2836] = 24, + [2983] = 9, + [3127] = 24, + [5171] = 25, + [5277] = 9, + [5938] = 21, + [6760] = 21, + [6761] = 21, + [6762] = 21, + [6768] = 22, + [6770] = 21, + [6774] = 25, + [8621] = 21, + [8623] = 21, + [8624] = 21, + [8631] = 21, + [8632] = 21, + [8633] = 21, + [8637] = 22, + [8639] = 21, + [8640] = 21, + [8643] = 22, + [8647] = 21, + [8649] = 21, + [8650] = 21, + [8676] = 21, + [8696] = 9, + [8721] = 21, + [8724] = 21, + [8725] = 21, + [11197] = 21, + [11198] = 21, + [11267] = 21, + [11268] = 21, + [11269] = 21, + [11273] = 21, + [11274] = 21, + [11275] = 21, + [11279] = 21, + [11280] = 21, + [11281] = 21, + [11289] = 21, + [11290] = 21, + [11293] = 21, + [11294] = 21, + [11297] = 21, + [11299] = 21, + [11300] = 21, + [11303] = 22, + [11305] = 9, + [17347] = 21, + [17348] = 21, + [25300] = 21, + [25302] = 22, + [26669] = 9, + [26679] = 22, + [26839] = 21, + [26861] = 21, + [26862] = 21, + [26863] = 21, + [26864] = 21, + [26865] = 21, + [26866] = 21, + [26867] = 21, + [26884] = 21, + [26889] = 9, + [27441] = 21, + [27448] = 22, + [31016] = 21, + [31224] = 9, + [32645] = 21, + [32684] = 21, + [34411] = 21, + [34412] = 21, + [34413] = 21, + [48637] = 21, + [48638] = 21, + [48656] = 21, + [48657] = 21, + [48658] = 22, + [48659] = 22, + [48660] = 21, + [48663] = 21, + [48666] = 21, + [48667] = 21, + [48668] = 21, + [48669] = 21, + [48671] = 21, + [48672] = 21, + [48673] = 22, + [48674] = 22, + [48675] = 21, + [48676] = 21, + [48689] = 21, + [48690] = 21, + [48691] = 21, + [51722] = 22, + [51723] = 25, + [51724] = 21, + [57934] = 22, + [57992] = 21, + [57993] = 21, + [17] = 15, + [592] = 15, + [600] = 15, + [3747] = 15, + [6065] = 15, + [6066] = 15, + [10898] = 15, + [10899] = 15, + [10900] = 15, + [10901] = 15, + [25217] = 15, + [25218] = 15, + [48065] = 15, + [48066] = 15, + [589] = 14, + [594] = 14, + [970] = 14, + [992] = 14, + [2767] = 14, + [10892] = 14, + [10893] = 14, + [10894] = 14, + [25367] = 14, + [25368] = 14, + [48124] = 14, + [48125] = 14, + [585] = 13, + [591] = 13, + [598] = 13, + [984] = 13, + [1004] = 13, + [6060] = 13, + [10933] = 13, + [10934] = 13, + [25363] = 13, + [25364] = 13, + [48122] = 13, + [48123] = 13, + [1243] = 14, + [1244] = 14, + [1245] = 14, + [2791] = 14, + [10937] = 14, + [10938] = 14, + [25389] = 14, + [48161] = 14, + [2050] = 13, + [2052] = 13, + [2053] = 13, + [139] = 14, + [6074] = 14, + [6075] = 14, + [6076] = 14, + [6077] = 14, + [6078] = 14, + [10927] = 14, + [10928] = 14, + [10929] = 14, + [25221] = 14, + [25222] = 14, + [25315] = 14, + [48067] = 14, + [48068] = 14, + [453] = 14, + [527] = 26, + [988] = 26, + [528] = 14, + [552] = 14, + [586] = 12, + [588] = 17, + [7128] = 17, + [602] = 17, + [1006] = 17, + [10951] = 17, + [10952] = 17, + [25431] = 17, + [48040] = 17, + [48168] = 17, + [596] = 13, + [996] = 13, + [10960] = 13, + [10961] = 13, + [25316] = 13, + [25308] = 13, + [48072] = 13, + [605] = 13, + [976] = 14, + [10957] = 14, + [10958] = 14, + [25433] = 14, + [48169] = 14, + [1706] = 14, + [2006] = 13, + [2010] = 13, + [10880] = 13, + [10881] = 13, + [20770] = 13, + [25435] = 13, + [48171] = 13, + [2054] = 13, + [2055] = 13, + [6063] = 13, + [6064] = 13, + [2060] = 13, + [10963] = 13, + [10964] = 13, + [10965] = 13, + [25314] = 13, + [25210] = 13, + [25213] = 13, + [48062] = 13, + [48063] = 13, + [2061] = 13, + [9472] = 13, + [9473] = 13, + [9474] = 13, + [10915] = 13, + [10916] = 13, + [10917] = 13, + [25233] = 13, + [25235] = 13, + [48070] = 13, + [48071] = 13, + [2096] = 14, + [10909] = 14, + [2944] = 14, + [19276] = 14, + [19277] = 14, + [19278] = 14, + [19279] = 14, + [19280] = 14, + [25467] = 14, + [48299] = 14, + [48300] = 14, + [6346] = 15, + [8092] = 16, + [8102] = 16, + [8103] = 16, + [8104] = 16, + [8105] = 16, + [8106] = 16, + [10945] = 16, + [10946] = 16, + [10947] = 16, + [25372] = 16, + [25375] = 16, + [48126] = 16, + [48127] = 16, + [8122] = 12, + [8124] = 12, + [10888] = 12, + [10890] = 12, + [8129] = 13, + [9484] = 13, + [9485] = 13, + [10955] = 13, + [14752] = 14, + [14818] = 14, + [14819] = 14, + [27841] = 14, + [25312] = 14, + [48073] = 14, + [14914] = 16, + [15262] = 16, + [15263] = 16, + [15264] = 16, + [15265] = 16, + [15266] = 16, + [15267] = 16, + [15261] = 16, + [25384] = 16, + [48134] = 16, + [48135] = 16, + [15237] = 17, + [15430] = 17, + [15431] = 17, + [27799] = 17, + [27800] = 17, + [27801] = 17, + [25331] = 17, + [48077] = 17, + [48078] = 17, + [15407] = 14, + [17311] = 14, + [17312] = 14, + [17313] = 14, + [17314] = 14, + [18807] = 14, + [25387] = 14, + [48155] = 14, + [48156] = 14, + [19238] = 12, + [19236] = 12, + [19240] = 12, + [19241] = 12, + [19242] = 12, + [19243] = 12, + [25437] = 12, + [48172] = 12, + [48173] = 12, + [21562] = 14, + [21564] = 14, + [25392] = 14, + [48162] = 14, + [27681] = 14, + [32999] = 14, + [48074] = 14, + [27683] = 14, + [39374] = 14, + [48170] = 14, + [724] = 16, + [27870] = 16, + [27871] = 16, + [28275] = 16, + [48086] = 16, + [48087] = 16, + [32375] = 13, + [32379] = 15, + [32996] = 15, + [48157] = 15, + [48158] = 15, + [32546] = 13, + [48119] = 13, + [48120] = 13, + [33076] = 15, + [48112] = 15, + [48113] = 15, + [34433] = 1, + [34861] = 14, + [34863] = 14, + [34864] = 14, + [34865] = 14, + [34866] = 14, + [48088] = 14, + [48089] = 14, + [34914] = 13, + [34916] = 13, + [34917] = 13, + [48159] = 13, + [48160] = 13, + [48045] = 14, + [53023] = 14, + [47540] = 28, + [53005] = 28, + [53006] = 28, + [53007] = 28, + [64843] = 12, + [64901] = 1, + [331] = 13, + [332] = 13, + [2484] = 12, + [8017] = 17, + [8042] = 15, + [131] = 14, + [325] = 25, + [370] = 14, + [421] = 16, + [526] = 14, + [403] = 13, + [529] = 13, + [546] = 14, + [547] = 13, + [548] = 13, + [556] = 27, + [913] = 13, + [915] = 13, + [930] = 16, + [939] = 13, + [943] = 13, + [959] = 13, + [1064] = 13, + [1535] = 15, + [2008] = 13, + [2062] = 12, + [2645] = 19, + [2825] = 12, + [2860] = 16, + [2894] = 12, + [3738] = 17, + [5675] = 17, + [5730] = 12, + [6041] = 13, + [6196] = 13, + [6363] = 17, + [3599] = 17, + [6364] = 17, + [6365] = 17, + [6375] = 17, + [6377] = 17, + [6390] = 12, + [6391] = 12, + [6392] = 12, + [6495] = 17, + [8004] = 13, + [8005] = 13, + [8008] = 13, + [8010] = 13, + [8012] = 14, + [8018] = 17, + [8019] = 17, + [8024] = 17, + [8027] = 17, + [8030] = 17, + [8033] = 17, + [8038] = 17, + [8042] = 15, + [8044] = 15, + [8045] = 15, + [8046] = 15, + [8050] = 15, + [8052] = 15, + [8053] = 15, + [8056] = 15, + [8058] = 15, + [8075] = 17, + [8143] = 17, + [8071] = 17, + [8154] = 17, + [8155] = 17, + [8160] = 17, + [8161] = 17, + [8170] = 17, + [8177] = 12, + [8181] = 17, + [8184] = 17, + [8190] = 17, + [8227] = 17, + [8232] = 17, + [8235] = 17, + [8249] = 17, + [8498] = 15, + [8499] = 15, + [8512] = 17, + [10391] = 13, + [10392] = 13, + [10395] = 13, + [10396] = 13, + [10399] = 17, + [10406] = 17, + [10407] = 17, + [10408] = 17, + [10412] = 15, + [10413] = 15, + [10414] = 15, + [10427] = 12, + [10428] = 12, + [10437] = 17, + [10438] = 17, + [10442] = 17, + [10447] = 15, + [10448] = 15, + [10456] = 17, + [10462] = 17, + [10463] = 17, + [10466] = 13, + [10467] = 13, + [10468] = 13, + [10472] = 15, + [10473] = 15, + [10478] = 17, + [10479] = 17, + [10486] = 17, + [10495] = 17, + [10496] = 17, + [10497] = 17, + [10526] = 17, + [10537] = 17, + [10538] = 17, + [10585] = 17, + [10586] = 17, + [10587] = 17, + [10595] = 17, + [10600] = 17, + [10601] = 17, + [10605] = 16, + [10622] = 13, + [10623] = 13, + [11314] = 15, + [11315] = 15, + [15207] = 13, + [15208] = 13, + [16339] = 17, + [16341] = 17, + [16342] = 17, + [16355] = 17, + [16356] = 17, + [16362] = 17, + [16387] = 17, + [20609] = 13, + [20610] = 13, + [20776] = 13, + [20777] = 13, + [25357] = 13, + [25361] = 17, + [25391] = 13, + [25396] = 13, + [25420] = 13, + [25422] = 13, + [25423] = 13, + [25439] = 16, + [25442] = 16, + [25448] = 13, + [25449] = 13, + [25454] = 15, + [25457] = 15, + [25464] = 15, + [25489] = 17, + [25500] = 17, + [25505] = 17, + [25508] = 17, + [25509] = 17, + [25525] = 12, + [25528] = 17, + [25533] = 17, + [25546] = 15, + [25547] = 15, + [25552] = 17, + [25557] = 17, + [25560] = 17, + [25563] = 17, + [25567] = 17, + [25570] = 17, + [25574] = 17, + [25590] = 13, + [29228] = 15, + [32182] = 12, + [32593] = 14, + [32594] = 14, + [49230] = 15, + [49231] = 15, + [49232] = 15, + [49233] = 15, + [49235] = 15, + [49236] = 15, + [49237] = 13, + [49238] = 13, + [49270] = 16, + [49271] = 16, + [49272] = 13, + [49273] = 13, + [49275] = 13, + [49276] = 13, + [49277] = 13, + [49283] = 14, + [49284] = 14, + [51505] = 16, + [51514] = 16, + [51730] = 17, + [51988] = 17, + [51991] = 17, + [51992] = 17, + [51993] = 17, + [51994] = 17, + [55458] = 13, + [55459] = 13, + [57622] = 17, + [57720] = 17, + [57721] = 17, + [57722] = 17, + [57994] = 15, + [58580] = 12, + [58581] = 12, + [58582] = 12, + [58643] = 17, + [58649] = 17, + [58652] = 17, + [58656] = 17, + [58699] = 17, + [58703] = 17, + [58704] = 17, + [58731] = 17, + [58734] = 17, + [58737] = 17, + [58739] = 17, + [58741] = 17, + [58745] = 17, + [58746] = 17, + [58749] = 17, + [58751] = 17, + [58753] = 17, + [58755] = 17, + [58756] = 17, + [58757] = 17, + [58771] = 17, + [58773] = 17, + [58774] = 17, + [58785] = 17, + [58789] = 17, + [58790] = 17, + [58794] = 17, + [58795] = 17, + [58796] = 17, + [58801] = 17, + [58803] = 17, + [58804] = 17, + [59156] = 9, + [59158] = 9, + [59159] = 9, + [60043] = 16, + [61299] = 15, + [61300] = 15, + [61301] = 15, + [61649] = 15, + [61657] = 15, + [1130] = 14, + [14323] = 14, + [14324] = 14, + [14325] = 14, + [53338] = 14, + [1978] = 14, + [13549] = 14, + [13550] = 14, + [13551] = 14, + [13552] = 14, + [13553] = 14, + [13554] = 14, + [13555] = 14, + [25295] = 14, + [27016] = 14, + [49000] = 14, + [49001] = 14, + [3044] = 15, + [14281] = 15, + [14282] = 15, + [14283] = 15, + [14284] = 15, + [14285] = 15, + [14286] = 15, + [14287] = 15, + [27019] = 15, + [49044] = 15, + [49045] = 15, + [136] = 14, + [3111] = 14, + [3661] = 14, + [3662] = 14, + [13542] = 14, + [13543] = 14, + [13544] = 14, + [27046] = 14, + [48989] = 14, + [48990] = 14, + [781] = 12, + [1002] = 13, + [1462] = 14, + [1495] = 15, + [14269] = 15, + [14270] = 15, + [14271] = 15, + [36916] = 15, + [53339] = 15, + [1499] = 12, + [14310] = 12, + [14311] = 12, + [1510] = 14, + [14294] = 14, + [14295] = 14, + [27022] = 14, + [58431] = 14, + [58434] = 14, + [1513] = 16, + [14326] = 16, + [14327] = 16, + [1543] = 15, + [2643] = 15, + [14288] = 15, + [14289] = 15, + [14290] = 15, + [25294] = 15, + [27021] = 15, + [49047] = 15, + [48048] = 15, + [2974] = 14, + [3034] = 15, + [3043] = 14, + [3045] = 12, + [5116] = 15, + [5384] = 12, + [6197] = 14, + [13795] = 12, + [14302] = 12, + [14303] = 12, + [14304] = 12, + [14305] = 12, + [27023] = 12, + [49055] = 12, + [49056] = 12, + [13809] = 12, + [13813] = 12, + [14316] = 12, + [14317] = 12, + [27025] = 12, + [49066] = 12, + [49067] = 12, + [2973] = 12, + [14260] = 12, + [14261] = 12, + [14262] = 12, + [14263] = 12, + [14264] = 12, + [14265] = 12, + [14266] = 12, + [27014] = 12, + [48995] = 12, + [48996] = 12, + [19263] = 7, + [19801] = 15, + [20736] = 15, + [19434] = 15, + [20900] = 15, + [20901] = 15, + [20902] = 15, + [20903] = 15, + [20904] = 15, + [27065] = 15, + [49049] = 15, + [49050] = 15, + [19306] = 15, + [20909] = 15, + [20910] = 15, + [27067] = 15, + [48998] = 15, + [48999] = 15, + [19386] = 15, + [24132] = 15, + [24133] = 15, + [27068] = 15, + [49011] = 15, + [49012] = 15, + [34026] = 15, + [56641] = 13, + [34120] = 13, + [49051] = 13, + [49052] = 13, + [34477] = 15, + [34600] = 12, + [53271] = 15, + [53351] = 15, + [61005] = 15, + [61006] = 15, + [53301] = 15, + [60051] = 15, + [60052] = 15, + [60053] = 15, + [60192] = 15, + [62757] = 4, + [3674] = 15, + [63668] = 15, + [63669] = 15, + [63670] = 15, + [63671] = 15, + [63672] = 15, + [19577] = 15, + [19574] = 15, + [34490] = 15, + [19503] = 15, + [53209] = 15, + [12042] = 9, + [12043] = 9, + [31589] = 14, + [12472] = 12, + [11958] = 9, + [31687] = 12, + [44572] = 15, + [20216] = 12, + [53563] = 14, + [53595] = 14, + [20375] = 17, + [35395] = 15, + [53385] = 12, + [20066] = 15, + [14751] = 7, + [10060] = 15, + [33206] = 15, + [47788] = 15, + [15487] = 15, + [15473] = 12, + [47585] = 7, + [64044] = 15, + [51662] = 21, + [13877] = 29, + [13750] = 7, + [51690] = 29, + [14278] = 22, + [16511] = 21, + [36554] = 22, + [51713] = 7, + [16166] = 7, + [30706] = 17, + [51490] = 7, + [17364] = 15, + [60103] = 15, + [51533] = 12, + [16188] = 7, + [974] = 14, + [61295] = 15, + [18223] = 14, + [19028] = 14, + [18708] = 7, + [47193] = 12, + [12328] = 3, + [46924] = 3, + [12323] = 4, + [12292] = 3, + [23881] = 6, + [23892] = 6, + [23893] = 6, + [23894] = 6, + [25251] = 6, + [30335] = 6, + [12809] = 6, + [50720] = 5, + [46968] = 3 + +--Blink uses templateNumber 1. +--so does Fire Blast +} + +--format: [templateNumber] = {powerLine, powerType, cooldownLine, rangeLine, castLine} +--powerLine tells which line cost is located. powerType is the type of resource. +--cooldownLine is which line cooldowns are located. +local TemplateTable = +{ + [1] = {0, 0, 6, 3, 0}, + [2] = {3, 1, 0, 4, 0}, + [3] = {3, 1, 6, 0, 0}, + [4] = {3, 1, 0, 0, 0}, + [5] = {0, 0, 0, 3, 0}, + [6] = {3, 1, 6, 4, 0}, + [7] = {0, 0, 3, 0, 0}, + [8] = {3, 1, 0, 4, 5}, + [9] = {0, 0, 4, 0, 0}, + [10] = {3, 4294967294, 6, 0, 0}, + [11] = {3, 1, 6, 4, 5}, + [12] = {3, 0, 6, 0, 0}, + [13] = {3, 0, 0, 4, 5}, + [14] = {3, 0, 0, 4, 0}, + [15] = {3, 0, 6, 4, 0}, + [16] = {3, 0, 6, 4, 5}, + [17] = {3, 0, 0, 0, 0}, + [18] = {5, 0, 8, 6, 7}, + [19] = {3, 0, 0, 0, 5}, + [20] = {3, 4294967294, 0, 4, 0}, + [21] = {3, 3, 0, 4, 0}, + [22] = {3, 3, 6, 4, 0}, + [23] = {0, 0, 0, 3, 5}, + [24] = {0, 0, 0, 0, 0}, + [25] = {3, 3, 0, 0, 0}, + [26] = {5, 0, 0, 6, 0}, + [27] = {3, 0, 6, 0, 5}, + [28] = {5, 0, 8, 6, 0}, + [29] = {3, 3, 6, 0, 0} +--This reads as "Template Number 1 has a Mana Cost value on line 3, and a cooldown on line 6." +} + +--Don't touch this table if you're editing tooltips, it's used for optimization and data storing. +--data table for tooltip correction +--format [spellid] = {powerLine, powerVal, powerType, cooldownLine, CD val, rangeLine, rangeVal, updateVal?, castLine, castVal} +local dataTable = {} + + + +local function GetTipNum() + TipNum = GameTooltip:NumLines() +end + +local function GetID() + _, _, TipID = GameTooltip:GetSpell() +end + + +local function RequestIDCheck(spellid) + + AIO.Handle("TooltipAIO", "HasSpellID", spellid) + +end + + +function tTHandler.ReceiveIDCheck(player, check) + spellCheck = check +end + +function RequestSpellCost(spellid) + + if(dataTable[spellid]) then + + if(dataTable[spellid][8]) then + AIO.Handle("TooltipAIO", "CostGrabber", spellid) + --AIO.Handle("TooltipAIO", "CooldownGrabber", spellid) no shuch function in TooltipCorrectorServer + dataTable[spellid][8] = false + --print("updating values") + skipCheck = true + else + --print("no need to updates values") + skipCheck = false + end + else + + AIO.Handle("TooltipAIO", "CostGrabber", spellid) + + local skipCheck = true + local tmpTemplate = TemplateTable[TaggedSpells[spellid]] + local insertFmt = {tmpTemplate[1], 0, tmpTemplate[2], tmpTemplate[3], 0, tmpTemplate[4], 0, true, tmpTemplate[5], 0} + dataTable[spellid] = insertFmt + + + dataTable[spellid][8] = false + end + +end + +function tTHandler.RefreshTable(player) + + for k,v in pairs(dataTable) do + dataTable[k][8] = true + end +end + +function tTHandler.ReceiveCostGrab(player, cost, powerType) + --print(cost) + + modCost = cost + dataTable[TipID][2] = modCost + dataTable[TipID][3] = powerType +--print("ReceiveCostGrab Fired") +end + +function tTHandler.ReceiveCDGrab(player, cooldown) + --print(cooldown) + modCooldown = (cooldown / 1000) + dataTable[TipID][5] = modCooldown + --print("ReceiveCDGrab Fired") +end + +function tTHandler.ReceiveRangeGrab(player, range) + + modRange = range + dataTable[TipID][7] = modRange +end + +function tTHandler.ReceiveCastTime(player, castTime) + modCastTime = castTime + dataTable[TipID][10] = modCastTime +end + +local function EnumerateTooltipLines_helper(...) + --this grabs all the lines from the original tooltip, and stores them. + for x = 1, select("#", ...) do + --print(x .. " Enumeratedtooltiplinevar") + local region = select(x, ...) + if region and region:GetObjectType() == "FontString" then + local text = region:GetText() -- string or nil + --print(x .. " was X, and the text is " .. text) + --print(x) + --print(text) + tab[x] = text + end + end + + +end + +function EnumerateTooltipLines(tooltip) + EnumerateTooltipLines_helper(tooltip:GetRegions()) +end + +function tTHandler.UpdateTooltips() + + local powerString + if(dataTable[TipID][3] == 0) then + powerString = " Mana" + elseif(dataTable[TipID][3] == 1) then + powerString = " Rage" + elseif(dataTable[TipID][3] == 2) then + powerString = " Focus" + elseif(dataTable[TipID][3] == 3) then + powerString = " Energy" + elseif(dataTable[TipID][3] > 8) then + powerString = " Health" + end + + + + for x = 10, 35 do + + if(x == (dataTable[TipID][1] + 9)) then + if(dataTable[TipID][3] == 1) then + tab[x] = (dataTable[TipID][2] / 10) .. powerString + else + tab[x] = dataTable[TipID][2] .. powerString + end + + end + + if(x == (dataTable[TipID][4] + 9)) then + tab[x] = dataTable[TipID][5] .. " sec cooldown" + end + + if(x == dataTable[TipID][6] + 9) then + tab[x] = dataTable[TipID][7] .. " yds" + end + + if(x == dataTable[TipID][9] + 9) then + tab[x] = (dataTable[TipID][10] / 1000) .. " sec cast" + end + + end + + + + local i = 10 + GameTooltip:ClearLines () + while i <= 35 do + if(i <= 13) then + GameTooltip:AddDoubleLine (tab[i], tab[i+1],1, 1, 1,1, 1, 1) + i = i + 2 + + elseif (tab[i]) then + GameTooltip:AddLine (tab[i], 1, 0.82, 0, true) + i = i + 1 + else + i = i + 1 + end + end + GameTooltip:Show() + currentlyProcessing = false + local o = 10 + while o <= 35 do + tab[o] = nil + o = o + 1 + end +end + +function locUpdateTooltips() + + local powerString + if(dataTable[TipID][3] == 0) then + powerString = " Mana" + elseif(dataTable[TipID][3] == 1) then + powerString = " Rage" + elseif(dataTable[TipID][3] == 2) then + powerString = " Focus" + elseif(dataTable[TipID][3] == 3) then + powerString = " Energy" + elseif(dataTable[TipID][3] > 8) then + powerString = " Health" + end + + + for x = 10, 35 do + + if(x == (dataTable[TipID][1] + 9)) then + if(dataTable[TipID][3] == 1) then + tab[x] = (dataTable[TipID][2] / 10) .. powerString + else + tab[x] = dataTable[TipID][2] .. powerString + end + + end + + if(x == (dataTable[TipID][4] + 9)) then + tab[x] = dataTable[TipID][5] .. " sec cooldown" + end + + if(x == dataTable[TipID][6] + 9) then + tab[x] = dataTable[TipID][7] .. " yds" + end + + if(x == dataTable[TipID][9] + 9) then + if(dataTable[TipID][10] == 0) then + tab[x] = "Instant cast" + else + tab[x] = (dataTable[TipID][10] / 1000) .. " sec cast" + end + end + end + + local i = 10 + GameTooltip:ClearLines () + + while i <= 35 do + if(i <= 13) then + GameTooltip:AddDoubleLine (tab[i], tab[i+1],1, 1, 1,1, 1, 1) + i = i + 2 + + elseif (tab[i]) then + GameTooltip:AddLine (tab[i], 1, 0.82, 0, true) + i = i + 1 + else + i = i + 1 + end + end + GameTooltip:Show() + currentlyProcessing = false + local o = 10 + while o <= 35 do + tab[o] = nil + o = o + 1 + end + +end + +local function GetCorrection(spellID) + --z var for ensuring ordered entries. + + tempNum = TaggedSpells[spellID] + pTemplateTable = TemplateTable[tempNum] + +end + + +local function ModifyTip () + if(currentlyProcessing == false) then + currentlyProcessing = true + if(GameTooltip:GetSpell ()) then + --skip check if training frame and spell is known-- + local frame = GetMouseFocus() + if (frame and frame:GetName()) then + if string.find(frame:GetName(), "TrainingFrame") then + local spellname,rank,spellid = GameTooltip:GetSpell() + if (GameTooltip:GetSpell() and IsSpellLearned(spellid) and (GetItemCount(1101243) > 0)) then + return false + end + end + end + -- end-- + GetID() + if(TaggedSpells[TipID]) then + GetTipNum() + GetCorrection(TipID) + + EnumerateTooltipLines(GameTooltip) + RequestSpellCost(TipID) + if((dataTable[TipID][8] == false) and (skipCheck == false)) then + locUpdateTooltips() + end + else + currentlyProcessing = false + end + else + currentlyProcessing = false + end + elseif(not GameTooltip:GetSpell()) then + currentlyProcessing = false + end +end + +GameTooltip:HookScript("OnShow", ModifyTip) + + + +--Standart interface Changes----Standart interface Changes----Standart interface Changes----Standart interface Changes----Standart interface Changes----Standart interface Changes----Standart interface Changes----Standart interface Changes----Standart interface Changes----Standart interface Changes----Standart interface Changes-- + +local SpellCost_ActionButtonAscension = { +} --data holding archive, spell entry = cost,powertype,range + + + +function UpdateUsableAscension (self) + local name = self:GetName(); + local icon = _G[name.."Icon"]; + local normalTexture = _G[name.."NormalTexture"]; + local isUsable, notEnoughMana = IsUsableAction(self.action); + + local type, id, subType, spellID = GetActionInfo(self.action) + + if (SpellCost_ActionButtonAscension[spellID]) then + local resource = 0 + -- rage exception + if (SpellCost_ActionButtonAscension[spellID][2] == 1) then + resource = SpellCost_ActionButtonAscension[spellID][1]/10 + else + resource = SpellCost_ActionButtonAscension[spellID][1] + end + -- end of rage exception + if UnitPower("player",SpellCost_ActionButtonAscension[spellID][2]) < resource then + notEnoughMana = true + isUsable = false + --print("Not Enough Resource for Spell "..spellID.." of type "..SpellCost_ActionButtonAscension[spellID][2].."\n Current amount of this resource: "..UnitPower("player",SpellCost_ActionButtonAscension[spellID][2]).." Needed: "..SpellCost_ActionButtonAscension[spellID][1]) + else + notEnoughMana = false + isUsable = true + end + end + --notEnoughMana = true + --isUsable = false + if ( isUsable ) then + icon:SetVertexColor(1.0, 1.0, 1.0); + normalTexture:SetVertexColor(1.0, 1.0, 1.0); + elseif ( notEnoughMana ) then + icon:SetVertexColor(0.5, 0.5, 1.0); + normalTexture:SetVertexColor(0.5, 0.5, 1.0); + else + icon:SetVertexColor(0.4, 0.4, 0.4); + normalTexture:SetVertexColor(1.0, 1.0, 1.0); + end +end + +ActionButton_UpdateUsable = UpdateUsableAscension + +function ActionButtonAscension_OnUpdate (self, elapsed) + if ( ActionButton_IsFlashing(self) ) then + local flashtime = self.flashtime; + flashtime = flashtime - elapsed; + + if ( flashtime <= 0 ) then + local overtime = -flashtime; + if ( overtime >= ATTACK_BUTTON_FLASH_TIME ) then + overtime = 0; + end + flashtime = ATTACK_BUTTON_FLASH_TIME - overtime; + + local flashTexture = _G[self:GetName().."Flash"]; + if ( flashTexture:IsShown() ) then + flashTexture:Hide(); + else + flashTexture:Show(); + end + end + + self.flashtime = flashtime; + end + + -- Handle range indicator + local rangeTimer = self.rangeTimer; + if ( rangeTimer ) then + rangeTimer = rangeTimer - elapsed; + + if ( rangeTimer <= 0 ) then + local count = _G[self:GetName().."HotKey"]; + local valid = IsActionInRange(self.action); + if ( count:GetText() == RANGE_INDICATOR ) then + if ( valid == 0 ) then + count:Show(); + count:SetVertexColor(1.0, 0.1, 0.1); + elseif ( valid == 1 ) then + count:Show(); + count:SetVertexColor(0.6, 0.6, 0.6); + else + count:Hide(); + end + else + if ( valid == 0 ) then + count:SetVertexColor(1.0, 0.1, 0.1); + else + count:SetVertexColor(0.6, 0.6, 0.6); + end + end + rangeTimer = TOOLTIP_UPDATE_TIME; + end + + self.rangeTimer = rangeTimer; + end + ActionButton_UpdateUsable(self) +end +ActionButton_OnUpdate = ActionButtonAscension_OnUpdate + +--Initalizate spell costs +function ActionButton_UpdateStateAscension (button) + assert(button); + + local action = button.action; + if ( IsCurrentAction(action) or IsAutoRepeatAction(action) ) then + button:SetChecked(1); + else + button:SetChecked(0); + end + + -- Spell Cost Custom Thing-- + local type, id, subType, spellID = GetActionInfo(button.action) + if (spellID) and TaggedSpells[spellID] then + AIO.Handle("TooltipAIO", "SpellCostGrabber", spellID) + end + -- Spell Cost Custom Thing-- +end + +ActionButton_UpdateState = ActionButton_UpdateStateAscension + + function tTHandler.GetSpellCost(player,Cost,Type,Range,spellid) + SpellCost_ActionButtonAscension[spellid] = {Cost, Type,Range} + --print("spellid "..spellid.." of Type "..Type) + end \ No newline at end of file diff --git a/TheClassMaskingSolution/TooltipCorrectorServer.lua b/TheClassMaskingSolution/TooltipCorrectorServer.lua new file mode 100644 index 0000000..f08ded4 --- /dev/null +++ b/TheClassMaskingSolution/TooltipCorrectorServer.lua @@ -0,0 +1,62 @@ +-- the lua script for grabbing if the player has a certain spellid learned. + +local AIO = AIO or require ("AIO") + +local tTHandler = AIO.AddHandlers ("TooltipAIO", {}) + +function tTHandler.HasSpellID(player, spellid) + --AIO ADDITIONAL CHECK-- + local expectedData = {"number"} + local values = {spellid} + if not(DataTypeCheck(expectedData, values)) then + return false + end + --MAIN ACTION-- + local y = player:HasSpell(spellid) + AIO.Handle(player, "TooltipAIO", "ReceiveIDCheck", y) + +end + +function tTHandler.CostGrabber(player, spellid) + --AIO ADDITIONAL CHECK-- + local expectedData = {"number"} + local values = {spellid} + if not(DataTypeCheck(expectedData, values)) then + return false + end + --MAIN ACTION-- + local y = player:GetSpellCost(spellid) + local x = player:GetSpellCooldown(spellid) + local z = player:GetSpellRange(spellid) + local w = player:GetSpellPowerType(spellid) + local v = player:GetSpellCastTime(spellid) + + AIO.Handle(player, "TooltipAIO", "ReceiveCostGrab", y, w) + AIO.Handle(player, "TooltipAIO", "ReceiveCDGrab", x) + AIO.Handle(player, "TooltipAIO", "ReceiveRangeGrab", z) + AIO.Handle(player, "TooltipAIO", "ReceiveCastTime", v) + AIO.Handle(player, "TooltipAIO", "UpdateTooltips") +end + +function tTHandler.SendRefresh(event, player, spellid) + AIO.Handle(player, "TooltipAIO", "RefreshTable") +end + +function tTHandler.SpellCostGrabber(player,spellid) + --AIO ADDITIONAL CHECK-- + local expectedData = {"number"} + local values = {spellid} + if not(DataTypeCheck(expectedData, values)) then + return false + end + --MAIN ACTION-- + + local Cost = player:GetSpellCost(spellid) + local Type = player:GetSpellPowerType(spellid) + local Range = player:GetSpellRange(spellid) + +AIO.Handle(player, "TooltipAIO", "GetSpellCost", Cost,Type,Range,spellid) +end + +RegisterPlayerEvent(45, tTHandler.SendRefresh) + diff --git a/TheClassMaskingSolution/TooltipCorrectorServer_range.lua-- b/TheClassMaskingSolution/TooltipCorrectorServer_range.lua-- new file mode 100644 index 0000000..0fcd268 --- /dev/null +++ b/TheClassMaskingSolution/TooltipCorrectorServer_range.lua-- @@ -0,0 +1,69 @@ +-- the lua script for grabbing if the player has a certain spellid learned. + +local AIO = AIO or require ("AIO") + +local tTHandler = AIO.AddHandlers ("TooltipAIO", {}) + +function tTHandler.HasSpellID(player, spellid) + --AIO ADDITIONAL CHECK-- + local expectedData = {"number"} + local values = {spellid} + if not(DataTypeCheck(expectedData, values)) then + return false + end + --MAIN ACTION-- + local y = player:HasSpell(spellid) + AIO.Handle(player, "TooltipAIO", "ReceiveIDCheck", y) + +end + +function tTHandler.CostGrabber(player, spellid) + --AIO ADDITIONAL CHECK-- + local expectedData = {"number"} + local values = {spellid} + if not(DataTypeCheck(expectedData, values)) then + return false + end + --MAIN ACTION-- + local y = player:GetSpellCost(spellid) + local x = player:GetSpellCooldown(spellid) + local z = player:GetSpellRange(spellid) + local w = player:GetSpellPowerType(spellid) + local v = player:GetSpellCastTime(spellid) + + AIO.Handle(player, "TooltipAIO", "ReceiveCostGrab", y, w) + AIO.Handle(player, "TooltipAIO", "ReceiveCDGrab", x) + AIO.Handle(player, "TooltipAIO", "ReceiveRangeGrab", z) + AIO.Handle(player, "TooltipAIO", "ReceiveCastTime", v) + AIO.Handle(player, "TooltipAIO", "UpdateTooltips") +end + +function tTHandler.SendRefresh(event, player, spellid) + AIO.Handle(player, "TooltipAIO", "RefreshTable") +end + +function tTHandler.SpellCostGrabber(player,spellid) + --AIO ADDITIONAL CHECK-- + local expectedData = {"number"} + local values = {spellid} + if not(DataTypeCheck(expectedData, values)) then + return false + end + --MAIN ACTION-- + + local Cost = player:GetSpellCost(spellid) + local Type = player:GetSpellPowerType(spellid) + local Range = player:GetSpellRange(spellid) + +AIO.Handle(player, "TooltipAIO", "GetSpellCost", Cost,Type,Range,spellid) +end + +function tTHandler.GetDistance(player) + if (player:GetPlayerTarget()) then + local dist = player:GetDistance(player:GetPlayerTarget()) + AIO.Handle(player, "TooltipAIO", "Distance", dist) +end +end + +RegisterPlayerEvent(45, tTHandler.SendRefresh) + diff --git a/TheClassMaskingSolution/TooltipCorrector_range.lua-- b/TheClassMaskingSolution/TooltipCorrector_range.lua-- new file mode 100644 index 0000000..99062a1 --- /dev/null +++ b/TheClassMaskingSolution/TooltipCorrector_range.lua-- @@ -0,0 +1,2183 @@ +local AIO = AIO or require ("AIO") + +if AIO.AddAddon() then + return +end + +local tTHandler = AIO.AddHandlers ("TooltipAIO", {}) + +local TipNum + +local TipID + +local spellCheck = false + +local modCost + +local modCastTime + +local modRange + +local modCooldown + +local tempNum + +local pTemplateTable + +local skipCheck + +currentlyProcessing = false + + +--TODO: Polish passes on spell entries +--TODO: Deal with "request interference" +--TODO: make the tooltips pretty(?) + + +--used to read tooltip +local tab = {} + +--format: [spellid] = templateNumber +--templateNumber refers to the templateTable. +local TaggedSpells = +{ + [100] = 1, + [6178] = 1, + [11578] = 1, + [772] = 2, + [6546] = 2, + [6547] = 2, + [6548] = 2, + [11572] = 2, + [11573] = 2, + [11574] = 2, + [25208] = 2, + [46845] = 2, + [47465] = 2, + [6343] = 3, + [8198] = 3, + [8204] = 3, + [8205] = 3, + [11580] = 3, + [11581] = 3, + [25264] = 3, + [47501] = 3, + [47501] = 3, + [6673] = 4, + [5242] = 4, + [6192] = 4, + [11549] = 4, + [11550] = 4, + [11551] = 4, + [25289] = 4, + [2048] = 4, + [47436] = 4, + [34428] = 5, + [72] = 6, + [1671] = 6, + [1672] = 6, + [29704] = 6, + [78] = 4, + [284] = 4, + [285] = 4, + [1608] = 4, + [11564] = 4, + [11565] = 4, + [11566] = 4, + [11567] = 4, + [25286] = 4, + [29707] = 4, + [30324] = 4, + [47449] = 4, + [47450] = 4, + [469] = 4, + [47439] = 4, + [47440] = 4, + [676] = 6, + [694] = 6, + [7400] = 6, + [7402] = 6, + [20559] = 6, + [20560] = 6, + [25266] = 6, + [47504] = 6, + [845] = 4, + [7369] = 4, + [11608] = 4, + [11609] = 4, + [20569] = 4, + [25231] = 4, + [47519] = 4, + [47520] = 4, + [871] = 7, + [1160] = 4, + [6190] = 4, + [11554] = 4, + [11555] = 4, + [11556] = 4, + [25202] = 4, + [25203] = 4, + [47437] = 4, + [1161] = 3, + [1464] = 8, + [8820] = 8, + [11604] = 8, + [11605] = 8, + [25241] = 8, + [25242] = 8, + [47474] = 8, + [47475] = 8, + [1680] = 3, + [1715] = 2, + [1719] = 9, + [2565] = 9, + [2687] = 10, + [3411] = 6, + [5246] = 6, + [5308] = 2, + [20658] = 2, + [20660] = 2, + [20661] = 2, + [20662] = 2, + [25234] = 2, + [25236] = 2, + [47470] = 2, + [47471] = 2, + [6552] = 6, + [6554] = 6, + [6572] = 6, + [6574] = 6, + [7379] = 6, + [11600] = 6, + [11601] = 6, + [25288] = 6, + [25269] = 6, + [30357] = 6, + [57823] = 6, + [7384] = 6, + [7887] = 6, + [11584] = 6, + [11585] = 6, + [18499] = 7, + [20230] = 9, + [20252] = 6, + [20616] = 6, + [20617] = 6, + [25272] = 6, + [25275] = 6, + [12294] = 6, + [21551] = 6, + [21552] = 6, + [21553] = 6, + [25248] = 6, + [30330] = 6, + [47485] = 6, + [47486] = 6, + [23920] = 3, + [23922] = 6, + [23923] = 6, + [23924] = 6, + [23925] = 6, + [25258] = 6, + [30356] = 6, + [47487] = 6, + [47488] = 6, + [20243] = 2, + [30016] = 2, + [30022] = 2, + [47497] = 2, + [47498] = 2, + [55694] = 3, + [57755] = 1, + [64382] = 11, + [498] = 12, + [635] = 13, + [639] = 13, + [647] = 13, + [1026] = 13, + [1042] = 13, + [3472] = 13, + [10328] = 13, + [10329] = 13, + [25292] = 13, + [27135] = 13, + [27136] = 13, + [48781] = 13, + [48782] = 13, + [19740] = 14, + [19834] = 14, + [19835] = 14, + [19836] = 14, + [19837] = 14, + [19838] = 14, + [25291] = 14, + [27140] = 14, + [48931] = 14, + [48932] = 14, + [19742] = 14, + [19850] = 14, + [19852] = 14, + [19853] = 14, + [19854] = 14, + [25290] = 14, + [27142] = 14, + [48935] = 14, + [48936] = 14, + [20911] = 14, + [25898] = 14, + [25782] = 14, + [25916] = 14, + [27141] = 14, + [48933] = 14, + [48934] = 14, + [25899] = 14, + [25894] = 14, + [25918] = 14, + [27143] = 14, + [48937] = 14, + [48938] = 14, + [1044] = 15, + [1038] = 15, + [1022] = 15, + [5599] = 15, + [10278] = 15, + [6940] = 15, + [20271] = 15, + [633] = 1, + [2800] = 1, + [10310] = 1, + [27154] = 1, + [48788] = 1, + [642] = 12, + [853] = 15, + [5588] = 15, + [5589] = 15, + [10308] = 15, + [879] = 16, + [5614] = 16, + [5615] = 16, + [10312] = 16, + [10313] = 16, + [10314] = 16, + [27138] = 16, + [48800] = 16, + [48801] = 16, + [1152] = 14, + [4987] = 14, + [2812] = 12, + [10318] = 12, + [27139] = 12, + [48816] = 12, + [48817] = 12, + [7328] = 13, + [10322] = 13, + [10324] = 13, + [20772] = 13, + [20773] = 13, + [48949] = 13, + [48950] = 13, + [10326] = 13, + [19750] = 13, + [19939] = 13, + [19940] = 13, + [19941] = 13, + [19942] = 13, + [19943] = 13, + [27137] = 13, + [48784] = 13, + [48785] = 13, + [19752] = 1, + [20116] = 12, + [26573] = 12, + [20922] = 12, + [20923] = 12, + [20924] = 12, + [27173] = 12, + [48818] = 12, + [48819] = 12, + [20164] = 17, + [20165] = 17, + [20166] = 17, + [20217] = 14, + [20925] = 12, + [20927] = 12, + [20928] = 12, + [27179] = 12, + [48951] = 12, + [48952] = 12, + [20473] = 18, + [20929] = 18, + [20930] = 18, + [27174] = 18, + [33072] = 18, + [48824] = 18, + [48825] = 18, + [24275] = 16, + [24274] = 16, + [24239] = 16, + [27180] = 16, + [48805] = 16, + [48806] = 16, + [31789] = 1, + [31884] = 12, + [31935] = 15, + [32699] = 15, + [32700] = 15, + [48826] = 15, + [48827] = 15, + [53407] = 16, + [53408] = 16, + [53600] = 15, + [61411] = 15, + [53601] = 14, + [53720] = 17, + [54428] = 9, + [62124] = 15, + [116] = 13, + [205] = 13, + [837] = 13, + [7322] = 13, + [8406] = 13, + [8407] = 13, + [8408] = 13, + [10179] = 13, + [10180] = 13, + [10181] = 13, + [25304] = 13, + [27071] = 13, + [27072] = 13, + [38697] = 13, + [42841] = 13, + [42842] = 13, + [133] = 13, + [143] = 13, + [145] = 13, + [3140] = 13, + [8400] = 13, + [8401] = 13, + [8402] = 13, + [10148] = 13, + [10149] = 13, + [10150] = 13, + [10151] = 13, + [25306] = 13, + [27070] = 13, + [38692] = 13, + [42832] = 13, + [42833] = 13, + [1459] = 14, + [1460] = 14, + [1461] = 14, + [10156] = 14, + [10157] = 14, + [27126] = 14, + [42995] = 14, + [2136] = 15, + [2137] = 15, + [2138] = 15, + [8412] = 15, + [8413] = 15, + [10197] = 15, + [10199] = 15, + [27078] = 15, + [27079] = 15, + [42872] = 15, + [42873] = 15, + [10] = 13, + [6141] = 13, + [8427] = 13, + [10185] = 13, + [10186] = 13, + [10187] = 13, + [27085] = 13, + [42939] = 13, + [42940] = 13, + [66] = 12, + [118] = 13, + [12824] = 13, + [12825] = 13, + [12826] = 13, + [28271] = 13, + [28272] = 13, + [61025] = 13, + [61305] = 13, + [61721] = 13, + [61780] = 13, + [71319] = 13, + [120] = 12, + [8492] = 12, + [10159] = 12, + [10160] = 12, + [10161] = 12, + [27087] = 12, + [42930] = 12, + [42931] = 12, + [122] = 12, + [865] = 12, + [6131] = 12, + [10230] = 12, + [27088] = 12, + [42917] = 12, + [130] = 14, + [475] = 14, + [543] = 12, + [8457] = 12, + [8458] = 12, + [10223] = 12, + [10225] = 12, + [27128] = 12, + [43010] = 12, + [6143] = 12, + [8461] = 12, + [8462] = 12, + [10177] = 12, + [28609] = 12, + [32796] = 12, + [43012] = 12, + [604] = 14, + [8450] = 14, + [8451] = 14, + [10173] = 14, + [10174] = 14, + [33944] = 14, + [43015] = 14, + [759] = 19, + [5513] = 19, + [8007] = 19, + [8008] = 19, + [22044] = 19, + [33312] = 19, + [5349] = 19, + [1113] = 19, + [1487] = 19, + [990] = 19, + [8075] = 19, + [8076] = 19, + [22895] = 19, + [22019] = 19, + [5350] = 19, + [2288] = 19, + [3772] = 19, + [8077] = 19, + [8078] = 19, + [8079] = 19, + [30703] = 19, + [22018] = 19, + [1008] = 14, + [8455] = 14, + [10169] = 14, + [10170] = 14, + [27130] = 14, + [33946] = 14, + [43017] = 14, + [1449] = 17, + [8437] = 17, + [8438] = 17, + [8439] = 17, + [10201] = 17, + [10202] = 17, + [27080] = 17, + [27082] = 17, + [42920] = 17, + [42921] = 17, + [1463] = 17, + [8494] = 17, + [8495] = 17, + [10191] = 17, + [10192] = 17, + [10193] = 17, + [27131] = 17, + [43019] = 17, + [43020] = 17, + [1953] = 12, + [2120] = 13, + [2121] = 13, + [8422] = 13, + [8423] = 13, + [10215] = 13, + [10216] = 13, + [27086] = 13, + [42925] = 13, + [42926] = 13, + [2139] = 15, + [2948] = 13, + [8444] = 13, + [8445] = 13, + [8446] = 13, + [10205] = 13, + [10206] = 13, + [10207] = 13, + [27073] = 13, + [27074] = 13, + [42858] = 13, + [42859] = 13, + [5143] = 14, + [5144] = 14, + [5145] = 14, + [8416] = 14, + [8417] = 14, + [10211] = 14, + [10212] = 14, + [25345] = 14, + [27075] = 14, + [38699] = 14, + [38704] = 14, + [42843] = 14, + [42846] = 14, + [6117] = 17, + [22782] = 17, + [22783] = 17, + [27125] = 17, + [43023] = 17, + [43024] = 17, + [168] = 17, + [7300] = 17, + [7301] = 17, + [7302] = 17, + [7320] = 17, + [10219] = 17, + [10220] = 17, + [27124] = 17, + [43008] = 17, + [12051] = 9, + [11366] = 13, + [12505] = 13, + [12522] = 13, + [12523] = 13, + [12524] = 13, + [12525] = 13, + [12526] = 13, + [18809] = 13, + [27132] = 13, + [33938] = 13, + [42890] = 13, + [42891] = 13, + [11113] = 12, + [13018] = 12, + [13019] = 12, + [13020] = 12, + [13021] = 12, + [27133] = 12, + [33933] = 12, + [42944] = 12, + [42945] = 12, + [11426] = 12, + [13031] = 12, + [13032] = 12, + [13033] = 12, + [27134] = 12, + [33405] = 12, + [43038] = 12, + [43039] = 12, + [23028] = 14, + [27127] = 14, + [43002] = 14, + [30449] = 14, + [30451] = 13, + [42894] = 13, + [42896] = 13, + [42897] = 13, + [30455] = 14, + [42913] = 14, + [42914] = 14, + [30482] = 17, + [43045] = 17, + [43046] = 17, + [31661] = 12, + [33041] = 12, + [33042] = 12, + [33043] = 12, + [42949] = 12, + [42950] = 12, + [42955] = 19, + [43523] = 19, + [43987] = 12, + [58659] = 12, + [44614] = 13, + [47610] = 13, + [44425] = 14, + [44780] = 14, + [44781] = 14, + [45438] = 12, + [55342] = 12, + [44457] = 14, + [55359] = 14, + [55360] = 14, + [172] = 14, + [6222] = 14, + [6223] = 14, + [7648] = 14, + [11671] = 14, + [11672] = 14, + [25311] = 14, + [27216] = 14, + [47812] = 14, + [47813] = 14, + [348] = 13, + [707] = 13, + [1094] = 13, + [2941] = 13, + [11665] = 13, + [11667] = 13, + [11668] = 13, + [25309] = 13, + [27215] = 13, + [47810] = 13, + [47811] = 13, + [688] = 19, + [697] = 19, + [712] = 19, + [691] = 19, + [30146] = 19, + [686] = 13, + [695] = 13, + [705] = 13, + [1088] = 13, + [1106] = 13, + [7641] = 13, + [11659] = 13, + [11660] = 13, + [11661] = 13, + [25307] = 13, + [27209] = 13, + [47808] = 13, + [47809] = 13, + [702] = 14, + [1108] = 14, + [6205] = 14, + [7646] = 14, + [11707] = 14, + [11708] = 14, + [27224] = 14, + [30909] = 14, + [50511] = 14, + [126] = 19, + [132] = 14, + [603] = 15, + [30910] = 15, + [47867] = 15, + [689] = 14, + [699] = 14, + [709] = 14, + [7651] = 14, + [11699] = 14, + [11700] = 14, + [27219] = 14, + [27220] = 14, + [47857] = 14, + [693] = 19, + [16892] = 19, + [16893] = 19, + [16895] = 19, + [16896] = 19, + [22116] = 19, + [36895] = 19, + [687] = 17, + [696] = 17, + [706] = 17, + [1086] = 17, + [11733] = 17, + [11734] = 17, + [11735] = 17, + [27260] = 17, + [47793] = 17, + [47889] = 17, + [698] = 12, + [710] = 13, + [18647] = 13, + [755] = 20, + [3698] = 20, + [3699] = 20, + [3700] = 20, + [11693] = 20, + [11694] = 20, + [11695] = 20, + [27259] = 20, + [47856] = 20, + [980] = 14, + [1014] = 14, + [6217] = 14, + [11711] = 14, + [11712] = 14, + [11713] = 14, + [27218] = 14, + [47863] = 14, + [47864] = 14, + [1098] = 13, + [11725] = 13, + [11726] = 13, + [61191] = 13, + [1120] = 14, + [8288] = 14, + [8289] = 14, + [11675] = 14, + [27217] = 14, + [47855] = 14, + [1490] = 14, + [11721] = 14, + [11722] = 14, + [27228] = 14, + [47865] = 14, + [1714] = 14, + [11719] = 14, + [1949] = 17, + [11683] = 17, + [11684] = 17, + [27213] = 17, + [47823] = 17, + [2362] = 19, + [41192] = 19, + [41193] = 19, + [41194] = 19, + [41195] = 19, + [41196] = 19, + [6366] = 19, + [41169] = 19, + [41171] = 19, + [41172] = 19, + [40773] = 19, + [41173] = 19, + [41174] = 19, + [5138] = 14, + [5484] = 19, + [17928] = 19, + [5576] = 13, + [17919] = 13, + [17920] = 13, + [17921] = 13, + [17922] = 13, + [17923] = 13, + [27210] = 13, + [30459] = 13, + [47814] = 13, + [47815] = 13, + [5697] = 14, + [6201] = 19, + [6202] = 19, + [5699] = 19, + [11729] = 19, + [11730] = 19, + [27230] = 19, + [47871] = 19, + [47878] = 19, + [5740] = 14, + [6219] = 14, + [11677] = 14, + [11678] = 14, + [27212] = 14, + [47819] = 14, + [47820] = 14, + [5782] = 13, + [6213] = 13, + [6215] = 13, + [6229] = 12, + [11739] = 12, + [11740] = 12, + [28610] = 12, + [47890] = 12, + [47891] = 12, + [6353] = 13, + [17924] = 13, + [27211] = 13, + [30545] = 13, + [47824] = 13, + [47825] = 13, + [6789] = 15, + [17925] = 15, + [17926] = 15, + [27223] = 15, + [47859] = 15, + [47860] = 15, + [17877] = 15, + [18867] = 15, + [18868] = 15, + [18869] = 15, + [18870] = 15, + [18871] = 15, + [27263] = 15, + [30546] = 15, + [47826] = 15, + [47827] = 15, + [18220] = 5, + [18937] = 5, + [18938] = 5, + [27265] = 5, + [59092] = 5, + [27243] = 13, + [47835] = 13, + [47836] = 13, + [28176] = 17, + [28189] = 17, + [47892] = 17, + [47893] = 17, + [29722] = 13, + [32231] = 13, + [47837] = 13, + [47838] = 13, + [29858] = 10, + [29893] = 15, + [58887] = 15, + [30108] = 13, + [30404] = 13, + [30405] = 13, + [47841] = 13, + [47843] = 13, + [30283] = 15, + [30413] = 15, + [30414] = 15, + [47846] = 15, + [47847] = 15, + [47897] = 12, + [61290] = 12, + [48018] = 19, + [48020] = 15, + [48181] = 15, + [59161] = 15, + [59163] = 15, + [59164] = 15, + [50796] = 16, + [59170] = 16, + [59171] = 16, + [59172] = 16, + [53] = 21, + [921] = 5, + [1757] = 21, + [1752] = 21, + [1776] = 22, + [1784] = 9, + [408] = 22, + [703] = 21, + [1725] = 22, + [1758] = 21, + [1759] = 21, + [1760] = 21, + [1766] = 22, + [1785] = 9, + [1786] = 9, + [1787] = 9, + [1804] = 23, + [1833] = 21, + [1842] = 23, + [1856] = 9, + [1857] = 9, + [1860] = 24, + [1966] = 22, + [2070] = 21, + [2094] = 22, + [2589] = 21, + [2590] = 21, + [2591] = 21, + [2836] = 24, + [2983] = 9, + [3127] = 24, + [5171] = 25, + [5277] = 9, + [5938] = 21, + [6760] = 21, + [6761] = 21, + [6762] = 21, + [6768] = 22, + [6770] = 21, + [6774] = 25, + [8621] = 21, + [8623] = 21, + [8624] = 21, + [8631] = 21, + [8632] = 21, + [8633] = 21, + [8637] = 22, + [8639] = 21, + [8640] = 21, + [8643] = 22, + [8647] = 21, + [8649] = 21, + [8650] = 21, + [8676] = 21, + [8696] = 9, + [8721] = 21, + [8724] = 21, + [8725] = 21, + [11197] = 21, + [11198] = 21, + [11267] = 21, + [11268] = 21, + [11269] = 21, + [11273] = 21, + [11274] = 21, + [11275] = 21, + [11279] = 21, + [11280] = 21, + [11281] = 21, + [11289] = 21, + [11290] = 21, + [11293] = 21, + [11294] = 21, + [11297] = 21, + [11299] = 21, + [11300] = 21, + [11303] = 22, + [11305] = 9, + [17347] = 21, + [17348] = 21, + [25300] = 21, + [25302] = 22, + [26669] = 9, + [26679] = 22, + [26839] = 21, + [26861] = 21, + [26862] = 21, + [26863] = 21, + [26864] = 21, + [26865] = 21, + [26866] = 21, + [26867] = 21, + [26884] = 21, + [26889] = 9, + [27441] = 21, + [27448] = 22, + [31016] = 21, + [31224] = 9, + [32645] = 21, + [32684] = 21, + [34411] = 21, + [34412] = 21, + [34413] = 21, + [48637] = 21, + [48638] = 21, + [48656] = 21, + [48657] = 21, + [48658] = 22, + [48659] = 22, + [48660] = 21, + [48663] = 21, + [48666] = 21, + [48667] = 21, + [48668] = 21, + [48669] = 21, + [48671] = 21, + [48672] = 21, + [48673] = 22, + [48674] = 22, + [48675] = 21, + [48676] = 21, + [48689] = 21, + [48690] = 21, + [48691] = 21, + [51722] = 22, + [51723] = 25, + [51724] = 21, + [57934] = 22, + [57992] = 21, + [57993] = 21, + [17] = 15, + [592] = 15, + [600] = 15, + [3747] = 15, + [6065] = 15, + [6066] = 15, + [10898] = 15, + [10899] = 15, + [10900] = 15, + [10901] = 15, + [25217] = 15, + [25218] = 15, + [48065] = 15, + [48066] = 15, + [589] = 14, + [594] = 14, + [970] = 14, + [992] = 14, + [2767] = 14, + [10892] = 14, + [10893] = 14, + [10894] = 14, + [25367] = 14, + [25368] = 14, + [48124] = 14, + [48125] = 14, + [585] = 13, + [591] = 13, + [598] = 13, + [984] = 13, + [1004] = 13, + [6060] = 13, + [10933] = 13, + [10934] = 13, + [25363] = 13, + [25364] = 13, + [48122] = 13, + [48123] = 13, + [1243] = 14, + [1244] = 14, + [1245] = 14, + [2791] = 14, + [10937] = 14, + [10938] = 14, + [25389] = 14, + [48161] = 14, + [2050] = 13, + [2052] = 13, + [2053] = 13, + [139] = 14, + [6074] = 14, + [6075] = 14, + [6076] = 14, + [6077] = 14, + [6078] = 14, + [10927] = 14, + [10928] = 14, + [10929] = 14, + [25221] = 14, + [25222] = 14, + [25315] = 14, + [48067] = 14, + [48068] = 14, + [453] = 14, + [527] = 26, + [988] = 26, + [528] = 14, + [552] = 14, + [586] = 12, + [588] = 17, + [7128] = 17, + [602] = 17, + [1006] = 17, + [10951] = 17, + [10952] = 17, + [25431] = 17, + [48040] = 17, + [48168] = 17, + [596] = 13, + [996] = 13, + [10960] = 13, + [10961] = 13, + [25316] = 13, + [25308] = 13, + [48072] = 13, + [605] = 13, + [976] = 14, + [10957] = 14, + [10958] = 14, + [25433] = 14, + [48169] = 14, + [1706] = 14, + [2006] = 13, + [2010] = 13, + [10880] = 13, + [10881] = 13, + [20770] = 13, + [25435] = 13, + [48171] = 13, + [2054] = 13, + [2055] = 13, + [6063] = 13, + [6064] = 13, + [2060] = 13, + [10963] = 13, + [10964] = 13, + [10965] = 13, + [25314] = 13, + [25210] = 13, + [25213] = 13, + [48062] = 13, + [48063] = 13, + [2061] = 13, + [9472] = 13, + [9473] = 13, + [9474] = 13, + [10915] = 13, + [10916] = 13, + [10917] = 13, + [25233] = 13, + [25235] = 13, + [48070] = 13, + [48071] = 13, + [2096] = 14, + [10909] = 14, + [2944] = 14, + [19276] = 14, + [19277] = 14, + [19278] = 14, + [19279] = 14, + [19280] = 14, + [25467] = 14, + [48299] = 14, + [48300] = 14, + [6346] = 15, + [8092] = 16, + [8102] = 16, + [8103] = 16, + [8104] = 16, + [8105] = 16, + [8106] = 16, + [10945] = 16, + [10946] = 16, + [10947] = 16, + [25372] = 16, + [25375] = 16, + [48126] = 16, + [48127] = 16, + [8122] = 12, + [8124] = 12, + [10888] = 12, + [10890] = 12, + [8129] = 13, + [9484] = 13, + [9485] = 13, + [10955] = 13, + [14752] = 14, + [14818] = 14, + [14819] = 14, + [27841] = 14, + [25312] = 14, + [48073] = 14, + [14914] = 16, + [15262] = 16, + [15263] = 16, + [15264] = 16, + [15265] = 16, + [15266] = 16, + [15267] = 16, + [15261] = 16, + [25384] = 16, + [48134] = 16, + [48135] = 16, + [15237] = 17, + [15430] = 17, + [15431] = 17, + [27799] = 17, + [27800] = 17, + [27801] = 17, + [25331] = 17, + [48077] = 17, + [48078] = 17, + [15407] = 14, + [17311] = 14, + [17312] = 14, + [17313] = 14, + [17314] = 14, + [18807] = 14, + [25387] = 14, + [48155] = 14, + [48156] = 14, + [19238] = 12, + [19236] = 12, + [19240] = 12, + [19241] = 12, + [19242] = 12, + [19243] = 12, + [25437] = 12, + [48172] = 12, + [48173] = 12, + [21562] = 14, + [21564] = 14, + [25392] = 14, + [48162] = 14, + [27681] = 14, + [32999] = 14, + [48074] = 14, + [27683] = 14, + [39374] = 14, + [48170] = 14, + [724] = 16, + [27870] = 16, + [27871] = 16, + [28275] = 16, + [48086] = 16, + [48087] = 16, + [32375] = 13, + [32379] = 15, + [32996] = 15, + [48157] = 15, + [48158] = 15, + [32546] = 13, + [48119] = 13, + [48120] = 13, + [33076] = 15, + [48112] = 15, + [48113] = 15, + [34433] = 1, + [34861] = 14, + [34863] = 14, + [34864] = 14, + [34865] = 14, + [34866] = 14, + [48088] = 14, + [48089] = 14, + [34914] = 13, + [34916] = 13, + [34917] = 13, + [48159] = 13, + [48160] = 13, + [48045] = 14, + [53023] = 14, + [47540] = 28, + [53005] = 28, + [53006] = 28, + [53007] = 28, + [64843] = 12, + [64901] = 1, + [331] = 13, + [332] = 13, + [2484] = 12, + [8017] = 17, + [8042] = 15, + [131] = 14, + [325] = 25, + [370] = 14, + [421] = 16, + [526] = 14, + [403] = 13, + [529] = 13, + [546] = 14, + [547] = 13, + [548] = 13, + [556] = 27, + [913] = 13, + [915] = 13, + [930] = 16, + [939] = 13, + [943] = 13, + [959] = 13, + [1064] = 13, + [1535] = 15, + [2008] = 13, + [2062] = 12, + [2645] = 19, + [2825] = 12, + [2860] = 16, + [2894] = 12, + [3738] = 17, + [5675] = 17, + [5730] = 12, + [6041] = 13, + [6196] = 13, + [6363] = 17, + [3599] = 17, + [6364] = 17, + [6365] = 17, + [6375] = 17, + [6377] = 17, + [6390] = 12, + [6391] = 12, + [6392] = 12, + [6495] = 17, + [8004] = 13, + [8005] = 13, + [8008] = 13, + [8010] = 13, + [8012] = 14, + [8018] = 17, + [8019] = 17, + [8024] = 17, + [8027] = 17, + [8030] = 17, + [8033] = 17, + [8038] = 17, + [8042] = 15, + [8044] = 15, + [8045] = 15, + [8046] = 15, + [8050] = 15, + [8052] = 15, + [8053] = 15, + [8056] = 15, + [8058] = 15, + [8075] = 17, + [8143] = 17, + [8071] = 17, + [8154] = 17, + [8155] = 17, + [8160] = 17, + [8161] = 17, + [8170] = 17, + [8177] = 12, + [8181] = 17, + [8184] = 17, + [8190] = 17, + [8227] = 17, + [8232] = 17, + [8235] = 17, + [8249] = 17, + [8498] = 15, + [8499] = 15, + [8512] = 17, + [10391] = 13, + [10392] = 13, + [10395] = 13, + [10396] = 13, + [10399] = 17, + [10406] = 17, + [10407] = 17, + [10408] = 17, + [10412] = 15, + [10413] = 15, + [10414] = 15, + [10427] = 12, + [10428] = 12, + [10437] = 17, + [10438] = 17, + [10442] = 17, + [10447] = 15, + [10448] = 15, + [10456] = 17, + [10462] = 17, + [10463] = 17, + [10466] = 13, + [10467] = 13, + [10468] = 13, + [10472] = 15, + [10473] = 15, + [10478] = 17, + [10479] = 17, + [10486] = 17, + [10495] = 17, + [10496] = 17, + [10497] = 17, + [10526] = 17, + [10537] = 17, + [10538] = 17, + [10585] = 17, + [10586] = 17, + [10587] = 17, + [10595] = 17, + [10600] = 17, + [10601] = 17, + [10605] = 16, + [10622] = 13, + [10623] = 13, + [11314] = 15, + [11315] = 15, + [15207] = 13, + [15208] = 13, + [16339] = 17, + [16341] = 17, + [16342] = 17, + [16355] = 17, + [16356] = 17, + [16362] = 17, + [16387] = 17, + [20609] = 13, + [20610] = 13, + [20776] = 13, + [20777] = 13, + [25357] = 13, + [25361] = 17, + [25391] = 13, + [25396] = 13, + [25420] = 13, + [25422] = 13, + [25423] = 13, + [25439] = 16, + [25442] = 16, + [25448] = 13, + [25449] = 13, + [25454] = 15, + [25457] = 15, + [25464] = 15, + [25489] = 17, + [25500] = 17, + [25505] = 17, + [25508] = 17, + [25509] = 17, + [25525] = 12, + [25528] = 17, + [25533] = 17, + [25546] = 15, + [25547] = 15, + [25552] = 17, + [25557] = 17, + [25560] = 17, + [25563] = 17, + [25567] = 17, + [25570] = 17, + [25574] = 17, + [25590] = 13, + [29228] = 15, + [32182] = 12, + [32593] = 14, + [32594] = 14, + [49230] = 15, + [49231] = 15, + [49232] = 15, + [49233] = 15, + [49235] = 15, + [49236] = 15, + [49237] = 13, + [49238] = 13, + [49270] = 16, + [49271] = 16, + [49272] = 13, + [49273] = 13, + [49275] = 13, + [49276] = 13, + [49277] = 13, + [49283] = 14, + [49284] = 14, + [51505] = 16, + [51514] = 16, + [51730] = 17, + [51988] = 17, + [51991] = 17, + [51992] = 17, + [51993] = 17, + [51994] = 17, + [55458] = 13, + [55459] = 13, + [57622] = 17, + [57720] = 17, + [57721] = 17, + [57722] = 17, + [57994] = 15, + [58580] = 12, + [58581] = 12, + [58582] = 12, + [58643] = 17, + [58649] = 17, + [58652] = 17, + [58656] = 17, + [58699] = 17, + [58703] = 17, + [58704] = 17, + [58731] = 17, + [58734] = 17, + [58737] = 17, + [58739] = 17, + [58741] = 17, + [58745] = 17, + [58746] = 17, + [58749] = 17, + [58751] = 17, + [58753] = 17, + [58755] = 17, + [58756] = 17, + [58757] = 17, + [58771] = 17, + [58773] = 17, + [58774] = 17, + [58785] = 17, + [58789] = 17, + [58790] = 17, + [58794] = 17, + [58795] = 17, + [58796] = 17, + [58801] = 17, + [58803] = 17, + [58804] = 17, + [59156] = 9, + [59158] = 9, + [59159] = 9, + [60043] = 16, + [61299] = 15, + [61300] = 15, + [61301] = 15, + [61649] = 15, + [61657] = 15, + [1130] = 14, + [14323] = 14, + [14324] = 14, + [14325] = 14, + [53338] = 14, + [1978] = 14, + [13549] = 14, + [13550] = 14, + [13551] = 14, + [13552] = 14, + [13553] = 14, + [13554] = 14, + [13555] = 14, + [25295] = 14, + [27016] = 14, + [49000] = 14, + [49001] = 14, + [3044] = 15, + [14281] = 15, + [14282] = 15, + [14283] = 15, + [14284] = 15, + [14285] = 15, + [14286] = 15, + [14287] = 15, + [27019] = 15, + [49044] = 15, + [49045] = 15, + [136] = 14, + [3111] = 14, + [3661] = 14, + [3662] = 14, + [13542] = 14, + [13543] = 14, + [13544] = 14, + [27046] = 14, + [48989] = 14, + [48990] = 14, + [781] = 12, + [1002] = 13, + [1462] = 14, + [1495] = 15, + [14269] = 15, + [14270] = 15, + [14271] = 15, + [36916] = 15, + [53339] = 15, + [1499] = 12, + [14310] = 12, + [14311] = 12, + [1510] = 14, + [14294] = 14, + [14295] = 14, + [27022] = 14, + [58431] = 14, + [58434] = 14, + [1513] = 16, + [14326] = 16, + [14327] = 16, + [1543] = 15, + [2643] = 15, + [14288] = 15, + [14289] = 15, + [14290] = 15, + [25294] = 15, + [27021] = 15, + [49047] = 15, + [48048] = 15, + [2974] = 14, + [3034] = 15, + [3043] = 14, + [3045] = 12, + [5116] = 15, + [5384] = 12, + [6197] = 14, + [13795] = 12, + [14302] = 12, + [14303] = 12, + [14304] = 12, + [14305] = 12, + [27023] = 12, + [49055] = 12, + [49056] = 12, + [13809] = 12, + [13813] = 12, + [14316] = 12, + [14317] = 12, + [27025] = 12, + [49066] = 12, + [49067] = 12, + [2973] = 12, + [14260] = 12, + [14261] = 12, + [14262] = 12, + [14263] = 12, + [14264] = 12, + [14265] = 12, + [14266] = 12, + [27014] = 12, + [48995] = 12, + [48996] = 12, + [19263] = 7, + [19801] = 15, + [20736] = 15, + [19434] = 15, + [20900] = 15, + [20901] = 15, + [20902] = 15, + [20903] = 15, + [20904] = 15, + [27065] = 15, + [49049] = 15, + [49050] = 15, + [19306] = 15, + [20909] = 15, + [20910] = 15, + [27067] = 15, + [48998] = 15, + [48999] = 15, + [19386] = 15, + [24132] = 15, + [24133] = 15, + [27068] = 15, + [49011] = 15, + [49012] = 15, + [34026] = 15, + [56641] = 13, + [34120] = 13, + [49051] = 13, + [49052] = 13, + [34477] = 15, + [34600] = 12, + [53271] = 15, + [53351] = 15, + [61005] = 15, + [61006] = 15, + [53301] = 15, + [60051] = 15, + [60052] = 15, + [60053] = 15, + [60192] = 15, + [62757] = 4, + [3674] = 15, + [63668] = 15, + [63669] = 15, + [63670] = 15, + [63671] = 15, + [63672] = 15, + [19577] = 15, + [19574] = 15, + [34490] = 15, + [19503] = 15, + [53209] = 15, + [12042] = 9, + [12043] = 9, + [31589] = 14, + [12472] = 12, + [11958] = 9, + [31687] = 12, + [44572] = 15, + [20216] = 12, + [53563] = 14, + [53595] = 14, + [20375] = 17, + [35395] = 15, + [53385] = 12, + [20066] = 15, + [14751] = 7, + [10060] = 15, + [33206] = 15, + [47788] = 15, + [15487] = 15, + [15473] = 12, + [47585] = 7, + [64044] = 15, + [51662] = 21, + [13877] = 29, + [13750] = 7, + [51690] = 29, + [14278] = 22, + [16511] = 21, + [36554] = 22, + [51713] = 7, + [16166] = 7, + [30706] = 17, + [51490] = 7, + [17364] = 15, + [60103] = 15, + [51533] = 12, + [16188] = 7, + [974] = 14, + [61295] = 15, + [18223] = 14, + [19028] = 14, + [18708] = 7, + [47193] = 12, + [12328] = 3, + [46924] = 3, + [12323] = 4, + [12292] = 3, + [23881] = 6, + [23892] = 6, + [23893] = 6, + [23894] = 6, + [25251] = 6, + [30335] = 6, + [12809] = 6, + [50720] = 5, + [46968] = 3 + +--Blink uses templateNumber 1. +--so does Fire Blast +} + +--format: [templateNumber] = {powerLine, powerType, cooldownLine, rangeLine, castLine} +--powerLine tells which line cost is located. powerType is the type of resource. +--cooldownLine is which line cooldowns are located. +local TemplateTable = +{ + [1] = {0, 0, 6, 3, 0}, + [2] = {3, 1, 0, 4, 0}, + [3] = {3, 1, 6, 0, 0}, + [4] = {3, 1, 0, 0, 0}, + [5] = {0, 0, 0, 3, 0}, + [6] = {3, 1, 6, 4, 0}, + [7] = {0, 0, 3, 0, 0}, + [8] = {3, 1, 0, 4, 5}, + [9] = {0, 0, 4, 0, 0}, + [10] = {3, 4294967294, 6, 0, 0}, + [11] = {3, 1, 6, 4, 5}, + [12] = {3, 0, 6, 0, 0}, + [13] = {3, 0, 0, 4, 5}, + [14] = {3, 0, 0, 4, 0}, + [15] = {3, 0, 6, 4, 0}, + [16] = {3, 0, 6, 4, 5}, + [17] = {3, 0, 0, 0, 0}, + [18] = {5, 0, 8, 6, 7}, + [19] = {3, 0, 0, 0, 5}, + [20] = {3, 4294967294, 0, 4, 0}, + [21] = {3, 3, 0, 4, 0}, + [22] = {3, 3, 6, 4, 0}, + [23] = {0, 0, 0, 3, 5}, + [24] = {0, 0, 0, 0, 0}, + [25] = {3, 3, 0, 0, 0}, + [26] = {5, 0, 0, 6, 0}, + [27] = {3, 0, 6, 0, 5}, + [28] = {5, 0, 8, 6, 0}, + [29] = {3, 3, 6, 0, 0} +--This reads as "Template Number 1 has a Mana Cost value on line 3, and a cooldown on line 6." +} + +--Don't touch this table if you're editing tooltips, it's used for optimization and data storing. +--data table for tooltip correction +--format [spellid] = {powerLine, powerVal, powerType, cooldownLine, CD val, rangeLine, rangeVal, updateVal?, castLine, castVal} +local dataTable = {} + + + +local function GetTipNum() + TipNum = GameTooltip:NumLines() +end + +local function GetID() + _, _, TipID = GameTooltip:GetSpell() +end + + +local function RequestIDCheck(spellid) + + AIO.Handle("TooltipAIO", "HasSpellID", spellid) + +end + + +function tTHandler.ReceiveIDCheck(player, check) + spellCheck = check +end + +function RequestSpellCost(spellid) + + if(dataTable[spellid]) then + + if(dataTable[spellid][8]) then + AIO.Handle("TooltipAIO", "CostGrabber", spellid) + --AIO.Handle("TooltipAIO", "CooldownGrabber", spellid) no shuch function in TooltipCorrectorServer + dataTable[spellid][8] = false + --print("updating values") + skipCheck = true + else + --print("no need to updates values") + skipCheck = false + end + else + + AIO.Handle("TooltipAIO", "CostGrabber", spellid) + + local skipCheck = true + local tmpTemplate = TemplateTable[TaggedSpells[spellid]] + local insertFmt = {tmpTemplate[1], 0, tmpTemplate[2], tmpTemplate[3], 0, tmpTemplate[4], 0, true, tmpTemplate[5], 0} + dataTable[spellid] = insertFmt + + + dataTable[spellid][8] = false + end + +end + +function tTHandler.RefreshTable(player) + + for k,v in pairs(dataTable) do + dataTable[k][8] = true + end +end + +function tTHandler.ReceiveCostGrab(player, cost, powerType) + --print(cost) + + modCost = cost + dataTable[TipID][2] = modCost + dataTable[TipID][3] = powerType +--print("ReceiveCostGrab Fired") +end + +function tTHandler.ReceiveCDGrab(player, cooldown) + --print(cooldown) + modCooldown = (cooldown / 1000) + dataTable[TipID][5] = modCooldown + --print("ReceiveCDGrab Fired") +end + +function tTHandler.ReceiveRangeGrab(player, range) + + modRange = range + dataTable[TipID][7] = modRange +end + +function tTHandler.ReceiveCastTime(player, castTime) + modCastTime = castTime + dataTable[TipID][10] = modCastTime +end + +local function EnumerateTooltipLines_helper(...) + --this grabs all the lines from the original tooltip, and stores them. + for x = 1, select("#", ...) do + --print(x .. " Enumeratedtooltiplinevar") + local region = select(x, ...) + if region and region:GetObjectType() == "FontString" then + local text = region:GetText() -- string or nil + --print(x .. " was X, and the text is " .. text) + --print(x) + --print(text) + tab[x] = text + end + end + + +end + +function EnumerateTooltipLines(tooltip) + EnumerateTooltipLines_helper(tooltip:GetRegions()) +end + +function tTHandler.UpdateTooltips() + + local powerString + if(dataTable[TipID][3] == 0) then + powerString = " Mana" + elseif(dataTable[TipID][3] == 1) then + powerString = " Rage" + elseif(dataTable[TipID][3] == 2) then + powerString = " Focus" + elseif(dataTable[TipID][3] == 3) then + powerString = " Energy" + elseif(dataTable[TipID][3] > 8) then + powerString = " Health" + end + + + + for x = 10, 35 do + + if(x == (dataTable[TipID][1] + 9)) then + if(dataTable[TipID][3] == 1) then + tab[x] = (dataTable[TipID][2] / 10) .. powerString + else + tab[x] = dataTable[TipID][2] .. powerString + end + + end + + if(x == (dataTable[TipID][4] + 9)) then + tab[x] = dataTable[TipID][5] .. " sec cooldown" + end + + if(x == dataTable[TipID][6] + 9) then + tab[x] = dataTable[TipID][7] .. " yds" + end + + if(x == dataTable[TipID][9] + 9) then + tab[x] = (dataTable[TipID][10] / 1000) .. " sec cast" + end + + end + + + + local i = 10 + GameTooltip:ClearLines () + while i <= 35 do + if(i <= 13) then + GameTooltip:AddDoubleLine (tab[i], tab[i+1]) + i = i + 2 + + elseif (tab[i]) then + GameTooltip:AddLine (tab[i], 1, 1, 1, true) + i = i + 1 + else + i = i + 1 + end + end + GameTooltip:Show() + currentlyProcessing = false + local o = 10 + while o <= 35 do + tab[o] = nil + o = o + 1 + end +end + +function locUpdateTooltips() + + local powerString + if(dataTable[TipID][3] == 0) then + powerString = " Mana" + elseif(dataTable[TipID][3] == 1) then + powerString = " Rage" + elseif(dataTable[TipID][3] == 2) then + powerString = " Focus" + elseif(dataTable[TipID][3] == 3) then + powerString = " Energy" + elseif(dataTable[TipID][3] > 8) then + powerString = " Health" + end + + + for x = 10, 35 do + + if(x == (dataTable[TipID][1] + 9)) then + if(dataTable[TipID][3] == 1) then + tab[x] = (dataTable[TipID][2] / 10) .. powerString + else + tab[x] = dataTable[TipID][2] .. powerString + end + + end + + if(x == (dataTable[TipID][4] + 9)) then + tab[x] = dataTable[TipID][5] .. " sec cooldown" + end + + if(x == dataTable[TipID][6] + 9) then + tab[x] = dataTable[TipID][7] .. " yds" + end + + if(x == dataTable[TipID][9] + 9) then + if(dataTable[TipID][10] == 0) then + tab[x] = "Instant cast" + else + tab[x] = (dataTable[TipID][10] / 1000) .. " sec cast" + end + end + end + + local i = 10 + GameTooltip:ClearLines () + + while i <= 35 do + if(i <= 13) then + GameTooltip:AddDoubleLine (tab[i], tab[i+1]) + i = i + 2 + + elseif (tab[i]) then + GameTooltip:AddLine (tab[i], 1, 1, 1, true) + i = i + 1 + else + i = i + 1 + end + end + GameTooltip:Show() + currentlyProcessing = false + local o = 10 + while o <= 35 do + tab[o] = nil + o = o + 1 + end + +end + +local function GetCorrection(spellID) + --z var for ensuring ordered entries. + + tempNum = TaggedSpells[spellID] + pTemplateTable = TemplateTable[tempNum] + +end + + +local function ModifyTip () + if(currentlyProcessing == false) then + currentlyProcessing = true + if(GameTooltip:GetSpell ()) then + --skip check if training frame and spell is known-- + local frame = GetMouseFocus() + if (frame and frame:GetName()) then + if string.find(frame:GetName(), "TrainingFrame") then + local spellname,rank,spellid = GameTooltip:GetSpell() + if (GameTooltip:GetSpell() and IsSpellLearned(spellid) and (GetItemCount(1101243) > 0)) then + return false + end + end + end + -- end-- + GetID() + if(TaggedSpells[TipID]) then + GetTipNum() + GetCorrection(TipID) + + EnumerateTooltipLines(GameTooltip) + RequestSpellCost(TipID) + if((dataTable[TipID][8] == false) and (skipCheck == false)) then + locUpdateTooltips() + end + else + currentlyProcessing = false + end + else + currentlyProcessing = false + end + elseif(not GameTooltip:GetSpell()) then + currentlyProcessing = false + end +end + +GameTooltip:HookScript("OnShow", ModifyTip) + + + +--Standart interface Changes----Standart interface Changes----Standart interface Changes----Standart interface Changes----Standart interface Changes----Standart interface Changes----Standart interface Changes----Standart interface Changes----Standart interface Changes----Standart interface Changes----Standart interface Changes-- + +local SpellCost_ActionButtonAscension = { +} --data holding archive, spell entry = cost,powertype,range + +local ActionButtonRange = 0 + +function UpdateUsableAscension (self) + local name = self:GetName(); + local icon = _G[name.."Icon"]; + local normalTexture = _G[name.."NormalTexture"]; + local isUsable, notEnoughMana = IsUsableAction(self.action); + + local type, id, subType, spellID = GetActionInfo(self.action) + + if (SpellCost_ActionButtonAscension[spellID]) then + local resource = 0 + -- rage exception + if (SpellCost_ActionButtonAscension[spellID][2] == 1) then + resource = SpellCost_ActionButtonAscension[spellID][1]/10 + else + resource = SpellCost_ActionButtonAscension[spellID][1] + end + -- end of rage exception + if UnitPower("player",SpellCost_ActionButtonAscension[spellID][2]) < resource then + notEnoughMana = true + isUsable = false + --print("Not Enough Resource for Spell "..spellID.." of type "..SpellCost_ActionButtonAscension[spellID][2].."\n Current amount of this resource: "..UnitPower("player",SpellCost_ActionButtonAscension[spellID][2]).." Needed: "..SpellCost_ActionButtonAscension[spellID][1]) + else + notEnoughMana = false + isUsable = true + end + end + --notEnoughMana = true + --isUsable = false + if ( isUsable ) then + icon:SetVertexColor(1.0, 1.0, 1.0); + normalTexture:SetVertexColor(1.0, 1.0, 1.0); + elseif ( notEnoughMana ) then + icon:SetVertexColor(0.5, 0.5, 1.0); + normalTexture:SetVertexColor(0.5, 0.5, 1.0); + else + icon:SetVertexColor(0.4, 0.4, 0.4); + normalTexture:SetVertexColor(1.0, 1.0, 1.0); + end +end + +ActionButton_UpdateUsable = UpdateUsableAscension + +function ActionButtonAscension_OnUpdate (self, elapsed) + if ( ActionButton_IsFlashing(self) ) then + local flashtime = self.flashtime; + flashtime = flashtime - elapsed; + + if ( flashtime <= 0 ) then + local overtime = -flashtime; + if ( overtime >= ATTACK_BUTTON_FLASH_TIME ) then + overtime = 0; + end + flashtime = ATTACK_BUTTON_FLASH_TIME - overtime; + + local flashTexture = _G[self:GetName().."Flash"]; + if ( flashTexture:IsShown() ) then + flashTexture:Hide(); + else + flashTexture:Show(); + end + end + + self.flashtime = flashtime; + end + + -- Handle range indicator + local rangeTimer = self.rangeTimer; + if ( rangeTimer ) then + rangeTimer = rangeTimer - elapsed; + + if ( rangeTimer <= 0 ) then + local count = _G[self:GetName().."HotKey"]; + local valid = IsActionInRange(self.action); -- fuck you, valid function. Exception for our solution below + + ---!!!!---Ask server for distance and try not to overload it + if (UnitExists("target")) and not(UnitIsFriend("target", "player")) then + AIO.Handle("TooltipAIO", "GetDistance") + else + ActionButtonRange = nil + end + ---!!!!--- + local type, id, subType, spellID = GetActionInfo(self.action) + --local spellname = GetSpellInfo(spellID) + if (SpellCost_ActionButtonAscension[spellID]) then + --if not(IsHelpfulSpell(spellname)) then + if (ActionButtonRange ~= nil) then + if (SpellCost_ActionButtonAscension[spellID][3] > ActionButtonRange) then + valid = 1 + else + valid = 0 + end + end + --end + end + -- + if ( count:GetText() == RANGE_INDICATOR ) then + if ( valid == 0 ) then + count:Show(); + count:SetVertexColor(1.0, 0.1, 0.1); + elseif ( valid == 1 ) then + count:Show(); + count:SetVertexColor(0.6, 0.6, 0.6); + else + count:Hide(); + end + else + if ( valid == 0 ) then + count:SetVertexColor(1.0, 0.1, 0.1); + else + count:SetVertexColor(0.6, 0.6, 0.6); + end + end + rangeTimer = TOOLTIP_UPDATE_TIME; + end + + self.rangeTimer = rangeTimer; + end + ActionButton_UpdateUsable(self) +end +ActionButton_OnUpdate = ActionButtonAscension_OnUpdate + +--Initalizate spell costs +function ActionButton_UpdateStateAscension (button) + assert(button); + + local action = button.action; + if ( IsCurrentAction(action) or IsAutoRepeatAction(action) ) then + button:SetChecked(1); + else + button:SetChecked(0); + end + + -- Spell Cost Custom Thing-- + local type, id, subType, spellID = GetActionInfo(button.action) + if (spellID) and TaggedSpells[spellID] then + AIO.Handle("TooltipAIO", "SpellCostGrabber", spellID) + end + -- Spell Cost Custom Thing-- +end + +ActionButton_UpdateState = ActionButton_UpdateStateAscension + + function tTHandler.GetSpellCost(player,Cost,Type,Range,spellid) + if Cost and Type and Range and spellid then + SpellCost_ActionButtonAscension[spellid] = {Cost, Type,Range} +end + --print("spellid "..spellid.." of Type "..Type) + end + +--super fucked up shit for range indicator-- + function tTHandler.Distance(player,dist) + ActionButtonRange = dist + --print("spellid "..spellid.." of Type "..Type) + end \ No newline at end of file diff --git a/TutorialStuff/NewbieHelp_Client.lua b/TutorialStuff/NewbieHelp_Client.lua new file mode 100644 index 0000000..a1b4880 --- /dev/null +++ b/TutorialStuff/NewbieHelp_Client.lua @@ -0,0 +1,162 @@ +local AIO = AIO or require("AIO") + + +if AIO.AddAddon() then + return +end + +local TutAIO = AIO.AddHandlers("TutAIO", {}) + +local TUTORIAL_TIPS = { +{"Interface\\AddOns\\AwAddons\\Textures\\Tutorial\\tutorial_Tex1","|cffFFFFFFWelcome! |rAscension|cffFFFFFF is a progressive |rclassless|cffFFFFFF realm with 3 different servers in mind ranging from softcore to hardcore. |rSoftcore|cffFFFFFF being the most vanilla-like while the |rharder|cffFFFFFF difficulties introduce new mechanics such as hunger, same faction pvp, and even item drops on death. No matter where you decide to play you can expect to be able to fully live out your fantasy of a character truly unique to you!|r"}, +{"Interface\\AddOns\\AwAddons\\Textures\\Tutorial\\tutorial_Addons","|cffFFFFFFPlease, check your |raddons|cffFFFFFF enabled. Ascension |rrequire|cffFFFFFF you to use |rAscension AIO|cffFFFFFF and Ascension Resources addons. You can |rset|cffFFFFFF them as you wish, that is why you have two of Ascension Resources addons, |rone|cffFFFFFF is for using with default User Interface and the |rsecond|cffFFFFFF if you're mature player and have a lot of custom addons in your UI.|r"}, +{"Interface\\AddOns\\AwAddons\\Textures\\Tutorial\\tutorial_TexUpgrades","|cffFFFFFFOn Ascension, you have a lot of |rcustom|cffFFFFFF features. You may get access to them using our special |rCharacter Upgrades|cffFFFFFF panel on your |rMain Menu Bar|cffFFFFFF on trough |rquick access|cffFFFFFF frame on your screen.|r"}, +{"Interface\\AddOns\\AwAddons\\Textures\\Tutorial\\tutorial_TexStat","|cffFFFFFFIn Ascension you are able to allocate stat points into anything you want. Typically, as a rule: |rStrength|cffFFFFFF is for attack power, |rAgility|cffFFFFFF is less attack power but gives critical strike for physical abilities, |rstamina|cffFFFFFF is how much health you can have, |rspirit|cffFFFFFF is your mana regeneration and |rintellect|cffFFFFFF is your spell power and spell crit. With our classless system, however you will discover many more possibilities!|r"}, +{"Interface\\AddOns\\AwAddons\\Textures\\Tutorial\\tutorial_TexPortrait","|cffFFFFFFClassless system means that every user is able to use all 3 kinds of |rresources|cffFFFFFF, such as: |rmana|cffFFFFFF, |rrage|cffFFFFFF and |renergy|cffFFFFFF. To make it clear and easy to control we included all of them to your |rupdated player portrait|cffFFFFFF. Additional |rhorizontal|cffFFFFFF bar is for energy and |rvertical|cffFFFFFF one is for rage.|r"}, +{"Interface\\AddOns\\AwAddons\\Textures\\Tutorial\\tutorial_Ffa","|cffFFFFFFIn non-softcore realms there is |rFFA|cffFFFFFF PVP, this means that you can attack players within your own faction who are not in your group or a safe zone. Be |rcareful|cffFFFFFF out there!|r"}, +{"Interface\\AddOns\\AwAddons\\Textures\\Tutorial\\tutorial_TexProgress","|cffFFFFFFDing! You now have 2 |rability essences|cffFFFFFF! You may now purchase any |rspell|cffFFFFFF from the spell character advancement page. Simply click on the book then on the |rclass|cffFFFFFF which has the |rspell|cffFFFFFF you would like and finally on the left side of the window. Think of the possibilities!|r"}, +{"Interface\\AddOns\\AwAddons\\Textures\\Tutorial\\tutorial_TexReset","|cffFFFFFFBe sure to chose your skills and talents carefully, but since we beileve that the main |rgoal|cffFFFFFF of our realms is to give you an opportunity to try out |rnew builds|cffFFFFFF and |rideas|cffFFFFFF all the time, there is a full spell or talent |rreset|cffFFFFFF possibility which is also accessable trough User Interface.|r"}, +{"Interface\\AddOns\\AwAddons\\Textures\\Tutorial\\tutorial_TexFreeReset","|cffFFFFFFNeed a |rchange|cffFFFFFF? We’re here to help! Up until level 10 we have |rfree spell resets|cffFFFFFF to ensure you can play around with our system and feel what is right for you.|r"}, +{"Interface\\AddOns\\AwAddons\\Textures\\Tutorial\\tutorial_Enchant","|cffFFFFFF|rRandom enchants|cffFFFFFF! Ever wondered what it would be like to have more levels in a talent you really enjoy? Well we have that and more with our |rRandom Enchantment|cffFFFFFF system. You will periodically find gear that has an enchant that might be a rank of a talent or something else entirely! These enchants |rstack|cffFFFFFF as well! So, you can find and experiment with many different possibilities. Good luck on your drops!|r"}, +{"Interface\\AddOns\\AwAddons\\Textures\\Tutorial\\tutorial_TexResetNotFree","|cffFFFFFFFreedom isn’t free! The free resets are now over but fear not as you can reset your spell or talent choices by simply using |r[Ability purge]|cffFFFFFF or |r[Talent Purge]|cffFFFFFF. You start off with |r3 of each|cffFFFFFF but after you run out you can use gold to reset further but the cost increases over time.|r"}, +{"Interface\\AddOns\\AwAddons\\Textures\\Tutorial\\tutorial_TexLoot","|cffFFFFFFIn addition to FFA PVP we also have |rloot drop on death|cffFFFFFF for our medium and hardcore realms. There is a method to our madness so |rnot only your best stuff will drop|cffFFFFFF! You must also be within a certain level range to drop or get items to drop from others.|r"}, +{"Interface\\AddOns\\AwAddons\\Textures\\Tutorial\\tutorial_FfaEnabled","|cffFFFFFF|rFFA|cffFFFFFF PVP is now |renabled|cffFFFFFF! You’ve honed your skills and talents in peace for 20 levels but now you will be able to kill and be killed by members of your |rown faction |cffFFFFFFor opposing. Hopefully you’ve chosen your skills wisely as you set out on your adventure and may the odds be ever in your favor!|r"}, + -- main tip -- TEX DONE + -- Addon Settings -- TEX DONE + -- Character Upgrades -- TEX DONE + -- Stat Allocation -- TEX DONE + -- Player Portrait -- TEX DONE + -- FFA PVP -- TEX DONE + -- level 2 Character Progression -- TEX DONE + -- level 5 Reset spells/talents -- TEX DONE + -- level 5 Free resets -- TEX DONE + -- level 10 random enchants -- TEX DONE + -- level 10 Free resets are over -- TEX DONE + -- level 10 PvP loot on death -- TEX DONE + -- level 20 FFA PVP is now enabled -- TEX DONE +} + +local CURRENTTIP = 1 +local MAXTIPS = 1 + +local Ascension_TutorialFrame = CreateFrame("Frame", "Ascension_TutorialFrame", UIParent, nil) +Ascension_TutorialFrame:SetSize(512,512) +--Ascension_TutorialFrame:SetAllPoints() +Ascension_TutorialFrame:SetPoint("CENTER",450,50) +Ascension_TutorialFrame:SetBackdrop({ + bgFile = "Interface\\AddOns\\AwAddons\\Textures\\Tutorial\\Tutorial", +}) +Ascension_TutorialFrame:Hide() + +Ascension_TutorialFrame:SetFrameStrata("TOOLTIP") + +local Ascension_TutorialFrame_CloseButton = CreateFrame("Button", "Ascension_TutorialFrame_CloseButton", Ascension_TutorialFrame, "UIPanelCloseButton") +Ascension_TutorialFrame_CloseButton:SetPoint("CENTER", 169, 116) +Ascension_TutorialFrame_CloseButton:EnableMouse(true) +--Ascension_TutorialFrame_CloseButton:SetSize(25, 25) +Ascension_TutorialFrame_CloseButton:SetScript("OnClick", function() + PlaySound("igMainMenuOptionCheckBoxOn") + Ascension_TutorialFrame:Hide() + end) + +local Ascension_TutorialFrame_TitleText = Ascension_TutorialFrame:CreateFontString("Ascension_TutorialFrame_TitleText") +Ascension_TutorialFrame_TitleText:SetFont("Fonts\\FRIZQT__.TTF", 12.2) +Ascension_TutorialFrame_TitleText:SetPoint("CENTER", 15, 116) +Ascension_TutorialFrame_TitleText:SetFontObject(GameFontNormal) +Ascension_TutorialFrame_TitleText:SetShadowOffset(1,-1) +Ascension_TutorialFrame_TitleText:SetText("Ascension Survival Guide") + +local Ascension_TutorialFrameTexture = Ascension_TutorialFrame:CreateTexture(nil, "ARTWORK") +Ascension_TutorialFrameTexture:SetSize(Ascension_TutorialFrame:GetSize()) +Ascension_TutorialFrameTexture:SetTexture("Interface\\AddOns\\AwAddons\\Textures\\Tutorial\\tutorial_Tex1") +Ascension_TutorialFrameTexture:SetPoint("CENTER",Ascension_TutorialFrame,0,0) + +local Ascension_TutorialFrame_TextBox = CreateFrame("EditBox",nil,Ascension_TutorialFrame) +Ascension_TutorialFrame_TextBox:SetWidth(330) +Ascension_TutorialFrame_TextBox:SetHeight(30) +Ascension_TutorialFrame_TextBox:SetFontObject(GameFontNormal) + +Ascension_TutorialFrame_TextBox:SetMaxLetters(420) +Ascension_TutorialFrame_TextBox:SetIndentedWordWrap(false) +Ascension_TutorialFrame_TextBox:SetMultiLine(true) +Ascension_TutorialFrame_TextBox:SetMaxResize(843, 80) +Ascension_TutorialFrame_TextBox:ClearFocus(self) +Ascension_TutorialFrame_TextBox:SetAutoFocus(false) +Ascension_TutorialFrame_TextBox:EnableMouse(false) +Ascension_TutorialFrame_TextBox:SetPoint("CENTER",Ascension_TutorialFrame,7,-40) +Ascension_TutorialFrame_TextBox:SetFont("Fonts\\FRIZQT__.TTF", 12) +Ascension_TutorialFrame_TextBox:SetJustifyH("CENTER") +Ascension_TutorialFrame_TextBox:SetText("|cffFFFFFFAscension is a progressive Classless project, starting from Vanilla progressing through the expansions. The realms vary from softcore: just the Vanilla world with Classless systems to hardcore with elements like Hunger, High risk death, and Randomly Enchanted items.|r") + +local Ascension_TutorialFrame_NextButton = CreateFrame("Button", "Ascension_TutorialFrame_NextButton", Ascension_TutorialFrame, nil) +Ascension_TutorialFrame_NextButton:SetSize(26, 26) +Ascension_TutorialFrame_NextButton:SetPoint("CENTER",110,-103) +Ascension_TutorialFrame_NextButton:EnableMouse(true) + +Ascension_TutorialFrame_NextButton:SetNormalTexture("Interface\\Buttons\\UI-SpellbookIcon-NextPage-Up") +Ascension_TutorialFrame_NextButton:SetPushedTexture("Interface\\Buttons\\UI-SpellbookIcon-NextPage-Down") +Ascension_TutorialFrame_NextButton:SetDisabledTexture("Interface\\Buttons\\UI-SpellbookIcon-NextPage-Disabled") +Ascension_TutorialFrame_NextButton:SetHighlightTexture("Interface\\Buttons\\UI-Common-MouseHilight") + +local Ascension_TutorialFrame_PrevButton = CreateFrame("Button", "Ascension_TutorialFrame_PrevButton", Ascension_TutorialFrame, nil) +Ascension_TutorialFrame_PrevButton:SetSize(26, 26) +Ascension_TutorialFrame_PrevButton:SetPoint("CENTER",-105,-103) +Ascension_TutorialFrame_PrevButton:EnableMouse(true) + +Ascension_TutorialFrame_PrevButton:SetNormalTexture("Interface\\Buttons\\UI-SpellbookIcon-PrevPage-Up") +Ascension_TutorialFrame_PrevButton:SetPushedTexture("Interface\\Buttons\\UI-SpellbookIcon-PrevPage-Down") +Ascension_TutorialFrame_PrevButton:SetDisabledTexture("Interface\\Buttons\\UI-SpellbookIcon-PrevPage-Disabled") +Ascension_TutorialFrame_PrevButton:SetHighlightTexture("Interface\\Buttons\\UI-Common-MouseHilight") + + Ascension_TutorialFrame_NextButton.Text = Ascension_TutorialFrame_NextButton:CreateFontString("Ascension_TutorialFrame_NextButton.Text") +--Ascension_TutorialFrame_NextButton.Text:SetFont("Fonts\\FRIZQT__.TTF", 12.2) +Ascension_TutorialFrame_NextButton.Text:SetPoint("CENTER",-30, 0) +Ascension_TutorialFrame_NextButton.Text:SetFontObject(GameFontHighlightSmall) +Ascension_TutorialFrame_NextButton.Text:SetShadowOffset(1,-1) +Ascension_TutorialFrame_NextButton.Text:SetText("Next") + + Ascension_TutorialFrame_PrevButton.Text = Ascension_TutorialFrame_PrevButton:CreateFontString("Ascension_TutorialFrame_PrevButton.Text") +--Ascension_TutorialFrame_PrevButton.Text:SetFont("Fonts\\FRIZQT__.TTF", 12.2) +Ascension_TutorialFrame_PrevButton.Text:SetPoint("CENTER",30, 0) +Ascension_TutorialFrame_PrevButton.Text:SetFontObject(GameFontHighlightSmall) +Ascension_TutorialFrame_PrevButton.Text:SetShadowOffset(1,-1) +Ascension_TutorialFrame_PrevButton.Text:SetText("Prev") + + +--SCRIPTS PART-- +Ascension_TutorialFrame_PrevButton:SetScript("OnUpdate", function(self) + if (CURRENTTIP == 1) and self:IsEnabled() then + self:Disable() + elseif (CURRENTTIP ~= 1) then + self:Enable() + end + end) + +Ascension_TutorialFrame_NextButton:SetScript("OnUpdate", function(self) + if (CURRENTTIP == MAXTIPS) and self:IsEnabled() then + self:Disable() + elseif (CURRENTTIP < MAXTIPS) then + self:Enable() + end + end) + +Ascension_TutorialFrame_PrevButton:SetScript("OnClick", function() +CURRENTTIP = CURRENTTIP -1 + end) + +Ascension_TutorialFrame_NextButton:SetScript("OnClick", function() +CURRENTTIP = CURRENTTIP +1 + end) + +Ascension_TutorialFrame:SetScript("OnUpdate", function(self) + if (Ascension_TutorialFrame_TextBox:GetText() ~= TUTORIAL_TIPS[CURRENTTIP][2]) then + Ascension_TutorialFrameTexture:SetTexture(TUTORIAL_TIPS[CURRENTTIP][1]) + Ascension_TutorialFrame_TextBox:SetText(TUTORIAL_TIPS[CURRENTTIP][2]) + end + end) + + function TutAIO.InitFrame(player,currtip,maxtips) -- AIO + CURRENTTIP = currtip + MAXTIPS = maxtips + Ascension_TutorialFrame:Show() + end \ No newline at end of file diff --git a/TutorialStuff/NewbieHelp_Server.lua b/TutorialStuff/NewbieHelp_Server.lua new file mode 100644 index 0000000..f5fab4e --- /dev/null +++ b/TutorialStuff/NewbieHelp_Server.lua @@ -0,0 +1,30 @@ +local AIO = AIO or require("AIO") + + +local TutAIO = AIO.AddHandlers("TutAIO", {}) + +local function TutorialStuff_SendHelp(event, player, oldLevel) + +if (oldLevel == 1) then +TutorialAio(AIO.Msg(), player,7,7):Send(player) +elseif (oldLevel == 4) then +TutorialAio(AIO.Msg(), player,8,9):Send(player) +elseif (oldLevel == 9) then +TutorialAio(AIO.Msg(), player,10,12):Send(player) +elseif (oldLevel == 19) then +TutorialAio(AIO.Msg(), player,13,13):Send(player) +end + + +end + + +RegisterPlayerEvent(13, TutorialStuff_SendHelp) + +RegisterPlayerEvent(30, function(event,player) + TutorialAio(AIO.Msg(), player,1,6):Send(player) + end) + +function TutorialAio(msg,player,currtip,maxtips) + return msg:Add("TutAIO", "InitFrame", currtip,maxtips) +end \ No newline at end of file diff --git a/extensions/ObjectCooldownExtension.lua b/extensions/ObjectCooldownExtension.lua new file mode 100644 index 0000000..0f6d6fe --- /dev/null +++ b/extensions/ObjectCooldownExtension.lua @@ -0,0 +1,41 @@ +local cooldowns = {}; + +function Player:SetLuaCooldown(seconds, opt_id) + assert(type(self) == "userdata"); + seconds = assert(tonumber(seconds)); + opt_id = opt_id or 1; + local guid, source = self:GetGUIDLow(), debug.getinfo(2, 'S').short_src; + + if (not cooldowns[guid]) then + cooldowns[guid] = { [source] = {}; }; + end + + cooldowns[guid][source][opt_id] = os.clock() + seconds; +end + +function Player:GetLuaCooldown(opt_id) + assert(type(self) == "userdata"); + local guid, source = self:GetGUIDLow(), debug.getinfo(2, 'S').short_src; + opt_id = opt_id or 1; + + if (not cooldowns[guid]) then + cooldowns[guid] = { [source] = {}; }; + end + + local cd = cooldowns[guid][source][opt_id]; + if (not cd or cd < os.clock()) then + cooldowns[guid][source][opt_id] = 0 + return 0; + else + return cooldowns[guid][source][opt_id] - os.clock(); + end +end + +--[[ Example: + if(player:GetLuaCooldown() == 0) then -- Check if cooldown is present + player:SetLuaCooldown(30) + print("Cooldown is set to 30 seconds") + else + print("There are still "..player:GetLuaCooldown().." seconds remaining of your cooldown!") + end +]] \ No newline at end of file diff --git a/extensions/ObjectVariables.ext b/extensions/ObjectVariables.ext new file mode 100644 index 0000000..e7f8b71 --- /dev/null +++ b/extensions/ObjectVariables.ext @@ -0,0 +1,94 @@ +-- +-- Copyright (C) 2010 - 2015 Eluna Lua Engine +-- This program is free software licensed under GPL version 3 +-- Please see the included DOCS/LICENSE.md for more information +-- + +-- filename.ext files are loaded before normal .lua files + +-- +-- This extension allows saving data to specific object for it's lifetime in current runtime session +-- Supports Map, Player, Creature, GameObject +-- +-- SetData sets a value +-- obj:SetData(key, val) +-- +-- GetData gets the data table or a specific value by key from it +-- local tbl = obj:GetData() +-- local val = obj:GetData(key) +-- + +local variableStores = { + Map = {}, + Player = {}, + Creature = {}, + GameObject = {}, +} + +local function DestroyMapData(event, obj) + local map = obj:GetMapId() + local inst = obj:GetInstanceId() + for k,v in pairs(variableStores) do + local mapdata = v[map] + if mapdata then + mapdata[inst] = nil + end + end +end + +local function DestroyObjData(event, obj) + local map = obj:GetMapId() + local inst = obj:GetInstanceId() + local otype = obj:GetObjectType() + local guid = otype == "Map" and 1 or obj:GetGUIDLow() + local mapdata = variableStores[otype][map] + if mapdata then + local instancedata = mapdata[inst] + if instancedata then + instancedata[guid] = nil + end + end +end + +local function GetData(self, field) + local map = self:GetMapId() + local inst = self:GetInstanceId() + local otype = self:GetObjectType() + local guid = otype == "Map" and 1 or self:GetGUIDLow() + local varStore = variableStores[otype] + + varStore[map] = varStore[map] or {} + varStore[map][inst] = varStore[map][inst] or {} + varStore[map][inst][guid] = varStore[map][inst][guid] or {} + + if field ~= nil then + return varStore[map][inst][guid][field] + else + return varStore[map][inst][guid] + end +end + +local function SetData(self, field, val) + local map = self:GetMapId() + local inst = self:GetInstanceId() + local otype = self:GetObjectType() + local guid = otype == "Map" and 1 or self:GetGUIDLow() + local varStore = variableStores[otype] + + varStore[map] = varStore[map] or {} + varStore[map][inst] = varStore[map][inst] or {} + varStore[map][inst][guid] = varStore[map][inst][guid] or {} + + varStore[map][inst][guid][field] = val +end + +for k,v in pairs(variableStores) do + _G[k].GetData = GetData + _G[k].SetData = SetData +end + +RegisterPlayerEvent(4, DestroyObjData) -- logout +RegisterServerEvent(31, DestroyObjData) -- creature delete +RegisterServerEvent(32, DestroyObjData) -- gameobject delete +RegisterServerEvent(17, DestroyMapData) -- map create +RegisterServerEvent(18, DestroyMapData) -- map destroy diff --git a/extensions/StackTracePlus/LICENSE b/extensions/StackTracePlus/LICENSE new file mode 100644 index 0000000..af90c89 --- /dev/null +++ b/extensions/StackTracePlus/LICENSE @@ -0,0 +1,21 @@ +The MIT License + +Copyright (c) 2010 Ignacio Burgueño + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. diff --git a/extensions/StackTracePlus/README.md b/extensions/StackTracePlus/README.md new file mode 100644 index 0000000..441c799 --- /dev/null +++ b/extensions/StackTracePlus/README.md @@ -0,0 +1,128 @@ +# StackTracePlus # + +[![Build Status](https://travis-ci.org/ignacio/StackTracePlus.png?branch=master)](https://travis-ci.org/ignacio/StackTracePlus) + +[StackTracePlus](https://github.com/ignacio/StackTracePlus) provides enhanced stack traces for [Lua 5.1, Lua 5.2][1] and [LuaJIT][2]. + +StackTracePlus can be used as a replacement for debug.traceback. It gives detailed information about locals, tries to guess +function names when they're not available, etc, so, instead of + + lua5.1.exe: D:\trunk_git\sources\stacktraceplus\test\test.lua:10: attempt to concatenate a nil value + stack traceback: + D:\trunk_git\sources\stacktraceplus\test\test.lua:10: in function + (tail call): ? + D:\trunk_git\sources\stacktraceplus\test\test.lua:15: in main chunk + [C]: ? + +you'll get + + lua5.1.exe: D:\trunk_git\sources\stacktraceplus\test\test.lua:10: attempt to concatenate a nil value + Stack Traceback + =============== + (2) C function 'function: 00A8F418' + (3) Lua function 'g' at file 'D:\trunk_git\sources\stacktraceplus\test\test.lua:10' (best guess) + Local variables: + fun = table module + str = string: "hey" + tb = table: 027DCBE0 {dummy:1, blah:true, foo:bar} + (*temporary) = nil + (*temporary) = string: "text" + (*temporary) = string: "attempt to concatenate a nil value" + (4) tail call + (5) main chunk of file 'D:\trunk_git\sources\stacktraceplus\test\test.lua' at line 15 + (6) C function 'function: 002CA480' + +## Usage # + +StackTracePlus can be used as a replacement for `debug.traceback`, as an `xpcall` error handler or even from C code. Note that +only the Lua 5.1 interpreter allows the traceback function to be replaced "on the fly". LuaJIT and Lua 5.2 always calls luaL_traceback internally so there is no easy way to override that. + +```lua +local STP = require "StackTracePlus" + +debug.traceback = STP.stacktrace +function test() + local s = "this is a string" + local n = 42 + local t = { foo = "bar" } + local co = coroutine + local cr = coroutine.create + + error("an error") +end +test() +``` + +That script will output (only with Lua 5.1): + + lua5.1: example.lua:11: an error + Stack Traceback + =============== + (2) C function 'function: 006B5758' + (3) global C function 'error' + (4) Lua global 'test' at file 'example.lua:11' + Local variables: + s = string: "this is a string" + n = number: 42 + t = table: 006E5220 {foo:bar} + co = coroutine table + cr = C function: 003C7080 + (5) main chunk of file 'example.lua' at line 14 + (6) C function 'function: 00637B30' + +**StackTracePlus** is aware of the usual Lua libraries, like *coroutine*, *table*, *string*, *io*, etc and functions like +*print*, *pcall*, *assert*, and so on. + +You can also make STP aware of your own tables and functions by calling *add_known_function* and *add_known_table*. + +```lua +local STP = require "StackTracePlus" + +debug.traceback = STP.stacktrace +local my_table = { + f = function() end +} +function my_function() +end + +function test(data, func) + local s = "this is a string" + + error("an error") +end + +STP.add_known_table(my_table, "A description for my_table") +STP.add_known_function(my_function, "A description for my_function") + +test( my_table, my_function ) +``` + +Will output: + + lua5.1: ..\test\example2.lua:13: an error + Stack Traceback + =============== + (2) C function 'function: 0073AAA8' + (3) global C function 'error' + (4) Lua global 'test' at file '..\test\example2.lua:13' + Local variables: + data = A description for my_table + func = Lua function 'A description for my_function' (defined at line 7 of chunk ..\test\example2.lua) + s = string: "this is a string" + (5) main chunk of file '..\test\example2.lua' at line 19 + (6) C function 'function: 00317B30' + + +## Installation # +The easiest way to install is with [LuaRocks][3]. + + - luarocks install stacktraceplus + +If you don't want to use LuaRocks, just copy StackTracePlus.lua to Lua's path. + +## License # +**StackTracePlus** is available under the MIT license. + +[1]: http://www.lua.org/ +[2]: http://luajit.org/ +[3]: http://luarocks.org/ diff --git a/extensions/StackTracePlus/StackTracePlus.ext b/extensions/StackTracePlus/StackTracePlus.ext new file mode 100644 index 0000000..bc28041 --- /dev/null +++ b/extensions/StackTracePlus/StackTracePlus.ext @@ -0,0 +1,411 @@ +-- tables +local _G = _G +local string, io, debug, coroutine = string, io, debug, coroutine + +-- functions +local tostring, print, require = tostring, print, require +local next, assert = next, assert +local pcall, type, pairs, ipairs = pcall, type, pairs, ipairs +local error = error + +assert(debug, "debug table must be available at this point") + +local io_open = io.open +local string_gmatch = string.gmatch +local string_sub = string.sub +local table_concat = table.concat + +local _M = { + max_tb_output_len = 70 -- controls the maximum length of the 'stringified' table before cutting with ' (more...)' +} + +-- this tables should be weak so the elements in them won't become uncollectable +local m_known_tables = { [_G] = "_G (global table)" } +local function add_known_module(name, desc) + local ok, mod = pcall(require, name) + if ok then + m_known_tables[mod] = desc + end +end + +add_known_module("string", "string module") +add_known_module("io", "io module") +add_known_module("os", "os module") +add_known_module("table", "table module") +add_known_module("math", "math module") +add_known_module("package", "package module") +add_known_module("debug", "debug module") +add_known_module("coroutine", "coroutine module") + +-- lua5.2 +add_known_module("bit32", "bit32 module") +-- luajit +add_known_module("bit", "bit module") +add_known_module("jit", "jit module") + + +local m_user_known_tables = {} + +local m_known_functions = {} +for _, name in ipairs{ + -- Lua 5.2, 5.1 + "assert", + "collectgarbage", + "dofile", + "error", + "getmetatable", + "ipairs", + "load", + "loadfile", + "next", + "pairs", + "pcall", + "print", + "rawequal", + "rawget", + "rawlen", + "rawset", + "require", + "select", + "setmetatable", + "tonumber", + "tostring", + "type", + "xpcall", + + -- Lua 5.1 + "gcinfo", + "getfenv", + "loadstring", + "module", + "newproxy", + "setfenv", + "unpack", + -- TODO: add table.* etc functions +} do + if _G[name] then + m_known_functions[_G[name]] = name + end +end + + + +local m_user_known_functions = {} + +local function safe_tostring (value) + local ok, err = pcall(tostring, value) + if ok then return err else return (": '%s'"):format(err) end +end + +-- Private: +-- Parses a line, looking for possible function definitions (in a very na?ve way) +-- Returns '(anonymous)' if no function name was found in the line +local function ParseLine(line) + assert(type(line) == "string") + --print(line) + local match = line:match("^%s*function%s+(%w+)") + if match then + --print("+++++++++++++function", match) + return match + end + match = line:match("^%s*local%s+function%s+(%w+)") + if match then + --print("++++++++++++local", match) + return match + end + match = line:match("^%s*local%s+(%w+)%s+=%s+function") + if match then + --print("++++++++++++local func", match) + return match + end + match = line:match("%s*function%s*%(") -- this is an anonymous function + if match then + --print("+++++++++++++function2", match) + return "(anonymous)" + end + return "(anonymous)" +end + +-- Private: +-- Tries to guess a function's name when the debug info structure does not have it. +-- It parses either the file or the string where the function is defined. +-- Returns '?' if the line where the function is defined is not found +local function GuessFunctionName(info) + --print("guessing function name") + if type(info.source) == "string" and info.source:sub(1,1) == "@" then + local file, err = io_open(info.source:sub(2), "r") + if not file then + print("file not found: "..tostring(err)) -- whoops! + return "?" + end + local line + for i = 1, info.linedefined do + line = file:read("*l") + end + if not line then + print("line not found") -- whoops! + return "?" + end + return ParseLine(line) + else + local line + local lineNumber = 0 + for l in string_gmatch(info.source, "([^\n]+)\n-") do + lineNumber = lineNumber + 1 + if lineNumber == info.linedefined then + line = l + break + end + end + if not line then + print("line not found") -- whoops! + return "?" + end + return ParseLine(line) + end +end + +--- +-- Dumper instances are used to analyze stacks and collect its information. +-- +local Dumper = {} + +Dumper.new = function(thread) + local t = { lines = {} } + for k,v in pairs(Dumper) do t[k] = v end + + t.dumping_same_thread = (thread == coroutine.running()) + + -- if a thread was supplied, bind it to debug.info and debug.get + -- we also need to skip this additional level we are introducing in the callstack (only if we are running + -- in the same thread we're inspecting) + if type(thread) == "thread" then + t.getinfo = function(level, what) + if t.dumping_same_thread and type(level) == "number" then + level = level + 1 + end + return debug.getinfo(thread, level, what) + end + t.getlocal = function(level, loc) + if t.dumping_same_thread then + level = level + 1 + end + return debug.getlocal(thread, level, loc) + end + else + t.getinfo = debug.getinfo + t.getlocal = debug.getlocal + end + + return t +end + +-- helpers for collecting strings to be used when assembling the final trace +function Dumper:add (text) + self.lines[#self.lines + 1] = text +end +function Dumper:add_f (fmt, ...) + self:add(fmt:format(...)) +end +function Dumper:concat_lines () + return table_concat(self.lines) +end + +--- +-- Private: +-- Iterates over the local variables of a given function. +-- +-- @param level The stack level where the function is. +-- +function Dumper:DumpLocals (level) + local prefix = "\t " + local i = 1 + + if self.dumping_same_thread then + level = level + 1 + end + + local name, value = self.getlocal(level, i) + if not name then + return + end + self:add("\tLocal variables:\r\n") + while name do + if type(value) == "number" then + self:add_f("%s%s = number: %g\r\n", prefix, name, value) + elseif type(value) == "boolean" then + self:add_f("%s%s = boolean: %s\r\n", prefix, name, tostring(value)) + elseif type(value) == "string" then + self:add_f("%s%s = string: %q\r\n", prefix, name, value) + elseif type(value) == "userdata" then + self:add_f("%s%s = %s\r\n", prefix, name, safe_tostring(value)) + elseif type(value) == "nil" then + self:add_f("%s%s = nil\r\n", prefix, name) + elseif type(value) == "table" then + if m_known_tables[value] then + self:add_f("%s%s = %s\r\n", prefix, name, m_known_tables[value]) + elseif m_user_known_tables[value] then + self:add_f("%s%s = %s\r\n", prefix, name, m_user_known_tables[value]) + else + local txt = "{" + for k,v in pairs(value) do + txt = txt..safe_tostring(k)..":"..safe_tostring(v) + if #txt > _M.max_tb_output_len then + txt = txt.." (more...)" + break + end + if next(value, k) then txt = txt..", " end + end + self:add_f("%s%s = %s %s\r\n", prefix, name, safe_tostring(value), txt.."}") + end + elseif type(value) == "function" then + local info = self.getinfo(value, "nS") + local fun_name = info.name or m_known_functions[value] or m_user_known_functions[value] + if info.what == "C" then + self:add_f("%s%s = C %s\r\n", prefix, name, (fun_name and ("function: " .. fun_name) or tostring(value))) + else + local source = info.short_src + if source:sub(2,7) == "string" then + source = source:sub(9) -- uno m?s, por el espacio que viene (string "Baragent.Main", por ejemplo) + end + --for k,v in pairs(info) do print(k,v) end + fun_name = fun_name or GuessFunctionName(info) + self:add_f("%s%s = Lua function '%s' (defined at line %d of chunk %s)\r\n", prefix, name, fun_name, info.linedefined, source) + end + elseif type(value) == "thread" then + self:add_f("%sthread %q = %s\r\n", prefix, name, tostring(value)) + end + i = i + 1 + name, value = self.getlocal(level, i) + end +end + + +--- +-- Public: +-- Collects a detailed stack trace, dumping locals, resolving function names when they're not available, etc. +-- This function is suitable to be used as an error handler with pcall or xpcall +-- +-- @param thread An optional thread whose stack is to be inspected (defaul is the current thread) +-- @param message An optional error string or object. +-- @param level An optional number telling at which level to start the traceback (default is 1) +-- +-- Returns a string with the stack trace and a string with the original error. +-- +function _M.stacktrace(thread, message, level) + if type(thread) ~= "thread" then + -- shift parameters left + thread, message, level = nil, thread, message + end + + thread = thread or coroutine.running() + + level = level or 1 + + local dumper = Dumper.new(thread) + + local original_error + + if type(message) == "table" then + dumper:add("an error object {\r\n") + local first = true + for k,v in pairs(message) do + if first then + dumper:add(" ") + first = false + else + dumper:add(",\r\n ") + end + dumper:add(safe_tostring(k)) + dumper:add(": ") + dumper:add(safe_tostring(v)) + end + dumper:add("\r\n}") + original_error = dumper:concat_lines() + elseif type(message) == "string" then + dumper:add(message) + original_error = message + end + + dumper:add("\r\n") + dumper:add[[ +Stack Traceback +=============== +]] + --print(error_message) + + local level_to_show = level + if dumper.dumping_same_thread then level = level + 1 end + + local info = dumper.getinfo(level, "nSlf") + while info do + if info.what == "main" then + if string_sub(info.source, 1, 1) == "@" then + dumper:add_f("(%d) main chunk of file '%s' at line %d\r\n", level_to_show, string_sub(info.source, 2), info.currentline) + else + dumper:add_f("(%d) main chunk of %s at line %d\r\n", level_to_show, info.short_src, info.currentline) + end + elseif info.what == "C" then + --print(info.namewhat, info.name) + --for k,v in pairs(info) do print(k,v, type(v)) end + local function_name = m_user_known_functions[info.func] or m_known_functions[info.func] or info.name or tostring(info.func) + dumper:add_f("(%d) %s C function '%s'\r\n", level_to_show, info.namewhat, function_name) + --dumper:add_f("%s%s = C %s\r\n", prefix, name, (m_known_functions[value] and ("function: " .. m_known_functions[value]) or tostring(value))) + elseif info.what == "tail" then + --print("tail") + --for k,v in pairs(info) do print(k,v, type(v)) end--print(info.namewhat, info.name) + dumper:add_f("(%d) tail call\r\n", level_to_show) + dumper:DumpLocals(level) + elseif info.what == "Lua" then + local source = info.short_src + local function_name = m_user_known_functions[info.func] or m_known_functions[info.func] or info.name + if source:sub(2, 7) == "string" then + source = source:sub(9) + end + local was_guessed = false + if not function_name or function_name == "?" then + --for k,v in pairs(info) do print(k,v, type(v)) end + function_name = GuessFunctionName(info) + was_guessed = true + end + -- test if we have a file name + local function_type = (info.namewhat == "") and "function" or info.namewhat + if info.source and info.source:sub(1, 1) == "@" then + dumper:add_f("(%d) Lua %s '%s' at file '%s:%d'%s\r\n", level_to_show, function_type, function_name, info.source:sub(2), info.currentline, was_guessed and " (best guess)" or "") + elseif info.source and info.source:sub(1,1) == '#' then + dumper:add_f("(%d) Lua %s '%s' at template '%s:%d'%s\r\n", level_to_show, function_type, function_name, info.source:sub(2), info.currentline, was_guessed and " (best guess)" or "") + else + dumper:add_f("(%d) Lua %s '%s' at line %d of chunk '%s'\r\n", level_to_show, function_type, function_name, info.currentline, source) + end + dumper:DumpLocals(level) + else + dumper:add_f("(%d) unknown frame %s\r\n", level_to_show, info.what) + end + + level = level + 1 + level_to_show = level_to_show + 1 + info = dumper.getinfo(level, "nSlf") + end + + return dumper:concat_lines(), original_error +end + +-- +-- Adds a table to the list of known tables +function _M.add_known_table(tab, description) + if m_known_tables[tab] then + error("Cannot override an already known table") + end + m_user_known_tables[tab] = description +end + +-- +-- Adds a function to the list of known functions +function _M.add_known_function(fun, description) + if m_known_functions[fun] then + error("Cannot override an already known function") + end + m_user_known_functions[fun] = description +end + +return _M diff --git a/extensions/_Misc.ext b/extensions/_Misc.ext new file mode 100644 index 0000000..6434b14 --- /dev/null +++ b/extensions/_Misc.ext @@ -0,0 +1,14 @@ +-- +-- Copyright (C) 2010 - 2015 Eluna Lua Engine +-- This program is free software licensed under GPL version 3 +-- Please see the included DOCS/LICENSE.md for more information +-- + +-- filename.ext files are loaded before normal .lua files + +-- Randomize random +math.randomseed(tonumber(tostring(os.time()):reverse():sub(1,6))) + +-- Set debug.traceback to use StackTracePlus to print full stack trace +local trace = require("StackTracePlus") +debug.traceback = trace.stacktrace diff --git a/extra_buttons_bar/Blizz_interface_changes_Server.lua b/extra_buttons_bar/Blizz_interface_changes_Server.lua new file mode 100644 index 0000000..9e10dca --- /dev/null +++ b/extra_buttons_bar/Blizz_interface_changes_Server.lua @@ -0,0 +1,37 @@ +--fix for talent points players have and which can be used in standart interface and then exploited +local function RemoveTalentPoints(event,player) + if (player:GetFreeTalentPoints()) then + player:SetFreeTalentPoints(0) + end +end + +RegisterPlayerEvent(3, RemoveTalentPoints) + +--ressurect and tele to city +local AIO = AIO or require("AIO") + + +local MyHandlers = AIO.AddHandlers("DeathRessurect", {}) + + function MyHandlers.Ressurect(player) + if player:HasAura(8326) and (player:GetLevel() >= 10) then + if (player:InBattleground()) then + return false + end + player:ResurrectPlayer(20, true) + player:DurabilityLossAll(100, true) + if player:IsAlliance() then + player:Teleport(0, -8525.72, 851.9157, 106.51, 3.8) + else + player:Teleport(1, 1451, -4181, 61.6, 1.05) + end + end +end + + function GetGoldForMoney(cost) + local c_gold,c_silver,c_copper = 0 + c_gold = math.floor(math.abs(cost / 10000)) + c_silver = math.floor(math.abs(math.fmod(cost / 100, 100))) + c_copper = math.floor(math.abs(math.fmod(cost, 100))) + return c_gold,c_silver,c_copper +end \ No newline at end of file diff --git a/extra_buttons_bar/Blizz_interface_improvements.lua b/extra_buttons_bar/Blizz_interface_improvements.lua new file mode 100644 index 0000000..02e2603 --- /dev/null +++ b/extra_buttons_bar/Blizz_interface_improvements.lua @@ -0,0 +1,172 @@ +local AIO = AIO or require("AIO") + + +if AIO.AddAddon() then + return +end + +local MicroButtons = { + AchievementMicroButton, + QuestLogMicroButton, + SocialsMicroButton, + PVPMicroButton +} +local MicroButtons2 = { + LFDMicroButton, + MainMenuMicroButton, + HelpMicroButton + } + +BI_i = CreateFrame("Frame", nil, UIParent) +BI_i:SetScript("OnUpdate", function() + if (PlayerTalentFrame) then + if (PlayerTalentFrame:IsVisible()) then + PlayerTalentFrameTab2:Hide() + PlayerTalentFrameTab3:Hide() + PlayerTalentFrameTab4:Hide() + end +end + + if (InspectFrame) then + if (InspectFrameTab3:IsVisible()) then + InspectFrameTab3:Hide() + end + end + + if (FriendsFrameTab2:IsVisible()) then + FriendsFrameTab2:Hide() + end + + --[[if (LFDMicroButton:IsVisible()) then + LFDMicroButton:Hide() + CharUpdatesMicroButton:Show() + end]] + if (TalentMicroButton:IsVisible()) then + TalentMicroButton:Hide() + CharUpdatesMicroButton:Show() + --moving all buttons to right + LFDMicroButton:Show() + for i = 1, #MicroButtons do + if (i == 1) then + MicroButtons[i]:SetPoint("BOTTOMLEFT", SpellbookMicroButton, "BOTTOMRIGHT", -3, 0) + else + MicroButtons[i]:SetPoint("BOTTOMLEFT", MicroButtons[i-1], "BOTTOMRIGHT", -3, 0) + end + end + + --shitty code, lol + for i = 1, #MicroButtons2 do + if (i == 1) then + MicroButtons2[i]:SetPoint("BOTTOMLEFT", CharUpdatesMicroButton, "BOTTOMRIGHT", -3, 0) + else + MicroButtons2[i]:SetPoint("BOTTOMLEFT", MicroButtons2[i-1], "BOTTOMRIGHT", -3, 0) + end + end + + end + + if (UnitLevel("player") >= 10) then + if (UnitIsGhost("player")) and not(DeathCapitalTeleportButton:IsVisible()) then + local zonenamename, zonetype = GetInstanceInfo() + if not(zonetype == "pvp") then + DeathCapitalTeleportButton:Show() + end + elseif not(UnitIsGhost("player")) and (DeathCapitalTeleportButton:IsVisible()) then + DeathCapitalTeleportButton:Hide() + end +end + end) +BI_i:Show() + +--Pet talents tab +table.insert(UnitPopupMenus["PET"], table.getn(UnitPopupMenus["PET"]), "ASCENSION_PETTALENTS"); +UnitPopupButtons["ASCENSION_PETTALENTS"] = {text = "Pet Talents", dist = 0} +hooksecurefunc("UnitPopup_OnClick", function (self) + local name = UIDROPDOWNMENU_INIT_MENU.name + if (name == MC_PLAYER) then return end + if (self.value == "ASCENSION_PETTALENTS") then + ToggleTalentFrame() + end + end); + +function IsSpellLearned(entry) + local spellname = GetSpellInfo(entry) + local done = false + local known = false + local i = 1 + local id = nil + if not(spellname) then + return false + end + spellname = string.gsub(spellname,"%(Rank %d+%)",""); + while not done do + local name = GetSpellName(i,BOOKTYPE_SPELL); + if not name then + done=true; + elseif (name==spellname) then + known = true + end + i = i+1; + end +return known +end + +--pet status bar-- +--[[function Asc_PetPaperDollFrame_Update() + local hasPetUI, canGainXP = HasPetUI(); + if ( not hasPetUI ) then + return; + end + PetModelFrame:SetUnit("pet"); + if ( UnitCreatureFamily("pet") ) then + PetLevelText:SetFormattedText(UNIT_TYPE_LEVEL_TEMPLATE,UnitLevel("pet"),UnitCreatureFamily("pet")); + end + if ( PetPaperDollFramePetFrame:IsShown() ) then + PetNameText:SetText(UnitName("pet")); + end + PetExpBar_Update(); + PetPaperDollFrame_SetResistances(); + PetPaperDollFrame_SetStats(); + PaperDollFrame_SetDamage(PetDamageFrame, "Pet"); + PaperDollFrame_SetArmor(PetArmorFrame, "Pet"); + PaperDollFrame_SetAttackPower(PetAttackPowerFrame, "Pet"); + PetPaperDollFrame_SetSpellBonusDamage(); + + if ( GetPetFoodTypes() ) then + PetPaperDollPetInfo:Show(); + else + PetPaperDollPetInfo:Hide(); + end +end +ActionButton_UpdateUsable = Asc_PetPaperDollFrame_Update]]-- + +--[[function Asc_PetFrame_SetHappiness () + local happiness, damagePercentage = GetPetHappiness(); + local hasPetUI, isHunterPet = HasPetUI(); + if ( not damagePercentage) then + PetFrameHappiness:Hide(); + return; + end + PetFrameHappiness:Show(); + + --custom hapiness indicator + if (damagePercentage > 100) then + happiness = 3 + elseif (damagePercentage == 100) then + happiness = 2 + else + happiness = 1 + end + --end + if ( happiness == 1 ) then + PetFrameHappinessTexture:SetTexCoord(0.375, 0.5625, 0, 0.359375); + elseif ( happiness == 2 ) then + PetFrameHappinessTexture:SetTexCoord(0.1875, 0.375, 0, 0.359375); + elseif ( happiness == 3 ) then + PetFrameHappinessTexture:SetTexCoord(0, 0.1875, 0, 0.359375); + end + PetFrameHappiness.tooltip = _G["PET_HAPPINESS"..happiness]; + PetFrameHappiness.tooltipDamage = format(PET_DAMAGE_PERCENTAGE, damagePercentage); +end + +PetFrame_SetHappiness = Asc_PetFrame_SetHappiness]]-- \ No newline at end of file diff --git a/extra_buttons_bar/ClientEBB.lua b/extra_buttons_bar/ClientEBB.lua new file mode 100644 index 0000000..e740dbe --- /dev/null +++ b/extra_buttons_bar/ClientEBB.lua @@ -0,0 +1,3937 @@ +local AIO = AIO or require("AIO") + + +if AIO.AddAddon() then + return +end + + +local MyHandlers = AIO.AddHandlers("sideBar", {}) + +local scrollitem = 1101243 +--fading function + +FramesToFade = {} + +function BaseFrameFade(frame, mode) + if (frame) then + frame.FadeTimer = 0 + if (frame.time) then + frame.TimeToFade = frame.time + else + frame.TimeToFade = 3 + end + frame.FadeMode = mode + table.insert(FramesToFade, frame) + end +end + +function BaseFrameFadeIn(frame, mode) + BaseFrameFade(frame, "IN") + frame:Show() +end + +function BaseFrameFadeOut(frame, mode) + BaseFrameFade(frame, "OUT") + --frame:Show() +end + +function BaseFading(elapsed) + for k,frame in pairs(FramesToFade) do + frame.FadeTimer = frame.FadeTimer + 0.1 + if (frame.FadeTimer < frame.TimeToFade) then + if (frame.FadeMode == "IN") then + frame:SetAlpha(frame.FadeTimer/frame.TimeToFade) + elseif (frame.FadeMode == "OUT") then + frame:SetAlpha((frame.TimeToFade-frame.FadeTimer)/frame.TimeToFade) + end + else + if ( frame.FadeMode == "IN" ) then + frame:SetAlpha(1.0); + elseif ( frame.FadeMode == "OUT" ) then + frame:SetAlpha(0); + frame:Hide() + end + table.remove(FramesToFade, k) + end + end + end + +fadingFunc = CreateFrame("FRAME", "fadingFunc") +fadingFunc:SetScript("OnUpdate", BaseFading) +--end of fading function + +--[[TEMP RESET COINAGE AMOUNT]]-- +--talent reset cost, ability reset cost, level modifier-- +--[[local Reset_Level = { + [0] = {2500, 2700, 105}, + [10] = {5000, 7500, 150}, + [20] = {7500, 10000, 2150}, + [30] = {50000,150000,3250}, + [40] = {150000,300000,9250}, + [50] = {300000,1000000,10550}, + [60] = {500000,2500000,20000}, +} + +local function GetMoneyForReset(purgemissing) + -- 1 - talent cost + -- 2 - ability cost +for k,v in pairs(Reset_Level) do + if (UnitLevel("player") >= k) and (UnitLevel("player") < k+10) then + local talent_cost = Reset_Level[k][purgemissing] + Reset_Level[k][3]*(UnitLevel("player")-k) + + local talent_cost_gold = floor(abs(talent_cost / 10000)) + local talent_cost_silver = floor(abs(mod(talent_cost / 100, 100))) + local talent_cost_cooper = floor(abs(mod(talent_cost, 100))) + return talent_cost, talent_cost_gold, talent_cost_silver, talent_cost_cooper + end +end +--]] +--[[TEMP RESET COINAGE AMOUNT]]-- +local function CanBeUnlearned(slot, item) + -- item check + -- player has spell check + local spellname,rank,spellid = GameTooltip:GetSpell() + if (GameTooltip:GetSpell() and IsSpellLearned(spellid) and (GetItemCount(scrollitem) > 0)) then + return true + end + return false +end + +Framework_Base = CreateFrame("Frame", "sideBar", UIParent, nil) +local sideBar = Framework_Base +sideBar:SetFrameStrata("LOW") + sideBar:SetSize(912, 456) + sideBar:SetMovable(true) + sideBar:EnableMouse(true) + sideBar:RegisterForDrag("LeftButton") + sideBar:SetPoint("CENTER", 0, 0) + sideBar:SetClampedToScreen(true) + sideBar:SetBackdrop({ + bgFile = "Interface\\AddOns\\AwAddons\\Textures\\misc\\main",}) + + sideBar:SetScript("OnUpdate" , function() + local itemCount_sb = GetItemCount(383080) or 0 + sideBar.Text_Ability:SetText("|cffE1AB18Ability Essence: |cffFFFFFF"..itemCount_sb) + local itemCount_sb2 = GetItemCount(383081) or 0 + sideBar.Text_Talent:SetText("|cffE1AB18Talent Essence: |cffFFFFFF"..itemCount_sb2) + local itemCount_sb_r = GetItemCount(383082) or 0 + sideBar.Text_Ability_Reset:SetText("|cffE1AB18Ability Resets: |cffFFFFFF"..itemCount_sb_r) + local itemCount_sb2_r = GetItemCount(383083) or 0 + sideBar.Text_Talent_Reset:SetText("|cffE1AB18Talent Resets: |cffFFFFFF"..itemCount_sb2_r) + end) + + sideBar:SetScript("OnDragStart", sideBar.StartMoving) + sideBar:SetScript("OnHide", sideBar.StopMovingOrSizing) + sideBar:SetScript("OnDragStop", sideBar.StopMovingOrSizing) + sideBar:EnableKeyboard(1) + sideBar:SetScript("OnKeyDown", function(self, arg1) + if (arg1 == "ESCAPE") then + self:Hide() + end + end) + + AIO.SavePosition(sideBar) + local ui_w, ui_h = UIParent:GetSize() + local ui_diff = 1 + local uiScale = 1 + + local MainFrame_ButtonModels_Ulduar1 = CreateFrame("Model", "MainFrame_ButtonModels_Ulduar1", sideBar) + MainFrame_ButtonModels_Ulduar1:SetWidth(ui_w*30/100); + MainFrame_ButtonModels_Ulduar1:SetHeight(ui_h*41.5/100); + MainFrame_ButtonModels_Ulduar1:SetPoint("CENTER", sideBar, "CENTER", 170, 5) + MainFrame_ButtonModels_Ulduar1:SetModel("Creature\\Tempscarletcrusaderheavy\\scarletcrusaderheavy.m2") + MainFrame_ButtonModels_Ulduar1:SetModelScale(0.3) + MainFrame_ButtonModels_Ulduar1:SetCamera(0) + MainFrame_ButtonModels_Ulduar1:SetPosition(0.0,0.0,2) + MainFrame_ButtonModels_Ulduar1:SetAlpha(0.4) + + local MainFrame_ButtonModels_Ulduar2 = CreateFrame("Model", "MainFrame_ButtonModels_Ulduar2", sideBar) + MainFrame_ButtonModels_Ulduar2:SetWidth(ui_w*22/100); + MainFrame_ButtonModels_Ulduar2:SetHeight(ui_h*41.5/100); + MainFrame_ButtonModels_Ulduar2:SetPoint("CENTER", sideBar, "CENTER", -180, 5) + MainFrame_ButtonModels_Ulduar2:SetModel("Creature\\Tempscarletcrusaderheavy\\scarletcrusaderheavy.m2") + MainFrame_ButtonModels_Ulduar2:SetModelScale(0.3) + MainFrame_ButtonModels_Ulduar2:SetCamera(0) + MainFrame_ButtonModels_Ulduar2:SetPosition(0.0,0.0,2) + MainFrame_ButtonModels_Ulduar2:SetAlpha(0.4) + MainFrame_ButtonModels_Ulduar2:SetFacing(0.1) + + local MainFrame_ButtonModels_Ulduar3 = CreateFrame("Model", "MainFrame_ButtonModels_Ulduar3", sideBar) + MainFrame_ButtonModels_Ulduar3:SetWidth(ui_w*34.4/100); + MainFrame_ButtonModels_Ulduar3:SetHeight(ui_h*52/100); + MainFrame_ButtonModels_Ulduar3:SetPoint("CENTER", sideBar, "CENTER", 0, 10) + MainFrame_ButtonModels_Ulduar3:SetModel("Creature\\Tempscarletcrusaderheavy\\scarletcrusaderheavy.m2") + MainFrame_ButtonModels_Ulduar3:SetModelScale(0.3) + MainFrame_ButtonModels_Ulduar3:SetCamera(0) + MainFrame_ButtonModels_Ulduar3:SetPosition(0.0,0.0,2) + MainFrame_ButtonModels_Ulduar3:SetAlpha(0.4) + MainFrame_ButtonModels_Ulduar3:SetFacing(0.1) + --MainFrame_ButtonModels_Ulduar1:Hide() + sideBar:Hide() + sideBar:SetScript("OnShow", function() + if (GetCVar("useUiScale") == "1") then + ui_diff = 1 + uiScale = GetCVar("uiScale") + else + --SetCVar("useUiScale","1") + SetCVar("uiScale","1") + ui_diff = ui_h/768 + uiScale = 1 + end -- resolution and uiscale fix + MainFrame_ButtonModels_Ulduar1:SetModel("World\\Expansion02\\doodads\\ulduar\\ul_statue_03.m2") + MainFrame_ButtonModels_Ulduar1:SetModelScale(0.23) + MainFrame_ButtonModels_Ulduar1:SetPosition(-0.27,0.0,1.662/uiScale*ui_diff) + MainFrame_ButtonModels_Ulduar1:SetFacing(-0.3) + MainFrame_ButtonModels_Ulduar1:SetAlpha(0.8) + + MainFrame_ButtonModels_Ulduar2:SetModel("World\\Expansion02\\doodads\\ulduar\\ul_smallstatue_druid.m2") + MainFrame_ButtonModels_Ulduar2:SetModelScale(0.17) + MainFrame_ButtonModels_Ulduar2:SetPosition(0.1,0.0,1.785/uiScale*ui_diff) + MainFrame_ButtonModels_Ulduar2:SetFacing(3.9) + MainFrame_ButtonModels_Ulduar2:SetAlpha(0.8) + + MainFrame_ButtonModels_Ulduar3:SetModel("World\\Expansion02\\doodads\\ulduar\\ul_statue_02.m2") + MainFrame_ButtonModels_Ulduar3:SetModelScale(0.17) + MainFrame_ButtonModels_Ulduar3:SetPosition(0.05,0.0,1.685/uiScale*ui_diff) + MainFrame_ButtonModels_Ulduar3:SetFacing(3.6) + MainFrame_ButtonModels_Ulduar3:SetAlpha(0.8) + end) + + sideBar.Text_Ability = sideBar:CreateFontString() + sideBar.Text_Ability:SetFontObject(GameFontNormal) + sideBar.Text_Ability:SetPoint("BOTTOM", sideBar, -190, 90); + sideBar.Text_Ability:SetFont("Fonts\\MORPHEUS.TTF", 15, "OUTLINE") + --MainFrame.Text_Ability:Hide() + + sideBar.Text_Talent = sideBar:CreateFontString() + sideBar.Text_Talent:SetFontObject(GameFontNormal) + sideBar.Text_Talent:SetPoint("BOTTOM", sideBar, -190, 65); + sideBar.Text_Talent:SetFont("Fonts\\MORPHEUS.TTF", 15, "OUTLINE") + --MainFrame.Text_Talent:Hide() + + sideBar.Text_Ability_Reset = sideBar:CreateFontString() + sideBar.Text_Ability_Reset:SetFontObject(GameFontNormal) + sideBar.Text_Ability_Reset:SetPoint("BOTTOM", sideBar, 190, 90); + sideBar.Text_Ability_Reset:SetFont("Fonts\\MORPHEUS.TTF", 15, "OUTLINE") + --MainFrame.Text_Ability_Reset:Hide() + + sideBar.Text_Talent_Reset = sideBar:CreateFontString() + sideBar.Text_Talent_Reset:SetFontObject(GameFontNormal) + sideBar.Text_Talent_Reset:SetPoint("BOTTOM", sideBar, 190, 65); + sideBar.Text_Talent_Reset:SetFont("Fonts\\MORPHEUS.TTF", 15, "OUTLINE") + --MainFrame.Text_Talent_Reset:Hide() + + sideBar.Text_Title = sideBar:CreateFontString() + sideBar.Text_Title:SetFontObject(GameFontNormal) + sideBar.Text_Title:SetPoint("BOTTOM", sideBar, -2, 120); + sideBar.Text_Title:SetFont("Fonts\\MORPHEUS.TTF", 15) + sideBar.Text_Title:SetShadowOffset(0, -1) + sideBar.Text_Title:SetText("|cff230d21Character Upgrades|r") + --MainFrame.Text_Title:Hide() + + local sideBar_CloseButton = CreateFrame("Button", "sideBar_CloseButton", sideBar, "UIPanelCloseButton") + sideBar_CloseButton:SetPoint("TOPRIGHT", -121, -55) --edited + sideBar_CloseButton:EnableMouse(true) + --sideBar_CloseButton:SetSize(29, 29) --edited + sideBar_CloseButton:SetScript("OnMouseUp", function() + PlaySound("Glyph_MajorDestroy") + BaseFrameFadeOut(sideBar) + end) + + sideBar.Text_CheckBox = sideBar:CreateFontString() + sideBar.Text_CheckBox:SetFontObject(GameFontNormal) + sideBar.Text_CheckBox:SetPoint("BOTTOM", sideBar, -2, 70); + sideBar.Text_CheckBox:SetFont("Fonts\\FRIZQT__.TTF", 12) + sideBar.Text_CheckBox:SetShadowOffset(0, -1) + sideBar.Text_CheckBox:SetText("|cffFFFFFFEnable/disable quick access to\ncharacter progression menu|r") + --edited + --edited + + + --[[TRAINING FRAME]]-- + local TrainingFrame = CreateFrame("Frame", "TrainingFrame", UIParent, nil) + TrainingFrame:SetSize(950, 860) + --TrainingFrame:SetMovable(true) + TrainingFrame:EnableMouse(true) + --TrainingFrame:RegisterForDrag("LeftButton") + TrainingFrame:SetPoint("CENTER", 0, 45) + TrainingFrame:SetFrameStrata("DIALOG") + --TrainingFrame:SetClampedToScreen(true) + TrainingFrame:EnableMouseWheel(true) + TrainingFrame:SetScript("OnMouseWheel", function(self, delta) + if (scrollbar:IsVisible()) then + local value = scrollbar:GetValue() + scrollbar:SetValue(value-delta*30) + end + end) + TrainingFrame:SetBackdrop({ + bgFile = "Interface\\AddOns\\AwAddons\\Textures\\progress\\progress",}) --edited + TrainingFrame:Hide() + + TrainingFrame_model = CreateFrame("Model", "TrainingFrame_model", TrainingFrame) + TrainingFrame_model:SetWidth(560); + TrainingFrame_model:SetHeight(655); + TrainingFrame_model:SetPoint("CENTER", TrainingFrame, "CENTER", -105, -30) + TrainingFrame_model:SetModel("World\\Expansion01\\doodads\\theexodar\\passivedoodads\\paladin_energy_fx\\exodar_paladin_shrine_energyfx.m2") + TrainingFrame_model:SetModelScale(0.04) + TrainingFrame_model:SetCamera(0) + TrainingFrame_model:SetPosition(0.075,0.09,0) + TrainingFrame_model:SetAlpha(0.002) + TrainingFrame_model:SetFacing(0.1) + TrainingFrame_model:Hide() + + TrainingFrame_model2 = CreateFrame("Model", "TrainingFrame_model2", TrainingFrame) + TrainingFrame_model2:SetWidth(560); + TrainingFrame_model2:SetHeight(655); + TrainingFrame_model2:SetPoint("CENTER", TrainingFrame, "CENTER", -105, -30) + TrainingFrame_model2:SetModel("World\\Expansion01\\doodads\\netherstorm\\crackeffects\\netherstormcracksmokeblue.m2") + TrainingFrame_model2:SetModelScale(0.2) + TrainingFrame_model2:SetCamera(0) + TrainingFrame_model2:SetPosition(0.18,0.20,0) + TrainingFrame_model2:SetAlpha(0.8) + TrainingFrame_model2:SetFacing(0.1) + TrainingFrame_model2:Hide() + + + TrainingFrame_SelectedTitle = CreateFrame("Frame", "TrainingFrame_SelectedTitle", TrainingFrame, nil) + TrainingFrame_SelectedTitle:SetSize(TrainingFrame:GetSize()) + TrainingFrame_SelectedTitle:SetPoint("CENTER",0,0) + + local TrainingFrame_SelectedTitle_Stars1 = CreateFrame("Model", "TrainingFrame_SelectedTitle_Stars1", TrainingFrame_SelectedTitle) + TrainingFrame_SelectedTitle_Stars1:SetWidth(560); + TrainingFrame_SelectedTitle_Stars1:SetHeight(655); + TrainingFrame_SelectedTitle_Stars1:SetPoint("CENTER", TrainingFrame, "CENTER", -105, -30) + TrainingFrame_SelectedTitle_Stars1:SetModel("Creature\\Tempscarletcrusaderheavy\\scarletcrusaderheavy.m2") + TrainingFrame_SelectedTitle_Stars1:SetModelScale(0.3) + TrainingFrame_SelectedTitle_Stars1:SetCamera(0) + TrainingFrame_SelectedTitle_Stars1:SetPosition(0.0,0.0,2) + TrainingFrame_SelectedTitle_Stars1:SetAlpha(0.4) + TrainingFrame_SelectedTitle_Stars1:SetFacing(0.1) + TrainingFrame_SelectedTitle_Stars1:Hide() + + + local TrainingFrame_SelectedTitle_Stars1_glow = CreateFrame("Model", "TrainingFrame_SelectedTitle_Stars1_glow", TrainingFrame_SelectedTitle) + TrainingFrame_SelectedTitle_Stars1_glow:SetWidth(256); + TrainingFrame_SelectedTitle_Stars1_glow:SetHeight(256); + TrainingFrame_SelectedTitle_Stars1_glow:SetPoint("CENTER", TrainingFrame_SelectedTitle_Stars1, "CENTER", -160, 0) + TrainingFrame_SelectedTitle_Stars1_glow:SetModel("World\\Kalimdor\\silithus\\passivedoodads\\ahnqirajglow\\quirajglow.m2") + TrainingFrame_SelectedTitle_Stars1_glow:SetModelScale(0.02) + TrainingFrame_SelectedTitle_Stars1_glow:SetCamera(0) + TrainingFrame_SelectedTitle_Stars1_glow:SetPosition(0.075,0.09,0) + TrainingFrame_SelectedTitle_Stars1_glow:SetAlpha(0.7) + TrainingFrame_SelectedTitle_Stars1_glow:SetFacing(0) + TrainingFrame_SelectedTitle_Stars1_glow:Hide() + + local TrainingFrame_SelectedTitle_Stars2 = CreateFrame("Model", "TrainingFrame_SelectedTitle_Stars2", TrainingFrame_SelectedTitle) + TrainingFrame_SelectedTitle_Stars2:SetWidth(560); + TrainingFrame_SelectedTitle_Stars2:SetHeight(655); + TrainingFrame_SelectedTitle_Stars2:SetPoint("CENTER", TrainingFrame, "CENTER", 230, -30) + TrainingFrame_SelectedTitle_Stars2:SetModel("Creature\\Tempscarletcrusaderheavy\\scarletcrusaderheavy.m2") + TrainingFrame_SelectedTitle_Stars2:SetModelScale(0.3) + TrainingFrame_SelectedTitle_Stars2:SetCamera(0) + TrainingFrame_SelectedTitle_Stars2:SetPosition(0.0,0.0,2) + TrainingFrame_SelectedTitle_Stars2:SetAlpha(0.4) + TrainingFrame_SelectedTitle_Stars2:SetFacing(0.1) + TrainingFrame_SelectedTitle_Stars2:Hide() + + + local TrainingFrame_SelectedTitle_Stars2_glow = CreateFrame("Model", "TrainingFrame_SelectedTitle_Stars2_glow", TrainingFrame_SelectedTitle) + TrainingFrame_SelectedTitle_Stars2_glow:SetWidth(256); + TrainingFrame_SelectedTitle_Stars2_glow:SetHeight(256); + TrainingFrame_SelectedTitle_Stars2_glow:SetPoint("CENTER", TrainingFrame_SelectedTitle_Stars2, "CENTER", -160, 0) + TrainingFrame_SelectedTitle_Stars2_glow:SetModel("World\\Kalimdor\\silithus\\passivedoodads\\ahnqirajglow\\quirajglow.m2") + TrainingFrame_SelectedTitle_Stars2_glow:SetModelScale(0.02) + TrainingFrame_SelectedTitle_Stars2_glow:SetCamera(0) + TrainingFrame_SelectedTitle_Stars2_glow:SetPosition(0.075,0.09,0) + TrainingFrame_SelectedTitle_Stars2_glow:SetAlpha(0.7) + TrainingFrame_SelectedTitle_Stars2_glow:SetFacing(0) + TrainingFrame_SelectedTitle_Stars2_glow:Hide() + + TrainingFrame_SelectedTitle:SetScript("OnShow", function() + if (GetCVar("useUiScale") == "1") then + ui_diff = 1 + uiScale = GetCVar("uiScale") + else + --SetCVar("useUiScale","1") + SetCVar("uiScale","1") + ui_diff = ui_h/768 + uiScale = 1 + end -- resolution and uiscale fix + TrainingFrame_SelectedTitle_Stars1:SetModel("Particles\\Lootfx2.m2") + TrainingFrame_SelectedTitle_Stars1:SetModelScale(0.1) + TrainingFrame_SelectedTitle_Stars1:SetPosition(0.2,0.0,1.85/uiScale*ui_diff) + TrainingFrame_SelectedTitle_Stars1:SetAlpha(0.8) + TrainingFrame_SelectedTitle_Stars2:SetModel("Particles\\Lootfx2.m2") + TrainingFrame_SelectedTitle_Stars2:SetModelScale(0.1) + TrainingFrame_SelectedTitle_Stars2:SetPosition(0.2,0.0,1.85/uiScale*ui_diff) + TrainingFrame_SelectedTitle_Stars2:SetAlpha(0.8) + end) + + local TrainingFrame_SelectedTitle_Glow = TrainingFrame_SelectedTitle:CreateTexture("TrainingFrame_SelectedTitle_Glow") + TrainingFrame_SelectedTitle_Glow:SetAllPoints() + TrainingFrame_SelectedTitle_Glow:SetTexture("Interface\\AddOns\\AwAddons\\Textures\\progress\\progress_cover_glow") + TrainingFrame_SelectedTitle_Glow:SetSize(TrainingFrame_SelectedTitle:GetSize()) + TrainingFrame_SelectedTitle_Glow:Hide() + + --[[07032017local TrainingFrame_SelectedTitle_Spells = TrainingFrame_SelectedTitle:CreateTexture("TrainingFrame_SelectedTitle_Spells") 08032017 + --TrainingFrame_SelectedTitle_Spells:SetAllPoints() + TrainingFrame_SelectedTitle_Spells:SetTexture("Interface\\AddOns\\AwAddons\\Textures\\progress\\spellicon") + TrainingFrame_SelectedTitle_Spells:SetPoint("CENTER", TrainingFrame_SelectedTitle, "CENTER", -114, 55) + TrainingFrame_SelectedTitle_Spells:SetSize(64,64)]]-- 08032017 + font_TrainingFrame_SelectedTitle_Spells = TrainingFrame_SelectedTitle:CreateFontString("TrainingFrame_SelectedTitle_Spells") + font_TrainingFrame_SelectedTitle_Spells:SetFontObject(GameFontNormal) + font_TrainingFrame_SelectedTitle_Spells:SetShadowOffset(1, -1) + font_TrainingFrame_SelectedTitle_Spells:SetText("Click to display spells") + font_TrainingFrame_SelectedTitle_Spells:SetPoint("CENTER", TrainingFrame_SelectedTitle, "CENTER", -114, -300) + font_TrainingFrame_SelectedTitle_Spells:Hide() + --TrainingFrame_SelectedTitle_Spells:Hide() + + --[[07032017local TrainingFrame_SelectedTitle_Talents = TrainingFrame_SelectedTitle:CreateTexture("TrainingFrame_SelectedTitle_Talents") 08032017 + --TrainingFrame_SelectedTitle_Talents:SetAllPoints() + TrainingFrame_SelectedTitle_Talents:SetTexture("Interface\\AddOns\\AwAddons\\Textures\\progress\\talenticon") + TrainingFrame_SelectedTitle_Talents:SetPoint("CENTER", TrainingFrame_SelectedTitle, "CENTER", -114, 55) + TrainingFrame_SelectedTitle_Talents:SetSize(64,64)]]-- 08032017 + font_TrainingFrame_SelectedTitle_Talents = TrainingFrame_SelectedTitle:CreateFontString("TrainingFrame_SelectedTitle_Talents") + font_TrainingFrame_SelectedTitle_Talents:SetFontObject(GameFontNormal) + --font_TrainingFrame_SelectedTitle_Talents:SetFont("Fonts\\MORPHEUS.TTF", 22, "OUTLINE") + font_TrainingFrame_SelectedTitle_Talents:SetShadowOffset(1, -1) + font_TrainingFrame_SelectedTitle_Talents:SetText("Click to display talents") + font_TrainingFrame_SelectedTitle_Talents:SetPoint("CENTER", TrainingFrame_SelectedTitle, "CENTER", -114, -300) + font_TrainingFrame_SelectedTitle_Talents:Hide() + --TrainingFrame_SelectedTitle_Talents:Hide() + + --TrainingFrame:SetScript("OnDragStart", TrainingFrame.StartMoving) + --TrainingFrame:SetScript("OnHide", TrainingFrame.StopMovingOrSizing) + --TrainingFrame:SetScript("OnDragStop", TrainingFrame.StopMovingOrSizing) + TrainingFrame:EnableKeyboard(1) + TrainingFrame:SetScript("OnKeyDown", function(self, arg1) + if (arg1 == "ESCAPE") then + self:Hide() + end + end) + + AIO.SavePosition(sideBar) + + --AIO.SavePosition(TrainingFrame) + + + --[[Skill Frame]] + local StatFrame = CreateFrame("Frame", "StatFrame", UIParent, nil) + StatFrame:SetSize(430, 480) --edited + --StatFrame:SetScale(0.88)--making everything more or less fit standart sizes of blizz interfaces + StatFrame:SetMovable(true) + StatFrame:EnableMouse(true) + StatFrame:RegisterForDrag("LeftButton") + StatFrame:SetPoint("CENTER") + StatFrame:SetClampedToScreen(true) + StatFrame:SetBackdrop({ + bgFile = "Interface\\AddOns\\AwAddons\\Textures\\Allocation\\allocation"}) --edited + StatFrame:Hide() + + StatFrame:SetScript("OnDragStart", StatFrame.StartMoving) + StatFrame:SetScript("OnHide", StatFrame.StopMovingOrSizing) + StatFrame:SetScript("OnDragStop", StatFrame.StopMovingOrSizing) + StatFrame_model = CreateFrame("Model", "StatFrame_model", StatFrame) + StatFrame_model:SetWidth(256); + StatFrame_model:SetHeight(256); + StatFrame_model:SetPoint("BOTTOM", StatFrame, "CENTER", 15, -350) + StatFrame_model:SetModel("World\\Kalimdor\\silithus\\passivedoodads\\ahnqirajglow\\quirajglow.m2") + StatFrame_model:SetModelScale(0.02) + StatFrame_model:SetCamera(0) + StatFrame_model:SetPosition(0.075,0.09,0) + StatFrame_model:SetAlpha(0.7) + StatFrame_model:SetFacing(0) + + StatFrame:EnableKeyboard(1) + StatFrame:SetScript("OnKeyDown", function(self, arg1) + if (arg1 == "ESCAPE") then + self:Hide() + end + end) + + AIO.SavePosition(StatFrame) + + + -- training button + --[[local sideBarOpeningFrameButton = CreateFrame("Button", "sideBarOpeningFrameButton", UIParent) + sideBarOpeningFrameButton:SetSize(256, 128) + sideBarOpeningFrameButton:SetPoint("CENTER", -60, 50) + sideBarOpeningFrameButton:EnableMouse(true) + sideBarOpeningFrameButton:SetMovable(true) + sideBarOpeningFrameButton:EnableMouse(true) + sideBarOpeningFrameButton:RegisterForDrag("LeftButton") + sideBarOpeningFrameButton:SetNormalTexture("Interface\\AddOns\\AwAddons\\Textures\\Misc\\mainb") + sideBarOpeningFrameButton:SetHighlightTexture("Interface\\AddOns\\AwAddons\\Textures\\Misc\\mainb_h") + + local sideBarOpeningFrameButton_text = sideBarOpeningFrameButton:CreateFontString("sideBarOpeningFrameButton_text") -- edited + sideBarOpeningFrameButton_text:SetFont("Fonts\\MORPHEUS.TTF", 16, "OUTLINE") -- edited + sideBarOpeningFrameButton_text:SetSize(250, 5) + sideBarOpeningFrameButton_text:SetPoint("CENTER", 0, 3) -- edited + sideBarOpeningFrameButton_text:SetText("Character Upgrades") -- edited + sideBarOpeningFrameButton:SetFontString(sideBarOpeningFrameButton_text) + --sideBarOpeningFrameButton:SetPushedTexture("Interface/Buttons/CheckButtonHilight") + local function sideBarOpeningFrameButton_pushed(self) + if not(sideBar:IsVisible()) then + BaseFrameFadeIn(sideBar) + else + BaseFrameFadeOut(sideBar) + end + end + sideBarOpeningFrameButton:SetScript("OnMouseUp", sideBarOpeningFrameButton_pushed) + sideBarOpeningFrameButton:SetScript("OnDragStart", sideBar.StartMoving) + sideBarOpeningFrameButton:SetScript("OnHide", sideBar.StopMovingOrSizing) + sideBarOpeningFrameButton:SetScript("OnDragStop", sideBar.StopMovingOrSizing)]]-- + LFDMicroButton:Hide() + local TOOLTIP_AWAKENING = "Using this menu you'll be\nable to reset your spells or talents,\nto get new abilities and allocate\nstats of your character" + function togglesiderframe() + TrainingFrame:Hide() StatFrame:Hide() + if not(sideBar:IsVisible()) then + PlaySound("Glyph_MajorCreate") + BaseFrameFadeIn(sideBar) + else + PlaySound("Glyph_MajorDestroy") + BaseFrameFadeOut(sideBar) + end + end + CharUpdatesMicroButton = CreateFrame("Button","CharUpdatesMicroButton",MainMenuBarArtFrame, "MainMenuBarMicroButton") + CharUpdatesMicroButton:SetPoint("BOTTOMLEFT", PVPMicroButton, "BOTTOMRIGHT", -3, 0) + CharUpdatesMicroButton:SetNormalTexture("Interface/Buttons/UI-MicroButton-Abilities-Up") + CharUpdatesMicroButton:SetPushedTexture("Interface/Buttons/UI-MicroButton-Abilities-Down") + CharUpdatesMicroButton:SetDisabledTexture("Interface/Buttons/UI-MicroButton-Abilities-Disabled") + CharUpdatesMicroButton:SetHighlightTexture("Interface\\Buttons\\UI-MicroButton-Hilight"); + + CharUpdatesMicroButton:SetScript("OnClick",function(self) + togglesiderframe() + SetButtonPulse(CharUpdatesMicroButton, 0, 1); --Stop the button pulse + SetButtonPulse(TrainingButton_fast, 0, 1); + SetButtonPulse(AllocateButton_fast, 0, 1); + end) + CharUpdatesMicroButton:SetScript("OnEnter",function(self) + GameTooltip:SetOwner(self, "ANCHOR_RIGHT") + GameTooltip:AddLine("|cffFFFFFFOpen Character Upgrades|r") + GameTooltip:AddLine(TOOLTIP_AWAKENING) + GameTooltip:Show() + end) + CharUpdatesMicroButton:SetScript("OnLeave",function(self) + GameTooltip:Hide() + end) + + --PULSE BUTTON IF PLAYER HAVE MORE THAN 2 ABILITY OR TALENT ESSENCES OR UNUSED STATS + CharUpdatesMicroButton:RegisterEvent("PLAYER_LEVEL_UP") + CharUpdatesMicroButton:SetScript("OnEvent", function(self,event,level) + local itemCount_ability = GetItemCount(383080) or 0 + local itemCount_talent = GetItemCount(383081) or 0 + if (itemCount_ability >= 2) or (itemCount_talent >= 1) or (level == 2) or (level == 10) then + SetButtonPulse(CharUpdatesMicroButton, 60, 1); + SetButtonPulse(TrainingButton_fast, 60, 1); + SetButtonPulse(AllocateButton_fast, 60, 1); + end + end) + --SetBinding("I", togglesiderframe()) + + --fast acces to frames-- + local fastaccessframe = CreateFrame("frame", "fastaccessframe", UIParent) + fastaccessframe:SetSize(210,210) + fastaccessframe:SetPoint("LEFT", 0, -80) + --fastaccessframe:EnableMouse(true) + fastaccessframe:SetMovable(true) + --[[fastaccessframe:EnableMouse(true) + fastaccessframe:RegisterForDrag("LeftButton") + fastaccessframe:SetScript("OnDragStart", fastaccessframe.StartMoving) + fastaccessframe:SetScript("OnHide", fastaccessframe.StopMovingOrSizing) + fastaccessframe:SetScript("OnDragStop", fastaccessframe.StopMovingOrSizing)]]-- + fastaccessframe:SetFrameStrata("BACKGROUND") + fastaccessframe:SetBackdrop({ + bgFile = "Interface\\AddOns\\AwAddons\\Textures\\Misc\\fastbuttonHighlight", + }) -- edited + fastaccessframe:Hide() + AIO.SavePosition(fastaccessframe) + --fastaccessframe:SetScript + + local TrainingButton_fast = CreateFrame("Button", "TrainingButton_fast", fastaccessframe) + TrainingButton_fast:SetSize(80, 80) + TrainingButton_fast:SetPoint("CENTER", -40, 0) + TrainingButton_fast:EnableMouse(true) + TrainingButton_fast:SetNormalTexture("Interface\\AddOns\\AwAddons\\Textures\\Misc\\roundbutton") + TrainingButton_fast:SetHighlightTexture("Interface\\AddOns\\AwAddons\\Textures\\Misc\\roundbuttonhighlight") + TrainingButton_fast:SetBackdrop({ + bgFile = "Interface\\AddOns\\AwAddons\\Textures\\Misc\\spell_Paladin_divinecircle", + insets = { + left = 18, + right = 18, + top = 18, + bottom = 18} + }) -- edited + --TrainingButton_fast:SetMovable(true) + TrainingButton_fast:RegisterForDrag("LeftButton") + TrainingButton_fast:SetScript("OnDragStart", function(self) fastaccessframe:StartMoving() end) + TrainingButton_fast:SetScript("OnHide", function(self) fastaccessframe:StopMovingOrSizing() end) + TrainingButton_fast:SetScript("OnDragStop", function(self) fastaccessframe:StopMovingOrSizing() end) + + + local AllocateButton_fast = CreateFrame("Button", "AllocateButton_fast", fastaccessframe) + AllocateButton_fast:SetSize(64, 64) + AllocateButton_fast:SetPoint("CENTER", 40, 10) + AllocateButton_fast:EnableMouse(true) + AllocateButton_fast:SetNormalTexture("Interface\\AddOns\\AwAddons\\Textures\\Misc\\roundbutton") + AllocateButton_fast:SetHighlightTexture("Interface\\AddOns\\AwAddons\\Textures\\Misc\\roundbuttonhighlight") + AllocateButton_fast:SetBackdrop({ + bgFile = "Interface\\AddOns\\AwAddons\\Textures\\Misc\\Spell_Priest_Chakra", + insets = { + left = 14, + right = 14, + top = 14, + bottom = 14} + }) -- edited + AllocateButton_fast:RegisterForDrag("LeftButton") + AllocateButton_fast:SetScript("OnDragStart", function(self) fastaccessframe:StartMoving() end) + AllocateButton_fast:SetScript("OnHide", function(self) fastaccessframe:StopMovingOrSizing() end) + AllocateButton_fast:SetScript("OnDragStop", function(self) fastaccessframe:StopMovingOrSizing() end) + + + local ResetButton_fast = CreateFrame("Button", "ResetButton_fast", fastaccessframe) + ResetButton_fast:SetSize(52, 52) + ResetButton_fast:SetPoint("CENTER", -20, -17) + ResetButton_fast:EnableMouse(true) + ResetButton_fast:SetNormalTexture("Interface\\AddOns\\AwAddons\\Textures\\Misc\\roundbutton") + ResetButton_fast:SetHighlightTexture("Interface\\AddOns\\AwAddons\\Textures\\Misc\\roundbuttonhighlight") + ResetButton_fast:SetBackdrop({ + bgFile = "Interface\\Icons\\inv_custom_talentpurge", + insets = { + left = 12, + right = 12, + top = 12, + bottom = 12} + }) -- edited + ResetButton_fast:SetFrameLevel(3) + ResetButton_fast:RegisterForDrag("LeftButton") + ResetButton_fast:SetScript("OnDragStart", function(self) fastaccessframe:StartMoving() end) + ResetButton_fast:SetScript("OnHide", function(self) fastaccessframe:StopMovingOrSizing() end) + ResetButton_fast:SetScript("OnDragStop", function(self) fastaccessframe:StopMovingOrSizing() end) + + --[[local ResetButton_fast_T = CreateFrame("Button", "ResetButton_fast_T", fastaccessframe) + ResetButton_fast_T:SetSize(46, 46) + ResetButton_fast_T:SetPoint("CENTER", -30, -30) + ResetButton_fast_T:EnableMouse(true) + ResetButton_fast_T:SetNormalTexture("Interface\\AddOns\\AwAddons\\Textures\\Misc\\roundbutton") + ResetButton_fast_T:SetHighlightTexture("Interface\\AddOns\\AwAddons\\Textures\\Misc\\roundbuttonhighlight") + ResetButton_fast_T:SetBackdrop({ + bgFile = "Interface\\Icons\\Ability_Marksmanship", + insets = { + left = 11, + right = 11, + top = 11, + bottom = 11} + }) -- edited + ResetButton_fast_T:SetFrameLevel(3)]]-- + + local fastaccessframe_h = fastaccessframe:CreateTexture(nil, "ARTWORK") + fastaccessframe_h:SetSize(fastaccessframe:GetSize()) + fastaccessframe_h:SetTexture("Interface\\AddOns\\AwAddons\\Textures\\Misc\\fastbuttonHighlight_h") + fastaccessframe_h:SetPoint("CENTER") + fastaccessframe_h:Hide() + fastaccessframe:SetScript("OnEnter", function() + if not(fastaccessframe_h:IsVisible()) then + BaseFrameFadeIn(fastaccessframe_h) + end + end) + fastaccessframe:SetScript("OnLEave", function() + if (fastaccessframe_h:IsVisible()) then + BaseFrameFadeOut(fastaccessframe_h) + end + end) + + local sideBar_CheckBox = CreateFrame("CheckButton", "sideBar_CheckBox", sideBar, "ChatConfigSmallCheckButtonTemplate") + sideBar_CheckBox:ClearAllPoints() + sideBar_CheckBox:SetPoint("LEFT", sideBar.Text_CheckBox, -20, 0) + sideBar_CheckBox:RegisterForClicks("AnyUp") + sideBar_CheckBox:SetScript("OnClick", function(self) + PlaySound("igMainMenuOptionCheckBoxOn") + if not(self:GetChecked()) then + fastaccessframe:Hide() + table.remove(fastacc_var,1) + table.insert(fastacc_var,1, 1) + --print(fastacc_var[1]) + else + fastaccessframe:Show() + table.remove(fastacc_var,1) + table.insert(fastacc_var,1, 2) + --print(fastacc_var[1]) + end + end) + + if not(fastacc_var) or (fastacc_var[1] == 2) then + fastacc_var = {} + sideBar_CheckBox:SetChecked(1) + table.remove(fastacc_var,1) + table.insert(fastacc_var,1, 2) + fastaccessframe:Show() + else + fastaccessframe:Hide() + end + CharUpdatesMicroButton:SetScript("OnUpdate", function() + if (fastacc_var[1] == 1) and (fastaccessframe:IsVisible()) then + fastaccessframe:Hide() + sideBar_CheckBox:SetChecked(0) + end + end) + AIO.AddSavedVar("fastacc_var") + + + --end of fast acces-- + + local TrainingButton = CreateFrame("Button", "TrainingButton", sideBar) + TrainingButton:SetSize(128, 64) + TrainingButton:SetPoint("CENTER", 0, 20) + TrainingButton:EnableMouse(true) + TrainingButton:SetNormalTexture("Interface\\AddOns\\AwAddons\\Textures\\Misc\\main_b") + TrainingButton:SetHighlightTexture("Interface\\AddOns\\AwAddons\\Textures\\Misc\\main_b_h") + TrainingButton:SetFrameLevel(3) + + local TrainingButton_text = TrainingButton:CreateFontString("TrainingButton_text") -- edited + TrainingButton_text:SetFont("Fonts\\MORPHEUS.TTF", 16, "OUTLINE") -- edited + TrainingButton_text:SetSize(250, 5) + TrainingButton_text:SetPoint("CENTER", 0, 0) -- edited + TrainingButton_text:SetText("Character Advancement") -- edited + TrainingButton:SetFontString(TrainingButton_text) + --TrainingButton:SetPushedTexture("Interface/Buttons/CheckButtonHilight") + local function Training_button_pushed(self) + SetButtonPulse(CharUpdatesMicroButton, 0, 1); --Stop the button pulse + SetButtonPulse(TrainingButton_fast, 0, 1); + SetButtonPulse(AllocateButton_fast, 0, 1); + + if not(TrainingFrame:IsVisible()) then + PlaySound("Glyph_MinorCreate") + TrainingFrame:Show() StatFrame:Hide() ResetFrame_main:Hide() + else + PlaySound("Glyph_MinorDestroy") + TrainingFrame:Hide() + end + end + + TrainingButton:SetScript("OnMouseUp", Training_button_pushed) + + local function TrainingButton_Tooltip_OnEnter(self, motion) + GameTooltip:SetOwner(self, "ANCHOR_RIGHT") + GameTooltip:SetText("|cffFFFFFFCharacter Advancement|r\nLearn new skills, or allocate skill points\nto improve existing ones.") + GameTooltip:Show() + end + TrainingButton:SetScript("OnEnter", TrainingButton_Tooltip_OnEnter) + local function TrainingButton_Tooltip_OnLeave(self, motion) + GameTooltip:Hide() + end + TrainingButton:SetScript("OnLeave", TrainingButton_Tooltip_OnLeave) + + + -- stat allocation button + local StatAllocationButton = CreateFrame("Button", StatAllocationButton, sideBar) + StatAllocationButton:SetSize(128, 64) + StatAllocationButton:SetPoint("CENTER", -200, -43) + StatAllocationButton:EnableMouse(true) + StatAllocationButton:SetNormalTexture("Interface\\AddOns\\AwAddons\\Textures\\Misc\\main_b") + StatAllocationButton:SetHighlightTexture("Interface\\AddOns\\AwAddons\\Textures\\Misc\\main_b_h") + StatAllocationButton:SetFrameLevel(3) +local StatAllocationButton_text = StatAllocationButton:CreateFontString("StatAllocationButton_text") -- edited + StatAllocationButton_text:SetFont("Fonts\\MORPHEUS.TTF", 17, "OUTLINE") -- edited + StatAllocationButton_text:SetSize(190, 5) + StatAllocationButton_text:SetPoint("CENTER", 0, 0) -- edited + StatAllocationButton_text:SetText("Stat Allocation") -- edited + StatAllocationButton:SetFontString(StatAllocationButton_text) + local function StatAllocation_button_pushed(self) + SetButtonPulse(CharUpdatesMicroButton, 0, 1); --Stop the button pulse + SetButtonPulse(TrainingButton_fast, 0, 1); + SetButtonPulse(AllocateButton_fast, 0, 1); + PlaySound("igQuestCancel") + if not(StatFrame:IsVisible()) then + StatFrame:Show() TrainingFrame:Hide() ResetFrame_main:Hide() + AIO.Handle("sideBar", "ReceivePlayerStats") + else + StatFrame:Hide() + end + end + StatAllocationButton:SetScript("OnMouseUp",StatAllocation_button_pushed) + local function StatAllocationButton_Tooltip_OnEnter(self, motion) + GameTooltip:SetOwner(self, "ANCHOR_RIGHT") + GameTooltip:SetText("|cffFFFFFFStat Allocation|r\nManage allocation of your attribute\npoints.") + GameTooltip:Show() + end + StatAllocationButton:SetScript("OnEnter", StatAllocationButton_Tooltip_OnEnter) + local function StatAllocationButton_Tooltip_OnLeave(self, motion) + GameTooltip:Hide() + end + + StatAllocationButton:SetScript("OnLeave", StatAllocationButton_Tooltip_OnLeave) + + local function ResetButtonFast_Tooltip_OnEnter(self, motion) + GameTooltip:SetOwner(self, "ANCHOR_RIGHT") + GameTooltip:SetText("|cffFFFFFFReset Spells/Talents|r\nUse your tokens or gold to refund\nyour Spells or Talents.") + GameTooltip:Show() + end +local function ResetButtonFast_Tooltip_OnLeave(self) + GameTooltip:Hide() + end + + local ResetUpgradesButton = CreateFrame("Button", "ResetUpgradesButton", sideBar) + ResetUpgradesButton:SetSize(128, 64) + ResetUpgradesButton:SetPoint("CENTER", 230, -43) + ResetUpgradesButton:EnableMouse(true) + ResetUpgradesButton:SetNormalTexture("Interface\\AddOns\\AwAddons\\Textures\\Misc\\main_b") + ResetUpgradesButton:SetHighlightTexture("Interface\\AddOns\\AwAddons\\Textures\\Misc\\main_b_h") + ResetUpgradesButton:SetFrameLevel(3) + + local ResetUpgradesButton_text = ResetUpgradesButton:CreateFontString("ResetUpgradesButton_text") -- edited + ResetUpgradesButton_text:SetFont("Fonts\\MORPHEUS.TTF", 16, "OUTLINE") -- edited + ResetUpgradesButton_text:SetSize(250, 5) + ResetUpgradesButton_text:SetPoint("CENTER", 0, 0) -- edited + ResetUpgradesButton_text:SetText("Resets Spells/Talents") -- edited + ResetUpgradesButton:SetFontString(ResetUpgradesButton_text) + --ResetUpgradesButton:SetPushedTexture("Interface/Buttons/CheckButtonHilight") + ResetUpgradesButton:SetScript("OnMouseUp", function() + PlaySound("TalentScreenOpen") + if not(ResetFrame_main:IsVisible()) then + ResetFrame_main:Show() StatFrame:Hide() TrainingFrame:Hide() + AIO.Handle("sideBar", "GetMults") + else + ResetFrame_main:Hide() + end + end) + ResetUpgradesButton:SetScript("OnEnter", ResetButtonFast_Tooltip_OnEnter) + ResetUpgradesButton:SetScript("OnLeave", ResetButtonFast_Tooltip_OnLeave) + + + -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- ResetGui Frame -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- + --[[MAIN FRAME SCRIPTS]]-- +local Ability_ResetMult = 0 +local Talent_ResetMult = 0 + +local Reset_Level = { + [0] = {2500, 2700, 105}, + [10] = {5000, 7500, 150}, + [20] = {7500, 10000, 2150}, + [30] = {50000,150000,3250}, + [40] = {150000,300000,9250}, + [50] = {300000,1000000,10550}, + [60] = {350000,1500000,20000}, + [70] = {500000,2500000,20000}, + [80] = {500000,2500000,20000}, +} + +local function GetMoneyForReset(purgetype) +local tokencount = nil +local mult = nil +local purge_cost = nil +local next_purge_cost = nil +--getting type of reset and token amount + if (purgetype == 2) then + mult = Ability_ResetMult + tokencount = GetItemCount(383082) + elseif (purgetype == 1) then + mult = Talent_ResetMult + tokencount = GetItemCount(383083) + end +--player has enough tokens to make a reset + if (tokencount > 1) then -- player has more than 1 token, show both costs in tokens + purge_cost = "token" + next_purge_cost = "token" + return purge_cost, next_purge_cost + else--player has not enough tokens to make a reset +for k,v in pairs(Reset_Level) do + if (UnitLevel("player") >= k) and (UnitLevel("player") < k+10) then + if (tokencount == 1) then -- player has one token, show current cost in tokens and next in gold + purge_cost = "token" + next_purge_cost = Reset_Level[k][purgetype] + Reset_Level[k][3]*(UnitLevel("player")-k+mult*2) + else + purge_cost = Reset_Level[k][purgetype] + Reset_Level[k][3]*(UnitLevel("player")-k+mult*2) + next_purge_cost = Reset_Level[k][purgetype] + Reset_Level[k][3]*(UnitLevel("player")-k+(mult+1)*2) + end + --cap + if (tonumber(purge_cost)) then + if (purge_cost>Reset_Level[k][purgetype]*1.75) then + purge_cost = Reset_Level[k][purgetype]*1.75 + end + end + if (tonumber(next_purge_cost)) then + if (next_purge_cost>Reset_Level[k][purgetype]*1.75) then + next_purge_cost = Reset_Level[k][purgetype]*1.75 + end + end + --end cap + return purge_cost, next_purge_cost + end +end +end -- end of the main "if" +end + + function GetGoldForMoney(cost) + local c_gold,c_silver,c_copper = 0 + c_gold = floor(abs(cost / 10000)) + c_silver = floor(abs(mod(cost / 100, 100))) + c_copper = floor(abs(mod(cost, 100))) + return c_gold,c_silver,c_copper +end + + --additional frames scripts + local function ResetFrame_GetAmountOfResets() + ResetFrame_AmountOfResets_Count:SetText("|cffFFFFFF"..Ability_ResetMult+Talent_ResetMult.."|r") + local levelrange_min = 0 + local levelrange_max = 0 + + for k,v in pairs(Reset_Level) do + if (UnitLevel("player") >= k) and (UnitLevel("player") < k+10) then + levelrange_min = k + levelrange_max = k+10 + if (k==0) then + levelrange_min = 1 + end + end + end + + ResetFrame_AmountOfResets_Count_Text:SetText("|cffE1AB18Resets you had on level |cffFF4E00["..levelrange_min.."-"..levelrange_max.."]|r") + end + local function ResetFrame_GetPurgeCost(typeofpurge) + local cost, nexcost, dialogtext,dialogtext_2 = nil + if (typeofpurge == "talent") then + cost, nexcost = GetMoneyForReset(1) + if (cost == "token") then + dialogText = "|cffE1AB18Reset: |TInterface\\Icons\\inv_custom_talentpurge.blp:14:14:0:0|t|cffFFFFFFx1" + else + local gold,silver,copper = GetGoldForMoney(cost) + dialogText = "|cffE1AB18Reset: |cffFFFFFF"..gold.."|TInterface\\MONEYFRAME\\UI-GoldIcon.blp:11:11:0:-1|t "..silver.."|TInterface\\MONEYFRAME\\UI-SilverIcon.blp:11:11:0:-1|t "..copper.."|TInterface\\MONEYFRAME\\UI-CopperIcon.blp:11:11:0:-1|t|r" + end + if (nexcost == "token") then + dialogText_2 = "|cffE1AB18Next Reset: |TInterface\\Icons\\inv_custom_talentpurge.blp:14:14:0:0|t|cffFFFFFFx1" + else + local gold,silver,copper = GetGoldForMoney(nexcost) + dialogText_2 = "|cffE1AB18Next Reset: |cffFFFFFF"..gold.."|TInterface\\MONEYFRAME\\UI-GoldIcon.blp:11:11:0:-1|t "..silver.."|TInterface\\MONEYFRAME\\UI-SilverIcon.blp:11:11:0:-1|t "..copper.."|TInterface\\MONEYFRAME\\UI-CopperIcon.blp:11:11:0:-1|t|r" + end + ResetFrame_TalentFrame_Cost:SetText(dialogText) + ResetFrame_TalentFrame_NextCost:SetText(dialogText_2) + elseif (typeofpurge == "ability") then + + if not(UnitLevel("player") < 10) then + cost, nexcost = GetMoneyForReset(2) + if (cost == "token") then + dialogText = "|cffE1AB18Reset: |TInterface\\Icons\\inv_custom_abilitypurge.blp:14:14:0:0|t|cffFFFFFFx1" + else + local gold,silver,copper = GetGoldForMoney(cost) + dialogText = "|cffE1AB18Reset: |cffFFFFFF"..gold.."|TInterface\\MONEYFRAME\\UI-GoldIcon.blp:11:11:0:-1|t "..silver.."|TInterface\\MONEYFRAME\\UI-SilverIcon.blp:11:11:0:-1|t "..copper.."|TInterface\\MONEYFRAME\\UI-CopperIcon.blp:11:11:0:-1|t|r" + end + if (nexcost == "token") then + dialogText_2 = "|cffE1AB18Next Reset: |TInterface\\Icons\\inv_custom_abilitypurge.blp:14:14:0:0|t|cffFFFFFFx1" + else + local gold,silver,copper = GetGoldForMoney(nexcost) + dialogText_2 = "|cffE1AB18Next Reset: |cffFFFFFF"..gold.."|TInterface\\MONEYFRAME\\UI-GoldIcon.blp:11:11:0:-1|t "..silver.."|TInterface\\MONEYFRAME\\UI-SilverIcon.blp:11:11:0:-1|t "..copper.."|TInterface\\MONEYFRAME\\UI-CopperIcon.blp:11:11:0:-1|t|r" + end + ResetFrame_AbilityFrame_Cost:SetText(dialogText) + ResetFrame_AbilityFrame_NextCost:SetText(dialogText_2) + else + ResetFrame_AbilityFrame_Cost:SetText("Free") + ResetFrame_AbilityFrame_NextCost:SetText("Free") + end + end + end +---[[MAIN FRAME SETTINGS]]--- +function MyHandlers.ResetFrame_Init(player, t_mult, a_mult) + Ability_ResetMult = a_mult + Talent_ResetMult = t_mult +ResetFrame_GetAmountOfResets() +ResetFrame_GetPurgeCost("talent") +ResetFrame_GetPurgeCost("ability") +if not(ResetFrame_AmountOfResets:IsVisible()) then +BaseFrameFadeIn(ResetFrame_AmountOfResets) +BaseFrameFadeIn(ResetFrame_TalentFrame) +BaseFrameFadeIn(ResetFrame_AbilityFrame) +end +if (GetMoneyForReset(1) == "token") or (GetMoneyForReset(1) <= GetMoney()) then + ResetFrame_main_TalentResetButton:Enable() +else + ResetFrame_main_TalentResetButton:Disable() + end +if (GetMoneyForReset(2) == "token") or (GetMoneyForReset(2) <= GetMoney()) or (UnitLevel("player") < 10) then + ResetFrame_main_AbilityResetButton:Enable() +else + ResetFrame_main_AbilityResetButton:Disable() + end +end + +local ResetFrame_main = CreateFrame("Frame", "ResetFrame_main", UIParent, nil) +ResetFrame_main:SetSize(380,400) +ResetFrame_main:SetPoint("CENTER") + +ResetFrame_main:SetMovable(true) +ResetFrame_main:EnableMouse(true) +ResetFrame_main:EnableKeyboard(true) +ResetFrame_main:RegisterForDrag("LeftButton") +ResetFrame_main:SetFrameStrata("MEDIUM") +ResetFrame_main:SetClampedToScreen(true) +ResetFrame_main:SetScript("OnDragStart", ResetFrame_main.StartMoving) +ResetFrame_main:SetScript("OnHide", ResetFrame_main.StopMovingOrSizing) +ResetFrame_main:SetScript("OnDragStop", ResetFrame_main.StopMovingOrSizing) +ResetFrame_main:SetScript("OnShow", ResetFrame_Init) +ResetFrame_main:SetScript("OnKeyDown", function(self, arg1) + if (arg1 == "ESCAPE") then + self:Hide() + end + end) +ResetFrame_main:Hide() +AIO.SavePosition(ResetFrame_main) + +ResetFrame_main:SetBackdrop({ + bgFile = "Interface\\AddOns\\AwAddons\\Textures\\ResetFrame\\reset_main", + insets = { left = -40, right = -40, top = -40, bottom = -40} +}) + +local ResetFrame_main_CloseButton = CreateFrame("Button", "ResetFrame_main_CloseButton", ResetFrame_main, "UIPanelCloseButton") +ResetFrame_main_CloseButton:SetPoint("TOPRIGHT", -13.5, 11) +ResetFrame_main_CloseButton:EnableMouse(true) +--ResetFrame_main_CloseButton:SetSize(29, 29) +ResetFrame_main_CloseButton:SetScript("OnMouseUp", function() + PlaySound("TalentScreenOpen") + ResetFrame_main:Hide() + end) +local ResetFrame_main_TitleText = ResetFrame_main:CreateFontString("ResetFrame_main_TitleText") +ResetFrame_main_TitleText:SetFont("Fonts\\FRIZQT__.TTF", 12.2) +ResetFrame_main_TitleText:SetFontObject(GameFontNormal) +ResetFrame_main_TitleText:SetPoint("TOP", 0, 2) +ResetFrame_main_TitleText:SetShadowOffset(1,-1) +ResetFrame_main_TitleText:SetText("Reset Menu") + +local ResetFrame_main_TalentResetButton = CreateFrame("Button", "ResetFrame_main_TalentResetButton", ResetFrame_main, nil) +ResetFrame_main_TalentResetButton:SetWidth(120) +ResetFrame_main_TalentResetButton:SetHeight(28) +ResetFrame_main_TalentResetButton:SetPoint("BOTTOM", -85,-5) +ResetFrame_main_TalentResetButton:RegisterForClicks("AnyUp") +ResetFrame_main_TalentResetButton:SetDisabledTexture("Interface\\AddOns\\AwAddons\\Textures\\ResetFrame\\dark-goldframe-button") +ResetFrame_main_TalentResetButton:SetNormalTexture("Interface\\AddOns\\AwAddons\\Textures\\ResetFrame\\dark-goldframe-button") +ResetFrame_main_TalentResetButton:SetPushedTexture("Interface\\AddOns\\AwAddons\\Textures\\ResetFrame\\dark-goldframe-button-pressed") + +ResetFrame_main_TalentResetButton.Text_Talent = ResetFrame_main_TalentResetButton:CreateFontString() +ResetFrame_main_TalentResetButton.Text_Talent:SetFontObject(GameFontNormal) +ResetFrame_main_TalentResetButton.Text_Talent:SetPoint("CENTER", ResetFrame_main_TalentResetButton, 0, 0); +ResetFrame_main_TalentResetButton.Text_Talent:SetFont("Fonts\\FRIZQT__.TTF", 11) +ResetFrame_main_TalentResetButton.Text_Talent:SetText("Reset Talents") +ResetFrame_main_TalentResetButton:SetFontString(ResetFrame_main_TalentResetButton.Text_Talent) + +ResetFrame_main_TalentResetButton:SetScript("OnDisable", function(self) + ResetFrame_main_TalentResetButton.Text_Talent:SetText("|cff6b625bReset Talents|r") + end) +ResetFrame_main_TalentResetButton:SetScript("OnEnable", function(self) + ResetFrame_main_TalentResetButton.Text_Talent:SetText("Reset Talents") + end) +ResetFrame_main_TalentResetButton:Disable() + +local ResetFrame_main_AbilityResetButton = CreateFrame("Button", "ResetFrame_main_AbilityResetButton", ResetFrame_main, nil) +ResetFrame_main_AbilityResetButton:SetWidth(120) +ResetFrame_main_AbilityResetButton:SetHeight(28) +ResetFrame_main_AbilityResetButton:SetPoint("BOTTOM", 85,-5) +ResetFrame_main_AbilityResetButton:RegisterForClicks("AnyUp") +ResetFrame_main_AbilityResetButton:SetText("Reset Spells") +ResetFrame_main_AbilityResetButton:SetDisabledTexture("Interface\\AddOns\\AwAddons\\Textures\\ResetFrame\\dark-goldframe-button") +ResetFrame_main_AbilityResetButton:SetNormalTexture("Interface\\AddOns\\AwAddons\\Textures\\ResetFrame\\dark-goldframe-button") +ResetFrame_main_AbilityResetButton:SetPushedTexture("Interface\\AddOns\\AwAddons\\Textures\\ResetFrame\\dark-goldframe-button-pressed") + +ResetFrame_main_AbilityResetButton.Text_Ability = ResetFrame_main_AbilityResetButton:CreateFontString() +ResetFrame_main_AbilityResetButton.Text_Ability:SetFontObject(GameFontNormal) +ResetFrame_main_AbilityResetButton.Text_Ability:SetPoint("CENTER", ResetFrame_main_AbilityResetButton, 0, 0); +ResetFrame_main_AbilityResetButton.Text_Ability:SetFont("Fonts\\FRIZQT__.TTF", 11) +ResetFrame_main_AbilityResetButton.Text_Ability:SetText("Reset Spells") +--ResetFrame_main_AbilityResetButton.Text_Ability:SetDisabledFontObject(GameFontNormal) +ResetFrame_main_AbilityResetButton:SetFontString(ResetFrame_main_AbilityResetButton.Text_Ability) + +ResetFrame_main_AbilityResetButton:SetScript("OnDisable", function(self) + ResetFrame_main_AbilityResetButton.Text_Ability:SetText("|cff6b625bReset Spells|r") + end) +ResetFrame_main_AbilityResetButton:SetScript("OnEnable", function(self) + ResetFrame_main_AbilityResetButton.Text_Ability:SetText("Reset Spells") + end) +ResetFrame_main_AbilityResetButton:Disable() + +--dialog frame-- + --[[Reset Frame]] + local ResetFrame = CreateFrame("Frame", "ResetFrame", ResetFrame_main, nil) + ResetFrame:SetSize(256,100) + ResetFrame:SetPoint("BOTTOM", 0, -100) + ResetFrame:SetClampedToScreen(true) + ResetFrame:SetBackdrop({ + bgFile = "Interface\\AddOns\\AwAddons\\Textures\\misc\\dialogframe",}) + --ResetFrame:Hide() + + + local ResetDialog_text = ResetFrame:CreateFontString("ResetDialog_text") -- edited + ResetDialog_text:SetFont("Fonts\\MORPHEUS.TTF", 15, "OUTLINE") -- edited + ResetDialog_text:SetSize(300, 500) + ResetDialog_text:SetPoint("CENTER", 0, 22) -- edited + ResetDialog_text:SetText("|cffE1AB18You are going to reset spells|r") -- edited + + local ResetButton_yes = CreateFrame("Button", "ResetButton_yes", ResetFrame) + ResetButton_yes:SetSize(64, 30) + ResetButton_yes:SetPoint("CENTER", -30, -15) + ResetButton_yes:EnableMouse(true) + --ResetButton_yes:SetNormalTexture("Interface\\AddOns\\AwAddons\\Textures\\Misc\\main_b") + ResetButton_yes:SetHighlightTexture("Interface\\AddOns\\AwAddons\\Textures\\misc\\dialog_glow") + ResetButton_yes:SetFrameLevel(3) + ResetButton_yes:Hide() + + local ResetButton_yes_text = ResetButton_yes:CreateFontString("ResetButton_yes_text") -- edited + ResetButton_yes_text:SetFont("Fonts\\MORPHEUS.TTF", 19, "OUTLINE") -- edited + ResetButton_yes_text:SetSize(250, 5) + ResetButton_yes_text:SetPoint("CENTER", 0, 0) -- edited + ResetButton_yes_text:SetText("Yes") -- edited + ResetButton_yes:SetFontString(ResetButton_yes_text) + + local ResetButton_yesTalents = CreateFrame("Button", "ResetButton_yesTalents", ResetFrame) + ResetButton_yesTalents:SetSize(64, 30) + ResetButton_yesTalents:SetPoint("CENTER", -30, -15) + ResetButton_yesTalents:EnableMouse(true) + --ResetButton_yesTalents:SetNormalTexture("Interface\\AddOns\\AwAddons\\Textures\\Misc\\main_b") + ResetButton_yesTalents:SetHighlightTexture("Interface\\AddOns\\AwAddons\\Textures\\misc\\dialog_glow") + ResetButton_yesTalents:SetFrameLevel(3) + ResetButton_yesTalents:Hide() + + local ResetButton_yesTalents_text = ResetButton_yesTalents:CreateFontString("ResetButton_yesTalents_text") -- edited + ResetButton_yesTalents_text:SetFont("Fonts\\MORPHEUS.TTF", 19, "OUTLINE") -- edited + ResetButton_yesTalents_text:SetSize(250, 5) + ResetButton_yesTalents_text:SetPoint("CENTER", 0, 0) -- edited + ResetButton_yesTalents_text:SetText("Yes") -- edited + ResetButton_yesTalents:SetFontString(ResetButton_yesTalents_text) + + ResetButton_yes:SetScript("OnMouseUp", function() + PlaySound("igMainMenuOptionCheckBoxOn") + if (TrainingFrame:IsVisible()) then + TrainingFrame:Hide() + end + Reset_spells_button() + ResetFrame:Hide() + end) + ResetButton_yesTalents:SetScript("OnMouseUp", function() + PlaySound("igMainMenuOptionCheckBoxOn") + if (TrainingFrame:IsVisible()) then + TrainingFrame:Hide() + end + Reset_talents_button() + ResetFrame:Hide() + end) + + + local ResetButton_No = CreateFrame("Button", "ResetButton_No", ResetFrame) + ResetButton_No:SetSize(64, 30) + ResetButton_No:SetPoint("CENTER", 30, -15) + ResetButton_No:EnableMouse(true) + --ResetButton_No:SetNormalTexture("Interface\\AddOns\\AwAddons\\Textures\\Misc\\main_b") + ResetButton_No:SetHighlightTexture("Interface\\AddOns\\AwAddons\\Textures\\misc\\dialog_glow") + ResetButton_No:SetFrameLevel(3) + ResetButton_No:SetScript("OnMouseUp", function() + PlaySound("igMainMenuOptionCheckBoxOn") + ResetFrame:Hide() + end) + + local ResetButton_No_text = ResetButton_No:CreateFontString("ResetButton_No_text") -- edited + ResetButton_No_text:SetFont("Fonts\\MORPHEUS.TTF", 19, "OUTLINE") -- edited + ResetButton_No_text:SetSize(250, 5) + ResetButton_No_text:SetPoint("CENTER", 0, 0) -- edited + ResetButton_No_text:SetText("No") -- edited + ResetButton_No:SetFontString(ResetButton_No_text) + ResetFrame:Hide() + + ResetFrame_Animgroup2 = ResetFrame:CreateAnimationGroup() + local ResetFrame_Scale2 = ResetFrame_Animgroup2:CreateAnimation("Scale") + ResetFrame_Scale2:SetDuration(0.5) + ResetFrame_Scale2:SetOrder(1) + ResetFrame_Scale2:SetEndDelay(0) + ResetFrame_Scale2:SetScale(10,1) + + ResetFrame_Animgroup = ResetFrame:CreateAnimationGroup() + local ResetFrame_Scale1 = ResetFrame_Animgroup:CreateAnimation("Scale") + ResetFrame_Scale1:SetDuration(0) + ResetFrame_Scale1:SetOrder(1) + ResetFrame_Scale1:SetEndDelay(0.5) + ResetFrame_Scale1:SetScale(0.1,1) + ResetFrame_Animgroup:SetScript("OnPlay", function() + ResetFrame_Animgroup2:Play() + end) + +--button scripts -- +local function ResetButton_button_pushed(self) + PlaySound("igMainMenuOptionCheckBoxOn") + if (TrainingFrame:IsVisible()) then + TrainingFrame:Hide() + end + if not(ResetButton_yes:IsVisible()) then + ResetDialog_text:SetText("|cffE1AB18You are going to reset spells|r") + ResetFrame:Show() + ResetFrame_Animgroup:Play() + ResetButton_yesTalents:Hide() + ResetButton_yes:Show() + else + ResetFrame:Hide() + end + end +local function ResetButton_Tooltip_OnEnter(self, motion) + GameTooltip:SetOwner(self, "ANCHOR_RIGHT") + GameTooltip:SetText("|cffFFFFFFReset Spells|r\nUse your tokens to refund your Spells.") + GameTooltip:Show() + BaseFrameFadeIn(ResetFrame_main_AbilityResetButton_Highlight) + end +local function ResetButton_Tooltip_OnLeave(self) + GameTooltip:Hide() + BaseFrameFadeOut(ResetFrame_main_AbilityResetButton_Highlight) + end +local function ResetButton_t_button_pushed(self) + PlaySound("igMainMenuOptionCheckBoxOn") + if (TrainingFrame:IsVisible()) then + TrainingFrame:Hide() + end + if not(ResetButton_yesTalents:IsVisible()) then + ResetDialog_text:SetText("|cffE1AB18You are going to reset talents|r") + ResetFrame:Show() + ResetFrame_Animgroup:Play() + ResetButton_yesTalents:Show() + ResetButton_yes:Hide() + else + ResetFrame:Hide() + end + end +local function ResetButton_t_Tooltip_OnEnter(self, motion) + GameTooltip:SetOwner(self, "ANCHOR_RIGHT") + GameTooltip:SetText("|cffFFFFFFReset Talents|r\nUse your tokens to refund your Talents.") + GameTooltip:Show() + BaseFrameFadeIn(ResetFrame_main_TalentResetButton_Highlight) + end +local function ResetButton_t_Tooltip_OnLeave(self) + GameTooltip:Hide() + BaseFrameFadeOut(ResetFrame_main_TalentResetButton_Highlight) + end + +ResetFrame_main_AbilityResetButton_Highlight = ResetFrame_main:CreateTexture(nil, "ARTWORK") +ResetFrame_main_AbilityResetButton_Highlight:SetHeight(64) +ResetFrame_main_AbilityResetButton_Highlight:SetWidth(250) +ResetFrame_main_AbilityResetButton_Highlight:SetTexture("Interface\\AddOns\\AwAddons\\Textures\\ResetFrame\\reset_buttonhighlight") +ResetFrame_main_AbilityResetButton_Highlight:SetPoint("BOTTOM",85,-23) +ResetFrame_main_AbilityResetButton_Highlight:SetBlendMode("ADD") +ResetFrame_main_AbilityResetButton_Highlight:Hide() + +ResetFrame_main_TalentResetButton_Highlight = ResetFrame_main:CreateTexture(nil, "ARTWORK") +ResetFrame_main_TalentResetButton_Highlight:SetHeight(64) +ResetFrame_main_TalentResetButton_Highlight:SetWidth(250) +ResetFrame_main_TalentResetButton_Highlight:SetTexture("Interface\\AddOns\\AwAddons\\Textures\\ResetFrame\\reset_buttonhighlight") +ResetFrame_main_TalentResetButton_Highlight:SetPoint("BOTTOM",-85,-23) +ResetFrame_main_TalentResetButton_Highlight:SetBlendMode("ADD") +ResetFrame_main_TalentResetButton_Highlight:Hide() + +ResetFrame_main_AbilityResetButton:SetScript("OnMouseUp", ResetButton_button_pushed) +ResetFrame_main_AbilityResetButton:SetScript("OnEnter", ResetButton_Tooltip_OnEnter) +ResetFrame_main_AbilityResetButton:SetScript("OnLeave", ResetButton_Tooltip_OnLeave) +ResetFrame_main_TalentResetButton:SetScript("OnMouseUp", ResetButton_t_button_pushed) +ResetFrame_main_TalentResetButton:SetScript("OnEnter", ResetButton_t_Tooltip_OnEnter) +ResetFrame_main_TalentResetButton:SetScript("OnLeave", ResetButton_t_Tooltip_OnLeave) +--------------Additional Frames------------------ + -- +ResetFrame_AmountOfResets = CreateFrame("Frame", "ResetFrame_main", ResetFrame_main, nil) +ResetFrame_AmountOfResets:SetSize(450,113) +ResetFrame_AmountOfResets:SetPoint("TOP",0,-6) +ResetFrame_AmountOfResets:SetBackdrop({ + bgFile = "Interface\\AddOns\\AwAddons\\Textures\\ResetFrame\\reset_resetcountframe", +}) +ResetFrame_AmountOfResets:Hide() +local ResetFrame_AmountOfResets_Count = ResetFrame_AmountOfResets:CreateFontString("ResetFrame_AmountOfResets_Count") +ResetFrame_AmountOfResets_Count:SetFont("Fonts\\MORPHEUS.TTF", 17, "OUTLINE") +ResetFrame_AmountOfResets_Count:SetSize(300, 500) +ResetFrame_AmountOfResets_Count:SetPoint("CENTER", 2, 20) +ResetFrame_AmountOfResets_Count:SetText("|cffE1AB180|r") +local ResetFrame_AmountOfResets_Count_Text = ResetFrame_AmountOfResets:CreateFontString("ResetFrame_AmountOfResets_Count_Text") +ResetFrame_AmountOfResets_Count_Text:SetFont("Fonts\\MORPHEUS.TTF", 16, "OUTLINE") +ResetFrame_AmountOfResets_Count_Text:SetSize(300, 500) +ResetFrame_AmountOfResets_Count_Text:SetPoint("CENTER", 2, -17) +ResetFrame_AmountOfResets_Count_Text:SetText("|cffFFFFFFResets you had on last 10 levels|r") +--talent frame +ResetFrame_TalentFrame = CreateFrame("Frame", "ResetFrame_main", ResetFrame_main, nil) +ResetFrame_TalentFrame:SetSize(512,128) +ResetFrame_TalentFrame:SetPoint("CENTER",-8,15) +ResetFrame_TalentFrame:SetBackdrop({ + bgFile = "Interface\\AddOns\\AwAddons\\Textures\\ResetFrame\\reset_Talentframe", +}) +ResetFrame_TalentFrame:Hide() +local ResetFrame_TalentFrame_Cost = ResetFrame_TalentFrame:CreateFontString("ResetFrame_TalentFrame_Cost") +ResetFrame_TalentFrame_Cost:SetFont("Fonts\\MORPHEUS.TTF", 12, "OUTLINE") +ResetFrame_TalentFrame_Cost:SetSize(300, 500) +ResetFrame_TalentFrame_Cost:SetPoint("CENTER", 8, 13) +ResetFrame_TalentFrame_Cost:SetText("|cffE1AB18You are going to reset talents|r") + +local ResetFrame_TalentFrame_NextCost = ResetFrame_TalentFrame:CreateFontString("ResetFrame_TalentFrame_NextCost") +ResetFrame_TalentFrame_NextCost:SetFont("Fonts\\MORPHEUS.TTF", 12, "OUTLINE") +ResetFrame_TalentFrame_NextCost:SetSize(300, 500) +ResetFrame_TalentFrame_NextCost:SetPoint("CENTER", 8, -19) +ResetFrame_TalentFrame_NextCost:SetText("|cffE1AB18You are going to reset talents|r") + +--ability frame +ResetFrame_AbilityFrame = CreateFrame("Frame", "ResetFrame_main", ResetFrame_main, nil) +ResetFrame_AbilityFrame:SetSize(512,128) +ResetFrame_AbilityFrame:SetPoint("BOTTOM",-8,45) +ResetFrame_AbilityFrame:SetBackdrop({ + bgFile = "Interface\\AddOns\\AwAddons\\Textures\\ResetFrame\\reset_abilityframe", +}) +ResetFrame_AbilityFrame:Hide() +local ResetFrame_AbilityFrame_Cost = ResetFrame_AbilityFrame:CreateFontString("ResetFrame_AbilityFrame_Cost") +ResetFrame_AbilityFrame_Cost:SetFont("Fonts\\MORPHEUS.TTF", 12, "OUTLINE") +ResetFrame_AbilityFrame_Cost:SetSize(300, 500) +ResetFrame_AbilityFrame_Cost:SetPoint("CENTER", 8, 13) +ResetFrame_AbilityFrame_Cost:SetText("|cffE1AB18You are going to reset spells|r") + +local ResetFrame_AbilityFrame_NextCost = ResetFrame_AbilityFrame:CreateFontString("ResetFrame_AbilityFrame_NextCost") +ResetFrame_AbilityFrame_NextCost:SetFont("Fonts\\MORPHEUS.TTF", 12, "OUTLINE") +ResetFrame_AbilityFrame_NextCost:SetSize(300, 500) +ResetFrame_AbilityFrame_NextCost:SetPoint("CENTER", 8, -19) +ResetFrame_AbilityFrame_NextCost:SetText("|cffE1AB18You are going to reset spells|r") + --[[local ResetButton = CreateFrame("Button", "ResetButton", sideBar) + ResetButton:SetSize(128, 64) + ResetButton:SetPoint("CENTER", 230, -43) + ResetButton:EnableMouse(true) + ResetButton:SetNormalTexture("Interface\\AddOns\\AwAddons\\Textures\\Misc\\main_b") + ResetButton:SetHighlightTexture("Interface\\AddOns\\AwAddons\\Textures\\Misc\\main_b_h") + ResetButton:SetFrameLevel(3) + local ResetButton_text = ResetButton:CreateFontString("ResetButton_text") -- edited + ResetButton_text:SetFont("Fonts\\MORPHEUS.TTF", 17, "OUTLINE") -- edited + ResetButton_text:SetSize(190, 5) + ResetButton_text:SetPoint("CENTER", 0, 0) -- edited + ResetButton_text:SetText("Reset abilities") -- edited + ResetButton:SetFontString(ResetButton_text)]]-- + --ResetButton:SetScript("OnMouseUp", ResetButton_button_pushed) + --ResetButton:SetScript("OnEnter", ResetButton_Tooltip_OnEnter) + --ResetButton:SetScript("OnLeave", ResetButton_Tooltip_OnLeave) + + --[[local ResetButton_t = CreateFrame("Button", "ResetButton_t", sideBar) + ResetButton_t:SetSize(128, 64) + ResetButton_t:SetPoint("CENTER", -200, -43) + ResetButton_t:EnableMouse(true) + ResetButton_t:SetNormalTexture("Interface\\AddOns\\AwAddons\\Textures\\Misc\\main_b") + ResetButton_t:SetHighlightTexture("Interface\\AddOns\\AwAddons\\Textures\\Misc\\main_b_h") + ResetButton_t:SetFrameLevel(3) + local ResetButton_t_text = ResetButton_t:CreateFontString("ResetButton_t_text") -- edited + ResetButton_t_text:SetFont("Fonts\\MORPHEUS.TTF", 17, "OUTLINE") -- edited + ResetButton_t_text:SetSize(190, 5) + ResetButton_t_text:SetPoint("CENTER", 0, 0) -- edited + ResetButton_t_text:SetText("Reset talents") -- edited + ResetButton_t:SetFontString(ResetButton_t_text)]]-- + --ResetButton_t:SetScript("OnMouseUp", ResetButton_t_button_pushed) + --ResetButton_t:SetScript("OnEnter", ResetButton_t_Tooltip_OnEnter) + --ResetButton_t:SetScript("OnLeave", ResetButton_t_Tooltip_OnLeave) + + --scritps for fast buttons + TrainingButton_fast:SetScript("OnMouseUp", Training_button_pushed) + TrainingButton_fast:SetScript("OnEnter", TrainingButton_Tooltip_OnEnter) + TrainingButton_fast:SetScript("OnLeave", TrainingButton_Tooltip_OnLeave) + AllocateButton_fast:SetScript("OnMouseUp",StatAllocation_button_pushed) + AllocateButton_fast:SetScript("OnEnter", StatAllocationButton_Tooltip_OnEnter) + AllocateButton_fast:SetScript("OnLeave", StatAllocationButton_Tooltip_OnLeave) + ResetButton_fast:SetScript("OnMouseUp", function() + PlaySound("TalentScreenOpen") + if not(ResetFrame_main:IsVisible()) then + ResetFrame_main:Show() StatFrame:Hide() TrainingFrame:Hide() + AIO.Handle("sideBar", "GetMults") + else + ResetFrame_main:Hide() + end + end) + ResetButton_fast:SetScript("OnEnter", ResetButtonFast_Tooltip_OnEnter) + ResetButton_fast:SetScript("OnLeave", ResetButtonFast_Tooltip_OnLeave) + --[[ResetButton_fast_T:SetScript("OnMouseUp", function() + if not(sideBar:IsVisible()) then + togglesiderframe() + end + ResetButton_t_button_pushed() + end) + ResetButton_fast_T:SetScript("OnEnter", ResetButton_t_Tooltip_OnEnter) + ResetButton_fast_T:SetScript("OnLeave", ResetButton_t_Tooltip_OnLeave)]]-- + + -- ================================ SPECIFIC UI SECTIONS ============================================== + + --[[ StatFrame UI ]] + + local StatFrame_CloseButton = CreateFrame("Button", "StatFrame_CloseButton", StatFrame, "UIPanelCloseButton") + StatFrame_CloseButton:SetPoint("TOPRIGHT", -40, -24.5) --edited + StatFrame_CloseButton:EnableMouse(true) + --StatFrame_CloseButton:SetSize(29, 29) --edited + StatFrame_CloseButton:SetScript("OnMouseUp", function(self) + PlaySound("igQuestCancel") + StatFrame:Hide() + end) + + --[[local StatFrame_TitleBar = CreateFrame("Frame", "StatFrame_TitleBar", StatFrame, nil) + StatFrame_TitleBar:SetSize(135, 25) + StatFrame_TitleBar:SetBackdrop({ + bgFile = "Interface/CHARACTERFRAME/UI-Party-Background", + edgeFile = "Interface/DialogFrame/UI-DialogBox-Border", + tile = true, + edgeSize = 16, + tileSize = 16, + insets = { left = 5, right = 5, top = 5, bottom = 5 } + }) + StatFrame_TitleBar:SetPoint("TOP", 0, 9)]]-- edited + local StatFrame_TitleText = StatFrame:CreateFontString("StatFrame_TitleText") -- edited + StatFrame_TitleText:SetFont("Fonts\\FRIZQT__.TTF", 12.2) -- edited + StatFrame_TitleText:SetFontObject(GameFontNormal) + StatFrame_TitleText:SetSize(190, 5) + StatFrame_TitleText:SetPoint("TOP", 0, -37) -- edited + StatFrame_TitleText:SetText("Stat Allocation") -- edited + + local StatFrame_Panel_Str = CreateFrame("Frame", "StatFrame_Panel_Str", StatFrame, nil) -- edited + StatFrame_Panel_Str:SetSize(450, 116) -- edited + StatFrame_Panel_Str:SetPoint("CENTER", 0, 120) -- edited + StatFrame_Panel_Str:SetBackdrop({ + bgFile = "Interface\\AddOns\\AwAddons\\Textures\\Allocation\\allocationbuttonframe"}) -- edited + + --edited-- + local StatFrame_Panel_Sta = CreateFrame("Frame", "StatFrame_Panel_Sta", StatFrame, nil) + StatFrame_Panel_Sta:SetSize(450, 116) -- edited + StatFrame_Panel_Sta:SetPoint("CENTER", 0, 62) -- edited + StatFrame_Panel_Sta:SetBackdrop({ + bgFile = "Interface\\AddOns\\AwAddons\\Textures\\Allocation\\allocationbuttonframe"}) -- edited + local StatFrame_Panel_Agi = CreateFrame("Frame", "StatFrame_Panel_Agi", StatFrame, nil) + StatFrame_Panel_Agi:SetSize(450, 116) -- edited + StatFrame_Panel_Agi:SetPoint("CENTER", 0, 4) -- edited + StatFrame_Panel_Agi:SetBackdrop({ + bgFile = "Interface\\AddOns\\AwAddons\\Textures\\Allocation\\allocationbuttonframe"}) -- edited + + local StatFrame_Panel_Int = CreateFrame("Frame", "StatFrame_Panel_Int", StatFrame, nil) + StatFrame_Panel_Int:SetSize(450, 116) -- edited + StatFrame_Panel_Int:SetPoint("CENTER", 0, -54) -- edited + StatFrame_Panel_Int:SetBackdrop({ + bgFile = "Interface\\AddOns\\AwAddons\\Textures\\Allocation\\allocationbuttonframe"}) -- edited + + local StatFrame_Panel_Spi = CreateFrame("Frame", "StatFrame_Panel_Spi", StatFrame, nil) + StatFrame_Panel_Spi:SetSize(450, 116) -- edited + StatFrame_Panel_Spi:SetPoint("CENTER", 0, -112) -- edited + StatFrame_Panel_Spi:SetBackdrop({ + bgFile = "Interface\\AddOns\\AwAddons\\Textures\\Allocation\\allocationbuttonframe"}) -- edited + + --textures + local StatFrame_Panel_Str_Ico = CreateFrame("FRAME", "StatFrame_Panel_Str_Ico", StatFrame_Panel_Str, nil) + StatFrame_Panel_Str_Ico:SetWidth(58); + StatFrame_Panel_Str_Ico:SetHeight(58); + StatFrame_Panel_Str_Ico:SetBackdrop({ + bgFile = "Interface\\AddOns\\AwAddons\\Textures\\Allocation\\strength"}) + StatFrame_Panel_Str_Ico:SetPoint("CENTER", -105,4) + StatFrame_Panel_Str_Ico:EnableMouse(true) + + local StatFrame_Panel_Sta_Ico = CreateFrame("FRAME", "StatFrame_Panel_Sta_Ico", StatFrame_Panel_Sta, nil) + StatFrame_Panel_Sta_Ico:SetWidth(58); + StatFrame_Panel_Sta_Ico:SetHeight(58); + StatFrame_Panel_Sta_Ico:SetBackdrop({ + bgFile = "Interface\\AddOns\\AwAddons\\Textures\\Allocation\\stamina"}) + StatFrame_Panel_Sta_Ico:SetPoint("CENTER", -105,4) + StatFrame_Panel_Sta_Ico:EnableMouse(true) + + local StatFrame_Panel_Agi_Ico = CreateFrame("FRAME", "StatFrame_Panel_Agi_Ico", StatFrame_Panel_Agi, nil) + StatFrame_Panel_Agi_Ico:SetWidth(58); + StatFrame_Panel_Agi_Ico:SetHeight(58); + StatFrame_Panel_Agi_Ico:SetBackdrop({ + bgFile = "Interface\\AddOns\\AwAddons\\Textures\\Allocation\\agility"}) + StatFrame_Panel_Agi_Ico:SetPoint("CENTER", -105,4) + StatFrame_Panel_Agi_Ico:EnableMouse(true) + + local StatFrame_Panel_Int_Ico = CreateFrame("FRAME", "StatFrame_Panel_Int_Ico", StatFrame_Panel_Int, nil) + StatFrame_Panel_Int_Ico:SetWidth(58); + StatFrame_Panel_Int_Ico:SetHeight(58); + StatFrame_Panel_Int_Ico:SetBackdrop({ + bgFile = "Interface\\AddOns\\AwAddons\\Textures\\Allocation\\intellect"}) + StatFrame_Panel_Int_Ico:SetPoint("CENTER", -105,4) + StatFrame_Panel_Int_Ico:EnableMouse(true) + + local StatFrame_Panel_Spi_Ico = CreateFrame("FRAME", "StatFrame_Panel_Spi_Ico", StatFrame_Panel_Spi, nil) + StatFrame_Panel_Spi_Ico:SetWidth(58); + StatFrame_Panel_Spi_Ico:SetHeight(58); + StatFrame_Panel_Spi_Ico:SetBackdrop({ + bgFile = "Interface\\AddOns\\AwAddons\\Textures\\Allocation\\spirit"}) + StatFrame_Panel_Spi_Ico:SetPoint("CENTER", -105,4) + StatFrame_Panel_Spi_Ico:EnableMouse(true) + + + local StatFrame_Panel_Str_Ico_h = StatFrame_Panel_Str_Ico:CreateTexture(nil, "ARTWORK") + StatFrame_Panel_Str_Ico_h:SetWidth(58); + StatFrame_Panel_Str_Ico_h:SetHeight(58); + StatFrame_Panel_Str_Ico_h:SetTexture("Interface\\AddOns\\AwAddons\\Textures\\Allocation\\strength_h") + StatFrame_Panel_Str_Ico_h:SetPoint("CENTER") + StatFrame_Panel_Str_Ico_h:SetBlendMode("ALPHAKEY") + + local StatFrame_Panel_Sta_Ico_h = StatFrame_Panel_Sta_Ico:CreateTexture(nil, "ARTWORK") + StatFrame_Panel_Sta_Ico_h:SetWidth(58); + StatFrame_Panel_Sta_Ico_h:SetHeight(58); + StatFrame_Panel_Sta_Ico_h:SetTexture("Interface\\AddOns\\AwAddons\\Textures\\Allocation\\stamina_h") + StatFrame_Panel_Sta_Ico_h:SetPoint("CENTER") + StatFrame_Panel_Sta_Ico_h:SetBlendMode("ALPHAKEY") + + local StatFrame_Panel_Agi_Ico_h = StatFrame_Panel_Agi_Ico:CreateTexture(nil, "ARTWORK") + StatFrame_Panel_Agi_Ico_h:SetWidth(58); + StatFrame_Panel_Agi_Ico_h:SetHeight(58); + StatFrame_Panel_Agi_Ico_h:SetTexture("Interface\\AddOns\\AwAddons\\Textures\\Allocation\\agility_h") + StatFrame_Panel_Agi_Ico_h:SetPoint("CENTER") + StatFrame_Panel_Agi_Ico_h:SetBlendMode("ALPHAKEY") + + local StatFrame_Panel_Int_Ico_h = StatFrame_Panel_Int_Ico:CreateTexture(nil, "ARTWORK") + StatFrame_Panel_Int_Ico_h:SetWidth(58); + StatFrame_Panel_Int_Ico_h:SetHeight(58); + StatFrame_Panel_Int_Ico_h:SetTexture("Interface\\AddOns\\AwAddons\\Textures\\Allocation\\intellect_h") + StatFrame_Panel_Int_Ico_h:SetPoint("CENTER") + StatFrame_Panel_Int_Ico_h:SetBlendMode("ALPHAKEY") + + local StatFrame_Panel_Spi_Ico_h = StatFrame_Panel_Spi_Ico:CreateTexture(nil, "ARTWORK") + StatFrame_Panel_Spi_Ico_h:SetWidth(58); + StatFrame_Panel_Spi_Ico_h:SetHeight(58); + StatFrame_Panel_Spi_Ico_h:SetTexture("Interface\\AddOns\\AwAddons\\Textures\\Allocation\\spirit_h") + StatFrame_Panel_Spi_Ico_h:SetPoint("CENTER") + StatFrame_Panel_Spi_Ico_h:SetBlendMode("ALPHAKEY") + + StatFrame_Panel_Str_Ico_h:Hide() + StatFrame_Panel_Sta_Ico_h:Hide() + StatFrame_Panel_Agi_Ico_h:Hide() + StatFrame_Panel_Int_Ico_h:Hide() + StatFrame_Panel_Spi_Ico_h:Hide() + + StatFrame_Panel_Str_Ico:SetScript("OnEnter", function(self) + GameTooltip:SetOwner(self, "ANCHOR_RIGHT") + GameTooltip:SetText("|cffFFFFFFStrength|r\nStrength increases |cffFFFFFFattack power|r and is the most important\nstat for plate armor-wearing classes in the |cffFFFFFFdamage-dealing|r or |cffFFFFFFtank|r role.\nStrength also converts into |cffFFFFFFparry|r.") + GameTooltip:Show() + StatFrame_Panel_Str_Ico_h:Show() + end) + StatFrame_Panel_Str_Ico:SetScript("OnLeave", function(self) + GameTooltip:Hide() + StatFrame_Panel_Str_Ico_h:Hide() + end) + StatFrame_Panel_Sta_Ico:SetScript("OnEnter", function(self) + GameTooltip:SetOwner(self, "ANCHOR_RIGHT") + GameTooltip:SetText("|cffFFFFFFStamina|r\nStamina is the source of all |cffFFFFFFhealth|r.\nMost armor has stamina on it, and all classes\nand specializations wear armor with stamina on it,\nbut |cffFFFFFFtanks|r generally have the most.") + GameTooltip:Show()StatFrame_Panel_Sta_Ico_h:Show() + end) + StatFrame_Panel_Sta_Ico:SetScript("OnLeave", function(self) + GameTooltip:Hide()StatFrame_Panel_Sta_Ico_h:Hide() + end) + StatFrame_Panel_Agi_Ico:SetScript("OnEnter", function(self) + GameTooltip:SetOwner(self, "ANCHOR_RIGHT") + GameTooltip:SetText("|cffFFFFFFAgility|r\nAgility increases |cffFFFFFFmelee|r and |cffFFFFFFranged attack power|r,\nand is the most important stat for leather armor\nand mail armor-wearing classes in the\n|cffFFFFFFdamage-dealing|r or |cffFFFFFFtank|r role.") + GameTooltip:Show()StatFrame_Panel_Agi_Ico_h:Show() + end) + StatFrame_Panel_Agi_Ico:SetScript("OnLeave", function(self) + GameTooltip:Hide()StatFrame_Panel_Agi_Ico_h:Hide() + end) + StatFrame_Panel_Int_Ico:SetScript("OnEnter", function(self) + GameTooltip:SetOwner(self, "ANCHOR_RIGHT") + GameTooltip:SetText("|cffFFFFFFIntellect|r\nIntellect increases |cffFFFFFFspell critical chance|r, |cffFFFFFFamount of mana|r and is the most\nimportant stat for mana-using classes\nwearing any armor type in the\n|cffFFFFFFdamage-dealing|r (ranged spell caster) or |cffFFFFFFhealer|r role.") + GameTooltip:Show()StatFrame_Panel_Int_Ico_h:Show() + end) + StatFrame_Panel_Int_Ico:SetScript("OnLeave", function(self) + GameTooltip:Hide()StatFrame_Panel_Int_Ico_h:Hide() + end) + StatFrame_Panel_Spi_Ico:SetScript("OnEnter", function(self) + GameTooltip:SetOwner(self, "ANCHOR_RIGHT") + GameTooltip:SetText("|cffFFFFFFSpirit|r\nSpirit is the |cffFFFFFFhealer-only|r stat,\nand increases their mana regeneration.") + GameTooltip:Show()StatFrame_Panel_Spi_Ico_h:Show() + end) + StatFrame_Panel_Spi_Ico:SetScript("OnLeave", function(self) + GameTooltip:Hide()StatFrame_Panel_Spi_Ico_h:Hide() + end) + --edited-- + --[[local StatFrame_PointsPanel = CreateFrame("Frame", "StatFrame_PointsPanel", StatFrame, nil) + StatFrame_PointsPanel:SetSize(170, 25) + StatFrame_PointsPanel:SetBackdrop({ + bgFile = "Interface/CHARACTERFRAME/UI-Party-Background", + edgeFile = "Interface/DialogFrame/UI-DialogBox-Border", + tile = true, + edgeSize = 16, + tileSize = 16, + insets = { left = 5, right = 5, top = 5, bottom = 5 } + }) + StatFrame_PointsPanel:SetPoint("LEFT", 14, 6)]]-- + + + -- Stat Names + --[[local StatNames = CreateFrame("Button", "StatNames", StatFrame, nil) + StatNames:SetSize(60, 100) + StatNames:SetPoint("TOPLEFT", 15, -37.5)]]-- edited + local Strength_Text = StatFrame_Panel_Str:CreateFontString("Strength_Text") -- edited + Strength_Text:SetFont("Fonts\\MORPHEUS.TTF", 14, "OUTLINE") -- edited + Strength_Text:SetSize(137, 5) + Strength_Text:SetPoint("TOP", 0, -35) + Strength_Text:SetText("|cffE1AB18Strength|r") + + local Allocation_Fast_Text = StatFrame_Panel_Str:CreateFontString("Allocation_Fast_Text") -- edited + Allocation_Fast_Text:SetFont("Fonts\\FRIZQT__.TTF", 12) -- edited + Allocation_Fast_Text:SetSize(500, 5) + Allocation_Fast_Text:SetPoint("TOP", 0, -10) + Allocation_Fast_Text:SetText("|cffE1AB18Hold |cffFFFFFFShift|cffE1AB18 to allocate 10 points per stat|r") + + local Stamina_Text = StatFrame_Panel_Sta:CreateFontString("Stamina_Text") -- edited + Stamina_Text:SetFont("Fonts\\MORPHEUS.TTF", 14, "OUTLINE") -- edited + Stamina_Text:SetSize(137, 5) + Stamina_Text:SetPoint("TOP", 0, -35) + Stamina_Text:SetText("|cffE1AB18Stamina|r") + local Agility_Text = StatFrame_Panel_Agi:CreateFontString("Agility_Text") -- edited + Agility_Text:SetFont("Fonts\\MORPHEUS.TTF", 14, "OUTLINE") -- edited + Agility_Text:SetSize(137, 5) + Agility_Text:SetPoint("TOP", 0, -35) + Agility_Text:SetText("|cffE1AB18Agility|r") + local Intellect_Text = StatFrame_Panel_Int:CreateFontString("Intellect_Text") -- edited + Intellect_Text:SetFont("Fonts\\MORPHEUS.TTF", 14, "OUTLINE") -- edited + Intellect_Text:SetSize(137, 5) + Intellect_Text:SetPoint("TOP", 0, -35) + Intellect_Text:SetText("|cffE1AB18Intellect|r") + local Spirit_Text = StatFrame_Panel_Spi:CreateFontString("Spirit_Text") -- edited + Spirit_Text:SetFont("Fonts\\MORPHEUS.TTF", 14, "OUTLINE") -- edited + Spirit_Text:SetSize(137, 5) + Spirit_Text:SetPoint("TOP", 0, -35) + Spirit_Text:SetText("|cffE1AB18Spirit|r") + local Stat_Text = StatFrame:CreateFontString("Stat_Text") -- edited + Stat_Text:SetFont("Fonts\\MORPHEUS.TTF", 16, "OUTLINE") -- edited + Stat_Text:SetSize(250, 5) + Stat_Text:SetPoint("BOTTOM", 0, 76) + Stat_Text:SetText("|cffE1AB18Available Stat Points:|r") + + --FontStrings for stat values + local Str_Value = StatFrame_Panel_Str:CreateFontString("Str_Value") + Str_Value:SetFont("Fonts\\MORPHEUS.TTF", 16, "OUTLINE") + Str_Value:SetSize(137, 5) + Str_Value:SetPoint("TOP", 0, -56) + local Sta_Value = StatFrame_Panel_Sta:CreateFontString("Sta_Value") + Sta_Value:SetFont("Fonts\\MORPHEUS.TTF", 16, "OUTLINE") + Sta_Value:SetSize(137, 5) + Sta_Value:SetPoint("TOP", 0, -56) + local Agi_Value = StatFrame_Panel_Agi:CreateFontString("Agi_Value") + Agi_Value:SetFont("Fonts\\MORPHEUS.TTF", 16, "OUTLINE") + Agi_Value:SetSize(137, 5) + Agi_Value:SetPoint("TOP", 0, -56) + local Inte_Value = StatFrame_Panel_Int:CreateFontString("Inte_Value") + Inte_Value:SetFont("Fonts\\MORPHEUS.TTF", 16, "OUTLINE") + Inte_Value:SetSize(137, 5) + Inte_Value:SetPoint("TOP", 0, -56) + local Spi_Value = StatFrame_Panel_Spi:CreateFontString("Spi_Value") + Spi_Value:SetFont("Fonts\\MORPHEUS.TTF", 16, "OUTLINE") + Spi_Value:SetSize(137, 5) + Spi_Value:SetPoint("TOP", 0, -56) + + local Stat_Value = StatFrame:CreateFontString("Stat_Value") + Stat_Value:SetFont("Fonts\\MORPHEUS.TTF", 18, "OUTLINE") + Stat_Value:SetSize(70, 5) + Stat_Value:SetPoint("BOTTOM", 0, 43)--edited all + + + function MyHandlers.GetStatValues(player, stats) + + Str_Value:SetText(stats[1]) + Sta_Value:SetText(stats[2]) + Agi_Value:SetText(stats[3]) + Inte_Value:SetText(stats[4]) + Spi_Value:SetText(stats[5]) + Stat_Value:SetText(stats[6]) + + end + + function Increase_stats(self) + PlaySound("igMainMenuOptionCheckBoxOn") + + local stat = nil + local amount = nil + if (IsShiftKeyDown()) then + amount = 10 + end + + if self == Inc_Str then + + stat = 1 + + elseif self == Inc_Sta then + + stat = 2 + + elseif self == Inc_Agi then + + stat = 3 + + elseif self == Inc_Inte then + + stat = 4 + + elseif self == Inc_Spi then + + stat = 5 + end + + AIO.Handle("sideBar", "AddStats", stat, amount) + + + end + + function Reduce_stats(self) + PlaySound("igMainMenuOptionCheckBoxOn") + + local stat = nil + local amount = nil + if (IsShiftKeyDown()) then + amount = 10 + end + + if self == Dec_Str then + + stat = 1 + + elseif self == Dec_Sta then + + stat = 2 + + elseif self == Dec_Agi then + + stat = 3 + + elseif self == Dec_Inte then + + stat = 4 + + elseif self == Dec_Spi then + + stat = 5 + + end + AIO.Handle("sideBar", "ReduceStats", stat, amount) + + + end + + Inc_Str = CreateFrame("Button", "Inc_Str", StatFrame_Panel_Str, nil) + Inc_Str:SetSize(23, 23) + Inc_Str:SetPoint("CENTER", 60, -2) + Inc_Str:EnableMouse(true) + Inc_Str:SetNormalTexture("Interface/BUTTONS/UI-SpellbookIcon-NextPage-Up") + Inc_Str:SetHighlightTexture("Interface/BUTTONS/UI-Panel-MinimizeButton-Highlight") + Inc_Str:SetPushedTexture("Interface/BUTTONS/UI-SpellbookIcon-NextPage-Down") + --Inc_Str:SetScript("OnMouseUp", Increase_stats) + + Dec_Str = CreateFrame("Button", "Dec_Str", StatFrame_Panel_Str, nil) + Dec_Str:SetSize(23, 23) + Dec_Str:SetPoint("CENTER", -60, -2) + Dec_Str:EnableMouse(true) + Dec_Str:SetNormalTexture("Interface/BUTTONS/UI-SpellbookIcon-PrevPage-Up") + Dec_Str:SetHighlightTexture("Interface/BUTTONS/UI-Panel-MinimizeButton-Highlight") + Dec_Str:SetPushedTexture("Interface/BUTTONS/UI-SpellbookIcon-PrevPage-Down") + --Dec_Str:SetScript("OnMouseUp", Reduce_stats) + + Inc_Sta = CreateFrame("Button", "Inc_Sta", StatFrame_Panel_Sta, nil) + Inc_Sta:SetSize(23, 23) + Inc_Sta:SetPoint("CENTER", 60, -2) + Inc_Sta:EnableMouse(true) + Inc_Sta:SetNormalTexture("Interface/BUTTONS/UI-SpellbookIcon-NextPage-Up") + Inc_Sta:SetHighlightTexture("Interface/BUTTONS/UI-Panel-MinimizeButton-Highlight") + Inc_Sta:SetPushedTexture("Interface/BUTTONS/UI-SpellbookIcon-NextPage-Down") + --Inc_Sta:SetScript("OnMouseUp", Increase_stats) + + Dec_Sta = CreateFrame("Button", "Dec_Sta", StatFrame_Panel_Sta, nil) + Dec_Sta:SetSize(23, 23) + Dec_Sta:SetPoint("CENTER", -60, -2) + Dec_Sta:EnableMouse(true) + Dec_Sta:SetNormalTexture("Interface/BUTTONS/UI-SpellbookIcon-PrevPage-Up") + Dec_Sta:SetHighlightTexture("Interface/BUTTONS/UI-Panel-MinimizeButton-Highlight") + Dec_Sta:SetPushedTexture("Interface/BUTTONS/UI-SpellbookIcon-PrevPage-Down") + --Dec_Sta:SetScript("OnMouseUp", Reduce_stats) + + Inc_Agi = CreateFrame("Button", "Inc_Agi", StatFrame_Panel_Agi, nil) + Inc_Agi:SetSize(23, 23) + Inc_Agi:SetPoint("CENTER", 60, -2) + Inc_Agi:EnableMouse(true) + Inc_Agi:SetNormalTexture("Interface/BUTTONS/UI-SpellbookIcon-NextPage-Up") + Inc_Agi:SetHighlightTexture("Interface/BUTTONS/UI-Panel-MinimizeButton-Highlight") + Inc_Agi:SetPushedTexture("Interface/BUTTONS/UI-SpellbookIcon-NextPage-Down") + --Inc_Agi:SetScript("OnMouseUp", Increase_stats) + + Dec_Agi = CreateFrame("Button", "Dec_Agi", StatFrame_Panel_Agi, nil) + Dec_Agi:SetSize(23, 23) + Dec_Agi:SetPoint("CENTER", -60, -2) + Dec_Agi:EnableMouse(true) + Dec_Agi:SetNormalTexture("Interface/BUTTONS/UI-SpellbookIcon-PrevPage-Up") + Dec_Agi:SetHighlightTexture("Interface/BUTTONS/UI-Panel-MinimizeButton-Highlight") + Dec_Agi:SetPushedTexture("Interface/BUTTONS/UI-SpellbookIcon-PrevPage-Down") + --Dec_Agi:SetScript("OnMouseUp", Reduce_stats) + + Inc_Inte = CreateFrame("Button", "Inc_Inte", StatFrame_Panel_Int, nil) + Inc_Inte:SetSize(23, 23) + Inc_Inte:SetPoint("CENTER", 60, -2) + Inc_Inte:EnableMouse(true) + Inc_Inte:SetNormalTexture("Interface/BUTTONS/UI-SpellbookIcon-NextPage-Up") + Inc_Inte:SetHighlightTexture("Interface/BUTTONS/UI-Panel-MinimizeButton-Highlight") + Inc_Inte:SetPushedTexture("Interface/BUTTONS/UI-SpellbookIcon-NextPage-Down") + --Inc_Inte:SetScript("OnMouseUp", Increase_stats) + + Dec_Inte = CreateFrame("Button", "Dec_Inte", StatFrame_Panel_Int, nil) + Dec_Inte:SetSize(23, 23) + Dec_Inte:SetPoint("CENTER", -60, -2) + Dec_Inte:EnableMouse(true) + Dec_Inte:SetNormalTexture("Interface/BUTTONS/UI-SpellbookIcon-PrevPage-Up") + Dec_Inte:SetHighlightTexture("Interface/BUTTONS/UI-Panel-MinimizeButton-Highlight") + Dec_Inte:SetPushedTexture("Interface/BUTTONS/UI-SpellbookIcon-PrevPage-Down") + --Dec_Inte:SetScript("OnMouseUp", Reduce_stats) + + Inc_Spi = CreateFrame("Button", "Inc_Spi", StatFrame_Panel_Spi, nil) + Inc_Spi:SetSize(23, 23) + Inc_Spi:SetPoint("CENTER", 60, -2) + Inc_Spi:EnableMouse(true) + Inc_Spi:SetNormalTexture("Interface/BUTTONS/UI-SpellbookIcon-NextPage-Up") + Inc_Spi:SetHighlightTexture("Interface/BUTTONS/UI-Panel-MinimizeButton-Highlight") + Inc_Spi:SetPushedTexture("Interface/BUTTONS/UI-SpellbookIcon-NextPage-Down") + --Inc_Spi:SetScript("OnMouseUp", Increase_stats) + + Dec_Spi = CreateFrame("Button", "Dec_Spi", StatFrame_Panel_Spi, nil) + Dec_Spi:SetSize(23, 23) + Dec_Spi:SetPoint("CENTER", -60, -2) + Dec_Spi:EnableMouse(true) + Dec_Spi:SetNormalTexture("Interface/BUTTONS/UI-SpellbookIcon-PrevPage-Up") + Dec_Spi:SetHighlightTexture("Interface/BUTTONS/UI-Panel-MinimizeButton-Highlight") + Dec_Spi:SetPushedTexture("Interface/BUTTONS/UI-SpellbookIcon-PrevPage-Down") + --Dec_Spi:SetScript("OnMouseUp", Reduce_stats) + --edited all + + + Inc_Str:SetScript("OnMouseUp", Increase_stats) + + + Dec_Str:SetScript("OnMouseUp", Reduce_stats) + + + Inc_Sta:SetScript("OnMouseUp", Increase_stats) + + + Dec_Sta:SetScript("OnMouseUp", Reduce_stats) + + + Inc_Agi:SetScript("OnMouseUp", Increase_stats) + + + Dec_Agi:SetScript("OnMouseUp", Reduce_stats) + + + Inc_Inte:SetScript("OnMouseUp", Increase_stats) + + + Dec_Inte:SetScript("OnMouseUp", Reduce_stats) + + + Inc_Spi:SetScript("OnMouseUp", Increase_stats) + + + Dec_Spi:SetScript("OnMouseUp", Reduce_stats) + + + --[[ Reset UI ]] + + + function Reset_spells_button(self) + display_stuff(GeneralStuff) + if not(TrainingFrame:IsVisible()) then + AIO.Handle("sideBar", "ResetSpells") + end + end + + function Reset_talents_button(self) + display_stuff(GeneralStuff) + if not(TrainingFrame:IsVisible()) then + AIO.Handle("sideBar", "ResetTalents") + end + end + + + --[[local ResetFrame_CloseButton = CreateFrame("Button", "ResetFrame_CloseButton", ResetFrame, "UIPanelCloseButton") + ResetFrame_CloseButton:SetPoint("TOPRIGHT", -5, -5) + ResetFrame_CloseButton:EnableMouse(true) + ResetFrame_CloseButton:SetSize(27, 27) + + local ResetFrame_TitleBar = CreateFrame("Frame", "ResetFrame_TitleBar", ResetFrame, nil) + ResetFrame_TitleBar:SetSize(135, 25) + ResetFrame_TitleBar:SetBackdrop({ + bgFile = "Interface/CHARACTERFRAME/UI-Party-Background", + edgeFile = "Interface/DialogFrame/UI-DialogBox-Border", + tile = true, + edgeSize = 16, + tileSize = 16, + insets = { left = 5, right = 5, top = 5, bottom = 5 } + }) + ResetFrame_TitleBar:SetPoint("TOP", 0, 9) + local ResetFrame_TitleText = ResetFrame_TitleBar:CreateFontString("ResetFrame_TitleText") + ResetFrame_TitleText:SetFont("Fonts\\FRIZQT__.TTF", 13) + ResetFrame_TitleText:SetSize(225, 5) + ResetFrame_TitleText:SetPoint("CENTER", 0, 0) + ResetFrame_TitleText:SetText("|cffFFC125Reset Spells/Talents|r") + + + local Reset_Spells = CreateFrame("Button", "Reset_Spells", ResetFrame, nil) + Reset_Spells:SetSize(100, 50) + Reset_Spells:SetPoint("CENTER", -60, -20) + Reset_Spells:EnableMouse(true) + local texture_spell = Reset_Spells:CreateTexture("Spell_Texture") + texture_spell:SetAllPoints(Reset_Spells) + texture_spell:SetTexture(0.5, 1, 1, 0.5) + Reset_Spells:SetNormalTexture(texture_spell) + local font_spell = Reset_Spells:CreateFontString("Spell_Font") + font_spell:SetFont("Fonts\\FRIZQT__.TTF", 11) + font_spell:SetShadowOffset(1, -1) + Reset_Spells:SetFontString(font_spell) + Reset_Spells:SetText("Spells Reset") + Reset_Spells:SetScript("OnMouseUp", Reset_spells_button) + + local Reset_Talents = CreateFrame("Button", "Reset_Talents", ResetFrame, nil) + Reset_Talents:SetSize(100, 50) + Reset_Talents:SetPoint("CENTER", 60, -20) + Reset_Talents:EnableMouse(true) + local texture_talent = Reset_Talents:CreateTexture("Talent_Texture") + texture_talent:SetAllPoints(Reset_Talents) + texture_talent:SetTexture(0.5, 1, 1, 0.5) + Reset_Talents:SetNormalTexture(texture_talent) + local font_talent = Reset_Talents:CreateFontString("Talent_Font") + font_talent:SetFont("Fonts\\FRIZQT__.TTF", 11) + font_talent:SetShadowOffset(1, -1) + Reset_Talents:SetFontString(font_talent) + Reset_Talents:SetText("Talents Reset") + Reset_Talents:SetScript("OnMouseUp", Reset_talents_button)]]-- + + + + --[[ Character Advancement UI ]] + spec_displaying = "ALL" + frame_displaying = "BASIC" + function display_stuff(self) + PlaySound("TalentScreenOpen") + + local all_buttons = {BalanceDruid, FeralDruid, RestorationDruid, BeastMasteryHunter, MarksmanshipHunter, SurvivalHunter, + ArcaneMage, FireMage, FrostMage, HolyPaladin, ProtectionPaladin, RetributionPaladin, + DisciplinePriest, HolyPriest, ShadowPriest, AssassinationRogue, CombatRogue, SubtletyRogue, + ElementalShaman, EnhancementShaman, RestorationShaman, AfflictionWarlock, DemonologyWarlock, DestructionWarlock, + ArmsWarrior, FuryWarrior, ProtectionWarrior, GeneralStuff} + + local all_textures = {texture_BalanceDruid, texture_FeralDruid, texture_RestorationDruid, texture_BeastMasteryHunter, texture_MarksmanshipHunter, texture_SurvivalHunter, + texture_ArcaneMage,texture_FireMage,texture_FrostMage,texture_HolyPaladin, texture_ProtectionPaladin, texture_RetributionPaladin, + texture_DisciplinePriest, texture_HolyPriest, texture_ShadowPriest, texture_AssassinationRogue, texture_CombatRogue, texture_SubtletyRogue, + texture_ElementalShaman, texture_EnhancementShaman, texture_RestorationShaman, texture_AfflictionWarlock, texture_DemonologyWarlock, texture_DestructionWarlock, + texture_ArmsWarrior, texture_FuryWarrior, texture_ProtectionWarrior, texture_GeneralStuff} + + local all_texture_values = {{1, .49, .04,},{1, .49, .04,},{1, .49, .04,},{.67, .83, .45},{.67, .83, .45},{.67, .83, .45}, + {.41, .8, .94},{.41, .8, .94},{.41, .8, .94},{.96, .55, .73},{.96, .55, .73},{.96, .55, .73}, + {1, 1, 1},{1, 1, 1},{1, 1, 1},{1, .96, .41},{1, .96, .41},{1, .96, .41}, + {0, .44, .87},{0, .44, .87},{0, .44, .87},{.58, .51, .79},{.58, .51, .79},{.58, .51, .79}, + {.78, .61, .43},{.78, .61, .43},{.78, .61, .43},{.4,.4,.4}} + + + for i,v in ipairs(all_buttons) do + if self == v then + all_textures[i]:SetTexture("Interface\\AddOns\\AwAddons\\Textures\\progress\\button") + all_textures[i]:SetVertexColor(all_texture_values[i][1], all_texture_values[i][2], all_texture_values[i][3], .8) + spec_displaying = v + else + all_textures[i]:SetTexture("Interface\\AddOns\\AwAddons\\Textures\\progress\\button_h") + all_textures[i]:SetVertexColor(all_texture_values[i][1], all_texture_values[i][2], all_texture_values[i][3], .8) + end + end + + DisplaySpellsButton:Enable() + DisplayTalentsButton:Enable() + BaseFrameFadeIn(TrainingFrame_SelectedTitle_Stars1) + TrainingFrame_SelectedTitle_Stars1_glow:Show() + BaseFrameFadeIn(TrainingFrame_SelectedTitle_Stars2) + TrainingFrame_SelectedTitle_Stars2_glow:Show() + BaseFrameFadeIn(TrainingFrame_SelectedTitle_Glow) + + frame_displaying = "BASIC" + display_frame_CA() + + end + + + + local TrainingFrame_CloseButton = CreateFrame("Button", "TrainingFrame_CloseButton", TrainingFrame, "UIPanelCloseButton") + TrainingFrame_CloseButton:SetPoint("TOPRIGHT", -63, -112) + TrainingFrame_CloseButton:EnableMouse(true) + TrainingFrame_CloseButton:SetSize(31, 31) + TrainingFrame_CloseButton:SetFrameStrata("FULLSCREEN_DIALOG") + TrainingFrame_CloseButton:SetScript("OnMouseUp", function() + PlaySound("Glyph_MinorCreate") + TrainingFrame:Hide() + end) + + + --[[local TrainingFrame_TitleBar = CreateFrame("Frame", "TrainingFrame_TitleBar", TrainingFrame, nil) + TrainingFrame_TitleBar:SetSize(180, 25) + TrainingFrame_TitleBar:SetBackdrop({ + bgFile = "Interface/CHARACTERFRAME/UI-Party-Background", + edgeFile = "Interface/DialogFrame/UI-DialogBox-Border", + tile = true, + edgeSize = 16, + tileSize = 16, + insets = { left = 5, right = 5, top = 5, bottom = 5 } + }) + TrainingFrame_TitleBar:SetPoint("TOP", -90, 9)]]-- + local TrainingFrame_TitleText = TrainingFrame:CreateFontString("TrainingFrame_TitleText") + TrainingFrame_TitleText:SetFont("Fonts\\MORPHEUS.TTF", 17, "OUTLINE") + --TrainingFrame_TitleText:SetSize(225, 255) + TrainingFrame_TitleText:SetPoint("TOPRIGHT",-135, -97) + TrainingFrame_TitleText:SetText("|cffFFC125Character|nProgression|r") + + -- ####################################### Spec Buttons ############################## +BalanceDruid = CreateFrame("Button", "TrainingFrame_BalanceDruid", TrainingFrame, nil) + BalanceDruid:SetSize(234, 25.5) + BalanceDruid:SetPoint("TOPRIGHT", -68.5, -136) + BalanceDruid:EnableMouse(true) + texture_BalanceDruid = BalanceDruid:CreateTexture("BalanceDruid") + texture_BalanceDruid:SetAllPoints(BalanceDruid) + texture_BalanceDruid:SetTexture("Interface\\AddOns\\AwAddons\\Textures\\progress\\button_h") + texture_BalanceDruid:SetVertexColor(1, .49, .04, .8) + BalanceDruid:SetNormalTexture(texture_BalanceDruid) + BalanceDruid:SetHighlightTexture("Interface\\AddOns\\AwAddons\\Textures\\progress\\button_h2") + font_BalanceDruid = BalanceDruid:CreateFontString("BalanceDruid_Font") + font_BalanceDruid:SetFont("Fonts\\FRIZQT__.TTF", 11) + font_BalanceDruid:SetShadowOffset(1, -1) + BalanceDruid:SetFontString(font_BalanceDruid) + BalanceDruid:SetText("Balance Druid") + BalanceDruid:SetScript("OnMouseUp", display_stuff) + + FeralDruid = CreateFrame("Button", "TrainingFrame_FeralDruid", TrainingFrame, nil) + FeralDruid:SetSize(234, 25.5) + FeralDruid:SetPoint("TOPRIGHT", -68.5, -159.5) + FeralDruid:EnableMouse(true) + texture_FeralDruid = BalanceDruid:CreateTexture("FeralDruid") + texture_FeralDruid:SetAllPoints(FeralDruid) + texture_FeralDruid:SetTexture("Interface\\AddOns\\AwAddons\\Textures\\progress\\button_h") + texture_FeralDruid:SetVertexColor(1, .49, .04, .8) + FeralDruid:SetNormalTexture(texture_FeralDruid) + FeralDruid:SetHighlightTexture("Interface\\AddOns\\AwAddons\\Textures\\progress\\button_h2") + font_FeralDruid = FeralDruid:CreateFontString("FeralDruid_Font") + font_FeralDruid:SetFont("Fonts\\FRIZQT__.TTF", 11) + font_FeralDruid:SetShadowOffset(1, -1) + FeralDruid:SetFontString(font_FeralDruid) + FeralDruid:SetText("Feral Druid") + FeralDruid:SetScript("OnMouseUp", display_stuff) + + RestorationDruid = CreateFrame("Button", "TrainingFrame_RestorationDruid", TrainingFrame, nil) + RestorationDruid:SetSize(234, 25.5) + RestorationDruid:SetPoint("TOPRIGHT", -68.5, -183) + RestorationDruid:EnableMouse(true) + texture_RestorationDruid = RestorationDruid:CreateTexture("RestorationDruid") + texture_RestorationDruid:SetAllPoints(RestorationDruid) + texture_RestorationDruid:SetTexture("Interface\\AddOns\\AwAddons\\Textures\\progress\\button_h") + texture_RestorationDruid:SetVertexColor(1, .49, .04, .8) + RestorationDruid:SetNormalTexture(texture_RestorationDruid) + RestorationDruid:SetHighlightTexture("Interface\\AddOns\\AwAddons\\Textures\\progress\\button_h2") + font_RestorationDruid = RestorationDruid:CreateFontString("RestorationDruid_Font") + font_RestorationDruid:SetFont("Fonts\\FRIZQT__.TTF", 11) + font_RestorationDruid:SetShadowOffset(1, -1) + RestorationDruid:SetFontString(font_RestorationDruid) + RestorationDruid:SetText("Restoration Druid") + RestorationDruid:SetScript("OnMouseUp", display_stuff) + + + BeastMasteryHunter = CreateFrame("Button", "TrainingFrame_BeastMasteryHunter", TrainingFrame, nil) + BeastMasteryHunter:SetSize(234, 25.5) + BeastMasteryHunter:SetPoint("TOPRIGHT", -68.5, -206,5) + BeastMasteryHunter:EnableMouse(true) + texture_BeastMasteryHunter = BeastMasteryHunter:CreateTexture("BeastMasteryHunter") + texture_BeastMasteryHunter:SetAllPoints(BeastMasteryHunter) + texture_BeastMasteryHunter:SetTexture("Interface\\AddOns\\AwAddons\\Textures\\progress\\button_h") + texture_BeastMasteryHunter:SetVertexColor(.67, .83, .45, .8) + BeastMasteryHunter:SetNormalTexture(texture_BeastMasteryHunter) + BeastMasteryHunter:SetHighlightTexture("Interface\\AddOns\\AwAddons\\Textures\\progress\\button_h2") + font_BeastMasteryHunter = BeastMasteryHunter:CreateFontString("BeastMasteryHunter_Font") + font_BeastMasteryHunter:SetFont("Fonts\\FRIZQT__.TTF", 11) + font_BeastMasteryHunter:SetShadowOffset(1, -1) + BeastMasteryHunter:SetFontString(font_BeastMasteryHunter) + BeastMasteryHunter:SetText("Beast Mastery Hunter") + BeastMasteryHunter:SetScript("OnMouseUp", display_stuff) + + + MarksmanshipHunter = CreateFrame("Button", "TrainingFrame_MarksmanshipHunter", TrainingFrame, nil) + MarksmanshipHunter:SetSize(234, 25.5) + MarksmanshipHunter:SetPoint("TOPRIGHT", -68.5, -230) + MarksmanshipHunter:EnableMouse(true) + texture_MarksmanshipHunter = MarksmanshipHunter:CreateTexture("MarksmanshipHunter") + texture_MarksmanshipHunter:SetAllPoints(MarksmanshipHunter) + texture_MarksmanshipHunter:SetTexture("Interface\\AddOns\\AwAddons\\Textures\\progress\\button_h") + texture_MarksmanshipHunter:SetVertexColor(.67, .83, .45, .8) + MarksmanshipHunter:SetNormalTexture(texture_MarksmanshipHunter) + MarksmanshipHunter:SetHighlightTexture("Interface\\AddOns\\AwAddons\\Textures\\progress\\button_h2") + font_MarksmanshipHunter = MarksmanshipHunter:CreateFontString("MarksmanshipHunter_Font") + font_MarksmanshipHunter:SetFont("Fonts\\FRIZQT__.TTF", 11) + font_MarksmanshipHunter:SetShadowOffset(1, -1) + MarksmanshipHunter:SetFontString(font_MarksmanshipHunter) + MarksmanshipHunter:SetText("Marksmanship Hunter") + MarksmanshipHunter:SetScript("OnMouseUp", display_stuff) + + + SurvivalHunter = CreateFrame("Button", "TrainingFrame_SurvivalHunter", TrainingFrame, nil) + SurvivalHunter:SetSize(234, 25.5) + SurvivalHunter:SetPoint("TOPRIGHT", -68.5, -253,5) + SurvivalHunter:EnableMouse(true) + texture_SurvivalHunter = MarksmanshipHunter:CreateTexture("SurvivalHunter") + texture_SurvivalHunter:SetAllPoints(SurvivalHunter) + texture_SurvivalHunter:SetTexture("Interface\\AddOns\\AwAddons\\Textures\\progress\\button_h") + texture_SurvivalHunter:SetVertexColor(.67, .83, .45, .8) + SurvivalHunter:SetNormalTexture(texture_SurvivalHunter) + SurvivalHunter:SetHighlightTexture("Interface\\AddOns\\AwAddons\\Textures\\progress\\button_h2") + font_SurvivalHunter = SurvivalHunter:CreateFontString("SurvivalHunter_Font") + font_SurvivalHunter:SetFont("Fonts\\FRIZQT__.TTF", 11) + font_SurvivalHunter:SetShadowOffset(1, -1) + SurvivalHunter:SetFontString(font_SurvivalHunter) + SurvivalHunter:SetText("Survival Hunter") + SurvivalHunter:SetScript("OnMouseUp", display_stuff) + + + ArcaneMage = CreateFrame("Button", "TrainingFrame_ArcaneMage", TrainingFrame, nil) + ArcaneMage:SetSize(234, 25.5) + ArcaneMage:SetPoint("TOPRIGHT", -68.5, -277) + ArcaneMage:EnableMouse(true) + texture_ArcaneMage = ArcaneMage:CreateTexture("FireMage") + texture_ArcaneMage:SetAllPoints(ArcaneMage) + texture_ArcaneMage:SetTexture("Interface\\AddOns\\AwAddons\\Textures\\progress\\button_h") + texture_ArcaneMage:SetVertexColor(.41, .8, .94, .8) + ArcaneMage:SetNormalTexture(texture_ArcaneMage) + ArcaneMage:SetHighlightTexture("Interface\\AddOns\\AwAddons\\Textures\\progress\\button_h2") + font_ArcaneMage = ArcaneMage:CreateFontString("ArcaneMage_Font") + font_ArcaneMage:SetFont("Fonts\\FRIZQT__.TTF", 11) + font_ArcaneMage:SetShadowOffset(1, -1) + ArcaneMage:SetFontString(font_ArcaneMage) + ArcaneMage:SetText("Arcane Mage") + ArcaneMage:SetScript("OnMouseUp", display_stuff) + + + FireMage = CreateFrame("Button", "TrainingFrame_FireMage", TrainingFrame, nil) + FireMage:SetSize(234, 25.5) + FireMage:SetPoint("TOPRIGHT", -68.5, -300.5) + FireMage:EnableMouse(true) + texture_FireMage = FireMage:CreateTexture("FireMage") + texture_FireMage:SetAllPoints(FireMage) + texture_FireMage:SetTexture("Interface\\AddOns\\AwAddons\\Textures\\progress\\button_h") + texture_FireMage:SetVertexColor(.41, .8, .94, .8) + FireMage:SetNormalTexture(texture_FireMage) + FireMage:SetHighlightTexture("Interface\\AddOns\\AwAddons\\Textures\\progress\\button_h2") + font_FireMage = FireMage:CreateFontString("FireMage_Font") + font_FireMage:SetFont("Fonts\\FRIZQT__.TTF", 11) + font_FireMage:SetShadowOffset(1, -1) + FireMage:SetFontString(font_FireMage) + FireMage:SetText("Fire Mage") + FireMage:SetScript("OnMouseUp", display_stuff) + + + FrostMage = CreateFrame("Button", "TrainingFrame_FrostMage", TrainingFrame, nil) + FrostMage:SetSize(234, 25.5) + FrostMage:SetPoint("TOPRIGHT", -68.5, -324) + FrostMage:EnableMouse(true) + texture_FrostMage = FrostMage:CreateTexture("FrostMage") + texture_FrostMage:SetAllPoints(FrostMage) + texture_FrostMage:SetTexture("Interface\\AddOns\\AwAddons\\Textures\\progress\\button_h") + texture_FrostMage:SetVertexColor(.41, .8, .94, .8) + FrostMage:SetNormalTexture(texture_FrostMage) + FrostMage:SetHighlightTexture("Interface\\AddOns\\AwAddons\\Textures\\progress\\button_h2") + font_FrostMage = FrostMage:CreateFontString("FrostMage_Font") + font_FrostMage:SetFont("Fonts\\FRIZQT__.TTF", 11) + font_FrostMage:SetShadowOffset(1, -1) + FrostMage:SetFontString(font_FrostMage) + FrostMage:SetText("Frost Mage") + FrostMage:SetScript("OnMouseUp", display_stuff) + + HolyPaladin = CreateFrame("Button", "TrainingFrame_HolyPaladin", TrainingFrame, nil) + HolyPaladin:SetSize(234, 25.5) + HolyPaladin:SetPoint("TOPRIGHT", -68.5, -347,5) + HolyPaladin:EnableMouse(true) + texture_HolyPaladin = HolyPaladin:CreateTexture("HolyPaladin") + texture_HolyPaladin:SetAllPoints(HolyPaladin) + texture_HolyPaladin:SetTexture("Interface\\AddOns\\AwAddons\\Textures\\progress\\button_h") + texture_HolyPaladin:SetVertexColor(.96, .55, .73, .8) + HolyPaladin:SetNormalTexture(texture_HolyPaladin) + HolyPaladin:SetHighlightTexture("Interface\\AddOns\\AwAddons\\Textures\\progress\\button_h2") + font_HolyPaladin = HolyPaladin:CreateFontString("HolyPaladin_Font") + font_HolyPaladin:SetFont("Fonts\\FRIZQT__.TTF", 11) + font_HolyPaladin:SetShadowOffset(1, -1) + HolyPaladin:SetFontString(font_HolyPaladin) + HolyPaladin:SetText("Holy Paladin") + HolyPaladin:SetScript("OnMouseUp", display_stuff) + + + ProtectionPaladin = CreateFrame("Button", "TrainingFrame_ProtectionPaladin", TrainingFrame, nil) + ProtectionPaladin:SetSize(234, 25.5) + ProtectionPaladin:SetPoint("TOPRIGHT", -68.5, -371) + ProtectionPaladin:EnableMouse(true) + texture_ProtectionPaladin = ProtectionPaladin:CreateTexture("ProtectionPaladin") + texture_ProtectionPaladin:SetAllPoints(ProtectionPaladin) + texture_ProtectionPaladin:SetTexture("Interface\\AddOns\\AwAddons\\Textures\\progress\\button_h") + texture_ProtectionPaladin:SetVertexColor(.96, .55, .73, .8) + ProtectionPaladin:SetNormalTexture(texture_ProtectionPaladin) + ProtectionPaladin:SetHighlightTexture("Interface\\AddOns\\AwAddons\\Textures\\progress\\button_h2") + font_ProtectionPaladin = ProtectionPaladin:CreateFontString("ProtectionPaladin_Font") + font_ProtectionPaladin:SetFont("Fonts\\FRIZQT__.TTF", 11) + font_ProtectionPaladin:SetShadowOffset(1, -1) + ProtectionPaladin:SetFontString(font_ProtectionPaladin) + ProtectionPaladin:SetText("Protection Paladin") + ProtectionPaladin:SetScript("OnMouseUp", display_stuff) + + + RetributionPaladin = CreateFrame("Button", "TrainingFrame_RetributionPaladin", TrainingFrame, nil) + RetributionPaladin:SetSize(234, 25.5) + RetributionPaladin:SetPoint("TOPRIGHT", -68.5, -394,5) + RetributionPaladin:EnableMouse(true) + texture_RetributionPaladin = RetributionPaladin:CreateTexture("RetributionPaladin") + texture_RetributionPaladin:SetAllPoints(RetributionPaladin) + texture_RetributionPaladin:SetTexture("Interface\\AddOns\\AwAddons\\Textures\\progress\\button_h") + texture_RetributionPaladin:SetVertexColor(.96, .55, .73, .8) + RetributionPaladin:SetNormalTexture(texture_RetributionPaladin) + RetributionPaladin:SetHighlightTexture("Interface\\AddOns\\AwAddons\\Textures\\progress\\button_h2") + font_RetributionPaladin = RetributionPaladin:CreateFontString("RetributionPaladin_Font") + font_RetributionPaladin:SetFont("Fonts\\FRIZQT__.TTF", 11) + font_RetributionPaladin:SetShadowOffset(1, -1) + RetributionPaladin:SetFontString(font_RetributionPaladin) + RetributionPaladin:SetText("Retribution Paladin") + RetributionPaladin:SetScript("OnMouseUp", display_stuff) + + + DisciplinePriest = CreateFrame("Button", "TrainingFrame_DisciplinePriest", TrainingFrame, nil) + DisciplinePriest:SetSize(234, 25.5) + DisciplinePriest:SetPoint("TOPRIGHT", -68.5, -418) + DisciplinePriest:EnableMouse(true) + texture_DisciplinePriest = DisciplinePriest:CreateTexture("DisciplinePriest") + texture_DisciplinePriest:SetAllPoints(DisciplinePriest) + texture_DisciplinePriest:SetTexture("Interface\\AddOns\\AwAddons\\Textures\\progress\\button_h") + texture_DisciplinePriest:SetVertexColor(1, 1, 1, .8) + DisciplinePriest:SetNormalTexture(texture_DisciplinePriest) + DisciplinePriest:SetHighlightTexture("Interface\\AddOns\\AwAddons\\Textures\\progress\\button_h2") + font_DisciplinePriest = DisciplinePriest:CreateFontString("DisciplinePriest_Font") + font_DisciplinePriest:SetFont("Fonts\\FRIZQT__.TTF", 11) + font_DisciplinePriest:SetShadowOffset(1, -1) + DisciplinePriest:SetFontString(font_DisciplinePriest) + DisciplinePriest:SetText("Discipline Priest") + DisciplinePriest:SetScript("OnMouseUp", display_stuff) + + + HolyPriest = CreateFrame("Button", "TrainingFrame_HolyPriest", TrainingFrame, nil) + HolyPriest:SetSize(234, 25.5) + HolyPriest:SetPoint("TOPRIGHT", -68.5, -441,5) + HolyPriest:EnableMouse(true) + texture_HolyPriest = HolyPriest:CreateTexture("HolyPriest") + texture_HolyPriest:SetAllPoints(HolyPriest) + texture_HolyPriest:SetTexture("Interface\\AddOns\\AwAddons\\Textures\\progress\\button_h") + texture_HolyPriest:SetVertexColor(1, 1, 1, .8) + HolyPriest:SetNormalTexture(texture_HolyPriest) + HolyPriest:SetHighlightTexture("Interface\\AddOns\\AwAddons\\Textures\\progress\\button_h2") + font_HolyPriest = HolyPriest:CreateFontString("HolyPriest_Font") + font_HolyPriest:SetFont("Fonts\\FRIZQT__.TTF", 11) + font_HolyPriest:SetShadowOffset(1, -1) + HolyPriest:SetFontString(font_HolyPriest) + HolyPriest:SetText("Holy Priest") + HolyPriest:SetScript("OnMouseUp", display_stuff) + + + ShadowPriest = CreateFrame("Button", "TrainingFrame_ShadowPriest", TrainingFrame, nil) + ShadowPriest:SetSize(234, 25.5) + ShadowPriest:SetPoint("TOPRIGHT", -68.5, -465) + ShadowPriest:EnableMouse(true) + texture_ShadowPriest = ShadowPriest:CreateTexture("ShadowPriest") + texture_ShadowPriest:SetAllPoints(ShadowPriest) + texture_ShadowPriest:SetTexture("Interface\\AddOns\\AwAddons\\Textures\\progress\\button_h") + texture_ShadowPriest:SetVertexColor(1, 1, 1, .8) + ShadowPriest:SetNormalTexture(texture_ShadowPriest) + ShadowPriest:SetHighlightTexture("Interface\\AddOns\\AwAddons\\Textures\\progress\\button_h2") + font_ShadowPriest = ShadowPriest:CreateFontString("ShadowPriest_Font") + font_ShadowPriest:SetFont("Fonts\\FRIZQT__.TTF", 11) + font_ShadowPriest:SetShadowOffset(1, -1) + ShadowPriest:SetFontString(font_ShadowPriest) + ShadowPriest:SetText("Shadow Priest") + ShadowPriest:SetScript("OnMouseUp", display_stuff) + + + AssassinationRogue = CreateFrame("Button", "TrainingFrame_AssassinationRogue", TrainingFrame, nil) + AssassinationRogue:SetSize(234, 25.5) + AssassinationRogue:SetPoint("TOPRIGHT", -68.5, -488,5) + AssassinationRogue:EnableMouse(true) + texture_AssassinationRogue = AssassinationRogue:CreateTexture("AssassinationRogue") + texture_AssassinationRogue:SetAllPoints(AssassinationRogue) + texture_AssassinationRogue:SetTexture("Interface\\AddOns\\AwAddons\\Textures\\progress\\button_h") + texture_AssassinationRogue:SetVertexColor(1, .96, .41, .8) + AssassinationRogue:SetNormalTexture(texture_AssassinationRogue) + AssassinationRogue:SetHighlightTexture("Interface\\AddOns\\AwAddons\\Textures\\progress\\button_h2") + font_AssassinationRogue = AssassinationRogue:CreateFontString("AssassinationRogue_Font") + font_AssassinationRogue:SetFont("Fonts\\FRIZQT__.TTF", 11) + font_AssassinationRogue:SetShadowOffset(1, -1) + AssassinationRogue:SetFontString(font_AssassinationRogue) + AssassinationRogue:SetText("Assassination Rogue") + AssassinationRogue:SetScript("OnMouseUp", display_stuff) + + + CombatRogue = CreateFrame("Button", "TrainingFrame_CombatRogue", TrainingFrame, nil) + CombatRogue:SetSize(234, 25.5) + CombatRogue:SetPoint("TOPRIGHT", -68.5, -512) + CombatRogue:EnableMouse(true) + texture_CombatRogue = CombatRogue:CreateTexture("CombatRogue") + texture_CombatRogue:SetAllPoints(CombatRogue) + texture_CombatRogue:SetTexture("Interface\\AddOns\\AwAddons\\Textures\\progress\\button_h") + texture_CombatRogue:SetVertexColor(1, .96, .41, .8) + CombatRogue:SetNormalTexture(texture_CombatRogue) + CombatRogue:SetHighlightTexture("Interface\\AddOns\\AwAddons\\Textures\\progress\\button_h2") + font_CombatRogue = CombatRogue:CreateFontString("CombatRogue_Font") + font_CombatRogue:SetFont("Fonts\\FRIZQT__.TTF", 11) + font_CombatRogue:SetShadowOffset(1, -1) + CombatRogue:SetFontString(font_CombatRogue) + CombatRogue:SetText("Combat Rogue") + CombatRogue:SetScript("OnMouseUp", display_stuff) + + + SubtletyRogue = CreateFrame("Button", "TrainingFrame_SubtletyRogue", TrainingFrame, nil) + SubtletyRogue:SetSize(234, 25.5) + SubtletyRogue:SetPoint("TOPRIGHT", -68.5, -535,5) + SubtletyRogue:EnableMouse(true) + texture_SubtletyRogue = SubtletyRogue:CreateTexture("SubtletyRogue") + texture_SubtletyRogue:SetAllPoints(SubtletyRogue) + texture_SubtletyRogue:SetTexture("Interface\\AddOns\\AwAddons\\Textures\\progress\\button_h") + texture_SubtletyRogue:SetVertexColor(1, .96, .41, .8) + SubtletyRogue:SetNormalTexture(texture_SubtletyRogue) + SubtletyRogue:SetHighlightTexture("Interface\\AddOns\\AwAddons\\Textures\\progress\\button_h2") + font_SubtletyRogue = SubtletyRogue:CreateFontString("SubtletyRogue_Font") + font_SubtletyRogue:SetFont("Fonts\\FRIZQT__.TTF", 11) + font_SubtletyRogue:SetShadowOffset(1, -1) + SubtletyRogue:SetFontString(font_SubtletyRogue) + SubtletyRogue:SetText("Subtlety Rogue") + SubtletyRogue:SetScript("OnMouseUp", display_stuff) + + + ElementalShaman = CreateFrame("Button", "TrainingFrame_ElementalShaman", TrainingFrame, nil) + ElementalShaman:SetSize(234, 25.5) + ElementalShaman:SetPoint("TOPRIGHT", -68.5, -559) + ElementalShaman:EnableMouse(true) + texture_ElementalShaman = ElementalShaman:CreateTexture("ElementalShaman") + texture_ElementalShaman:SetAllPoints(ElementalShaman) + texture_ElementalShaman:SetTexture("Interface\\AddOns\\AwAddons\\Textures\\progress\\button_h") + texture_ElementalShaman:SetVertexColor(0, .44, .87, .8) + ElementalShaman:SetNormalTexture(texture_ElementalShaman) + ElementalShaman:SetHighlightTexture("Interface\\AddOns\\AwAddons\\Textures\\progress\\button_h2") + font_ElementalShaman = ElementalShaman:CreateFontString("ElementalShaman_Font") + font_ElementalShaman:SetFont("Fonts\\FRIZQT__.TTF", 11) + font_ElementalShaman:SetShadowOffset(1, -1) + ElementalShaman:SetFontString(font_ElementalShaman) + ElementalShaman:SetText("Elemental Shaman") + ElementalShaman:SetScript("OnMouseUp", display_stuff) + + + EnhancementShaman = CreateFrame("Button", "TrainingFrame_EnhancementShaman", TrainingFrame, nil) + EnhancementShaman:SetSize(234, 25.5) + EnhancementShaman:SetPoint("TOPRIGHT", -68.5, -582,5) + EnhancementShaman:EnableMouse(true) + texture_EnhancementShaman = EnhancementShaman:CreateTexture("EnhancementShaman") + texture_EnhancementShaman:SetAllPoints(EnhancementShaman) + texture_EnhancementShaman:SetTexture("Interface\\AddOns\\AwAddons\\Textures\\progress\\button_h") + texture_EnhancementShaman:SetVertexColor(0, .44, .87, .8) + EnhancementShaman:SetNormalTexture(texture_EnhancementShaman) + EnhancementShaman:SetHighlightTexture("Interface\\AddOns\\AwAddons\\Textures\\progress\\button_h2") + font_EnhancementShaman = EnhancementShaman:CreateFontString("EnhancementShaman_Font") + font_EnhancementShaman:SetFont("Fonts\\FRIZQT__.TTF", 11) + font_EnhancementShaman:SetShadowOffset(1, -1) + EnhancementShaman:SetFontString(font_EnhancementShaman) + EnhancementShaman:SetText("Enhancement Shaman") + EnhancementShaman:SetScript("OnMouseUp", display_stuff) + + + RestorationShaman = CreateFrame("Button", "TrainingFrame_RestorationShaman", TrainingFrame, nil) + RestorationShaman:SetSize(234, 25.5) + RestorationShaman:SetPoint("TOPRIGHT", -68.5, -606) + RestorationShaman:EnableMouse(true) + texture_RestorationShaman = RestorationShaman:CreateTexture("RestorationShaman") + texture_RestorationShaman:SetAllPoints(RestorationShaman) + texture_RestorationShaman:SetTexture("Interface\\AddOns\\AwAddons\\Textures\\progress\\button_h") + texture_RestorationShaman:SetVertexColor(0, .44, .87, .8) + RestorationShaman:SetNormalTexture(texture_RestorationShaman) + RestorationShaman:SetHighlightTexture("Interface\\AddOns\\AwAddons\\Textures\\progress\\button_h2") + font_RestorationShaman = RestorationShaman:CreateFontString("RestorationShaman_Font") + font_RestorationShaman:SetFont("Fonts\\FRIZQT__.TTF", 11) + font_RestorationShaman:SetShadowOffset(1, -1) + RestorationShaman:SetFontString(font_RestorationShaman) + RestorationShaman:SetText("Restoration Shaman") + RestorationShaman:SetScript("OnMouseUp", display_stuff) + + + AfflictionWarlock = CreateFrame("Button", "TrainingFrame_AfflictionWarlock", TrainingFrame, nil) + AfflictionWarlock:SetSize(234, 25.5) + AfflictionWarlock:SetPoint("TOPRIGHT", -68.5, -629,5) + AfflictionWarlock:EnableMouse(true) + texture_AfflictionWarlock = AfflictionWarlock:CreateTexture("AfflictionWarlock") + texture_AfflictionWarlock:SetAllPoints(AfflictionWarlock) + texture_AfflictionWarlock:SetTexture("Interface\\AddOns\\AwAddons\\Textures\\progress\\button_h") + texture_AfflictionWarlock:SetVertexColor(.58, .51, .79, .8) + AfflictionWarlock:SetNormalTexture(texture_AfflictionWarlock) + AfflictionWarlock:SetHighlightTexture("Interface\\AddOns\\AwAddons\\Textures\\progress\\button_h2") + font_AfflictionWarlock = AfflictionWarlock:CreateFontString("AfflictionWarlock_Font") + font_AfflictionWarlock:SetFont("Fonts\\FRIZQT__.TTF", 11) + font_AfflictionWarlock:SetShadowOffset(1, -1) + AfflictionWarlock:SetFontString(font_AfflictionWarlock) + AfflictionWarlock:SetText("Affliction Warlock") + AfflictionWarlock:SetScript("OnMouseUp", display_stuff) + + DemonologyWarlock = CreateFrame("Button", "TrainingFrame_DemonologyWarlock", TrainingFrame, nil) + DemonologyWarlock:SetSize(234, 25.5) + DemonologyWarlock:SetPoint("TOPRIGHT", -68.5, -653) + DemonologyWarlock:EnableMouse(true) + texture_DemonologyWarlock = DemonologyWarlock:CreateTexture("DemonologyWarlock") + texture_DemonologyWarlock:SetAllPoints(DemonologyWarlock) + texture_DemonologyWarlock:SetTexture("Interface\\AddOns\\AwAddons\\Textures\\progress\\button_h") + texture_DemonologyWarlock:SetVertexColor(.58, .51, .79, .8) + DemonologyWarlock:SetNormalTexture(texture_DemonologyWarlock) + DemonologyWarlock:SetHighlightTexture("Interface\\AddOns\\AwAddons\\Textures\\progress\\button_h2") + font_DemonologyWarlock = DemonologyWarlock:CreateFontString("DemonologyWarlock_Font") + font_DemonologyWarlock:SetFont("Fonts\\FRIZQT__.TTF", 11) + font_DemonologyWarlock:SetShadowOffset(1, -1) + DemonologyWarlock:SetFontString(font_DemonologyWarlock) + DemonologyWarlock:SetText("Demonology Warlock") + DemonologyWarlock:SetScript("OnMouseUp", display_stuff) + + + DestructionWarlock = CreateFrame("Button", "TrainingFrame_DestructionWarlock", TrainingFrame, nil) + DestructionWarlock:SetSize(234, 25.5) + DestructionWarlock:SetPoint("TOPRIGHT", -68.5, -676,5) + DestructionWarlock:EnableMouse(true) + texture_DestructionWarlock = DestructionWarlock:CreateTexture("DestructionWarlock") + texture_DestructionWarlock:SetAllPoints(DestructionWarlock) + texture_DestructionWarlock:SetTexture("Interface\\AddOns\\AwAddons\\Textures\\progress\\button_h") + texture_DestructionWarlock:SetVertexColor(.58, .51, .79, .8) + DestructionWarlock:SetNormalTexture(texture_DestructionWarlock) + DestructionWarlock:SetHighlightTexture("Interface\\AddOns\\AwAddons\\Textures\\progress\\button_h2") + font_DestructionWarlock = DestructionWarlock:CreateFontString("DestructionWarlock_Font") + font_DestructionWarlock:SetFont("Fonts\\FRIZQT__.TTF", 11) + font_DestructionWarlock:SetShadowOffset(1, -1) + DestructionWarlock:SetFontString(font_DestructionWarlock) + DestructionWarlock:SetText("Destruction Warlock") + DestructionWarlock:SetScript("OnMouseUp", display_stuff) + + + ArmsWarrior = CreateFrame("Button", "TrainingFrame_ArmsWarrior", TrainingFrame, nil) + ArmsWarrior:SetSize(234, 25.5) + ArmsWarrior:SetPoint("TOPRIGHT", -68.5, -700) + ArmsWarrior:EnableMouse(true) + texture_ArmsWarrior = ArmsWarrior:CreateTexture("ArmsWarrior") + texture_ArmsWarrior:SetAllPoints(ArmsWarrior) + texture_ArmsWarrior:SetTexture("Interface\\AddOns\\AwAddons\\Textures\\progress\\button_h") + texture_ArmsWarrior:SetVertexColor(.78, .61, .43, .8) + ArmsWarrior:SetNormalTexture(texture_ArmsWarrior) + ArmsWarrior:SetHighlightTexture("Interface\\AddOns\\AwAddons\\Textures\\progress\\button_h2") + font_ArmsWarrior = ArmsWarrior:CreateFontString("ArmsWarrior_Font") + font_ArmsWarrior:SetFont("Fonts\\FRIZQT__.TTF", 11) + font_ArmsWarrior:SetShadowOffset(1, -1) + ArmsWarrior:SetFontString(font_ArmsWarrior) + ArmsWarrior:SetText("Arms Warrior") + ArmsWarrior:SetScript("OnMouseUp", display_stuff) + + + FuryWarrior = CreateFrame("Button", "TrainingFrame_FuryWarrior", TrainingFrame, nil) + FuryWarrior:SetSize(234, 25.5) + FuryWarrior:SetPoint("TOPRIGHT", -68.5, -723,5) + FuryWarrior:EnableMouse(true) + texture_FuryWarrior = FuryWarrior:CreateTexture("FuryWarrior") + texture_FuryWarrior:SetAllPoints(FuryWarrior) + texture_FuryWarrior:SetTexture("Interface\\AddOns\\AwAddons\\Textures\\progress\\button_h") + texture_FuryWarrior:SetVertexColor(.78, .61, .43, .8) + FuryWarrior:SetNormalTexture(texture_FuryWarrior) + FuryWarrior:SetHighlightTexture("Interface\\AddOns\\AwAddons\\Textures\\progress\\button_h2") + font_FuryWarrior = FuryWarrior:CreateFontString("FuryWarrior_Font") + font_FuryWarrior:SetFont("Fonts\\FRIZQT__.TTF", 11) + font_FuryWarrior:SetShadowOffset(1, -1) + FuryWarrior:SetFontString(font_FuryWarrior) + FuryWarrior:SetText("Fury Warrior") + FuryWarrior:SetScript("OnMouseUp", display_stuff) + + + ProtectionWarrior = CreateFrame("Button", "TrainingFrame_ProtectionWarrior", TrainingFrame, nil) + ProtectionWarrior:SetSize(234, 25.5) + ProtectionWarrior:SetPoint("TOPRIGHT", -68.5, -747) + ProtectionWarrior:EnableMouse(true) + texture_ProtectionWarrior = ProtectionWarrior:CreateTexture("ProtectionWarrior") + texture_ProtectionWarrior:SetAllPoints(ProtectionWarrior) + texture_ProtectionWarrior:SetTexture("Interface\\AddOns\\AwAddons\\Textures\\progress\\button_h") + texture_ProtectionWarrior:SetVertexColor(.78, .61, .43, .8) + ProtectionWarrior:SetNormalTexture(texture_ProtectionWarrior) + ProtectionWarrior:SetHighlightTexture("Interface\\AddOns\\AwAddons\\Textures\\progress\\button_h2") + font_ProtectionWarrior = ProtectionWarrior:CreateFontString("ProtectionWarrior_Font") + font_ProtectionWarrior:SetFont("Fonts\\FRIZQT__.TTF", 11) + font_ProtectionWarrior:SetShadowOffset(1, -1) + ProtectionWarrior:SetFontString(font_ProtectionWarrior) + ProtectionWarrior:SetText("Protection Warrior") + ProtectionWarrior:SetScript("OnMouseUp", display_stuff) + + GeneralStuff = CreateFrame("Button", "TrainingFrame_GeneralStuff", TrainingFrame, nil) + GeneralStuff:SetSize(234, 25.5) + GeneralStuff:SetPoint("TOPRIGHT", -68.5, -770,5) + GeneralStuff:EnableMouse(true) + texture_GeneralStuff = GeneralStuff:CreateTexture("GeneralStuff") + texture_GeneralStuff:SetAllPoints(GeneralStuff) + texture_GeneralStuff:SetTexture("Interface\\AddOns\\AwAddons\\Textures\\progress\\button_h") + texture_GeneralStuff:SetVertexColor(.4, .4, .4, .8) + GeneralStuff:SetNormalTexture(texture_GeneralStuff) + GeneralStuff:SetHighlightTexture("Interface\\AddOns\\AwAddons\\Textures\\progress\\button_h2") + font_GeneralStuff = GeneralStuff:CreateFontString("GeneralStuff_Font") + font_GeneralStuff:SetFont("Fonts\\FRIZQT__.TTF", 11) + font_GeneralStuff:SetShadowOffset(1, -1) + GeneralStuff:SetFontString(font_GeneralStuff) + GeneralStuff:SetText("General") + GeneralStuff:SetScript("OnMouseUp", display_stuff) + + spec_displaying = GeneralStuff + + + -- ####################################### Frame Handling ############################## + + function display_frame_CA() + + if frame_displaying == "BASIC" then + TrainingFrame:SetBackdrop({ + bgFile = "Interface\\AddOns\\AwAddons\\Textures\\progress\\progress",}) + -- shows + DisplaySpellsButton:Show() + DisplayTalentsButton:Show() + TrainingFrame.Text_Ability:Hide() + + ProgressionBlueBookBorder:Hide() + ProgressionPurpleBookBorder:Hide() + TrainingFrame_model:Hide() + TrainingFrame_model2:Hide() + + --hides + for i,v in ipairs(all_spell_slots) do + v[1]:Hide() + end + scrollframe:Hide() + scrollbar:Hide() + top_left_bg:Hide() + top_right_bg:Hide() + bottom_left_bg:Hide() + bottom_right_bg:Hide() + current_talenList = {} + current_known_talents_list = {} + + elseif frame_displaying == "SPELLS" then + + --shows + for i,v in ipairs(all_spell_slots) do + v[1]:Show() + end + + --hides + DisplaySpellsButton:Hide() + DisplayTalentsButton:Hide() + scrollframe:Hide() + scrollbar:Hide() + + elseif frame_displaying == "TALENTS" then + + --shows + scrollframe:Show() + scrollbar:Show() + + --hides + DisplaySpellsButton:Hide() + DisplayTalentsButton:Hide() + for i,v in ipairs(all_spell_slots) do + v[1]:Hide() + end + end + + end + + function display_next_frame_CA(self) + PlaySound("TalentScreenClose") + + if self == DisplaySpellsButton then + + frame_displaying = "SPELLS" + TrainingFrame:SetBackdrop({ + bgFile = "Interface\\AddOns\\AwAddons\\Textures\\progress\\progress_inside_blue",}) + ProgressionBlueBookBorder:Show() + TrainingFrame.Text_Ability:Show() + --TrainingFrameBorder:SetFrameStrata("FULLSCREEN") + + local all_buttons = {BalanceDruid, FeralDruid, RestorationDruid, BeastMasteryHunter, MarksmanshipHunter, SurvivalHunter, + ArcaneMage, FireMage, FrostMage, HolyPaladin, ProtectionPaladin, RetributionPaladin, + DisciplinePriest, HolyPriest, ShadowPriest, AssassinationRogue, CombatRogue, SubtletyRogue, + ElementalShaman, EnhancementShaman, RestorationShaman, AfflictionWarlock, DemonologyWarlock, DestructionWarlock, + ArmsWarrior, FuryWarrior, ProtectionWarrior, GeneralStuff} + + local all_pass_varis = {{"DRUID", "BALANCE"}, {"DRUID", "FERAL"}, {"DRUID", "RESTORATION"}, + {"HUNTER", "BEASTMASTERY"},{"HUNTER", "MARKSMANSHIP"}, {"HUNTER", "SURVIVAL"}, + {"MAGE", "ARCANE"}, {"MAGE", "FIRE"}, {"MAGE", "FROST"}, + {"PALADIN", "HOLY"}, {"PALADIN", "PROTECTION"}, {"PALADIN", "RETRIBUTION"}, + {"PRIEST", "DISCIPLINE"}, {"PRIEST", "HOLY"}, {"PRIEST", "SHADOW"}, + {"ROGUE", "ASSASSINATION"}, {"ROGUE", "COMBAT"}, {"ROGUE", "SUBTLETY"}, + {"SHAMAN", "ELEMENTAL"}, {"SHAMAN", "ENHANCEMENT"}, {"SHAMAN", "RESTORATION"}, + {"WARLOCK", "AFFLICTION"}, {"WARLOCK", "DEMONOLOGY"}, {"WARLOCK", "DESTRUCTION"}, + {"WARRIOR", "ARMS"}, {"WARRIOR", "FURY"}, {"WARRIOR", "PROTECTION"}, + {"GENERAL", "GENERAL"}} + + for i,v in ipairs(all_buttons) do + if spec_displaying == v then + AIO.Handle("sideBar", "SendAmountOfSpells", all_pass_varis[i][1], all_pass_varis[i][2]) + sideBar.CurrentSpellSpec = {all_pass_varis[i][1], all_pass_varis[i][2]} + end + end + + end + + display_frame_CA() + + end + + function display_talents(self) + PlaySound("TalentScreenClose") + + if spec_displaying ~= GeneralStuff then + frame_displaying = "TALENTS" + TrainingFrame:SetBackdrop({ + bgFile = "Interface\\AddOns\\AwAddons\\Textures\\progress\\progress_inside_purple",}) + ProgressionPurpleBookBorder:Show() + TrainingFrame.Text_Ability:Show() + --TrainingFrameBorder:SetFrameStrata("FULLSCREEN") + + local all_buttons = {BalanceDruid, FeralDruid, RestorationDruid, BeastMasteryHunter, MarksmanshipHunter, SurvivalHunter, + ArcaneMage, FireMage, FrostMage, HolyPaladin, ProtectionPaladin, RetributionPaladin, + DisciplinePriest, HolyPriest, ShadowPriest, AssassinationRogue, CombatRogue, SubtletyRogue, + ElementalShaman, EnhancementShaman, RestorationShaman, AfflictionWarlock, DemonologyWarlock, DestructionWarlock, + ArmsWarrior, FuryWarrior, ProtectionWarrior, GeneralStuff} + + local all_pass_varis = {"DRUIDBALANCE", "DRUIDFERAL", "DRUIDRESTORATION", + "HUNTERBEASTMASTERY", "HUNTERMARKSMANSHIP", "HUNTERSURVIVAL", + "MAGEARCANE", "MAGEFIRE", "MAGEFROST", + "PALADINHOLY", "PALADINPROTECTION", "PALADINRETRIBUTION", + "PRIESTDISCIPLINE", "PRIESTHOLY", "PRIESTSHADOW", + "ROGUEASSASSINATION", "ROGUECOMBAT", "ROGUESUBTLETY", + "SHAMANELEMENTAL", "SHAMANENHANCEMENT", "SHAMANRESTORATION", + "WARLOCKAFFLICTION", "WARLOCK", "DEMONOLOGY", "WARLOCKDESTRUCTION", + "WARRIORARMS", "WARRIORFURY", "WARRIORPROTECTION"} + local ClassSpec = nil + for i,v in ipairs(all_buttons) do + + if v == spec_displaying then + ClassSpec = all_pass_varis[i] + + break + end + end + AIO.Handle("sideBar", "GetAllBGs", ClassSpec) + sideBar.CurrentTalentSpec = ClassSpec + display_frame_CA() + end + + end + + current_talentList = {} + current_known_talents_list = {} + + function MyHandlers.SetBackgroundImages(player, ClassSpec, bgList, talentList, known_talents_list, tabIndex) + + local all_pass_varis = {"DRUIDBALANCE", "DRUIDFERAL", "DRUIDRESTORATION", + "HUNTERBEASTMASTERY", "HUNTERMARKSMANSHIP", "HUNTERSURVIVAL", + "MAGEARCANE", "MAGEFIRE", "MAGEFROST", + "PALADINHOLY", "PALADINPROTECTION", "PALADINRETRIBUTION", + "PRIESTDISCIPLINE", "PRIESTHOLY", "PRIESTSHADOW", + "ROGUEASSASSINATION", "ROGUECOMBAT", "ROGUESUBTLETY", + "SHAMANELEMENTAL", "SHAMANENHANCEMENT", "SHAMANRESTORATION", + "WARLOCKAFFLICTION", "WARLOCK", "DEMONOLOGY", "WARLOCKDESTRUCTION", + "WARRIORARMS", "WARRIORFURY", "WARRIORPROTECTION"} + current_talentList = talentList + current_known_talents_list = known_talents_list + + for i,v in ipairs(all_pass_varis) do + + if v == ClassSpec then + + top_left_bg_t:SetTexture(bgList[i][1]) + top_left_bg:Show() + + top_right_bg_t:SetTexture(bgList[i][2]) + top_right_bg:Show() + + bottom_left_bg_t:SetTexture(bgList[i][3]) + bottom_left_bg:Show() + + bottom_right_bg_t:SetTexture(bgList[i][4]) + bottom_right_bg:Show() + end + end + + for i,v in ipairs(button_on_off_state) do + button_on_off_state[i] = false + end + on_talent = 1 + talent_index = 1 + for i,v in ipairs(talentList) do + local player_knows_a_talent = false + local player_talent_known = 0 + local learn_text = "|cff6b625bLearn|r" + local learn_tooltip = "Requires: Level "..v[5] + local learn_texture = {.3, .3, .3} + local attach_it = false + local number_of_ranks = v[1] + local tabIndexee = tabIndex + + local spellIds = v[2] + local AE_cost = v[3] + local TE_cost = v[4] + local requiredLevel = v[5] + local column = v[6] + local talent_ID = v[7] + local BG_New = "Interface\\AddOns\\AwAddons\\Textures\\progress\\talent_bg" + local BG_Color = {0.46,0.36,0.34,1} + + local get_spell_link = GetSpellLink(spellIds[1]) + local name,_, icon, _,_,_,_ = GetSpellInfo(spellIds[1]) + + if known_talents_list[i] ~= false then + player_knows_a_talent = true + player_talent_known = known_talents_list[i] + end + + if requiredLevel <= UnitLevel("player") then + + learn_tooltip = "Cost: "..AE_cost.." AE "..TE_cost.." TE" + + if player_knows_a_talent == true then + + get_spell_link = "|cffFFFFFF|Hspell:"..spellIds[player_talent_known].."|h[Talent]|h|r" + BG_Color = {1,1,1,1} + if player_talent_known == number_of_ranks then + learn_tooltip = "Maxed Out" + learn_texture = {1, 1, 0} + learn_text = "|cff6b625bMax|r" + BG_New = "Interface\\AddOns\\AwAddons\\Textures\\progress\\talent_rank_max" + else + attach_it = {spellIds[player_talent_known + 1],AE_cost,TE_cost,spellIds,number_of_ranks} + learn_texture = {0, .5, 0} + learn_text = "|cffE1AB18Upgrade|r" + BG_New = "Interface\\AddOns\\AwAddons\\Textures\\progress\\talent_rank" + end + else + + learn_text="Learn" -- used for talent texts + + attach_it = {spellIds[1],AE_cost,TE_cost,spellIds,number_of_ranks} + + end + + end + + local button_using = (((requiredLevel - 10) / 5) * 4) + column + all_talent_slot_buttons[button_using]:SetBackdrop({ + bgFile = icon + }) + all_talent_slot_buttons[button_using]:SetBackdropColor(unpack(BG_Color)) + all_talent_slots[button_using]:SetBackdrop({ + bgFile = BG_New, + insets = { + left = -11, + right = -11, + top = -11, + bottom = -11} + }) + all_talent_slot_buttons[button_using].HyperLink = get_spell_link + + local talent_indexee = talent_index + local function talent_icon_tooltip_Enter(self, motion) + GameTooltip:SetOwner(self, "ANCHOR_RIGHT") + if self.HyperLink ~= nil then + GameTooltip:SetHyperlink(self.HyperLink) + else + GameTooltip:SetTalent(tabIndexee, talent_indexee, false, false, nil) + end + GameTooltip:Show() + --for unlearn spell + --[[local red, green, blue, alpha = self:GetBackdropColor() + if (red) and (red > 0.98) then + BaseFrameFadeIn(self.UnlearnTex) + GameTooltip:AppendText("\n|cffFF0000Click on the icon to use |cff00FF00[Scroll of unlearning]|r") + end]]-- + -- end + -- for ranks with learned talents + if self.HyperLink ~= nil then + GameTooltip:AppendText("\nRank "..all_talent_FrameNumber[button_using]:GetText().."/"..number_of_ranks.."") + end + end + all_talent_slot_buttons[button_using]:SetScript("OnEnter", talent_icon_tooltip_Enter) + local function talent_icon_tooltip_OnLeave(self) + --for unlearn talent + --[[if (self.UnlearnTex:IsVisible()) then + BaseFrameFadeOut(self.UnlearnTex) + end]]-- + -- end + GameTooltip:Hide() + end + all_talent_slot_buttons[button_using]:SetScript("OnLeave", talent_icon_tooltip_OnLeave) + + all_learn_talent_buttons_t[button_using]:SetTexture(learn_texture[1], learn_texture[2], learn_texture[3], 0) + + local function learn_button_tooltip_Enter(self, motion) + GameTooltip:SetOwner(self, "ANCHOR_RIGHT") + GameTooltip:SetText(learn_tooltip) + GameTooltip:Show() + end + all_learn_talent_buttons[button_using]:SetScript("OnEnter", learn_button_tooltip_Enter) + local function learn_button_tooltip_Leave(self, motion) + GameTooltip:Hide() + end + all_learn_talent_buttons[button_using]:SetScript("OnLeave", learn_button_tooltip_Leave) + + all_attached_talent[button_using] = attach_it + + all_learn_talent_buttons[button_using]:SetText(learn_text) + + all_talent_FrameNumber[button_using]:SetText(player_talent_known) + + button_on_off_state[button_using] = true + on_talent = on_talent + 1 + talent_index = talent_index + 1 + + end + for i,v in ipairs(button_on_off_state) do + + if v == true then + all_talent_slots[i]:Show() + + all_talent_slot_buttons[i]:Show() + + all_learn_talent_buttons[i]:Show() + + all_talent_FrameNumber[i]:Show() + else + all_talent_slots[i]:Hide() + + all_talent_slot_buttons[i]:Hide() + + all_learn_talent_buttons[i]:Hide() + + all_talent_FrameNumber[i]:Hide() + end + end + + content:Show() + end + + function upgrade_talent(self) + PlaySound("igMainMenuOptionCheckBoxOn") + local talent_attached = false + local indexAt + + for i,v in ipairs(all_learn_talent_buttons) do + if v == self then + talent_attached = all_attached_talent[i] + all_attached_talent[i] = nil + indexAt = i + break + end + end + + + + if talent_attached ~= false then + AIO.Handle("sideBar","LearnThisTalent",talent_attached,indexAt,sideBar.CurrentTalentSpec) + end + + end + + function MyHandlers.TalentGoBack(player, attached_talent, indexAt) + all_attached_talent[indexAt] = attached_talent + end + + function MyHandlers.UpdateTalent(player, attached_talent, indexAt) + + local AE_cost = attached_talent[2] + local TE_cost = attached_talent[3] + local all_spellIds = attached_talent[4] + local talents_ranks = attached_talent[5] + local previous_spellId = attached_talent[1] + + local texture_changed = {0, .5, 0} + local text_changed = "|cffE1AB18Upgrade|r" + local learn_tooltip = nil + local attached_talent = nil + local BG_File = "Interface\\AddOns\\AwAddons\\Textures\\progress\\talent_bg" + local FN = 1 + local BG_Color_U = {0.46,0.36,0.34,1} + + + for i,v in ipairs(all_spellIds) do + if v == previous_spellId then + FN = i + if i == talents_ranks then + texture_changed = {1, 1, 0} + learn_tooltip = "Maxed Out" -- used for talent texts + text_changed = "|cff6b625bMax|r" + all_talent_slot_buttons[indexAt].HyperLink = "|cffFFFFFF|Hspell:"..all_spellIds[i].."|h[Talent]|h|r" + BG_File = "Interface\\AddOns\\AwAddons\\Textures\\progress\\talent_rank_max" + BG_Color_U = {1,1,1,1} + else + all_talent_slot_buttons[indexAt].HyperLink = "|cffFFFFFF|Hspell:"..all_spellIds[i].."|h[Talent]|h|r" + attached_talent = {all_spellIds[i + 1],AE_cost, TE_cost,all_spellIds,talents_ranks} + BG_File = "Interface\\AddOns\\AwAddons\\Textures\\progress\\talent_rank" + BG_Color_U = {1,1,1,1} + end + break + end + end + + if learn_tooltip ~= nil then + local function learn_button_tooltip_Enter(self, motion) + GameTooltip:SetOwner(self, "ANCHOR_RIGHT") + GameTooltip:SetText(learn_tooltip) + GameTooltip:Show() + end + all_learn_talent_buttons[indexAt]:SetScript("OnEnter", learn_button_tooltip_Enter) + end + + all_attached_talent[indexAt] = attached_talent + + + all_learn_talent_buttons[indexAt]:SetText(text_changed) + + all_talent_FrameNumber[indexAt]:SetText(FN) + + all_talent_slots[indexAt]:SetBackdrop({ + bgFile = BG_File, + insets = { + left = -11, + right = -11, + top = -11, + bottom = -11} + }) + all_talent_slot_buttons[indexAt]:SetBackdropColor(unpack(BG_Color_U)) + + --all_learn_talent_buttons_t[indexAt]:SetTexture(texture_changed[1], texture_changed[2], texture_changed[3], 1) + + end + --begin of the client talent unlearn part-- + function unlearn_talent(self) + PlaySound("igMainMenuOptionCheckBoxOn") + local talent_attached = false + local indexAt + + for i,v in ipairs(all_talent_slot_buttons) do + if v == self then + spellName, spellRank, spellID = GameTooltip:GetSpell() + talent_attached = spellID + indexAt = i + break + end + end + + if talent_attached ~= false then + AIO.Handle("sideBar","UnLearnThisTalent",talent_attached,indexAt,sideBar.CurrentTalentSpec) + end + + end + + function MyHandlers.UnLearnTalent(player, attached_talent, indexAt) + + local AE_cost = attached_talent[2] + local TE_cost = attached_talent[3] + local all_spellIds = attached_talent[4] + local spellId = attached_talent[1] + + local texture_changed = {0, .5, 0} + local text_changed = "|cffFFFFFFLearn|r" + local learn_tooltip = nil + local BG_File = "Interface\\AddOns\\AwAddons\\Textures\\progress\\talent_bg" + local FN = 0 + local BG_Color_U = {0.46,0.36,0.34,1} + + all_talent_slot_buttons[indexAt].HyperLink = "|cffFFFFFF|Hspell:"..all_spellIds[1].."|h[Talent]|h|r" + + if learn_tooltip ~= nil then + local function learn_button_tooltip_Enter(self, motion) + GameTooltip:SetOwner(self, "ANCHOR_RIGHT") + GameTooltip:SetText(learn_tooltip) + GameTooltip:Show() + end + all_learn_talent_buttons[indexAt]:SetScript("OnEnter", learn_button_tooltip_Enter) + end + + all_attached_talent[indexAt] = attached_talent + + + all_learn_talent_buttons[indexAt]:SetText(text_changed) + + all_talent_FrameNumber[indexAt]:SetText(FN) + + all_talent_slots[indexAt]:SetBackdrop({ + bgFile = BG_File, + insets = { + left = -11, + right = -11, + top = -11, + bottom = -11} + }) + all_talent_slot_buttons[indexAt]:SetBackdropColor(unpack(BG_Color_U)) + + --all_learn_talent_buttons_t[indexAt]:SetTexture(texture_changed[1], texture_changed[2], texture_changed[3], 1) + + end + -- end of the client talent unlearn part-- + function MyHandlers.GetSpellCount(player, spellCount, spellList) + + local start_ticker = 1 + + repeat + local spellId = spellList[start_ticker][1] + local spellCostAE = spellList[start_ticker][2] + local spellCostTE = spellList[start_ticker][3] + local RequiredLevel = spellList[start_ticker][4] + local name, rank, icon, _,_,_,_ = GetSpellInfo(spellId) + local player_knows = IsSpellLearned(spellId) + local learn_tooltip = "Cost: "..spellCostAE.." AE "..spellCostTE.." TE" + local learn_texture = {.9, .2, .1} + local learn_text = "Learn" -- used for spell texts + local attach_it = {spellId, spellCostAE, spellCostTE} + if player_knows == true then + learn_tooltip = "Already Known" + learn_text = "|cff6b625bLearn|r" + learn_texture = {.3, .3, .3} + attach_it = nil + elseif RequiredLevel > UnitLevel("player") then + learn_tooltip = "Requires: Level "..RequiredLevel + learn_text = "|cff6b625bLearn|r" + learn_texture = {.3, .3, .3} + attach_it = nil + end + + -- spell_desc = GetSpellDescription(spellId) -- Doesn't work? Added in cata... lame + + all_spell_slot_buttons[start_ticker]:SetBackdrop({ + bgFile = icon + }) + local get_spell_link = GetSpellLink(spellId) + local function spell_icon_tooltip_Enter(self, motion) + GameTooltip:SetOwner(self, "ANCHOR_RIGHT") + GameTooltip:SetHyperlink(get_spell_link) + GameTooltip:Show() + --for unlearn spell + if (CanBeUnlearned()) then + GameTooltip:AppendText("\n|cffFF0000Click on the icon to use |cff00FF00[Scroll of unlearning]|r") + BaseFrameFadeIn(_G[self:GetName().."_UnlearnTex"]) + all_spell_slot_buttons_UnLearnEffect:SetPoint("CENTER",self,"CENTER",0,0) + BaseFrameFadeIn(all_spell_slot_buttons_UnLearnEffect) + end + end + all_spell_slot_buttons[start_ticker]:SetScript("OnEnter", spell_icon_tooltip_Enter) + local function spell_icon_tooltip_OnLeave(self) + GameTooltip:Hide() + -- for unlearn spell + if (_G[self:GetName().."_UnlearnTex"]:IsVisible()) then + BaseFrameFadeOut(_G[self:GetName().."_UnlearnTex"]) + BaseFrameFadeOut(all_spell_slot_buttons_UnLearnEffect) + end + end + all_spell_slot_buttons[start_ticker]:SetScript("OnLeave", spell_icon_tooltip_OnLeave) + + --all_learn_spell_buttons_t[start_ticker]:SetTexture(learn_texture[1], learn_texture[2], learn_texture[3], 1) + + local function learn_button_tooltip_Enter(self, motion) + GameTooltip:SetOwner(self, "ANCHOR_RIGHT") + GameTooltip:SetText(learn_tooltip) + GameTooltip:Show() + end + all_learn_spell_buttons[start_ticker]:SetScript("OnEnter", learn_button_tooltip_Enter) + local function learn_button_tooltip_Leave(self, motion) + GameTooltip:Hide() + end + all_learn_spell_buttons[start_ticker]:SetScript("OnLeave", learn_button_tooltip_Leave) + + all_attached_spells[start_ticker] = attach_it + + all_learn_spell_buttons[start_ticker]:SetText(learn_text) + + start_ticker = start_ticker + 1 + + until start_ticker == spellCount + 1 + + repeat + all_spell_slot_buttons[start_ticker]:SetBackdrop({ + bgFile = "Interface\\AddOns\\AwAddons\\Textures\\progress\\buttonbackgroundold" + }) + + + all_spell_slot_buttons[start_ticker]:SetScript("OnEnter", nil) + + + all_spell_slot_buttons[start_ticker]:SetScript("OnLeave", nil) + + all_learn_spell_buttons[start_ticker]:SetScript("OnEnter", nil) + + all_learn_spell_buttons[start_ticker]:SetScript("OnLeave", nil) + + --all_learn_spell_buttons_t[start_ticker]:SetTexture(.3, .3, .3, 1) + all_learn_spell_buttons[start_ticker]:SetText("|cff6b625bEmpty|r") + all_attached_spells[start_ticker] = nil + start_ticker = start_ticker + 1 + until start_ticker == 36 + 1 + + end + + function learn_spell(self) + PlaySound("igMainMenuOptionCheckBoxOn") + local got_spell = nil + local got_index + --check for preventing hacks + local class, spec = unpack(sideBar.CurrentSpellSpec) + + for i,v in ipairs(all_learn_spell_buttons) do + if self == v then + got_spell = all_attached_spells[i] + all_attached_spells[i] = nil + got_index = i + end + end + + if got_spell ~= nil then + AIO.Handle("sideBar", "LearnThisSpell", got_spell, got_index, class,spec) + end + end + + function MyHandlers.ChangeLearnButton(player, i) + + local function learn_button_tooltip_Enter(self, motion) + GameTooltip:SetOwner(self, "ANCHOR_RIGHT") + GameTooltip:SetText("Already Known") + GameTooltip:Show() + end + all_learn_spell_buttons[i]:SetText("|cff6b625bLearn|r") + all_learn_spell_buttons[i]:SetScript("OnEnter", learn_button_tooltip_Enter) + + --all_learn_spell_buttons_t[i]:SetTexture(.3, .3, .3, 1) + all_attached_spells[i] = nil + end + + --unlearn spell part-- + function unlearn_spell(self) + if (CanBeUnlearned()) then + PlaySound("igMainMenuOptionCheckBoxOn") + local got_spell = nil + local got_index + --check for preventing hacks + local class, spec = unpack(sideBar.CurrentSpellSpec) + + for i,v in ipairs(all_spell_slot_buttons) do + if self == v then + spellName, spellRank, spellID = GameTooltip:GetSpell() + got_spell = spellID + got_index = i + end + end + + if got_spell ~= nil then + AIO.Handle("sideBar", "UnLearnThisSpell", got_spell, got_index, class,spec) + end + end + end + + function MyHandlers.ChangeLearnButtonBack(player, i, spellid,cost_one,cost_two) + local AE_cost = cost_one + local TE_cost = cost_two + local spell = spellid + local function learn_button_tooltip_Enter(self, motion) + GameTooltip:SetOwner(self, "ANCHOR_RIGHT") + GameTooltip:SetText("Cost: "..AE_cost.." AE "..TE_cost.." TE") + GameTooltip:Show() + end + BaseFrameFadeOut(_G[all_spell_slot_buttons[i]:GetName().."_UnlearnTex"]) + BaseFrameFadeOut(all_spell_slot_buttons_UnLearnEffect) + all_learn_spell_buttons[i]:SetText("|cffFFFFFFLearn|r") + all_learn_spell_buttons[i]:SetScript("OnEnter", learn_button_tooltip_Enter) + all_attached_spells[i] = {spell, cost_one, cost_two} + end + --end of unlearn spell part-- + + -- ####################################### Basic Frame ############################## + local ProgressionPurpleCovertexture = TrainingFrame:CreateTexture() + ProgressionPurpleCovertexture:SetAllPoints() + ProgressionPurpleCovertexture:SetTexture("Interface\\AddOns\\AwAddons\\Textures\\progress\\progress_cover_purple") + ProgressionPurpleCovertexture:SetSize(TrainingFrame:GetSize()) + ProgressionPurpleCovertexture:Hide() + + local ProgressionBlueCovertexture = TrainingFrame:CreateTexture() + ProgressionBlueCovertexture:SetAllPoints() + ProgressionBlueCovertexture:SetTexture("Interface\\AddOns\\AwAddons\\Textures\\progress\\progress_cover_Blue") + ProgressionBlueCovertexture:SetSize(TrainingFrame:GetSize()) + ProgressionBlueCovertexture:Hide() + + CreateFrame("Frame", "TrainingFrameBorder", TrainingFrame, nil) + --TrainingFrameBorder:SetFrameStrata("DIALOG") + --TrainingFrameBorder:SetBackdrop({ + --bgFile = "Interface\\AddOns\\AwAddons\\Textures\\progress\\progress_frame",}) + TrainingFrameBorder:SetSize(TrainingFrame:GetSize()) + TrainingFrameBorder:SetPoint("CENTER",0,0) + TrainingFrameBorder:SetFrameStrata("FULLSCREEN") -- a bit tricky, but I lost huge part of my work in photoshop so I had to do that ._. + + TrainingFrame.Text_Ability = TrainingFrameBorder:CreateFontString() +TrainingFrame.Text_Ability:SetFontObject(GameFontNormal) +TrainingFrame.Text_Ability:SetPoint("BOTTOM", TrainingFrame, 75, 67); +TrainingFrame.Text_Ability:SetFont("Fonts\\FRIZQT__.TTF", 12) +local itemCount = GetItemCount(383080) or 0 +local itemCount2 = GetItemCount(383080) or 0 +TrainingFrame.Text_Ability:SetText("|cffE1AB18AE: |cffFFFFFF"..itemCount.." |cffE1AB18TE: |cffFFFFFF"..itemCount2) +TrainingFrame.Text_Ability:Hide() + + + local ProgressionBlueBookBorder = TrainingFrameBorder:CreateTexture("ProgressionBlueBookBorder", "BACKGROUND") + ProgressionBlueBookBorder:SetAllPoints() + ProgressionBlueBookBorder:SetTexture("Interface\\AddOns\\AwAddons\\Textures\\progress\\progress_add_blue") + ProgressionBlueBookBorder:SetSize(TrainingFrame:GetSize()) + ProgressionBlueBookBorder:SetVertexColor(1,1, 1, .7) + ProgressionBlueBookBorder:Hide() + + local ProgressionPurpleBookBorder = TrainingFrameBorder:CreateTexture("ProgressionPurpleBookBorder", "BACKGROUND") + ProgressionPurpleBookBorder:SetAllPoints() + ProgressionPurpleBookBorder:SetTexture("Interface\\AddOns\\AwAddons\\Textures\\progress\\progress_add_Purple") + ProgressionPurpleBookBorder:SetSize(TrainingFrame:GetSize()) + ProgressionPurpleBookBorder:SetVertexColor(1,1, 1, 1) + ProgressionPurpleBookBorder:Hide() + + local ProgressionAdditionalBorder = TrainingFrameBorder:CreateTexture("ProgressionAdditionalBorder", "DIALOG") + ProgressionAdditionalBorder:SetAllPoints() + ProgressionAdditionalBorder:SetTexture("Interface\\AddOns\\AwAddons\\Textures\\progress\\progress_frame") + ProgressionAdditionalBorder:SetSize(TrainingFrame:GetSize()) + ProgressionAdditionalBorder:SetVertexColor(1,1, 1, 1) + + --ProgressionFrametexture:ClearAllPoints() + + DisplaySpellsButton = CreateFrame("Button", "TrainingFrame_DisplaySpellsButton", TrainingFrame, nil) + DisplaySpellsButton:SetSize(200, 250) + DisplaySpellsButton:SetPoint("CENTER", -250, -20) + DisplaySpellsButton:EnableMouse(true) + texture_DisplaySpellsButton = DisplaySpellsButton:CreateTexture("DisplaySpellsButton") + texture_DisplaySpellsButton:SetAllPoints(DisplaySpellsButton) + texture_DisplaySpellsButton:SetTexture(.9, .2, .2, 0) + texture_DisplaySpellsButton_p = DisplaySpellsButton:CreateTexture("DisplaySpellsButton_p") + texture_DisplaySpellsButton_p:SetAllPoints(DisplaySpellsButton) + texture_DisplaySpellsButton_p:SetTexture(.9, .2, .2, 0) + DisplaySpellsButton:SetNormalTexture(texture_DisplaySpellsButton) + DisplaySpellsButton:SetPushedTexture(texture_DisplaySpellsButton_p) + font_DisplaySpellsButton = DisplaySpellsButton:CreateFontString("DisplaySpellsButton_Font") + font_DisplaySpellsButton:SetFont("Fonts\\MORPHEUS.TTF", 30, "OUTLINE") + font_DisplaySpellsButton:SetShadowOffset(1, -1) + DisplaySpellsButton:SetFontString(font_DisplaySpellsButton) + --DisplaySpellsButton:SetText("Show|nSpells") + DisplaySpellsButton:SetScript("OnMouseUp", display_next_frame_CA) + DisplaySpellsButton:SetScript("OnEnter", function(self) + BaseFrameFadeIn(ProgressionBlueCovertexture) + BaseFrameFadeIn(TrainingFrame_model2) + BaseFrameFadeOut(TrainingFrame_SelectedTitle_Stars1) + TrainingFrame_SelectedTitle_Stars1_glow:Hide() + BaseFrameFadeOut(TrainingFrame_SelectedTitle_Stars2) + TrainingFrame_SelectedTitle_Stars2_glow:Hide() + BaseFrameFadeOut(TrainingFrame_SelectedTitle_Glow) + BaseFrameFadeIn(font_TrainingFrame_SelectedTitle_Spells) + --BaseFrameFadeIn(TrainingFrame_SelectedTitle_Spells) + end) + DisplaySpellsButton:SetScript("OnLeave", function() + BaseFrameFadeOut(ProgressionBlueCovertexture) + BaseFrameFadeOut(TrainingFrame_model2) + BaseFrameFadeIn(TrainingFrame_SelectedTitle_Stars1) + TrainingFrame_SelectedTitle_Stars1_glow:Show() + BaseFrameFadeIn(TrainingFrame_SelectedTitle_Stars2) + TrainingFrame_SelectedTitle_Stars2_glow:Show() + BaseFrameFadeIn(TrainingFrame_SelectedTitle_Glow) + BaseFrameFadeOut(font_TrainingFrame_SelectedTitle_Spells) + --BaseFrameFadeOut(TrainingFrame_SelectedTitle_Spells) + end) + + + DisplayTalentsButton = CreateFrame("Button", "TrainingFrame_DisplayTalentsButton", TrainingFrame, nil) + DisplayTalentsButton:SetSize(200, 250) + DisplayTalentsButton:SetPoint("CENTER", 22, -20) + DisplayTalentsButton:EnableMouse(true) + texture_DisplayTalentsButton = DisplayTalentsButton:CreateTexture("DisplayTalentsButton") + texture_DisplayTalentsButton:SetAllPoints(DisplayTalentsButton) + texture_DisplayTalentsButton:SetTexture(.9, .2, .2, 0) + texture_DisplayTalentsButton_p = DisplayTalentsButton:CreateTexture("DisplayTalentsButton_p") + texture_DisplayTalentsButton_p:SetAllPoints(DisplayTalentsButton) + texture_DisplayTalentsButton_p:SetTexture(.9, .2, .2, 0) + DisplayTalentsButton:SetNormalTexture(texture_DisplayTalentsButton) + DisplayTalentsButton:SetPushedTexture(texture_DisplayTalentsButton_p) + font_DisplayTalentsButton = DisplayTalentsButton:CreateFontString("DisplayTalentsButton_Font") + font_DisplayTalentsButton:SetFont("Fonts\\MORPHEUS.TTF", 30, "OUTLINE") + font_DisplayTalentsButton:SetShadowOffset(1, -1) + DisplayTalentsButton:SetFontString(font_DisplayTalentsButton) + --DisplayTalentsButton:SetText("Show\nTalents") + DisplayTalentsButton:SetScript("OnMouseUp", display_talents) + DisplayTalentsButton:SetScript("OnEnter", function(self) + BaseFrameFadeIn(ProgressionPurpleCovertexture) + BaseFrameFadeIn(TrainingFrame_model) + BaseFrameFadeOut(TrainingFrame_SelectedTitle_Stars1) + TrainingFrame_SelectedTitle_Stars1_glow:Hide() + BaseFrameFadeOut(TrainingFrame_SelectedTitle_Stars2) + TrainingFrame_SelectedTitle_Stars2_glow:Hide() + BaseFrameFadeOut(TrainingFrame_SelectedTitle_Glow) + BaseFrameFadeIn(font_TrainingFrame_SelectedTitle_Talents) + --BaseFrameFadeIn(TrainingFrame_SelectedTitle_Talents) + end) + DisplayTalentsButton:SetScript("OnLeave", function() + BaseFrameFadeOut(ProgressionPurpleCovertexture) + BaseFrameFadeOut(TrainingFrame_model) + BaseFrameFadeIn(TrainingFrame_SelectedTitle_Stars1) + TrainingFrame_SelectedTitle_Stars1_glow:Show() + BaseFrameFadeIn(TrainingFrame_SelectedTitle_Stars2) + TrainingFrame_SelectedTitle_Stars2_glow:Show() + BaseFrameFadeIn(TrainingFrame_SelectedTitle_Glow) + BaseFrameFadeOut(font_TrainingFrame_SelectedTitle_Talents) + --BaseFrameFadeOut(TrainingFrame_SelectedTitle_Talents) + end) + DisplaySpellsButton:Disable() +DisplayTalentsButton:Disable() + +TrainingFrame:SetScript("OnUpdate" , function() + local itemCount_t = GetItemCount(383080) or 0 + local itemCount2_t = GetItemCount(383081) or 0 + TrainingFrame.Text_Ability:SetText("|cffFFFFFF"..itemCount_t.." |cffE1AB18|TInterface\\Icons\\inv_custom_abilityessence.blp:15:15:0:0|t|r |cffFFFFFF"..itemCount2_t.." |cffE1AB18|TInterface\\Icons\\inv_custom_talentessence.blp:15:15:0:0|t |cffFFFFFF") + + if not(DisplaySpellsButton:IsVisible()) then + TrainingFrame_SelectedTitle_Stars1:Hide() + TrainingFrame_SelectedTitle_Stars1_glow:Hide() + TrainingFrame_SelectedTitle_Stars2:Hide() + TrainingFrame_SelectedTitle_Stars2_glow:Hide() + TrainingFrame_SelectedTitle_Glow:Hide() + end + end) + +TrainingFrame:SetScript("OnHide" , function() + display_stuff(GeneralStuff) + end) + + + + -- ####################################### Spells Frame ############################## + + Spell_slot1 = CreateFrame("Frame", "TrainingFrame_Spell_slot1", TrainingFrame, nil) + Spell_slot1Button = CreateFrame("Button", "TrainingFrame_Spell_slot1Button", Spell_slot1, nil) + Spell_slot1ButtonL = CreateFrame("Button", "TrainingFrame_Spell_slot1ButtonL", Spell_slot1, nil) + Spell_slot1ButtonLT = Spell_slot1ButtonL:CreateTexture("Spell_slot1ButtonLT") + Spell_slot1ButtonF = Spell_slot1ButtonL:CreateFontString("Spell_slot1ButtonF") + Spell_slot1_AttachedSpell = nil + + Spell_slot2 = CreateFrame("Frame", "TrainingFrame_Spell_slot2", TrainingFrame, nil) + Spell_slot2Button = CreateFrame("Button", "TrainingFrame_Spell_slot2Button", Spell_slot2, nil) + Spell_slot2ButtonL = CreateFrame("Button", "TrainingFrame_Spell_slot2ButtonL", Spell_slot2, nil) + Spell_slot2ButtonLT = Spell_slot2ButtonL:CreateTexture("Spell_slot2ButtonLT") + Spell_slot2ButtonF = Spell_slot2ButtonL:CreateFontString("Spell_slot2ButtonF") + Spell_slot2_AttachedSpell = nil + + Spell_slot3 = CreateFrame("Frame", "TrainingFrame_Spell_slot3", TrainingFrame, nil) + Spell_slot3Button = CreateFrame("Button", "TrainingFrame_Spell_slot3Button", Spell_slot3, nil) + Spell_slot3ButtonL = CreateFrame("Button", "TrainingFrame_Spell_slot3ButtonL", Spell_slot3, nil) + Spell_slot3ButtonLT = Spell_slot3ButtonL:CreateTexture("Spell_slot3ButtonLT") + Spell_slot3ButtonF = Spell_slot3ButtonL:CreateFontString("Spell_slot3ButtonF") + Spell_slot3_AttachedSpell = nil + + Spell_slot4 = CreateFrame("Frame", "TrainingFrame_Spell_slot4", TrainingFrame, nil) + Spell_slot4Button = CreateFrame("Button", "TrainingFrame_Spell_slot4Button", Spell_slot4, nil) + Spell_slot4ButtonL = CreateFrame("Button", "TrainingFrame_Spell_slot4ButtonL", Spell_slot4, nil) + Spell_slot4ButtonLT = Spell_slot4ButtonL:CreateTexture("Spell_slot4ButtonLT") + Spell_slot4ButtonF = Spell_slot1ButtonL:CreateFontString("Spell_slot4ButtonF") + Spell_slot4_AttachedSpell = nil + + Spell_slot5 = CreateFrame("Frame", "TrainingFrame_Spell_slot5", TrainingFrame, nil) + Spell_slot5Button = CreateFrame("Button", "TrainingFrame_Spell_slot5Button", Spell_slot5, nil) + Spell_slot5ButtonL = CreateFrame("Button", "TrainingFrame_Spell_slot5ButtonL", Spell_slot5, nil) + Spell_slot5ButtonLT = Spell_slot5ButtonL:CreateTexture("Spell_slot5ButtonLT") + Spell_slot5ButtonF = Spell_slot5ButtonL:CreateFontString("Spell_slot5ButtonF") + Spell_slot5_AttachedSpell = nil + + Spell_slot6 = CreateFrame("Frame", "TrainingFrame_Spell_slot6", TrainingFrame, nil) + Spell_slot6Button = CreateFrame("Button", "TrainingFrame_Spell_slot6Button", Spell_slot6, nil) + Spell_slot6ButtonL = CreateFrame("Button", "TrainingFrame_Spell_slot6ButtonL", Spell_slot6, nil) + Spell_slot6ButtonLT = Spell_slot6ButtonL:CreateTexture("Spell_slot6ButtonLT") + Spell_slot6ButtonF = Spell_slot6ButtonL:CreateFontString("Spell_slot6ButtonF") + Spell_slot6_AttachedSpell = nil + + Spell_slot7 = CreateFrame("Frame", "TrainingFrame_Spell_slot7", TrainingFrame, nil) + Spell_slot7Button = CreateFrame("Button", "TrainingFrame_Spell_slot7Button", Spell_slot7, nil) + Spell_slot7ButtonL = CreateFrame("Button", "TrainingFrame_Spell_slot7ButtonL", Spell_slot7, nil) + Spell_slot7ButtonLT = Spell_slot7ButtonL:CreateTexture("Spell_slot7ButtonLT") + Spell_slot7ButtonF = Spell_slot7ButtonL:CreateFontString("Spell_slot7ButtonF") + Spell_slot7_AttachedSpell = nil + + Spell_slot8 = CreateFrame("Frame", "TrainingFrame_Spell_slot8", TrainingFrame, nil) + Spell_slot8Button = CreateFrame("Button", "TrainingFrame_Spell_slot8Button", Spell_slot8, nil) + Spell_slot8ButtonL = CreateFrame("Button", "TrainingFrame_Spell_slot8ButtonL", Spell_slot8, nil) + Spell_slot8ButtonLT = Spell_slot8ButtonL:CreateTexture("Spell_slot8ButtonLT") + Spell_slot8ButtonF = Spell_slot8ButtonL:CreateFontString("Spell_slot8ButtonF") + Spell_slot8_AttachedSpell = nil + + Spell_slot9 = CreateFrame("Frame", "TrainingFrame_Spell_slot9", TrainingFrame, nil) + Spell_slot9Button = CreateFrame("Button", "TrainingFrame_Spell_slot9Button", Spell_slot9, nil) + Spell_slot9ButtonL = CreateFrame("Button", "TrainingFrame_Spell_slot9ButtonL", Spell_slot9, nil) + Spell_slot9ButtonLT = Spell_slot9ButtonL:CreateTexture("Spell_slot9ButtonLT") + Spell_slot9ButtonF = Spell_slot9ButtonL:CreateFontString("Spell_slot9ButtonF") + Spell_slot9_AttachedSpell = nil + + Spell_slot10 = CreateFrame("Frame", "TrainingFrame_Spell_slot10", TrainingFrame, nil) + Spell_slot10Button = CreateFrame("Button", "TrainingFrame_Spell_slot10Button", Spell_slot10, nil) + Spell_slot10ButtonL = CreateFrame("Button", "TrainingFrame_Spell_slot10ButtonL", Spell_slot10, nil) + Spell_slot10ButtonLT = Spell_slot10ButtonL:CreateTexture("Spell_slot10ButtonLT") + Spell_slot10ButtonF = Spell_slot10ButtonL:CreateFontString("Spell_slot10ButtonF") + Spell_slot10_AttachedSpell = nil + + Spell_slot11 = CreateFrame("Frame", "TrainingFrame_Spell_slot11", TrainingFrame, nil) + Spell_slot11Button = CreateFrame("Button", "TrainingFrame_Spell_slot11Button", Spell_slot11, nil) + Spell_slot11ButtonL = CreateFrame("Button", "TrainingFrame_Spell_slot11ButtonL", Spell_slot11, nil) + Spell_slot11ButtonLT = Spell_slot11ButtonL:CreateTexture("Spell_slot11ButtonLT") + Spell_slot11ButtonF = Spell_slot11ButtonL:CreateFontString("Spell_slot11ButtonF") + Spell_slot11_AttachedSpell = nil + + Spell_slot12 = CreateFrame("Frame", "TrainingFrame_Spell_slot12", TrainingFrame, nil) + Spell_slot12Button = CreateFrame("Button", "TrainingFrame_Spell_slot12Button", Spell_slot12, nil) + Spell_slot12ButtonL = CreateFrame("Button", "TrainingFrame_Spell_slot12ButtonL", Spell_slot12, nil) + Spell_slot12ButtonLT = Spell_slot12ButtonL:CreateTexture("Spell_slot12ButtonLT") + Spell_slot12ButtonF = Spell_slot12ButtonL:CreateFontString("Spell_slot12ButtonF") + Spell_slot12_AttachedSpell = nil + + Spell_slot13 = CreateFrame("Frame", "TrainingFrame_Spell_slot13", TrainingFrame, nil) + Spell_slot13Button = CreateFrame("Button", "TrainingFrame_Spell_slot13Button", Spell_slot13, nil) + Spell_slot13ButtonL = CreateFrame("Button", "TrainingFrame_Spell_slot13ButtonL", Spell_slot13, nil) + Spell_slot13ButtonLT = Spell_slot13ButtonL:CreateTexture("Spell_slot13ButtonLT") + Spell_slot13ButtonF = Spell_slot13ButtonL:CreateFontString("Spell_slot13ButtonF") + Spell_slot13_AttachedSpell = nil + + Spell_slot14 = CreateFrame("Frame", "TrainingFrame_Spell_slot14", TrainingFrame, nil) + Spell_slot14Button = CreateFrame("Button", "TrainingFrame_Spell_slot14Button", Spell_slot14, nil) + Spell_slot14ButtonL = CreateFrame("Button", "TrainingFrame_Spell_slot14ButtonL", Spell_slot14, nil) + Spell_slot14ButtonLT = Spell_slot14ButtonL:CreateTexture("Spell_slot14ButtonLT") + Spell_slot14ButtonF = Spell_slot14ButtonL:CreateFontString("Spell_slot14ButtonF") + Spell_slot14_AttachedSpell = nil + + Spell_slot15 = CreateFrame("Frame", "TrainingFrame_Spell_slot15", TrainingFrame, nil) + Spell_slot15Button = CreateFrame("Button", "TrainingFrame_Spell_slot15Button", Spell_slot15, nil) + Spell_slot15ButtonL = CreateFrame("Button", "TrainingFrame_Spell_slot15ButtonL", Spell_slot15, nil) + Spell_slot15ButtonLT = Spell_slot15ButtonL:CreateTexture("Spell_slot15ButtonLT") + Spell_slot15ButtonF = Spell_slot15ButtonL:CreateFontString("Spell_slot15ButtonF") + Spell_slot15_AttachedSpell = nil + + Spell_slot16 = CreateFrame("Frame", "TrainingFrame_Spell_slot16", TrainingFrame, nil) + Spell_slot16Button = CreateFrame("Button", "TrainingFrame_Spell_slot16Button", Spell_slot16, nil) + Spell_slot16ButtonL = CreateFrame("Button", "TrainingFrame_Spell_slot16ButtonL", Spell_slot16, nil) + Spell_slot16ButtonLT = Spell_slot16ButtonL:CreateTexture("Spell_slot16ButtonLT") + Spell_slot16ButtonF = Spell_slot16ButtonL:CreateFontString("Spell_slot16ButtonF") + Spell_slot16_AttachedSpell = nil + + Spell_slot17 = CreateFrame("Frame", "TrainingFrame_Spell_slot17", TrainingFrame, nil) + Spell_slot17Button = CreateFrame("Button", "TrainingFrame_Spell_slot17Button", Spell_slot17, nil) + Spell_slot17ButtonL = CreateFrame("Button", "TrainingFrame_Spell_slot17ButtonL", Spell_slot17, nil) + Spell_slot17ButtonLT = Spell_slot17ButtonL:CreateTexture("Spell_slot17ButtonLT") + Spell_slot17ButtonF = Spell_slot17ButtonL:CreateFontString("Spell_slot17ButtonF") + Spell_slot17_AttachedSpell = nil + + Spell_slot18 = CreateFrame("Frame", "TrainingFrame_Spell_slot18", TrainingFrame, nil) + Spell_slot18Button = CreateFrame("Button", "TrainingFrame_Spell_slot18Button", Spell_slot18, nil) + Spell_slot18ButtonL = CreateFrame("Button", "TrainingFrame_Spell_slot18ButtonL", Spell_slot18, nil) + Spell_slot18ButtonLT = Spell_slot18ButtonL:CreateTexture("Spell_slot18ButtonLT") + Spell_slot18ButtonF = Spell_slot18ButtonL:CreateFontString("Spell_slot18ButtonF") + Spell_slot18_AttachedSpell = nil + + Spell_slot19 = CreateFrame("Frame", "TrainingFrame_Spell_slot19", TrainingFrame, nil) + Spell_slot19Button = CreateFrame("Button", "TrainingFrame_Spell_slot19Button", Spell_slot19, nil) + Spell_slot19ButtonL = CreateFrame("Button", "TrainingFrame_Spell_slot19ButtonL", Spell_slot19, nil) + Spell_slot19ButtonLT = Spell_slot19ButtonL:CreateTexture("Spell_slot19ButtonLT") + Spell_slot19ButtonF = Spell_slot19ButtonL:CreateFontString("Spell_slot19ButtonF") + Spell_slot19_AttachedSpell = nil + + Spell_slot20 = CreateFrame("Frame", "TrainingFrame_Spell_slot20", TrainingFrame, nil) + Spell_slot20Button = CreateFrame("Button", "TrainingFrame_Spell_slot20Button", Spell_slot20, nil) + Spell_slot20ButtonL = CreateFrame("Button", "TrainingFrame_Spell_slot20ButtonL", Spell_slot20, nil) + Spell_slot20ButtonLT = Spell_slot20ButtonL:CreateTexture("Spell_slot20ButtonLT") + Spell_slot20ButtonF = Spell_slot20ButtonL:CreateFontString("Spell_slot20ButtonF") + Spell_slot20_AttachedSpell = nil + + Spell_slot21 = CreateFrame("Frame", "TrainingFrame_Spell_slot21", TrainingFrame, nil) + Spell_slot21Button = CreateFrame("Button", "TrainingFrame_Spell_slot21Button", Spell_slot21, nil) + Spell_slot21ButtonL = CreateFrame("Button", "TrainingFrame_Spell_slot21ButtonL", Spell_slot21, nil) + Spell_slot21ButtonLT = Spell_slot21ButtonL:CreateTexture("Spell_slot21ButtonLT") + Spell_slot21ButtonF = Spell_slot21ButtonL:CreateFontString("Spell_slot21ButtonF") + Spell_slot21_AttachedSpell = nil + + Spell_slot22 = CreateFrame("Frame", "TrainingFrame_Spell_slot22", TrainingFrame, nil) + Spell_slot22Button = CreateFrame("Button", "TrainingFrame_Spell_slot22Button", Spell_slot22, nil) + Spell_slot22ButtonL = CreateFrame("Button", "TrainingFrame_Spell_slot22ButtonL", Spell_slot22, nil) + Spell_slot22ButtonLT = Spell_slot22ButtonL:CreateTexture("Spell_slot22ButtonLT") + Spell_slot22ButtonF = Spell_slot22ButtonL:CreateFontString("Spell_slot22ButtonF") + Spell_slot22_AttachedSpell = nil + + Spell_slot23 = CreateFrame("Frame", "TrainingFrame_Spell_slot23", TrainingFrame, nil) + Spell_slot23Button = CreateFrame("Button", "TrainingFrame_Spell_slot23Button", Spell_slot23, nil) + Spell_slot23ButtonL = CreateFrame("Button", "TrainingFrame_Spell_slot23ButtonL", Spell_slot23, nil) + Spell_slot23ButtonLT = Spell_slot23ButtonL:CreateTexture("Spell_slot23ButtonLT") + Spell_slot23ButtonF = Spell_slot23ButtonL:CreateFontString("Spell_slot23ButtonF") + Spell_slot23_AttachedSpell = nil + + Spell_slot24 = CreateFrame("Frame", "TrainingFrame_Spell_slot24", TrainingFrame, nil) + Spell_slot24Button = CreateFrame("Button", "TrainingFrame_Spell_slot24Button", Spell_slot24, nil) + Spell_slot24ButtonL = CreateFrame("Button", "TrainingFrame_Spell_slot24ButtonL", Spell_slot24, nil) + Spell_slot24ButtonLT = Spell_slot24ButtonL:CreateTexture("Spell_slot24ButtonLT") + Spell_slot24ButtonF = Spell_slot24ButtonL:CreateFontString("Spell_slot24ButtonF") + Spell_slot24_AttachedSpell = nil + + Spell_slot25 = CreateFrame("Frame", "TrainingFrame_Spell_slot25", TrainingFrame, nil) + Spell_slot25Button = CreateFrame("Button", "TrainingFrame_Spell_slot25Button", Spell_slot25, nil) + Spell_slot25ButtonL = CreateFrame("Button", "TrainingFrame_Spell_slot25ButtonL", Spell_slot25, nil) + Spell_slot25ButtonLT = Spell_slot25ButtonL:CreateTexture("Spell_slot25ButtonLT") + Spell_slot25ButtonF = Spell_slot25ButtonL:CreateFontString("Spell_slot25ButtonF") + Spell_slot25_AttachedSpell = nil + + Spell_slot26 = CreateFrame("Frame", "TrainingFrame_Spell_slot26", TrainingFrame, nil) + Spell_slot26Button = CreateFrame("Button", "TrainingFrame_Spell_slot26Button", Spell_slot26, nil) + Spell_slot26ButtonL = CreateFrame("Button", "TrainingFrame_Spell_slot26ButtonL", Spell_slot26, nil) + Spell_slot26ButtonLT = Spell_slot26ButtonL:CreateTexture("Spell_slot26ButtonLT") + Spell_slot26ButtonF = Spell_slot26ButtonL:CreateFontString("Spell_slot26ButtonF") + Spell_slot26_AttachedSpell = nil + + Spell_slot27 = CreateFrame("Frame", "TrainingFrame_Spell_slot27", TrainingFrame, nil) + Spell_slot27Button = CreateFrame("Button", "TrainingFrame_Spell_slot27Button", Spell_slot27, nil) + Spell_slot27ButtonL = CreateFrame("Button", "TrainingFrame_Spell_slot27ButtonL", Spell_slot27, nil) + Spell_slot27ButtonLT = Spell_slot27ButtonL:CreateTexture("Spell_slot27ButtonLT") + Spell_slot27ButtonF = Spell_slot27ButtonL:CreateFontString("Spell_slot27ButtonF") + Spell_slot27_AttachedSpell = nil + + Spell_slot28 = CreateFrame("Frame", "TrainingFrame_Spell_slot28", TrainingFrame, nil) + Spell_slot28Button = CreateFrame("Button", "TrainingFrame_Spell_slot28Button", Spell_slot28, nil) + Spell_slot28ButtonL = CreateFrame("Button", "TrainingFrame_Spell_slot28ButtonL", Spell_slot28, nil) + Spell_slot28ButtonLT = Spell_slot28ButtonL:CreateTexture("Spell_slot28ButtonLT") + Spell_slot28ButtonF = Spell_slot28ButtonL:CreateFontString("Spell_slot28ButtonF") + Spell_slot28_AttachedSpell = nil + + Spell_slot29 = CreateFrame("Frame", "TrainingFrame_Spell_slot29", TrainingFrame, nil) + Spell_slot29Button = CreateFrame("Button", "TrainingFrame_Spell_slot29Button", Spell_slot29, nil) + Spell_slot29ButtonL = CreateFrame("Button", "TrainingFrame_Spell_slot29ButtonL", Spell_slot29, nil) + Spell_slot29ButtonLT = Spell_slot29ButtonL:CreateTexture("Spell_slot29ButtonLT") + Spell_slot29ButtonF = Spell_slot29ButtonL:CreateFontString("Spell_slot29ButtonF") + Spell_slot29_AttachedSpell = nil + + Spell_slot30 = CreateFrame("Frame", "TrainingFrame_Spell_slot30", TrainingFrame, nil) + Spell_slot30Button = CreateFrame("Button", "TrainingFrame_Spell_slot30Button", Spell_slot30, nil) + Spell_slot30ButtonL = CreateFrame("Button", "TrainingFrame_Spell_slot30ButtonL", Spell_slot30, nil) + Spell_slot30ButtonLT = Spell_slot30ButtonL:CreateTexture("Spell_slot30ButtonLT") + Spell_slot30ButtonF = Spell_slot30ButtonL:CreateFontString("Spell_slot30ButtonF") + Spell_slot30_AttachedSpell = nil + + Spell_slot31 = CreateFrame("Frame", "TrainingFrame_Spell_slot31", TrainingFrame, nil) + Spell_slot31Button = CreateFrame("Button", "TrainingFrame_Spell_slot31Button", Spell_slot31, nil) + Spell_slot31ButtonL = CreateFrame("Button", "TrainingFrame_Spell_slot31ButtonL", Spell_slot31, nil) + Spell_slot31ButtonLT = Spell_slot31ButtonL:CreateTexture("Spell_slot31ButtonLT") + Spell_slot31ButtonF = Spell_slot31ButtonL:CreateFontString("Spell_slot31ButtonF") + Spell_slot31_AttachedSpell = nil + + Spell_slot32 = CreateFrame("Frame", "TrainingFrame_Spell_slot32", TrainingFrame, nil) + Spell_slot32Button = CreateFrame("Button", "TrainingFrame_Spell_slot32Button", Spell_slot32, nil) + Spell_slot32ButtonL = CreateFrame("Button", "TrainingFrame_Spell_slot32ButtonL", Spell_slot32, nil) + Spell_slot32ButtonLT = Spell_slot32ButtonL:CreateTexture("Spell_slot32ButtonLT") + Spell_slot32ButtonF = Spell_slot32ButtonL:CreateFontString("Spell_slot32ButtonF") + Spell_slot32_AttachedSpell = nil + + Spell_slot33 = CreateFrame("Frame", "TrainingFrame_Spell_slot33", TrainingFrame, nil) + Spell_slot33Button = CreateFrame("Button", "TrainingFrame_Spell_slot33Button", Spell_slot33, nil) + Spell_slot33ButtonL = CreateFrame("Button", "TrainingFrame_Spell_slot33ButtonL", Spell_slot33, nil) + Spell_slot33ButtonLT = Spell_slot33ButtonL:CreateTexture("Spell_slot33ButtonLT") + Spell_slot33ButtonF = Spell_slot33ButtonL:CreateFontString("Spell_slot33ButtonF") + Spell_slot33_AttachedSpell = nil + + Spell_slot34 = CreateFrame("Frame", "TrainingFrame_Spell_slot34", TrainingFrame, nil) + Spell_slot34Button = CreateFrame("Button", "TrainingFrame_Spell_slot34Button", Spell_slot34, nil) + Spell_slot34ButtonL = CreateFrame("Button", "TrainingFrame_Spell_slot34ButtonL", Spell_slot34, nil) + Spell_slot34ButtonLT = Spell_slot34ButtonL:CreateTexture("Spell_slot34ButtonLT") + Spell_slot34ButtonF = Spell_slot34ButtonL:CreateFontString("Spell_slot34ButtonF") + Spell_slot34_AttachedSpell = nil + + Spell_slot35 = CreateFrame("Frame", "TrainingFrame_Spell_slot35", TrainingFrame, nil) + Spell_slot35Button = CreateFrame("Button", "TrainingFrame_Spell_slot35Button", Spell_slot35, nil) + Spell_slot35ButtonL = CreateFrame("Button", "TrainingFrame_Spell_slot35ButtonL", Spell_slot35, nil) + Spell_slot35ButtonLT = Spell_slot35ButtonL:CreateTexture("Spell_slot35ButtonLT") + Spell_slot35ButtonF = Spell_slot35ButtonL:CreateFontString("Spell_slot35ButtonF") + Spell_slot35_AttachedSpell = nil + + Spell_slot36 = CreateFrame("Frame", "TrainingFrame_Spell_slot36", TrainingFrame, nil) + Spell_slot36Button = CreateFrame("Button", "TrainingFrame_Spell_slot36Button", Spell_slot36, nil) + Spell_slot36ButtonL = CreateFrame("Button", "TrainingFrame_Spell_slot36ButtonL", Spell_slot36, nil) + Spell_slot36ButtonLT = Spell_slot36ButtonL:CreateTexture("Spell_slot36ButtonLT") + Spell_slot36ButtonF = Spell_slot36ButtonL:CreateFontString("Spell_slot36ButtonF") + Spell_slot36_AttachedSpell = nil + + all_spell_slots = { + {Spell_slot1, -300, -160}, {Spell_slot2, -220, -160}, {Spell_slot3, -140, -160}, {Spell_slot4, -60, -160}, {Spell_slot5, 20, -160}, {Spell_slot6, 100, -160}, + {Spell_slot7, -300, -260}, {Spell_slot8, -220, -260}, {Spell_slot9, -140, -260}, {Spell_slot10, -60, -260}, {Spell_slot11, 20, -260}, {Spell_slot12, 100, -260}, + {Spell_slot13, -300, -360}, {Spell_slot14, -220, -360}, {Spell_slot15, -140, -360}, {Spell_slot16, -60, -360}, {Spell_slot17, 20, -360}, {Spell_slot18, 100, -360}, + {Spell_slot19, -300, -460}, {Spell_slot20, -220, -460}, {Spell_slot21, -140, -460}, {Spell_slot22, -60, -460}, {Spell_slot23, 20, -460}, {Spell_slot24, 100, -460}, + {Spell_slot25, -300, -560}, {Spell_slot26, -220, -560}, {Spell_slot27, -140, -560}, {Spell_slot28, -60, -560}, {Spell_slot29, 20, -560}, {Spell_slot30, 100, -560}, + {Spell_slot31, -300, -660}, {Spell_slot32, -220, -660}, {Spell_slot33, -140, -660}, {Spell_slot34, -60, -660}, {Spell_slot35, 20, -660}, {Spell_slot36, 100, -660}} + + all_spell_slot_buttons = {Spell_slot1Button, Spell_slot2Button, Spell_slot3Button, Spell_slot4Button, + Spell_slot5Button, Spell_slot6Button, Spell_slot7Button, Spell_slot8Button, + Spell_slot9Button, Spell_slot10Button, Spell_slot11Button, Spell_slot12Button, + Spell_slot13Button, Spell_slot14Button, Spell_slot15Button, Spell_slot16Button, + Spell_slot17Button, Spell_slot18Button, Spell_slot19Button, Spell_slot20Button, + Spell_slot21Button, Spell_slot22Button, Spell_slot23Button, Spell_slot24Button, + Spell_slot25Button, Spell_slot26Button, Spell_slot27Button, Spell_slot28Button, + Spell_slot29Button, Spell_slot30Button, Spell_slot31Button, Spell_slot32Button, + Spell_slot33Button, Spell_slot34Button, Spell_slot35Button, Spell_slot36Button} + + all_learn_spell_buttons = {Spell_slot1ButtonL, Spell_slot2ButtonL, Spell_slot3ButtonL, Spell_slot4ButtonL, + Spell_slot5ButtonL, Spell_slot6ButtonL, Spell_slot7ButtonL, Spell_slot8ButtonL, + Spell_slot9ButtonL, Spell_slot10ButtonL, Spell_slot11ButtonL, Spell_slot12ButtonL, + Spell_slot13ButtonL, Spell_slot14ButtonL, Spell_slot15ButtonL, Spell_slot16ButtonL, + Spell_slot17ButtonL, Spell_slot18ButtonL, Spell_slot19ButtonL, Spell_slot20ButtonL, + Spell_slot21ButtonL, Spell_slot22ButtonL, Spell_slot23ButtonL, Spell_slot24ButtonL, + Spell_slot25ButtonL, Spell_slot26ButtonL, Spell_slot27ButtonL, Spell_slot28ButtonL, + Spell_slot29ButtonL, Spell_slot30ButtonL, Spell_slot31ButtonL, Spell_slot32ButtonL, + Spell_slot33ButtonL, Spell_slot34ButtonL, Spell_slot35ButtonL, Spell_slot36ButtonL} + + all_learn_spell_buttons_t = {Spell_slot1ButtonLT, Spell_slot2ButtonLT, Spell_slot3ButtonLT, Spell_slot4ButtonLT, + Spell_slot5ButtonLT, Spell_slot6ButtonLT, Spell_slot7ButtonLT, Spell_slot8ButtonLT, + Spell_slot9ButtonLT, Spell_slot10ButtonLT, Spell_slot11ButtonLT, Spell_slot12ButtonLT, + Spell_slot13ButtonLT, Spell_slot14ButtonLT, Spell_slot15ButtonLT, Spell_slot16ButtonLT, + Spell_slot17ButtonLT, Spell_slot19ButtonLT, Spell_slot18ButtonLT, Spell_slot20ButtonLT, + Spell_slot21ButtonLT, Spell_slot22ButtonLT, Spell_slot23ButtonLT, Spell_slot24ButtonLT, + Spell_slot25ButtonLT, Spell_slot26ButtonLT, Spell_slot27ButtonLT, Spell_slot28ButtonLT, + Spell_slot29ButtonLT, Spell_slot30ButtonLT, Spell_slot31ButtonLT, Spell_slot32ButtonLT, + Spell_slot33ButtonLT, Spell_slot34ButtonLT, Spell_slot35ButtonLT, Spell_slot36ButtonLT} + + all_learn_spell_buttons_f = {Spell_slot1ButtonF, Spell_slot2ButtonF, Spell_slot3ButtonF, Spell_slot4ButtonF, + Spell_slot5ButtonF, Spell_slot6ButtonF, Spell_slot7ButtonF, Spell_slot8ButtonF, + Spell_slot9ButtonF, Spell_slot10ButtonF, Spell_slot11ButtonF, Spell_slot12ButtonF, + Spell_slot13ButtonF, Spell_slot14ButtonF, Spell_slot15ButtonF, Spell_slot16ButtonF, + Spell_slot17ButtonF, Spell_slot18ButtonF, Spell_slot19ButtonF, Spell_slot20ButtonF, + Spell_slot21ButtonF, Spell_slot22ButtonF, Spell_slot23ButtonF, Spell_slot24ButtonF, + Spell_slot25ButtonF, Spell_slot26ButtonF, Spell_slot27ButtonF, Spell_slot28ButtonF, + Spell_slot29ButtonF, Spell_slot30ButtonF, Spell_slot31ButtonF, Spell_slot32ButtonF, + Spell_slot33ButtonF, Spell_slot34ButtonF, Spell_slot35ButtonF, Spell_slot36ButtonF} + + all_attached_spells = {Spell_slot1_AttachedSpell, Spell_slot2_AttachedSpell, Spell_slot3_AttachedSpell, Spell_slot4_AttachedSpell, + Spell_slot5_AttachedSpell, Spell_slot6_AttachedSpell, Spell_slot7_AttachedSpell, Spell_slot8_AttachedSpell, + Spell_slot9_AttachedSpell, Spell_slot10_AttachedSpell, Spell_slot11_AttachedSpell, Spell_slot12_AttachedSpell, + Spell_slot13_AttachedSpell, Spell_slot14_AttachedSpell, Spell_slot15_AttachedSpell, Spell_slot16_AttachedSpell, + Spell_slot17_AttachedSpell, Spell_slot18_AttachedSpell, Spell_slot19_AttachedSpell, Spell_slot20_AttachedSpell, + Spell_slot21_AttachedSpell, Spell_slot22_AttachedSpell, Spell_slot23_AttachedSpell, Spell_slot24_AttachedSpell, + Spell_slot25_AttachedSpell, Spell_slot26_AttachedSpell, Spell_slot27_AttachedSpell, Spell_slot28_AttachedSpell, + Spell_slot29_AttachedSpell, Spell_slot30_AttachedSpell, Spell_slot31_AttachedSpell, Spell_slot32_AttachedSpell, + Spell_slot33_AttachedSpell, Spell_slot34_AttachedSpell, Spell_slot35_AttachedSpell, Spell_slot36_AttachedSpell} + + for i,v in ipairs(all_spell_slots) do + v[1]:SetSize(50, 50) + v[1]:SetBackdrop({ + bgFile = "Interface\\AddOns\\AwAddons\\Textures\\progress\\buttonbackground", + edgeFile = "Interface\\AddOns\\AwAddons\\Textures\\progress\\buttonbackground-Border", + edgeSize = 15 + }) + v[1]:SetPoint("TOP", v[2], v[3]) + v[1]:Hide() + end + + for i,v in ipairs(all_spell_slot_buttons) do + v:SetSize(40, 40) + v:SetPoint("CENTER") + v:EnableMouse(true) + v:SetBackdrop({ + bgFile = "Interface\\AddOns\\AwAddons\\Textures\\progress\\buttonbackground" + }) + v:SetScript("OnMouseUp", unlearn_spell) + --v:SetScript("OnMouseUp", nil) + + _G[v:GetName().."_UnlearnTex"] = v:CreateTexture() + _G[v:GetName().."_UnlearnTex"]:SetAllPoints() + _G[v:GetName().."_UnlearnTex"]:SetSize(v:GetSize()) + _G[v:GetName().."_UnlearnTex"]:SetPoint("CENTER",0,0) + _G[v:GetName().."_UnlearnTex"]:SetTexture("Interface\\Icons\\inv_custom_scrollofunlearning") + _G[v:GetName().."_UnlearnTex"]:Hide() + + if (i == 1) then + all_spell_slot_buttons_UnLearnEffect = CreateFrame("Model", "all_spell_slot_buttons_UnLearnEffect", v) + all_spell_slot_buttons_UnLearnEffect:SetWidth(256); + all_spell_slot_buttons_UnLearnEffect:SetHeight(256); + all_spell_slot_buttons_UnLearnEffect:SetPoint("CENTER", v, "CENTER", 0, 0) + all_spell_slot_buttons_UnLearnEffect:SetModel("World\\Expansion01\\doodads\\netherstorm\\crackeffects\\netherstormcracksmokeblue.m2") + all_spell_slot_buttons_UnLearnEffect:SetModelScale(0.035) + all_spell_slot_buttons_UnLearnEffect:SetCamera(0) + all_spell_slot_buttons_UnLearnEffect:SetPosition(0.08,0.087,0) + --all_spell_slot_buttons_UnLearnEffect:SetAlpha(0.8) + all_spell_slot_buttons_UnLearnEffect:SetFacing(0.1) + all_spell_slot_buttons_UnLearnEffect:Hide() + end + end + + for i,v in ipairs(all_learn_spell_buttons) do + v:SetSize(50, 20) + v:SetPoint("CENTER", 0, -42) + v:EnableMouse(true) + v:SetHighlightTexture("Interface\\AddOns\\AwAddons\\Textures\\misc\\dialog_glow") + v:SetScript("OnMouseUp", learn_spell) + end + + for i,v in ipairs(all_learn_spell_buttons_t) do + v:SetAllPoints(all_learn_spell_buttons[i]) + --v:SetTexture("Interface\\AddOns\\AwAddons\\Textures\\progress\\buttonflag") + all_learn_spell_buttons[i]:SetNormalTexture(v) + end + + for i,v in ipairs(all_learn_spell_buttons_f) do + v:SetFont("Fonts\\MORPHEUS.TTF", 15, "OUTLINE") + v:SetShadowOffset(1, -1) + all_learn_spell_buttons[i]:SetFontString(v) + all_learn_spell_buttons[i]:SetText("|cffFFFFFFLearn|r") + end + + + -- ####################################### Talents Frame ############################## + + --scrollframe + scrollframe = CreateFrame("ScrollFrame", nil, TrainingFrame) + scrollframe:SetPoint("TOPLEFT", 95, -135) + scrollframe:SetSize(500, 650) + TrainingFrame.scrollframe = scrollframe + scrollframe:Hide() + + --scrollbar + scrollbar = CreateFrame("Slider", nil, scrollframe, "UIPanelScrollBarTemplate") + scrollbar:SetPoint("TOPLEFT", scrollframe, "TOPRIGHT", 33, 0) + scrollbar:SetPoint("BOTTOMLEFT", scrollframe, "BOTTOMRIGHT", 33, 0) + scrollbar:SetMinMaxValues(0, 670) + scrollbar:SetValueStep(1) + scrollbar.scrollStep = 1 + scrollbar:SetValue(0) + scrollbar:SetWidth(16) + scrollbar:SetFrameStrata("FULLSCREEN") + scrollbar:SetScript("OnValueChanged", + function (self, value) + self:GetParent():SetVerticalScroll(value) + end) + local scrollbg = scrollbar:CreateTexture(nil, "BACKGROUND") + scrollbg:SetAllPoints(scrollbar) + scrollbg:SetTexture(0, 0, 0, 0.4) + TrainingFrame.scrollbar = scrollbar + scrollbar:Hide() + + + + + + -- backgrounds + top_left_bg = CreateFrame("Frame", nil, TrainingFrame) + top_left_bg:SetSize(305, 402) + top_left_bg:SetPoint("TOPLEFT", 90, -138) + top_left_bg_t = top_left_bg:CreateTexture() + top_left_bg_t:SetAllPoints() + top_left_bg_t:SetTexture("Interface\\TalentFrame\\MageFire-TopLeft") + top_left_bg.texture = top_left_bg_t + top_left_bg:Hide() + + top_right_bg = CreateFrame("Frame", nil, TrainingFrame) + top_right_bg:SetSize(305, 402) + top_right_bg:SetPoint("TOPLEFT", 395, -138) + top_right_bg_t = top_right_bg:CreateTexture() + top_right_bg_t:SetAllPoints() + top_right_bg_t:SetTexture("Interface\\TalentFrame\\MageFire-TopRight") + top_right_bg.texture = top_right_bg_t + top_right_bg:Hide() + + bottom_left_bg = CreateFrame("Frame", nil, TrainingFrame) + bottom_left_bg:SetSize(305, 402) + bottom_left_bg:SetPoint("TOPLEFT", 90, -540) + bottom_left_bg_t = bottom_left_bg:CreateTexture() + bottom_left_bg_t:SetAllPoints() + bottom_left_bg_t:SetTexture("Interface\\TalentFrame\\MageFire-BottomLeft") + bottom_left_bg.texture = bottom_left_bg_t + bottom_left_bg:Hide() + + bottom_right_bg = CreateFrame("Frame", nil, TrainingFrame) + bottom_right_bg:SetSize(305, 402) + bottom_right_bg:SetPoint("TOPLEFT", 395, -540) + bottom_right_bg_t = bottom_right_bg:CreateTexture() + bottom_right_bg_t:SetAllPoints() + bottom_right_bg_t:SetTexture("Interface\\TalentFrame\\MageFire-BottomRight") + bottom_right_bg.texture = bottom_right_bg_t + bottom_right_bg:Hide() + + --content frame + content = CreateFrame("Frame", nil, scrollframe) + content:SetSize(500, 1320) + scrollframe.content = content + content:Hide() + + scrollframe:SetScrollChild(content) + + all_talent_slots = {} + + all_talent_slot_buttons = {} + + all_learn_talent_buttons = {} + + all_learn_talent_buttons_t = {} + + all_learn_talent_buttons_f = {} + + all_attached_talent = {} + + all_talent_FrameNumber = {} + + all_talent_FNF = {} + + button_on_off_state = {} + + local max_number_of_buttons = 44 + + local button_making = 1 + + repeat + + local talent_slot = CreateFrame("Frame", "TrainingFrame_talent_slot1", content, nil) + table.insert(all_talent_slots, talent_slot) + local talent_slotButton = CreateFrame("Button", "TrainingFrame_talent_slotButton", talent_slot, nil) + table.insert(all_talent_slot_buttons, talent_slotButton) + local talent_slotButtonL = CreateFrame("Button", "TrainingFrame_talent_slotButtonL", talent_slot, nil) + table.insert(all_learn_talent_buttons, talent_slotButtonL) + local talent_slotButtonLT = talent_slotButtonL:CreateTexture("talent_slotButtonLT") + table.insert(all_learn_talent_buttons_t, talent_slotButtonLT) + local talent_slotButtonF = talent_slotButtonL:CreateFontString("talent_slotButtonF") + table.insert(all_learn_talent_buttons_f, talent_slotButtonF) + local talent_slot_AttachedTalent = nil + table.insert(all_attached_talent, talent_slot_AttachedTalent) + local talent_slotFrameNumber = CreateFrame("Button", "TrainingFrame_talent_slotFrameNumber", talent_slot, nil) + table.insert(all_talent_FrameNumber, talent_slotFrameNumber) + local talent_slotFNF = talent_slotFrameNumber:CreateFontString("talent_stotFNF") + table.insert(all_talent_FNF, talent_slotFNF) + table.insert(button_on_off_state, false) + + + button_making = button_making + 1 + until(button_making > max_number_of_buttons) + + + + + + all_talent_coords = {{-165, -83}, {-40, -83}, {85, -83}, {210, -83}, + {-165, -191}, {-40, -191}, {85, -191}, {210, -191}, + {-165, -299}, {-40, -299}, {85, -299}, {210, -299}, + {-165, -407}, {-40, -407}, {85, -407}, {210, -407}, + {-165, -515}, {-40, -515}, {85, -515}, {210, -515}, + {-165, -623}, {-40, -623}, {85, -623}, {210, -623}, + {-165, -731}, {-40, -731}, {85, -731}, {210, -731}, + {-165, -839}, {-40, -839}, {85, -839}, {210, -839}, + {-165, -947}, {-40, -947}, {85, -947}, {210, -947}, + {-165, -1055}, {-40, -1055}, {85, -1055}, {210, -1055}, + {-165, -1163}, {-40, -1163}, {85, -1163}, {210, -1163}} + + + for i,v in ipairs(all_talent_slots) do + v:SetSize(56, 56) + v:SetBackdrop({ + bgFile = "Interface\\AddOns\\AwAddons\\Textures\\progress\\talent_bg", + insets = { + left = -11, + right = -11, + top = -11, + bottom = -11} + }) + v:SetPoint("TOP", all_talent_coords[i][1], all_talent_coords[i][2]) + v:Show() + end + + for i,v in ipairs(all_talent_slot_buttons) do + v:SetSize(48, 48) + v:SetPoint("CENTER") + v:EnableMouse(true) + v:SetBackdrop({ + bgFile = "Interface\\AddOns\\AwAddons\\Textures\\progress\\buttonbackgroundold" + }) + --v:SetScript("OnMouseUp", unlearn_talent) + v:SetScript("OnMouseUp", nil) + + --[[_G[v:GetName().."_UnlearnTex"] = v:CreateTexture() + _G[v:GetName().."_UnlearnTex"]:SetAllPoints() + _G[v:GetName().."_UnlearnTex"]:SetSize(v:GetSize()) + _G[v:GetName().."_UnlearnTex"]:SetPoint("CENTER",0,0) + _G[v:GetName().."_UnlearnTex"]:SetTexture("Interface\\Icons\\inv_custom_scrollofunlearning") + _G[v:GetName().."_UnlearnTex"]:Hide() + v.UnlearnTex = _G[v:GetName().."_UnlearnTex"]]-- + end + + for i,v in ipairs(all_learn_talent_buttons) do + v:SetSize(50, 20) + v:SetPoint("CENTER", 0, -42) + v:EnableMouse(true) + v:SetHighlightTexture("Interface\\AddOns\\AwAddons\\Textures\\misc\\dialog_glow") + v:SetScript("OnMouseUp", upgrade_talent) + end + + for i,v in ipairs(all_learn_talent_buttons_t) do + v:SetAllPoints(all_learn_talent_buttons[i]) + all_learn_talent_buttons[i]:SetText("|cffE1AB18Learn|r") + all_learn_talent_buttons[i]:SetNormalTexture(v) + end + + for i,v in ipairs(all_learn_talent_buttons_f) do + v:SetFont("Fonts\\MORPHEUS.TTF", 15, "OUTLINE") + v:SetShadowOffset(1, -1) + all_learn_talent_buttons[i]:SetFontString(v) + all_learn_talent_buttons[i]:SetText("Learn") + end + + for i,v in ipairs(all_talent_FrameNumber) do + v:SetSize(16, 16) + v:SetBackdrop({ + bgFile = "Interface\\AddOns\\AwAddons\\Textures\\progress\\talent_fn", + insets = { + left = -7, + right = -7, + top = -7, + bottom = -7} + }) + v:EnableMouse(false) + v:SetPoint("BOTTOMRIGHT", 2, -1) + end + + for i,v in ipairs(all_talent_FNF) do + v:SetFont("Fonts\\FRIZQT__.ttf", 13) + v:SetPoint("CENTER",0,-1) + v:SetShadowOffset(1, 1) + all_talent_FrameNumber[i]:SetFontString(v) + all_talent_FrameNumber[i]:SetText(" ") + end + + --extra buttons for a spellbookframe-- + local SpellBook_SkillTabOverFlowButton = CreateFrame("Button", "SpellBook_SkillTabOverFlowButton", SpellBookFrame, nil) +SpellBook_SkillTabOverFlowButton:SetSize(25,50) +SpellBook_SkillTabOverFlowButton:SetPoint("TOPLEFT", SpellBookSkillLineTab1, 0, 49) +SpellBook_SkillTabOverFlowButton:SetNormalTexture("Interface\\AddOns\\AwAddons\\Textures\\Misc\\spellbook_forward") +SpellBook_SkillTabOverFlowButton:SetDisabledTexture("Interface\\AddOns\\AwAddons\\Textures\\Misc\\spellbook_forward_d") +SpellBook_SkillTabOverFlowButton:SetHighlightTexture("Interface\\AddOns\\AwAddons\\Textures\\Misc\\spellbook_forward_h") +SpellBook_SkillTabOverFlowButton:SetScript("OnUpdate", function(self) + if (_G["SpellBookSkillLineTab"..GetNumSpellTabs()]) and (_G["SpellBookSkillLineTab"..GetNumSpellTabs()]:IsVisible()) then + self:Disable() + elseif (GetNumSpellTabs() > 7) then + self:Enable() + end + end) +SpellBook_SkillTabOverFlowButton:SetScript("OnClick", function(self) + if (self:IsEnabled()) then + skilltab_pagenum = skilltab_pagenum +1 + SpellBookFrame_PlayOpenSound() + SpellBookFrame_Update() +end + end) + +local SpellBook_SkillTabOverFlowButton_b = CreateFrame("Button", "SpellBook_SkillTabOverFlowButton_b", SpellBookFrame, nil) +SpellBook_SkillTabOverFlowButton_b:SetSize(25,50) +SpellBook_SkillTabOverFlowButton_b:SetPoint("BOTTOMLEFT", SpellBookSkillLineTab7, 0, -49) +SpellBook_SkillTabOverFlowButton_b:SetNormalTexture("Interface\\AddOns\\AwAddons\\Textures\\Misc\\spellbook_back") +SpellBook_SkillTabOverFlowButton_b:SetDisabledTexture("Interface\\AddOns\\AwAddons\\Textures\\Misc\\spellbook_back_d") +SpellBook_SkillTabOverFlowButton_b:SetHighlightTexture("Interface\\AddOns\\AwAddons\\Textures\\Misc\\spellbook_back_h") +SpellBook_SkillTabOverFlowButton_b:SetScript("OnUpdate", function(self) + if (skilltab_pagenum == 1) then + self:Disable() + else + self:Enable() + end + end) +SpellBook_SkillTabOverFlowButton_b:SetScript("OnClick", function(self) + if (self:IsEnabled()) then +skilltab_pagenum = skilltab_pagenum -1 +SpellBookFrame_PlayOpenSound() +SpellBookFrame_Update() +end + end) + +SpellBook_SkillTabOverFlowButton:Disable() +SpellBook_SkillTabOverFlowButton_b:Disable() diff --git a/extra_buttons_bar/Misc_DeathResFrame.lua b/extra_buttons_bar/Misc_DeathResFrame.lua new file mode 100644 index 0000000..4d15054 --- /dev/null +++ b/extra_buttons_bar/Misc_DeathResFrame.lua @@ -0,0 +1,85 @@ +local AIO = AIO or require("AIO") + +if AIO.AddAddon() then + return +end + +local MyHandlers = AIO.AddHandlers("DeathRessurect", {}) + +DeathCapitalTeleportButton = CreateFrame("Button", "DeathCapitalTeleportButton", UIParent, nil) +DeathCapitalTeleportButton:SetWidth(200) +DeathCapitalTeleportButton:SetHeight(100) +DeathCapitalTeleportButton:SetPoint("TOP", 0,-20) +DeathCapitalTeleportButton:SetNormalTexture("Interface\\AddOns\\AwAddons\\Textures\\misc\\pvprev") +--font +local DeathCapitalTeleportButton_text = DeathCapitalTeleportButton:CreateFontString("TicketMasterFrame_Title") +DeathCapitalTeleportButton_text:SetFontObject(GameFontNormal) +DeathCapitalTeleportButton_text:SetText("Resurrect\nin a capital city") +DeathCapitalTeleportButton_text:SetPoint("CENTER",32,0) +-- +DeathCapitalTeleportButton:SetFontString(DeathCapitalTeleportButton_text) +DeathCapitalTeleportButton:RegisterForClicks("AnyUp") +DeathCapitalTeleportButton:SetHighlightTexture("Interface\\AddOns\\AwAddons\\Textures\\misc\\pvprev_h") +DeathCapitalTeleportButton:SetScript("OnClick", function() +DeathDialog:Show() +end) +DeathCapitalTeleportButton:Hide() + +local DeathDialog = CreateFrame("Frame", "DeathDialog",DeathCapitalTeleportButton,nil) +DeathDialog:ClearAllPoints() +DeathDialog:SetBackdrop(StaticPopup1:GetBackdrop()) +DeathDialog:SetHeight(115) +DeathDialog:SetWidth(390) +DeathDialog:SetPoint("TOP", UIParent, 0, -215) +DeathDialog:Hide() + +DeathDialog.text = DeathDialog:CreateFontString(nil, "BACKGROUND", "GameFontHighlight") +--DeathDialog.text:SetAllPoints() +DeathDialog.text:SetFont("Fonts\\FRIZQT__.TTF", 11) +DeathDialog.text:SetText("Are you sure you want to be resurrected in a City? All of your items\n will take 100% durability damage,\n and you will be\n afflicted by 10 minutes of Resurrection Sickness.") +DeathDialog.text:SetPoint("TOP",0,-20) + + +DeathDialog.Alert = DeathDialog:CreateTexture("DeathDialog.Alert") +--DeathDialog.Alert:SetAllPoints() +DeathDialog.Alert:SetTexture("Interface\\DialogFrame\\UI-Dialog-Icon-AlertNew") +DeathDialog.Alert:SetSize(48,48) +DeathDialog.Alert:SetPoint("LEFT",24,0) + +DeathDialog.Yes = CreateFrame("Button", nil, DeathDialog, "StaticPopupButtonTemplate") +DeathDialog.Yes:SetWidth(110) +DeathDialog.Yes:SetHeight(19) +DeathDialog.Yes:SetPoint("BOTTOM", -60,15) +DeathDialog.Yes:SetScript("OnClick", function() + AIO.Handle("DeathRessurect", "Ressurect") + DeathDialog:Hide() + end) + + +DeathDialog.No = CreateFrame("Button", nil, DeathDialog, "StaticPopupButtonTemplate") +DeathDialog.No:SetWidth(110) +DeathDialog.No:SetHeight(19) +DeathDialog.No:SetPoint("BOTTOM", 60,15) +DeathDialog.No:SetScript("OnClick", function() + DeathDialog:Hide() + end) + +DeathDialog.Yes.text = DeathDialog.Yes:CreateFontString(nil, "BACKGROUND", "GameFontNormal") +DeathDialog.Yes.text:SetFont("Fonts\\FRIZQT__.TTF", 11) +DeathDialog.Yes.text:SetText("Accept") +DeathDialog.Yes.text:SetPoint("CENTER",0,1) + +DeathDialog.No.text = DeathDialog.No:CreateFontString(nil, "BACKGROUND", "GameFontNormal") +DeathDialog.No.text:SetFont("Fonts\\FRIZQT__.TTF", 11) +DeathDialog.No.text:SetText("Cancel") +DeathDialog.No.text:SetPoint("CENTER",0,1) + +DeathDialog.Yes:SetFontString(DeathDialog.Yes.text) +DeathDialog.No:SetFontString(DeathDialog.No.text) + +DeathDialog:SetScript("OnShow", function(self) +PlaySound("igMainMenuOpen") +end) +DeathDialog:SetScript("OnHide", function(self) +PlaySound("igMainMenuClose") +end) \ No newline at end of file diff --git a/extra_buttons_bar/ServerEBB.lua b/extra_buttons_bar/ServerEBB.lua new file mode 100644 index 0000000..ef62917 --- /dev/null +++ b/extra_buttons_bar/ServerEBB.lua @@ -0,0 +1,1131 @@ +local AIO = AIO or require("AIO") + + +local MyHandlers = AIO.AddHandlers("sideBar", {}) +local ghost = {8326} + +local scrollitem = 1101243 +local Reset_Level = { + [0] = {2500, 2700, 105}, + [10] = {5000, 7500, 150}, + [20] = {7500, 10000, 2150}, + [30] = {50000,150000,3250}, + [40] = {150000,300000,9250}, + [50] = {300000,1000000,10550}, + [60] = {350000,1500000,20000}, + [70] = {500000,2500000,20000}, + [80] = {500000,2500000,20000}, +} + +local function GetMoneyForReset(player,purgemissing) + local TalentMult = 0 + local SpellMult = 0 + local mult = 0 + local SQLMultQuery = CharDBQuery("SELECT ability_resets, talent_resets FROM custom_resets WHERE char_guid = "..player:GetGUIDLow()..";") + if not(SQLMultQuery) then + CharDBExecute("INSERT INTO custom_resets VALUES ("..player:GetGUIDLow()..",0,0);") + else + SpellMult = SQLMultQuery:GetInt32(0) + TalentMult = SQLMultQuery:GetInt32(1) + end +for k,v in pairs(Reset_Level) do + if (player:GetLevel() >= k) and (player:GetLevel() < k+10) then + + if (purgemissing == 1) then + mult = TalentMult + elseif (purgemissing == 2) then + mult = SpellMult + end + + local talent_cost = Reset_Level[k][purgemissing] + Reset_Level[k][3]*(player:GetLevel()-k+mult*2) + if (talent_cost>Reset_Level[k][purgemissing]*1.75) then + talent_cost = Reset_Level[k][purgemissing]*1.75 + end + return talent_cost,TalentMult,SpellMult + end +end +end + + function MyHandlers.GetMults(player) + local cost = 0 + local t_mult = 0 + local a_mult = 0 + cost, t_mult, a_mult = GetMoneyForReset(player, 1) + resetFrame_Refresh(AIO.Msg(), player,t_mult, a_mult):Send(player) +end + + function resetFrame_Refresh(msg,player,t_mult, a_mult) + return msg:Add("sideBar", "ResetFrame_Init", t_mult, a_mult) +end + +function MyHandlers.ReceivePlayerStats(player) + local player_guid = player:GetGUIDLow() + local stats_query = CharDBQuery("SELECT str, sta, agi, inte, spi FROM character_stat_allocation WHERE guid = "..player_guid) + local stat_point_query = CharDBQuery("SELECT points FROM character_stat_points WHERE guid = "..player_guid) + local stats = {stats_query:GetInt32(0), stats_query:GetInt32(1), stats_query:GetInt32(2), stats_query:GetInt32(3), stats_query:GetInt32(4), stat_point_query:GetInt32(0)} + sendStatsToPlayer(AIO.Msg(), player, stats):Send(player) +end + + + +function MyHandlers.AddStats(player, stat, s_amount) + if (s_amount) then + --AIO ADDITIONAL CHECK-- + local expectedData = {"number","number"} + local values = {stat,s_amount} + if not(DataTypeCheck(expectedData, values)) then + return false + end + --MAIN ACTION-- + else + --AIO ADDITIONAL CHECK-- + local expectedData = {"number"} + local values = {stat} + if not(DataTypeCheck(expectedData, values)) then + return false + end + --MAIN ACTION-- + end + -- stat values equal >>>>> 1 = strength | 2 = stamina | 3 = agility | 4 = intellect | 5 = spirit + + local stat_names = {"str", "sta", "agi", "inte", "spi"} + local player_guid = player:GetGUIDLow() + local stat_point_query = CharDBQuery("SELECT points FROM character_stat_points WHERE guid = "..player_guid) + local point_val = stat_point_query:GetInt32(0) + local stats_query = CharDBQuery("SELECT str, sta, agi, inte, spi FROM character_stat_allocation WHERE guid = "..player_guid) + local stats = {stats_query:GetInt32(0), stats_query:GetInt32(1), stats_query:GetInt32(2), stats_query:GetInt32(3), stats_query:GetInt32(4)} + local range = {[9]=(player:GetLevel() + 4), [19]=((player:GetLevel() * 2) - 5), [29]=((player:GetLevel() * 3) - 24), [39]=((player:GetLevel() * 4) - 53), [59]=((player:GetLevel() * 5) - 92), [69]=((player:GetLevel() * 10) - 387)} + local levels = {9, 19, 29, 39, 59, 69} + local amount = 1 + if (s_amount) then + if (s_amount <= point_val) then + amount = s_amount + elseif (point_val > 0) and (point_val 0 then + if (player:GetLevel() <= 9) then + if point_val + (stats[1] + stats[2] + stats[3] + stats[4] + stats[5]) ~= range[9] then + local point_max = range[9] + point_max = point_max - (stats[1] + stats[2] + stats[3] + stats[4] + stats[5]) + point_val = point_max + end + point_val = point_val - amount + CharDBExecute("UPDATE character_stat_points SET points = "..point_val.." WHERE guid = "..player_guid) + elseif (player:GetLevel() <= 19) then + if point_val + (stats[1] + stats[2] + stats[3] + stats[4] + stats[5]) ~= range[19] then + local point_max = range[19] + point_max = point_max - (stats[1] + stats[2] + stats[3] + stats[4] + stats[5]) + point_val = point_max + end + point_val = point_val - amount + CharDBExecute("UPDATE character_stat_points SET points = "..point_val.." WHERE guid = "..player_guid) + elseif (player:GetLevel() <= 29) then + if point_val + (stats[1] + stats[2] + stats[3] + stats[4] + stats[5]) ~= range[29] then + local point_max = range[29] + point_max = point_max - (stats[1] + stats[2] + stats[3] + stats[4] + stats[5]) + point_val = point_max + end + point_val = point_val - amount + CharDBExecute("UPDATE character_stat_points SET points = "..point_val.." WHERE guid = "..player_guid) + elseif (player:GetLevel() <= 39) then + if point_val + (stats[1] + stats[2] + stats[3] + stats[4] + stats[5]) ~= range[39] then + local point_max = range[39] + point_max = point_max - (stats[1] + stats[2] + stats[3] + stats[4] + stats[5]) + point_val = point_max + end + point_val = point_val - amount + CharDBExecute("UPDATE character_stat_points SET points = "..point_val.." WHERE guid = "..player_guid) + elseif (player:GetLevel() <= 59) then + if point_val + (stats[1] + stats[2] + stats[3] + stats[4] + stats[5]) ~= range[59] then + local point_max = range[59] + point_max = point_max - (stats[1] + stats[2] + stats[3] + stats[4] + stats[5]) + point_val = point_max + end + point_val = point_val - amount + CharDBExecute("UPDATE character_stat_points SET points = "..point_val.." WHERE guid = "..player_guid) + else--if (player:GetLevel() <= 69) then + if point_val + (stats[1] + stats[2] + stats[3] + stats[4] + stats[5]) ~= range[69] then + local point_max = range[69] + point_max = point_max - (stats[1] + stats[2] + stats[3] + stats[4] + stats[5]) + point_val = point_max + end + point_val = point_val - amount + CharDBExecute("UPDATE character_stat_points SET points = "..point_val.." WHERE guid = "..player_guid) + end + + local stat_use = stat_names[stat] + + + stats_query = CharDBQuery("SELECT "..stat_use.." FROM character_stat_allocation WHERE guid = "..player_guid) + local stat_value = stats_query:GetInt32(0) + + + stat_value = stat_value + amount + + CharDBExecute("UPDATE character_stat_allocation set "..stat_use.." = "..stat_value.." WHERE guid = "..player_guid) + + + stats_query = CharDBQuery("SELECT str, sta, agi, inte, spi FROM character_stat_allocation WHERE guid = "..player_guid) + + stats = {stats_query:GetInt32(0), stats_query:GetInt32(1), stats_query:GetInt32(2), stats_query:GetInt32(3), stats_query:GetInt32(4), point_val} + stats[stat] = stat_value + + + + sendStatsToPlayer(AIO.Msg(), player, stats):Send(player) + player_stat_auras(player, stats) + + + else + + player:SendBroadcastMessage("You do not have enough points to do that!") + end + else + player:SendBroadcastMessage("You cannot do that while dead!") + end + end + end +end + + + + +function MyHandlers.ReduceStats(player, stat, s_amount) + if (s_amount) then + --AIO ADDITIONAL CHECK-- + local expectedData = {"number","number"} + local values = {stat,s_amount} + if not(DataTypeCheck(expectedData, values)) then + return false + end + --MAIN ACTION-- + else + --AIO ADDITIONAL CHECK-- + local expectedData = {"number"} + local values = {stat} + if not(DataTypeCheck(expectedData, values)) then + return false + end + --MAIN ACTION-- + end + -- stat values equal >>>>> 1 = strength | 2 = stamina | 3 = agility | 4 = intellect | 5 = spirit + local stat_names = {"str", "sta", "agi", "inte", "spi"} + local player_guid = player:GetGUIDLow() + local stats_query = CharDBQuery("SELECT str, sta, agi, inte, spi FROM character_stat_allocation WHERE guid = "..player_guid) + local points_query = CharDBQuery("SELECT points FROM character_stat_points WHERE guid = "..player_guid) + local point_val = points_query:GetInt32(0) + local stats = {stats_query:GetInt32(0), stats_query:GetInt32(1), stats_query:GetInt32(2), stats_query:GetInt32(3), stats_query:GetInt32(4)} + local range = {[9]=(player:GetLevel() + 4), [19]=((player:GetLevel() * 2) - 5), [29]=((player:GetLevel() * 3) - 24), [39]=((player:GetLevel() * 4) - 53), [59]=((player:GetLevel() * 5) - 92), [69]=((player:GetLevel() * 10) - 387)} + local levels = {9, 19, 29, 39, 59, 69} + local amount = 1 + if (s_amount) then + if (s_amount <= stats[stat]) then + amount = s_amount + elseif (stats[stat] > 0) and (stats[stat] 0 then + if (player:GetLevel() <= 9) then + if point_val + (stats[1] + stats[2] + stats[3] + stats[4] + stats[5]) ~= range[9] then + local point_max = range[9] + point_max = point_max - (stats[1] + stats[2] + stats[3] + stats[4] + stats[5]) + point_val = point_max + end + point_val = point_val + amount + CharDBExecute("UPDATE character_stat_points SET points = "..point_val.." WHERE guid = "..player_guid) + elseif (player:GetLevel() <= 19) then + if point_val + (stats[1] + stats[2] + stats[3] + stats[4] + stats[5]) ~= range[19] then + local point_max = range[19] + point_max = point_max - (stats[1] + stats[2] + stats[3] + stats[4] + stats[5]) + point_val = point_max + end + point_val = point_val + amount + CharDBExecute("UPDATE character_stat_points SET points = "..point_val.." WHERE guid = "..player_guid) + elseif (player:GetLevel() <= 29) then + if point_val + (stats[1] + stats[2] + stats[3] + stats[4] + stats[5]) ~= range[29] then + local point_max = range[29] + point_max = point_max - (stats[1] + stats[2] + stats[3] + stats[4] + stats[5]) + point_val = point_max + end + point_val = point_val + amount + CharDBExecute("UPDATE character_stat_points SET points = "..point_val.." WHERE guid = "..player_guid) + elseif (player:GetLevel() <= 39) then + if point_val + (stats[1] + stats[2] + stats[3] + stats[4] + stats[5]) ~= range[39] then + local point_max = range[39] + point_max = point_max - (stats[1] + stats[2] + stats[3] + stats[4] + stats[5]) + point_val = point_max + end + point_val = point_val + 1 + CharDBExecute("UPDATE character_stat_points SET points = "..point_val.." WHERE guid = "..player_guid) + elseif (player:GetLevel() <= 59) then + if point_val + (stats[1] + stats[2] + stats[3] + stats[4] + stats[5]) ~= range[59] then + local point_max = range[59] + point_max = point_max - (stats[1] + stats[2] + stats[3] + stats[4] + stats[5]) + point_val = point_max + end + point_val = point_val + amount + CharDBExecute("UPDATE character_stat_points SET points = "..point_val.." WHERE guid = "..player_guid) + else--if (player:GetLevel() <= 69) then + if point_val + (stats[1] + stats[2] + stats[3] + stats[4] + stats[5]) ~= range[69] then + local point_max = range[69] + point_max = point_max - (stats[1] + stats[2] + stats[3] + stats[4] + stats[5]) + point_val = point_max + end + point_val = point_val + amount + CharDBExecute("UPDATE character_stat_points SET points = "..point_val.." WHERE guid = "..player_guid) + end + + + local stat_value = stats[stat] - amount + CharDBExecute("UPDATE character_stat_allocation set "..stat_names[stat].." = "..stat_value.." WHERE guid = "..player_guid) + + stats_query = CharDBQuery("SELECT str, sta, agi, inte, spi FROM character_stat_allocation WHERE guid = "..player_guid) + local stats = {stats_query:GetInt32(0), stats_query:GetInt32(1), stats_query:GetInt32(2), stats_query:GetInt32(3), stats_query:GetInt32(4), point_val} + + stats[stat] = stat_value + + + + sendStatsToPlayer(AIO.Msg(), player, stats):Send(player) + player_stat_auras(player, stats) + + + + else + player:SendBroadcastMessage("You do not have any points in that stat") + end + else + player:SendBroadcastMessage("You cannot do that while dead!") + end + end + end +end + + + + + + +function sendStatsToPlayer(msg, player, stats) + + return msg:Add("sideBar", "GetStatValues", stats) + +end + + + +local function OnPlayerLogin(event, player) -- Caps out at 302 stats wont show beyond level 69, NEVER WIPE AGAIN unless no one has reached level 70:D + local player_guid = player:GetGUIDLow() + local stats_query = CharDBQuery("SELECT str, sta, agi, inte, spi FROM character_stat_allocation WHERE guid = "..player_guid.."") + local points_query = CharDBQuery("SELECT points FROM character_stat_points WHERE guid = "..player_guid.."") + if not(stats_query or points_query) then + return false + end + local statsq = {stats_query:GetInt32(0), stats_query:GetInt32(1), stats_query:GetInt32(2), stats_query:GetInt32(3), stats_query:GetInt32(4)} + --for _,v in pairs(statsq) do + if ((statsq[1] + statsq[2] + statsq[3] + statsq[4] + statsq[5]) == 0) then + if (player:GetLevel() <= 9) then + local init_points = player:GetLevel() + 4 + CharDBExecute("REPLACE INTO character_stat_points(guid, points) VALUES("..player_guid..","..init_points..")") + elseif (player:GetLevel() <= 19) then + local init_points = ((player:GetLevel() * 2) - 5) + CharDBExecute("REPLACE INTO character_stat_points(guid, points) VALUES("..player_guid..","..init_points..")") + elseif (player:GetLevel() <= 29) then + local init_points = ((player:GetLevel() * 3) - 24) + CharDBExecute("REPLACE INTO character_stat_points(guid, points) VALUES("..player_guid..","..init_points..")") + elseif (player:GetLevel() <= 39) then + local init_points = ((player:GetLevel() * 4) - 53) + CharDBExecute("REPLACE INTO character_stat_points(guid, points) VALUES("..player_guid..","..init_points..")") + elseif (player:GetLevel() <= 59) then + local init_points = ((player:GetLevel() * 5) - 92) + CharDBExecute("REPLACE INTO character_stat_points(guid, points) VALUES("..player_guid..","..init_points..")") + else--if (player:GetLevel() <= 69) then + local init_points = ((player:GetLevel() * 10) - 387) + CharDBExecute("REPLACE INTO character_stat_points(guid, points) VALUES("..player_guid..","..init_points..")") + end + else + local stats = {stats_query:GetInt32(0), stats_query:GetInt32(1), stats_query:GetInt32(2), stats_query:GetInt32(3), stats_query:GetInt32(4)} + player_stat_auras(player, stats) + player:DealHeal(player, 818037, 500000) + end + end + + +function player_stat_auras(player, stats) + local stat_auras = {7464, 7477, 7471, 7468, 7474} + for i,v in ipairs(stats) do + if v == 0 and player:HasAura(stat_auras[i]) == true then + player:RemoveAura(stat_auras[i], player) + + elseif v ~= 0 then + + if player:HasAura(stat_auras[i]) == false then + player:AddAura(stat_auras[i], player) + --print("adding aura") + end + + local stack_amount = stats[i] + local aura = player:GetAura(stat_auras[i]) + aura:SetStackAmount(stack_amount) + + + end + end +end + +local function OnRevive(event, player) + local player_guid = player:GetGUIDLow() + local stats_query = CharDBQuery("SELECT str, sta, agi, inte, spi FROM character_stat_allocation WHERE guid = "..player_guid.."") + if not(stats_query) then + return false + end + local stats = {stats_query:GetInt32(0), stats_query:GetInt32(1), stats_query:GetInt32(2), stats_query:GetInt32(3), stats_query:GetInt32(4)} + player_stat_auras(player, stats) +end + +local function OnLevelChange(event, player, oldLevel) + + local player_guid = player:GetGUIDLow() + --resets part-- + if (oldLevel == 9) or (oldLevel == 19) or (oldLevel == 29) or (oldLevel == 39) or (oldLevel == 49) or (oldLevel == 59) then + CharDBExecute("DELETE FROM custom_resets WHERE char_guid = "..player_guid..";") + resetFrame_Refresh(AIO.Msg(), player,0, 0):Send(player) + end + + local points_query = CharDBQuery("SELECT points FROM character_stat_points WHERE guid = "..player_guid) + local point_val = points_query:GetInt32(0) + if (player:GetLevel() <= 9) then + point_val = point_val + 1 + CharDBExecute("UPDATE character_stat_points SET points = "..point_val.." WHERE guid = "..player_guid) + elseif (player:GetLevel() <= 19) then + point_val = point_val + 2 + CharDBExecute("UPDATE character_stat_points SET points = "..point_val.." WHERE guid = "..player_guid) + elseif (player:GetLevel() <= 29) then + point_val = point_val + 3 + CharDBExecute("UPDATE character_stat_points SET points = "..point_val.." WHERE guid = "..player_guid) + elseif (player:GetLevel() <= 39) then + point_val = point_val + 4 + CharDBExecute("UPDATE character_stat_points SET points = "..point_val.." WHERE guid = "..player_guid) + elseif (player:GetLevel() <= 59) then + point_val = point_val + 5 + CharDBExecute("UPDATE character_stat_points SET points = "..point_val.." WHERE guid = "..player_guid) + elseif (player:GetLevel() <= 69) then + point_val = point_val + 10 + CharDBExecute("UPDATE character_stat_points SET points = "..point_val.." WHERE guid = "..player_guid) + else--if (player:GetLevel() <= 80) then + point_val = point_val + 20 + CharDBExecute("UPDATE character_stat_points SET points = "..point_val.." WHERE guid = "..player_guid) + end + + local stats_query = CharDBQuery("SELECT str, sta, agi, inte, spi FROM character_stat_allocation WHERE guid = "..player_guid) + local stats = {stats_query:GetInt32(0), stats_query:GetInt32(1), stats_query:GetInt32(2), stats_query:GetInt32(3), stats_query:GetInt32(4), point_val} + + sendStatsToPlayer(AIO.Msg(), player, stats):Send(player) + +end + +RegisterPlayerEvent(36, OnRevive) +RegisterPlayerEvent(13, OnLevelChange) +RegisterPlayerEvent(3, OnPlayerLogin) + + +noTEspells = {54785, 50589, 818050, 50581, 59671, 21849, 21850, 26991, 48470, 21562, 21564, 25782, 25916, 27141, 27681, 10143, 8121, 7763, 10937, 10938, 9884, 1373} + +function MyHandlers.ResetSpells(player) + local free_spell_reset = false + if (player:GetLevel() < 10) then + free_spell_reset = true + end + local cost = GetMoneyForReset(player,2) + local all_spell_lists = {druid_balance_spells, druid_feral_spells, druid_restoration_spells, + hunter_beastmastery_spells, hunter_marksmanship_spells, hunter_survival_spells, + mage_arcane_spells, mage_fire_spells, mage_frost_spells, + paladin_holy_spells, paladin_protection_spells, paladin_retribution_spells, + priest_discipline_spells, priest_holy_spells, priest_shadow_spells, + rogue_assassination_spells, rogue_combat_spells, rogue_subtlety_spells, + shaman_elemental_spells, shaman_enhancement_spells, shaman_restoration_spells, + warlock_affliction_spells, warlock_demonology_spells, warlock_destruction_spells, + warrior_arms_spells, warrior_fury_spells, warrior_protection_spells, general_spells} + if (player:InArena() == true or player:InBattleground() == true) then + player:SendBroadcastMessage("You can't do that in Battlegrounds and Arenas.") + else + if player:HasItem(spell_reset_token) == true or free_spell_reset == true or (player:GetCoinage() >= cost) then + if (player:HasItem(spell_reset_token) == true or free_spell_reset == true) then + if not(free_spell_reset) then + player:RemoveItem(spell_reset_token, 1) + end + else + player:ModifyMoney(-cost) + end + --local noTEspells = {54785, 674, 50589, 107, 3127, 818050, 774994, 50581, 59671, 11417, 11420, 11418, 3567, 3566, 3563, 11419, 11416, 10059, 3565, 3562, 3561, 21849, 21850, 26991, 48470, 21562, 21564, 25782, 25916, 27141, 27681, 49360, 49359, 49361, 49358, 10143, 8121, 7763, 10937, 10938, 9884, 1373} + -- commited list with general spells tab + for s, sid in pairs(noTEspells) do + if player:HasSpell(sid) then + player:RemoveSpell(sid) + end + end + for listloc,spec in ipairs(all_spell_lists) do + for loc,spell in ipairs(spec) do + local AE_cost = spell[2] + local TE_cost = spell[3] + local spellid = spell[1] + + if player:HasSpell(spellid) == true then + player:RemoveSpell(spellid) + player:AddItem(spell_essence, AE_cost) + if TE_cost ~= 0 then + player:Additem(talent_essence, TE_cost) + end + if player:HasAura(spellid) == true then + player:RemoveAura(spellid) + end + end + end + end + --custom mult part + --player:RemoveItem(spell_essence, player:GetItemCount(spell_essence)) + --player:AddItem(spell_essence, player:GetLevel()) + CharDBExecute("UPDATE custom_resets SET ability_resets = ability_resets+1 WHERE char_guid = "..player:GetGUIDLow()..";") + local temp_cost, temp_t_mult, temp_a_mult = GetMoneyForReset(player, 1) + resetFrame_Refresh(AIO.Msg(), player,temp_t_mult, temp_a_mult+1):Send(player) + -- + player:RemoveAura(774993) + player:RemoveAura(774994) + player:CastSpell(player, 65632) + player:SendBroadcastMessage("Refund Complete for Spells") + else + player:SendBroadcastMessage("You are missing the required token to do this!") + end + end +end + + +function MyHandlers.ResetTalents(player) + local cost = GetMoneyForReset(player,1) + local all_talent_lists = {druid_balance_talents, druid_feral_talents, druid_restoration_talents, + hunter_beastmastery_talents, hunter_marksmanship_talents, hunter_survival_talents, + mage_arcane_talents, mage_fire_talents, mage_frost_talents, + paladin_holy_talents, paladin_protection_talents, paladin_retribution_talents, + priest_discipline_talents, priest_holy_talents, priest_shadow_talents, + rogue_assassination_talents, rogue_combat_talents, rogue_subtlety_talents, + shaman_elemental_talents, shaman_enhancement_talents, shaman_restoration_talents, + warlock_affliction_talents, warlock_demonology_talents, warlock_destruction_talents, + warrior_arms_talents, warrior_fury_talents, warrior_protection_talents} + if (player:InArena() == true or player:InBattleground() == true) then + player:SendBroadcastMessage("You can't do that in Battlegrounds and Arenas.") + else + if player:HasItem(talent_reset_token) == true or free_talent_reset == true or (player:GetCoinage() >= cost) then + if (player:HasItem(talent_reset_token) == true or free_talent_reset == true) then + player:RemoveItem(talent_reset_token, 1) + else + player:ModifyMoney(-cost) + end + for i,v in ipairs(all_talent_lists) do + + for listloc,talent in ipairs(v) do + local spell_removed = false + local rank_removed = 0 + local AE_cost = talent[3] + local TE_cost = talent[4] + for slot,spellid in ipairs(talent[2]) do + if player:HasSpell(spellid) == true then + spell_removed = true + rank_removed = slot + player:RemoveSpell(spellid) + + if player:HasAura(spellid) == true then + player:RemoveAura(spellid) + end + + player:SendBroadcastMessage("removing: "..spellid) + end + end + + if spell_removed == true then + player:AddItem(talent_essence, (rank_removed*TE_cost)) + if AE_cost ~= 0 then + player:AddItem(spell_essence, (rank_removed*AE_cost)) + end + end + end + end + --custom mult part + --player:RemoveItem(talent_essence, player:GetItemCount(talent_essence)) + --player:AddItem(talent_essence, player:GetLevel()-9) + CharDBExecute("UPDATE custom_resets SET talent_resets = talent_resets+1 WHERE char_guid = "..player:GetGUIDLow()..";") + local temp_cost, temp_t_mult, temp_a_mult = GetMoneyForReset(player, 1) + resetFrame_Refresh(AIO.Msg(), player,temp_t_mult+1, temp_a_mult):Send(player) + -- + player:CastSpell(player, 65632) + player:SendBroadcastMessage("Refund Complete for talents") + else + player:SendBroadcastMessage("You are missing the required token to do this!") + end + + end +end + + function GetRightSpellTables(class,Spec) +local spell_count = nil +local spell_list = nil + + if class == "DRUID" and Spec == "BALANCE" then + spell_count = druid_balance_spells_count + spell_list = druid_balance_spells + elseif class == "DRUID" and Spec == "FERAL" then + spell_count = druid_feral_spells_count + spell_list = druid_feral_spells + elseif class == "DRUID" and Spec == "RESTORATION" then + spell_count = druid_restoration_spells_count + spell_list = druid_restoration_spells + elseif class == "HUNTER" and Spec == "BEASTMASTERY" then + spell_count = hunter_beastmastery_spells_count + spell_list = hunter_beastmastery_spells + elseif class == "HUNTER" and Spec == "MARKSMANSHIP" then + spell_count = hunter_marksmanship_spells_count + spell_list = hunter_marksmanship_spells + elseif class == "HUNTER" and Spec == "SURVIVAL" then + spell_count = hunter_survival_spells_count + spell_list = hunter_survival_spells + elseif class == "MAGE" and Spec == "ARCANE" then + spell_count = mage_arcane_spells_count + spell_list = mage_arcane_spells + elseif class == "MAGE" and Spec == "FIRE" then + spell_count = mage_fire_spells_count + spell_list = mage_fire_spells + elseif class == "MAGE" and Spec == "FROST" then + spell_count = mage_frost_spells_count + spell_list = mage_frost_spells + elseif class == "PALADIN" and Spec == "HOLY" then + spell_count = paladin_holy_spells_count + spell_list = paladin_holy_spells + elseif class == "PALADIN" and Spec == "RETRIBUTION" then + spell_count = paladin_retribution_spells_count + spell_list = paladin_retribution_spells + elseif class == "PALADIN" and Spec == "PROTECTION" then + spell_count = paladin_protection_spells_count + spell_list = paladin_protection_spells + elseif class == "PRIEST" and Spec == "DISCIPLINE" then + spell_count = priest_discipline_spells_count + spell_list = priest_discipline_spells + elseif class == "PRIEST" and Spec == "HOLY" then + spell_count = priest_holy_spells_count + spell_list = priest_holy_spells + elseif class == "PRIEST" and Spec == "SHADOW" then + spell_count = priest_shadow_spells_count + spell_list = priest_shadow_spells + elseif class == "ROGUE" and Spec == "ASSASSINATION" then + spell_count = rogue_assassination_spells_count + spell_list = rogue_assassination_spells + elseif class == "ROGUE" and Spec == "COMBAT" then + spell_count = rogue_combat_spells_count + spell_list = rogue_combat_spells + elseif class == "ROGUE" and Spec == "SUBTLETY" then + spell_count = rogue_subtlety_spells_count + spell_list = rogue_subtlety_spells + elseif class == "SHAMAN" and Spec == "ELEMENTAL" then + spell_count = shaman_elemental_spells_count + spell_list = shaman_elemental_spells + elseif class == "SHAMAN" and Spec == "ENHANCEMENT" then + spell_count = shaman_enhancement_spells_count + spell_list = shaman_enhancement_spells + elseif class == "SHAMAN" and Spec == "RESTORATION" then + spell_count = shaman_restoration_spells_count + spell_list = shaman_restoration_spells + elseif class == "WARLOCK" and Spec == "AFFLICTION" then + spell_count = warlock_affliction_spells_count + spell_list = warlock_affliction_spells + elseif class == "WARLOCK" and Spec == "DEMONOLOGY" then + spell_count = warlock_demonology_spells_count + spell_list = warlock_demonology_spells + elseif class == "WARLOCK" and Spec == "DESTRUCTION" then + spell_count = warlock_destruction_spells_count + spell_list = warlock_destruction_spells + elseif class == "WARRIOR" and Spec == "ARMS" then + spell_count = warrior_arms_spells_count + spell_list = warrior_arms_spells + elseif class == "WARRIOR" and Spec == "FURY" then + spell_count = warrior_fury_spells_count + spell_list = warrior_fury_spells + elseif class == "WARRIOR" and Spec == "PROTECTION" then + spell_count = warrior_protection_spells_count + spell_list = warrior_protection_spells + elseif class == "GENERAL" and Spec == "GENERAL" then + spell_count = general_spells_count + spell_list = general_spells + end +return spell_count, spell_list + +end + +function MyHandlers.SendAmountOfSpells(player, class, Spec) + --AIO ADDITIONAL CHECK-- + local expectedData = {"string","string"} + local values = {class,Spec} + if not(DataTypeCheck(expectedData, values)) then + return false + end + --MAIN ACTION-- + + local pass_1, pass_2 = GetRightSpellTables(class,Spec) + sendAmountOfSpells(AIO.Msg(), player, pass_1, pass_2):Send(player) + +end + +function sendAmountOfSpells(msg, player, spellCount, spellList) + + return msg:Add("sideBar", "GetSpellCount", spellCount, spellList) + +end + +function sendButtonToChangeSpells(msg, player, i) + + return msg:Add("sideBar", "ChangeLearnButton", i) + +end + + +function MyHandlers.LearnThisSpell(player, got_spell, i,class,spec) + + --AIO ADDITIONAL CHECK-- + local expectedData = {{"number","number","number"},"number","string","string"} + local values = {got_spell,i,class,spec} + if not(DataTypeCheck(expectedData, values)) then + return false + end + --MAIN ACTION-- + + local successful = true + local player_has_currency = true + + local currency_one = nil + local currency_two = nil + local spellID = nil + local LevelReq = nil + + local countofspells, spells = GetRightSpellTables(class,spec) + if not(spells) then + successful = false + else + for k,v in pairs(spells) do + if (v[1] == got_spell[1]) then + currency_one = v[2] + currency_two = v[3] + spellID = v[1] + LevelReq = v[4] + end + end + end + + if not(spellID) or player:HasSpell(spellID) then + successful = false + end + + if (LevelReq > player:GetLevel()) then + successful = false + end + + if currency_one ~= 0 then + if player:HasItem(spell_essence, currency_one) == false then + player_has_currency = false + successful = false + end + end + + if currency_two ~= 0 then + if player:HasItem(talent_essence, currency_two) == false then + player_has_currency = false + successful = false + end + end + + if player_has_currency == true and currency_one ~= 0 then + player:RemoveItem(spell_essence, currency_one) + end + + if player_has_currency == true and currency_two ~= 0 then + player:RemoveItem(talent_essence, currency_two) + end + + if successful == true then + player:CastSpell(player, 966006) + player:LearnSpell(spellID) + --player:SaveToDB() + end + + if successful == false then + player:SendBroadcastMessage("You do not have the required currency!") + + else + sendButtonToChangeSpells(AIO.Msg(), player, i):Send(player) + end + +end + + +--unlearn this spell part-- +function sendButtonToChangeSpellsBack(msg, player, i,spellID,currency_one,currency_two) + return msg:Add("sideBar", "ChangeLearnButtonBack", i,spellID,currency_one,currency_two) + +end + +function MyHandlers.UnLearnThisSpell(player, got_spell, i,class,spec) + + --AIO ADDITIONAL CHECK-- + local expectedData = {"number","number","string","string"} + local values = {got_spell,i,class,spec} + if not(DataTypeCheck(expectedData, values)) then + return false + end + --MAIN ACTION-- + + local successful = true + + local currency_one = nil + local currency_two = nil + local spellID = nil + local LevelReq = nil + local spell = nil + + local countofspells, spells = GetRightSpellTables(class,spec) + for k,v in pairs(spells) do + if (v[1] == got_spell) then + currency_one = v[2] + currency_two = v[3] + spellID = v[1] + LevelReq = v[4] + end + end + + if (not(spellID)) or (LevelReq > player:GetLevel()) or (not(player:HasItem(scrollitem))) or (not(player:HasSpell(spellID))) then + successful = false + end + + if successful == false then + player:SendBroadcastMessage("You can't unlearn this spell!") + + else + player:RemoveItem(scrollitem,1) + player:RemoveSpell(spellID) + if (currency_one) then + player:AddItem( spell_essence, currency_one ) + end + if (currency_two) then + player:AddItem( talent_essence, currency_two ) + end + sendButtonToChangeSpellsBack(AIO.Msg(), player, i,spellID, currency_one, currency_two):Send(player) + end + +end +--end of unlearn this spell part-- +function MyHandlers.GetAllBGs(player, ClassSpec) + + --AIO ADDITIONAL CHECK-- + local expectedData = {"string"} + local values = {ClassSpec} + if not(DataTypeCheck(expectedData, values)) then + return false + end + --MAIN ACTION-- + + local bgList = {druid_balance_bgs, druid_feral_bgs, druid_restoration_bgs, + hunter_beastmastery_bgs, hunter_marksmanship_bgs, hunter_survival_bgs, + mage_arcane_bgs, mage_fire_bgs, mage_frost_bgs, + paladin_holy_bgs, paladin_protection_bgs, paladin_retribution_bgs, + priest_discipline_bgs, priest_holy_bgs, priest_shadow_bgs, + rogue_assassination_bgs, rogue_combat_bgs, rogue_subtlety_bgs, + shaman_elemental_bgs, shaman_enhancement_bgs, shaman_restoration_bgs, + warlock_affliction_bgs, warlock_demonology_bgs, warlock_destruction_bgs, + warrior_arms_bgs, warrior_fury_bgs, warrior_protection_bgs} + + local talentList = {} + local tabIndex = 0 + + local ClassSpecList = {"DRUIDBALANCE", "DRUIDFERAL", "DRUIDRESTORATION", + "HUNTERBEASTMASTERY", "HUNTERMARKSMANSHIP", "HUNTERSURVIVAL", + "MAGEARCANE", "MAGEFIRE", "MAGEFROST", + "PALADINHOLY", "PALADINPROTECTION", "PALADINRETRIBUTION", + "PRIESTDISCIPLINE", "PRIESTHOLY", "PRIESTSHADOW", + "ROGUEASSASSINATION", "ROGUECOMBAT", "ROGUESUBTLETY", + "SHAMANELEMENTAL", "SHAMANENHANCEMENT", "SHAMANRESTORATION", + "WARLOCKAFFLICTION", "WARLOCK", "DEMONOLOGY", "WARLOCKDESTRUCTION", + "WARRIORARMS", "WARRIORFURY", "WARRIORPROTECTION"} + + local ListOfTalentLists = {druid_balance_talents, druid_feral_talents, druid_restoration_talents, + hunter_beastmastery_talents, hunter_marksmanship_talents, hunter_survival_talents, + mage_arcane_talents, mage_fire_talents, mage_frost_talents, + paladin_holy_talents, paladin_protection_talents, paladin_retribution_talents, + priest_discipline_talents, priest_holy_talents, priest_shadow_talents, + rogue_assassination_talents, rogue_combat_talents, rogue_subtlety_talents, + shaman_elemental_talents, shaman_enhancement_talents, shaman_restoration_talents, + warlock_affliction_talents, warlock_demonology_talents, warlock_destruction_talents, + warrior_arms_talents, warrior_fury_talents, warrior_protection_talents} + local ListOfTabIndexes = {druid_balance_talents_tab, druid_feral_talents_tab, druid_restoration_talents_tab, + hunter_beastmastery_talents_tab, hunter_marksmanship_talents_tab, hunter_survival_talents_tab, + mage_arcane_talents_tab, mage_fire_talents_tab, mage_frost_talents_tab, + paladin_holy_talents_tab, paladin_protection_talents_tab, paladin_retribution_talents_tab, + priest_discipline_talents_tab, priest_holy_talents_tab, priest_shadow_talents_tab, + rogue_assassination_talents_tab, rogue_combat_talents_tab, rogue_subtlety_talents_tab, + shaman_elemental_talents_tab, shaman_enhancement_talents_tab, shaman_restoration_talents_tab, + warlock_affliction_talents_tab, warlock_demonology_talents_tab, warlock_destruction_talents_tab, + warrior_arms_talents_tab, warrior_fury_talents_tab, warrior_protection_talents_tab} + + for i,v in ipairs(ClassSpecList) do + if ClassSpec == v then + talentList = ListOfTalentLists[i] + tabIndex = ListOfTabIndexes[i] + end + end + + local known_talents_list = {} + + for i,v in ipairs(talentList) do + local spellids = v[2] + local know_a_spell = false + + for p,t in ipairs(spellids) do + if player:HasSpell(t) == true then + know_a_spell = p + end + end + + table.insert(known_talents_list, know_a_spell) + + end + + sendBGListToPlayer(AIO.Msg(), player, ClassSpec, bgList, talentList, known_talents_list, tabIndex):Send(player) + +end + + +function sendBGListToPlayer(msg, player, ClassSpec, bgList, talentList, known_talents_list, tabIndex) + + return msg:Add("sideBar", "SetBackgroundImages", ClassSpec, bgList, talentList, known_talents_list, tabIndex) + +end + + +function MyHandlers.LearnThisTalent(player, attached_talent, indexAt,ClassSpec) + --AIO ADDITIONAL CHECK-- + local expectedData = {{"number","number","number",{},"number"},"number","string"} + local values = {attached_talent,indexAt,ClassSpec} + if not(DataTypeCheck(expectedData, values)) then + return false + end + for k,v in pairs(attached_talent[4]) do + expectedData = {"number"} + values = {v} + if not(DataTypeCheck(expectedData, values)) then + return false + end + end + --MAIN ACTION-- + + local talentList = nil + local successful = true + local player_has_currency = true + local currency_one = nil + local currency_two = nil + local spellID = nil + local LevelReq = nil + --preventing any spell learn hack-- + --HACKFIX, VERY FUCKING HACK FIX OF HACK-- + local ClassSpecList = {"DRUIDBALANCE", "DRUIDFERAL", "DRUIDRESTORATION", + "HUNTERBEASTMASTERY", "HUNTERMARKSMANSHIP", "HUNTERSURVIVAL", + "MAGEARCANE", "MAGEFIRE", "MAGEFROST", + "PALADINHOLY", "PALADINPROTECTION", "PALADINRETRIBUTION", + "PRIESTDISCIPLINE", "PRIESTHOLY", "PRIESTSHADOW", + "ROGUEASSASSINATION", "ROGUECOMBAT", "ROGUESUBTLETY", + "SHAMANELEMENTAL", "SHAMANENHANCEMENT", "SHAMANRESTORATION", + "WARLOCKAFFLICTION", "WARLOCK", "DEMONOLOGY", "WARLOCKDESTRUCTION", + "WARRIORARMS", "WARRIORFURY", "WARRIORPROTECTION"} + + local ListOfTalentLists = {druid_balance_talents, druid_feral_talents, druid_restoration_talents, + hunter_beastmastery_talents, hunter_marksmanship_talents, hunter_survival_talents, + mage_arcane_talents, mage_fire_talents, mage_frost_talents, + paladin_holy_talents, paladin_protection_talents, paladin_retribution_talents, + priest_discipline_talents, priest_holy_talents, priest_shadow_talents, + rogue_assassination_talents, rogue_combat_talents, rogue_subtlety_talents, + shaman_elemental_talents, shaman_enhancement_talents, shaman_restoration_talents, + warlock_affliction_talents, warlock_demonology_talents, warlock_destruction_talents, + warrior_arms_talents, warrior_fury_talents, warrior_protection_talents} + ------------------------------------------ + for i,v in ipairs(ClassSpecList) do + if ClassSpec == v then + talentList = ListOfTalentLists[i] + end + end + for i,v in ipairs(talentList) do -- getting costs and id + local spellids = v[2] + for k,s in pairs(spellids) do + if (attached_talent[1] == s) then + spellID = s + currency_one = v[3] + currency_two = v[4] + LevelReq = v[5] + end + end -- check for spellid + + end + + if not(spellID) or player:HasSpell(spellID) or not(talentList) then + successful = false + end + + if (LevelReq > player:GetLevel()) then + successful = false + end -- end of hackfix + + if currency_one ~= 0 then + if player:HasItem(spell_essence, currency_one) == false then + player_has_currency = false + successful = false + end + end + + if currency_two ~= 0 then + if player:HasItem(talent_essence, currency_two) == false then + player_has_currency = false + successful = false + end + end + + if player_has_currency == true and currency_one ~= 0 then + player:RemoveItem(spell_essence, currency_one) + end + + if player_has_currency == true and currency_two ~= 0 then + player:RemoveItem(talent_essence, currency_two) + end + + if successful == true then + player:CastSpell(player, 966006) + player:LearnSpell(spellID) + --player:SaveToDB() + end + + if successful == false then + player:SendBroadcastMessage("You do not have the required currency!") + SendGoBackTalent(AIO.Msg(), player, attached_talent, indexAt):Send(player) + + else + sendUpdatedTalent(AIO.Msg(), player, attached_talent, indexAt):Send(player) + end + +end + +function sendUpdatedTalent(msg, player, attached_talent, indexAt) + + return msg:Add("sideBar", "UpdateTalent", attached_talent, indexAt) + +end + +function SendGoBackTalent(msg, player, attached_talent, indexAt) + return msg:Add("sideBar", "TalentGoBack", attached_talent, indexAt) +end + + --talent unlearning part-- +function MyHandlers.UnLearnThisTalent(player, attached_talent, indexAt,ClassSpec) + local talentList = nil + local successful = true + local currency_one = nil + local currency_two = nil + local spellID = nil + local LevelReq = nil + local TalentRank = nil + local talents_ranks = nil + local spellIDOriginal = nil + --preventing any spell learn hack-- + --HACKFIX, VERY FUCKING HACK FIX OF HACK-- + local ClassSpecList = {"DRUIDBALANCE", "DRUIDFERAL", "DRUIDRESTORATION", + "HUNTERBEASTMASTERY", "HUNTERMARKSMANSHIP", "HUNTERSURVIVAL", + "MAGEARCANE", "MAGEFIRE", "MAGEFROST", + "PALADINHOLY", "PALADINPROTECTION", "PALADINRETRIBUTION", + "PRIESTDISCIPLINE", "PRIESTHOLY", "PRIESTSHADOW", + "ROGUEASSASSINATION", "ROGUECOMBAT", "ROGUESUBTLETY", + "SHAMANELEMENTAL", "SHAMANENHANCEMENT", "SHAMANRESTORATION", + "WARLOCKAFFLICTION", "WARLOCK", "DEMONOLOGY", "WARLOCKDESTRUCTION", + "WARRIORARMS", "WARRIORFURY", "WARRIORPROTECTION"} + + local ListOfTalentLists = {druid_balance_talents, druid_feral_talents, druid_restoration_talents, + hunter_beastmastery_talents, hunter_marksmanship_talents, hunter_survival_talents, + mage_arcane_talents, mage_fire_talents, mage_frost_talents, + paladin_holy_talents, paladin_protection_talents, paladin_retribution_talents, + priest_discipline_talents, priest_holy_talents, priest_shadow_talents, + rogue_assassination_talents, rogue_combat_talents, rogue_subtlety_talents, + shaman_elemental_talents, shaman_enhancement_talents, shaman_restoration_talents, + warlock_affliction_talents, warlock_demonology_talents, warlock_destruction_talents, + warrior_arms_talents, warrior_fury_talents, warrior_protection_talents} + ------------------------------------------ + for i,v in ipairs(ClassSpecList) do + if ClassSpec == v then + talentList = ListOfTalentLists[i] + end + end + for i,v in ipairs(talentList) do -- getting costs and id + local spellids = v[2] + for k,s in pairs(spellids) do + if (attached_talent == s) then + spellID = s + spellIDOriginal = spellids + currency_one = v[3] + currency_two = v[4] + LevelReq = v[5] + TalentRank = k + talents_ranks = talentList[i][1] + end + end -- check for spellid + + end + + if (not(spellID)) or (LevelReq > player:GetLevel()) or (not(player:HasSpell(spellID))) then + successful = false + end + + if successful == false then + player:SendBroadcastMessage("You can't unlearn this talent!") + + else + for k,v in pairs(spellIDOriginal) do + player:RemoveSpell(v) + end + if (currency_one) then + player:AddItem( spell_essence, currency_one*TalentRank) + end + if (currency_two) then + player:AddItem( talent_essence, currency_two*TalentRank) + end + attached_talent = {spellIDOriginal[1],currency_one, currency_two,spellIDOriginal,talents_ranks} + sendUnlearnedTalent(AIO.Msg(), player, attached_talent, indexAt):Send(player) + end + +end + +function sendUnlearnedTalent(msg, player, attached_talent, indexAt) + + return msg:Add("sideBar", "UnLearnTalent", attached_talent, indexAt) + +end +--end of the talent unlearning part-- \ No newline at end of file diff --git a/extra_buttons_bar/character advancement/CharacterAdvancementC.lua b/extra_buttons_bar/character advancement/CharacterAdvancementC.lua new file mode 100644 index 0000000..e69de29 diff --git a/extra_buttons_bar/character advancement/CharacterAdvancementS.lua b/extra_buttons_bar/character advancement/CharacterAdvancementS.lua new file mode 100644 index 0000000..e69de29 diff --git a/extra_buttons_bar/character advancement/druid_vari.lua b/extra_buttons_bar/character advancement/druid_vari.lua new file mode 100644 index 0000000..a6f6ac0 --- /dev/null +++ b/extra_buttons_bar/character advancement/druid_vari.lua @@ -0,0 +1,74 @@ +-- Documentation {5176, 2, 0, 1} {Spellid, Ability Essence, Talent Essence, Required Level} +-- Make sure to adjust Count if you add or subtract any spells +-- talent documentation {5,{16814,16814,16814,16814,16814},0,1,10,2,762} {number of ranks, {spellids}, AE cost, TE cost, required level, +-- column, talentId} +-- talents tab variables refers to talenttab dbc + + +druid_balance_spells = {{5176, 2, 0, 1}, {8921, 2, 0, 4}, {467, 2, 0, 6}, {339, 2, 0, 8}, {18960, 2, 0, 10}, +{16689, 2, 0, 10}, {770, 2, 0, 18}, {2637, 2, 0, 18}, {2912, 2, 0, 20}, {2908, 1, 0, 22}, {29166, 2, 0, 40}, +{16914, 2, 0, 40}, {22812, 2, 0, 44}, {33786, 2, 0, 70}} + +druid_balance_spells_count = 14 +druid_balance_bgs = {"Interface\\TalentFrame\\DruidBalance-TopLeft", "Interface\\TalentFrame\\DruidBalance-TopRight", +"Interface\\TalentFrame\\DruidBalance-BottomLeft", "Interface\\TalentFrame\\DruidBalance-BottomRight"} + +druid_balance_talents = {{5,{16814,16815,16816,16817,16818},0,1,10,2,762}, {5,{57810,57811,57812,57813,57814},0,1,10,3,2238}, +{3,{16845,16846,16847},0,1,15,1,783}, {2,{35363,35364},0,1,15,2,1822}, {2,{16821,16822},0,1,15,4,763}, +{3,{16836,16839,16840},0,1,20,1,782}, {3,{16880,61345,61346},0,1,20,2,789}, {1,{57865},1,1,20,3,2240}, {2,{16819,16820},0,1,20,4,764}, +{5,{16909,16910,16911,16912,16913},0,1,25,2,792}, {3,{16850,16923,16924},0,1,25,3,784}, +{3,{33589,33590,33591},0,1,30,1,1782}, {1,{5570},2,1,30,2,788}, {3,{57849,57850,57851},0,1,30,3,2239}, +{3,{33597,33599,33956},0,1,35,1,1784}, {3,{16896,16897,16899},0,1,35,2,790}, {2,{33592,33596},0,1,35,3,1783}, +{1,{24858},2,1,40,2,793}, {3,{48384,48395,48396},0,1,40,3,1912}, {3,{33600,33601,33602},0,1,40,4,1785}, +{3,{48389,48392,48393},0,1,45,1,1913}, {5,{33603,33604,33605,33606,33607},0,1,45,3,1786}, +{3,{48516,48521,48525},0,1,50,1,1924}, {1,{50516},2,1,50,2,1923}, {1,{33831},2,1,50,3,1787}, {2,{48488,48514},0,1,50,4,1925}, +{3,{48506,48510,48511},0,1,55,2,1928}, +{1,{48505},3,1,60,2,1926}} +druid_balance_talents_tab = 18 + + +druid_feral_spells = {{99, 2, 0, 10}, {6807, 1, 0, 10}, {6795, 1, 0, 10}, {5487, 2, 0, 10}, {5229, 2, 0, 12}, +{5211, 2, 0, 14}, {1066, 2, 0, 16}, {779, 2, 0, 16}, {16857, 2, 0, 18}, {1082, 1, 0, 20}, +{1079, 2, 0, 20}, {768, 2, 0, 20}, {5215, 2, 0, 20}, {62078, 2, 0, 20}, {5221, 2, 0, 22}, {1822, 1, 0, 24}, {5217, 2, 0, 24}, +{1850, 2, 0, 26}, {8998, 2, 0, 28}, {5209, 2, 0, 28}, {783, 2, 0, 30}, {22568, 2, 0, 32}, +{6785, 2, 0, 32}, {9005, 2, 0, 36}, {22842, 2, 0, 36}, {20719, 1, 0, 40}, {62600, 2, 0, 40}, {22570, 2, 0, 62}, {33745, 2, 0, 66}, {52610, 2, 0, 75}} + +druid_feral_spells_count = 30 +druid_feral_bgs = {"Interface\\TalentFrame\\DruidFeralCombat-TopLeft", "Interface\\TalentFrame\\DruidFeralCombat-TopRight", +"Interface\\TalentFrame\\DruidFeralCombat-BottomLeft", "Interface\\TalentFrame\\DruidFeralCombat-BottomRight"} + +druid_feral_talents = {{5, {16934,16935,16936,16937,16938}, 0, 1, 10, 2,796}, {5, {16858,16859,16860,16861,16862}, 0, 1, 10, 3,795}, +{3, {16947,16948,16949}, 0, 1, 15, 1,799}, {2, {16998,16999}, 0, 1, 15, 2,805}, {3, {16929,16930,16931}, 0, 1, 15, 3,794}, +{2, {17002,24866}, 0, 1, 20, 1,807}, {1, {61336}, 2, 1, 20, 2,1162}, {3, {16942,16943,16944}, 0, 1, 20, 3,798}, +{2,{16966,16968},0,1,25,1,802},{3,{16972,16974,16975},0,1,25, 2,803},{2,{37116,37117},0,1,25,3,801},{2,{48409,48410},0,1,25,4,1914}, +{2, {16940,16941}, 0, 1, 30, 1,797}, {1, {49377}, 2, 1, 30, 3,804}, {2, {33872,33873}, 0, 1, 30, 4,1792}, +{3, {57878,57880,57881}, 0, 1, 35, 1,2242},{5, {17003,17004,17005,17006,24894},0,1,35,2,808},{3,{33853,33855,33856},0,1,35,3,1794}, +{1, {17007}, 2, 1, 40, 2,809}, {2,{34297,34300},0,1,40,3,1798}, {3,{33851,33852,33957},0,1,40,4,1793}, +{3,{57873,57876,57877},0,1,45,1,2241},{3,{33859,33866,33867},0,1,45,3,1795},{3,{48483,48484,48485},0,1,45,4,1919}, +{3,{48492,48494,48495},0,1,50,1,1921},{1,{33917},2,1,50,2,1796},{3,{48532,48489,48491},0,1,50,3,1920}, +{5,{48432,48433,48434,51268,51269},0,1,55,2,1918},{1,{63503},1,1,55,3,2266}, +{1, {50334}, 3, 1, 60, 2,1927}} +druid_feral_talents_tab = 16 + + +druid_restoration_spells = {{5185, 2, 0, 1}, {1126, 2, 0, 1}, {774, 2, 0, 4}, {8936, 2, 0, 12}, {50769, 2, 0, 12}, +{8946, 2, 0, 14}, {20484, 2, 0, 20}, {2782, 2, 0, 24}, {2893, 2, 0, 26}, {740, 2, 0 ,30}, +{33763, 2, 0, 64},{504642, 0, 80}} + +druid_restoration_spells_count = 11 +druid_restoration_bgs = {"Interface\\TalentFrame\\DruidRestoration-TopLeft", "Interface\\TalentFrame\\DruidRestoration-TopRight", +"Interface\\TalentFrame\\DruidRestoration-BottomLeft", "Interface\\TalentFrame\\DruidRestoration-BottomRight"} + +druid_restoration_talents = {{2,{17050,17051},0,1,10,1,821}, {3,{17063,17065,17066},0,1,10,2,823}, {5,{17056,17058,17059,17060,17061},0,1,10,3,822}, +{5,{17069,17070,17071,17072,17073},0,1,15,1,824}, {3,{17118,17119,17120},0,1,15,2,841}, {1,{16833},1,1,15,3,826}, +{3,{17106,17107,17108},0,1,20,1,829}, {1,{16864},1,1,20,2,827}, {2,{48411,48412},0,1,20,3,1915}, +{5,{24968,24969,24970,24971,24972},0,1,25,2,843}, {3,{17111,17112,17113},0,1,25,3,830}, +{1,{17116},2,1,30,1,831}, {5,{17104,24943,24944,24945,24946},0,1,30,2,828}, {2,{17123,17124},0,1,30,4,842}, +{2,{33879,33880},0,1,35,1,1788}, {5,{17074,17075,17076,17077,17078},0,1,35,3,825}, +{3,{34151,34152,34153},0,1,40,1,1797}, {1,{18562},2,1,40,2,844}, {3,{33881,33882,33883},0,1,40,3,1790}, +{5,{33886,33887,33888,33889,33890},0,1,45,2,1789}, {3,{48496,48499,48500},0,1,45,3,1922}, +{3,{48539,48544,48545},0,1,50,1,1929}, {1,{65139},2,1,50,2,1791}, {3,{48535,48536,48537},0,1,50,3,1930}, +{2,{63410,63411},0,1,55,1,2264}, {5,{51179,51180,51181,51182,51183},0,1,55,3,1916}, +{1,{48438},3,1,60,2,1917}} + +druid_restoration_talents_tab = 17 diff --git a/extra_buttons_bar/character advancement/hunter_vari.lua b/extra_buttons_bar/character advancement/hunter_vari.lua new file mode 100644 index 0000000..17a4993 --- /dev/null +++ b/extra_buttons_bar/character advancement/hunter_vari.lua @@ -0,0 +1,77 @@ +-- Documentation {5176, 2, 0, 1} {Spellid, Ability Essence, Talent Essence, Required Level} +-- Make sure to adjust Count if you add or subtract any spells +-- talent documentation {5,{16814,16814,16814,16814,16814},0,1,10,2,762} {number of ranks, {spellids}, AE cost, TE cost, required level, +-- column, talentId} +-- talents tab variables refers to talenttab dbc + +hunter_beastmastery_spells = {{13163, 2, 0, 4}, {883, 1, 0, 10}, {1515, 2, 0, 10}, {2641, 1, 0, 10}, {6991, 1, 0, 10}, {13165, 2, 0, 10}, +{982, 1, 0, 10}, {136, 2, 0, 12}, {6197, 1, 0, 14}, {1513, 2, 0, 14}, {1002, 1, 0, 14}, {5118, 2, 0, 16}, +{34074, 2, 0, 20}, {1462, 1, 0, 24}, {13161, 2, 0, 30}, {13159, 2, 0, 40}, {20043, 2, 0, 46}, {34026, 2, 0, 66}, +{61846, 2, 0, 74}, {53271, 2, 0, 75}, {62757, 2, 0, 80}} + +hunter_beastmastery_spells_count = 21 +hunter_beastmastery_bgs = {"Interface\\TalentFrame\\HunterBeastmastery-TopLeft", "Interface\\TalentFrame\\HunterBeastmastery-TopRight", +"Interface\\TalentFrame\\HunterBeastmastery-BottomLeft", "Interface\\TalentFrame\\HunterBeastmastery-BottomRight"} + +hunter_beastmastery_talents = {{5,{19552,19553,19554,19555,19556},0,1,10,2,1382}, {5,{19583,19584,19585,19586,19587},0,1,10,3,1389}, +{2,{35029,35030},0,1,15,1,1624},{3,{19549,19550,19551},0,1,15,2,1381}, {3,{19609,19610,19612},0,1,15,3,1395}, {2,{24443,19575},0,1,15,4,1625}, +{2,{19559,19560},0,1,20,1,1384}, {1,{53265},1,1,20,2,2138}, {5,{19616,19617,19618,19619,19620},0,1,20,3,1396}, +{2,{19572,19573},0,1,25,2,1385}, {5,{19598,19599,19600,19601,19602},0,1,25,3,1393}, +{2,{19578,20895},0,1,30,1,1388}, {1,{19577},2,1,30,2,1387}, {2,{19590,19592},0,1,30,4,1390}, +{2,{34453,34454},0,1,35,1,1799}, {5,{19621,19622,19623,19624,19625},0,1,35,3,1397}, +{3,{34455,34459,34460},0,1,40,1,1800}, {1,{19574},2,1,40,2,1386}, {3,{34462,34464,34465},0,1,40,3,1801}, +{2,{53252,53253},0,1,45,1,2136}, {5,{34466,34467,34468,34469,34470},0,1,45,3,1802}, +{3,{53262,53263,53264},0,1,50,1,2140}, {1,{34692},1,1,50,2,1803}, {3,{53256,53259,53260},0,1,50,3,2137}, +{5,{56314,56315,56316,56317,56318},0,1,55,2,2227}, +{1,{53270},3,1,60,2,2139}} + +hunter_beastmastery_talents_tab = 22 + + + +hunter_marksmanship_spells = {{75, 2, 0, 1}, {1978, 2, 0, 4}, {3044, 2, 0, 6}, {1130, 2, 0, 6}, {5116, 2, 0, 8}, +{20736, 2, 0, 12}, {2643, 2, 0, 18}, {3043, 2, 0, 22}, {3045, 2, 0, 26}, {1543, 2, 0, 32}, {3034, 2, 0, 36}, +{1510, 2, 0, 40}, {56641, 2, 0, 50}, {19801, 2, 0, 60}, {53351, 2, 0, 71}} + +hunter_marksmanship_spells_count = 15 +hunter_marksmanship_bgs = {"Interface\\TalentFrame\\HunterMarksmanship-TopLeft", "Interface\\TalentFrame\\HunterMarksmanship-TopRight", +"Interface\\TalentFrame\\HunterMarksmanship-BottomLeft", "Interface\\TalentFrame\\HunterMarksmanship-BottomRight"} + +hunter_marksmanship_talents = {{2,{19407,19412},0,1,10,1,1341}, {3,{53620,53621,53622},0,1,10,2,2197}, {5,{19426,19427,19429,19430,19431},0,1,10,3,1344}, +{3,{34482,34483,34484},0,1,15,1,1806}, {3,{19421,19422,19423},0,1,15,2,1343}, {5,{19485,19487,19488,19489,19490},0,1,15,3,1349}, +{2,{34950,34954},0,1,20,1,1818}, {3,{19454,19455,19456},0,1,20,2,1346}, {1,{19434},2,1,20,3,1345}, {2,{34948,34949},0,1,20,4,1819}, +{3,{19464,19465,19466},0,1,25,2,1348}, {5,{19416,19417,19418,19419,19420},0,1,25,3,1342}, +{2,{35100,35102},0,1,30,1,1351}, {1,{23989},2,1,30,2,1353}, {3,{19461,19462,24691},0,1,30,3,1347}, +{2,{34475,34476},0,1,35,1,1804}, {3,{19507,19508,19509},0,1,35,4,1362}, +{3,{53234,53237,53238},0,1,40,1,2130}, {1,{19506},2,1,40,2,1361}, {3,{35104,35110,35111},0,1,40,3,1821}, +{5,{34485,34486,34487,34488,34489},0,1,45,2,1807}, {2,{53228,53232},0,1,45,3,2131}, +{3,{53215,53216,53217},0,1,50,1,2132}, {1,{34490},2,1,50,2,1808}, {3,{53221,53222,53224},0,1,50,3,2133}, +{5,{53241,53243,53244,53245,53246},0,1,55,2,2134}, +{1,{53209},3,1,60,2,2135}} + +hunter_marksmanship_talents_tab = 24 + + +hunter_survival_spells = {{2973, 2, 0, 1}, {1494, 2, 0, 2}, {19883, 2, 0, 10}, {2974, 2, 0, 12}, {13795, 2, 0, 16}, +{1495, 2, 0, 16}, {19884, 1, 0, 18}, {1499, 2, 0 ,20}, {781, 2, 0, 20}, {19885, 2, 0, 24}, {13809, 2, 0, 28}, +{19880, 1, 0, 28}, {5384, 2, 0, 30}, {19878, 2, 0, 32}, {13813, 2, 0, 34}, {19882, 1, 0, 40}, {19879, 2, 0, 50}, +{19263, 2, 0, 60}, {34600, 2, 0, 68}, {34477, 2, 0, 70}, {60192, 2, 0, 80}} + +hunter_survival_spells_count = 21 +hunter_survival_bgs = {"Interface\\TalentFrame\\HunterSurvival-TopLeft", "Interface\\TalentFrame\\HunterSurvival-TopRight", +"Interface\\TalentFrame\\HunterSurvival-BottomLeft", "Interface\\TalentFrame\\HunterSurvival-BottomRight"} + +hunter_survival_talents = {{5,{52783,52785,52786,52787,52788},0,1,10,1,1623}, {3,{19498,19499,19500},0,1,10,2,1820}, {2,{19159,19160},0,1,10,3,1621}, +{3,{19290,19294,24283},0,1,15,1,1310}, {3,{19184,19387,19388},0,1,15,2,1304}, {3,{19376,63457,63458},0,1,15,3,1305}, {2,{34494,34496},0,1,15,4,1810}, +{5,{19255,19256,19257,19258,19259},0,1,20,1,1622}, {1,{19503},2,1,20,2,1814}, {3,{19295,19297,19298},0,1,20,3,1311}, {2,{19286,19287},0,1,20,4,1309}, +{3,{56333,56336,56337},0,1,25,2,2229}, {3,{56342,56343,56344},0,1,25,4,1306}, +{3,{56339,56340,56341},0,1,30,1,2228}, {3,{19370,19371,19373},0,1,30,2,1321}, {1,{19306},2,1,30,3,1312}, +{5,{19168,19180,19181,24296,24297},0,1,35,1,1303}, {3,{34491,34492,34493},0,1,35,3,1809}, +{3,{34500,34502,34503},0,1,40,1,1812}, {1,{19386},2,1,40,2,1325}, {3,{34497,34498,34499},0,1,40,3,1811}, +{5,{34506,34507,34508,34838,34839},0,1,45,1,1813}, {3,{53295,53296,53297},0,1,45,2,2141}, +{2,{53298,53299},0,1,50,1,2142}, {1,{3674},2,1,50,2,1322}, {3,{53302,53303,53304},0,1,50,4,2143}, +{3,{53290,53291,53292},0,1,55,3,2144}, +{1,{53301},3,1,60,2,2145}} + +hunter_survival_talents_tab = 23 + diff --git a/extra_buttons_bar/character advancement/mage_vari.lua b/extra_buttons_bar/character advancement/mage_vari.lua new file mode 100644 index 0000000..acef442 --- /dev/null +++ b/extra_buttons_bar/character advancement/mage_vari.lua @@ -0,0 +1,78 @@ +-- Documentation {5176, 2, 0, 1} {Spellid, Ability Essence, Talent Essence, Required Level} +-- Make sure to adjust Count if you add or subtract any spells +-- talent documentation {5,{16814,16814,16814,16814,16814},0,1,10,2,762} {number of ranks, {spellids}, AE cost, TE cost, required level, +-- column, talentId} +-- talents tab variables refers to talenttab dbc + +mage_arcane_spells = {{1459, 2, 0, 1}, {5504, 2, 0, 4}, {587, 2, 0, 6}, {5143, 2, 0, 8}, {118, 2, 0, 8}, +{475, 2, 0, 10}, {604, 2, 0, 12}, {130, 2, 0, 12}, {1449, 2, 0, 14}, {1008, 2, 0, 18}, {1463, 2, 0, 20}, +{1953, 2, 0, 20}, {818045, 2, 0, 20}, {12051, 2, 0, 20}, {2139, 2, 0, 24}, {759, 2, 0, 28}, {6117, 2, 0, 34}, +{30451, 2, 0, 64}, {66, 2, 0, 68}, {43987, 2, 0, 70}, {30449, 2, 0, 70}, {55342, 2, 0, 80}} + +mage_arcane_spells_count = 22 +mage_arcane_bgs = {"Interface\\TalentFrame\\MageArcane-TopLeft", "Interface\\TalentFrame\\MageArcane-TopRight", +"Interface\\TalentFrame\\MageArcane-BottomLeft", "Interface\\TalentFrame\\MageArcane-BottomRight"} + +mage_arcane_talents = {{2,{11210,12592},0,1,10,1,74}, {3,{11222,12839,12840},0,1,10,2,76}, {5,{11237,12463,12464,16769,16770},0,1,10,3,80}, +{3,{28574,54658,54659},0,1,15,1,85}, {2,{29441,29444},0,1,15,2,1650}, {5,{11213,12574,12575,12576,12577},0,1,15,3,75}, +{2,{11247,12606},0,1,20,1,82}, {3,{11242,12467,12469},0,1,20,2,81}, {3,{44397,44398,44399},0,1,20,3,1845}, {1,{54646},2,1,20,4,2211}, +{2,{11252,12605},0,1,25,1,83}, {2,{11255,12598},0,1,25,2,88}, {3,{18462,18463,18464},0,1,25,3,1142}, {3,{29447,55339,55340},0,1,25,4,2222}, +{2,{31569,31570},0,1,30,1,1724}, {1,{12043},2,1,30,2,86}, {5,{11232,12500,12501,12502,12503},0,1,30,4,77}, +{3,{31574,31575,54354},0,1,35,1,1726}, {3,{15058,15059,15060},0,1,35,2,421}, {2,{31571,31572},0,1,35,3,1725}, +{3,{31579,31582,31583},0,1,40,1,1727}, {1,{12042},2,1,40,2,87}, {0,{0,0,0},0,0,40,3,1844}, +{2,{44378,44379},0,1,45,2,1843}, {5,{31584,31585,31586,31587,31588},0,1,45,3,1728}, +{1,{31589},2,1,50,2,1729}, {5,{44404,54486,54488,54489,54490},0,1,50,3,2209}, +{3,{44400,44402,44403},0,1,55,2,1846}, {2,{35578,35581},0,1,55,3,1826}, +{1,{44425},3,1,60,2,1847}} + +--{3,{44394,44395,44396},0,1,40,3,1844} Incanters + +mage_arcane_talents_tab = 3 + + + +mage_fire_spells = {{133, 2, 0, 1}, {2136, 2, 0, 6}, {2120, 2, 0, 16}, {543, 2, 0, 20}, {2948, 2, 0, 22}, +{30482, 2, 0, 62}, {44614, 2, 0, 75}} + +mage_fire_spells_count = 7 +mage_fire_bgs = {"Interface\\TalentFrame\\MageFire-TopLeft", "Interface\\TalentFrame\\MageFire-TopRight", +"Interface\\TalentFrame\\MageFire-BottomLeft", "Interface\\TalentFrame\\MageFire-BottomRight"} + +mage_fire_talents = {{2,{11078,11080},0,1,10,1,27}, {3,{18459,18460,54734},0,1,10,2,1141}, {5,{11069,12338,12339,12340,12341},0,1,10,3,26}, +{5,{11119,11120,12846,12847,12848},0,1,15,1,34}, {2,{54747,54749},0,1,15,2,2212}, {3,{11108,12349,12350},0,1,15,3,31}, +{2,{11100,12353},0,1,20,1,28}, {3,{11103,12357,12358},0,1,20,2,30}, {1,{11366},2,1,20,3,29}, {2,{11083,12351},0,1,20,4,23}, +{3,{11095,12872,12873},0,1,25,1,25}, {2,{11094,13043},0,1,25,2,24}, {3,{29074,29075,29076},0,1,25,4,1639}, +{3,{31638,31639,31640},0,1,30,1,1730}, {3,{11115,11367,11368},0,1,30,2,33}, {1,{11113},2,1,30,3,32}, +{2,{31641,31642},0,1,35,1,1731}, {5,{11124,12378,12398,12399,12400},0,1,35,3,35}, +{3,{34293,34295,34296},0,1,40,1,1733}, {1,{11129},2,1,40,2,36}, {2,{31679,31680},0,1,40,3,1732}, +{2,{64353,64357},0,1,45,1,1848}, {3,{31656,31657,31658},0,1,45,3,1734}, +{2,{44442,44443},0,1,50,1,1849}, {1,{31661},2,1,50,2,1735}, {3,{44445,44446,44448},0,1,50,3,1850}, +{5,{44449,44469,44470,44471,44472},0,1,55,2,1851}, +{1,{44457},3,1,60,2,1852}} + +mage_fire_talents_tab = 1 + + + + +mage_frost_spells = {{168, 2, 0, 1}, {116, 2, 0, 4}, {122, 2, 0, 10}, {10, 2, 0, 20}, {6143, 2, 0, 22}, +{120, 2, 0, 26}, {45438, 2, 0, 30}, {30455, 2, 0, 66}} + +mage_frost_spells_count = 8 +mage_frost_bgs = {"Interface\\TalentFrame\\MageFrost-TopLeft", "Interface\\TalentFrame\\MageFrost-TopRight", +"Interface\\TalentFrame\\MageFrost-BottomLeft", "Interface\\TalentFrame\\MageFrost-BottomRight"} + +mage_frost_talents = {{3,{11071,12496,12497},0,1,10,1,38}, {5,{11070,12473,16763,16765,16766},0,1,10,2,37}, {3,{31670,31672,55094},0,1,10,3,62}, +{3,{11207,12672,15047},0,1,15,1,73}, {2,{11189,28332},0,1,15,2,70}, {3,{29438,29439,29440},0,1,15,3,1649}, {3,{11175,12569,12571},0,1,15,4,65}, +{3,{11151,12952,12953},0,1,20,1,61}, {1,{12472},2,1,20,2,69}, {3,{11185,12487,12488},0,1,20,3,63}, +{2,{16757,16758},0,1,25,1,741}, {3,{11160,12518,12519},0,1,25,2,66}, {3,{11170,12982,12983},0,1,25,3,67}, +{1,{11958},2,1,30,2,72}, {3,{11190,12489,12490},0,1,30,3,64}, {3,{31667,31668,31669},0,1,30,4,1736}, +{2,{55091,55092},0,1,35,1,1737}, {3,{11180,28592,28593},0,1,35,3,68}, +{2,{44745,54787},0,1,40,1,2214}, {1,{11426},2,1,40,2,71}, {5,{31674,31675,31676,31677,31678},0,1,40,3,1738}, +{3,{31682,31683,31684},0,1,45,2,1740}, {2,{44543,44545},0,1,45,3,1853}, +{3,{44546,44548,44549},0,1,50,1,1854}, {1,{31687},2,1,50,2,1741}, {3,{44557,44560,44561},0,1,50,3,1855}, +{5,{44566,44567,44568,44570,44571},0,1,55,2,1856}, +{1,{44572},3,1,60,2,1857}} + +mage_frost_talents_tab = 2 + diff --git a/extra_buttons_bar/character advancement/paladin_vari.lua b/extra_buttons_bar/character advancement/paladin_vari.lua new file mode 100644 index 0000000..6b3624f --- /dev/null +++ b/extra_buttons_bar/character advancement/paladin_vari.lua @@ -0,0 +1,78 @@ +-- Documentation {5176, 2, 0, 1} {Spellid, Ability Essence, Talent Essence, Required Level} +-- Make sure to adjust Count if you add or subtract any spells +-- talent documentation {5,{16814,16814,16814,16814,16814},0,1,10,2,762} {number of ranks, {spellids}, AE cost, TE cost, required level, +-- column, talentId} +-- talents tab variables refers to talenttab dbc + +paladin_holy_spells = {{635, 2, 0, 1}, {20154, 2, 0, 1}, {1152, 2, 0, 8}, {633, 2, 0, 10}, {7328, 2, 0, 12}, {19742, 2, 0, 14}, +{26573, 2, 0, 20}, {879, 2, 0, 20}, {19750, 2, 0, 20}, {5502, 1, 0 ,20}, {19746, 2, 0, 22}, {10326, 2, 0, 24}, +{20165, 2, 0, 30}, {20166, 2, 0, 38}, {4987, 2, 0, 42}, {2812, 2, 0, 50}, {54428, 2, 0, 71}, +{53601, 2, 0, 80}} + +paladin_holy_spells_count = 18 +paladin_holy_bgs = {"Interface\\TalentFrame\\PaladinHoly-TopLeft", "Interface\\TalentFrame\\PaladinHoly-TopRight", +"Interface\\TalentFrame\\PaladinHoly-BottomLeft", "Interface\\TalentFrame\\PaladinHoly-BottomRight"} + +paladin_holy_talents = {{5,{20205,20206,20207,20209,20208},0,1,10,2,1432}, {5,{20224,20225,20330,20331,20332},0,1,10,3,1463}, +{3,{20237,20238,20239},0,1,15,1,1444}, {5,{20257,20258,20259,20260,20261},0,1,15,2,1449}, {2,{9453,25836},0,1,15,3,1628}, +{1,{31821},2,1,20,1,1435}, {5,{20210,20212,20213,20214,20215},0,1,20,2,1461}, {2,{20234,20235},0,1,20,3,1443}, +{3,{20254,20255,20256},0,1,25,1,1450}, {2,{20244,20245},0,1,25,3,1446}, {2,{53660,53661},0,1,25,4,2198}, +{2,{31822,31823},0,1,30,1,1742}, {1,{20216},2,1,30,2,1433}, {3,{20359,20360,20361},0,1,30,3,1465}, +{2,{31825,31826},0,1,35,1,1743}, {5,{5923,5924,5925,5926,25829},0,1,35,3,1627}, +{3,{31833,31835,31836},0,1,40,1,1745}, {1,{20473},2,1,40,2,1502}, {3,{31828,31829,31830},0,1,40,3,1744}, +{3,{53551,53552,53553},0,1,45,1,2190}, {5,{31837,31838,31839,31840,31841},0,1,45,3,1746}, +{1,{31842},2,1,50,1,1747}, {5,{53671,53673,54151,54154,54155},0,1,50,3,2199}, +{2,{53569,53576},0,1,55,2,2193}, {2,{53556,53557},0,1,55,3,2191}, +{1,{53563},3,1,60,2,2192}} + +paladin_holy_talents_tab = 26 + + + +paladin_retribution_spells = {{19740, 2, 0, 4}, {20271, 2, 0 ,4}, {53408, 2, 0, 12}, {7294, 2, 0, 16}, {53407, 2, 0, 28}, +{24275, 2, 0, 44}, {32223, 2, 0, 62}, {31801, 2, 0, 64}, {31884, 2, 0, 70}} + +paladin_retribution_spells_count = 9 +paladin_retribution_bgs = {"Interface\\TalentFrame\\Paladincombat-TopLeft", "Interface\\TalentFrame\\Paladincombat-TopRight", +"Interface\\TalentFrame\\Paladincombat-BottomLeft", "Interface\\TalentFrame\\Paladincombat-BottomRight"} + +paladin_retribution_talents = {{5,{20060,20061,20062,20063,20064},0,1,10,2,1403}, {5,{20101,20102,20103,20104,20105},0,1,10,3,1407}, +{2,{25956,25957},0,1,15,1,1631}, {3,{20335,20336,20337},0,1,15,2,1464}, {2,{20042,20045},0,1,15,3,1401}, +{2,{9452,26016},0,1,20,1,1633}, {5,{20117,20118,20119,20120,20121},0,1,20,2,1411}, {1,{20375},2,1,20,3,1481}, {2,{26022,26023},0,1,20,4,1634}, +{2,{9799,25988},0,1,25,1,1632}, {3,{32043,35396,35397},0,1,25,3,1761}, {3,{31866,31867,31868},0,1,25,4,1755}, +{3,{20111,20112,20113},0,1,30,1,1410}, {1,{31869},1,1,30,3,1756}, +{3,{20049,20056,20057},0,1,35,2,1402}, {2,{31871,31872},0,1,35,3,1757}, +{2,{53486,53488},0,1,40,1,2176}, {1,{20066},2,1,40,2,1441}, {3,{31876,31877,31878},0,1,40,3,1758}, +{3,{31879,31880,31881},0,1,45,2,1759}, {2,{53375,53376},0,1,45,3,2147}, +{3,{53379,53484,53648},0,1,50,1,2148}, {1,{35395},2,1,50,2,1823}, {5,{53501,53502,53503,853504,853505},0,1,50,3,2179}, +{3,{53380,53381,53382},0,1,55,2,2149}, +{1,{53385},3,1,60,2,2150}} + +paladin_retribution_talents_tab = 25 + + + +paladin_protection_spells = {{465, 2, 0, 1}, {498, 2, 0, 6}, {853, 2, 0, 8}, {1022, 2, 0, 10}, {31789, 2, 0, 14}, +{62124, 2, 0, 16}, {25780, 2, 0, 16}, {1044, 2, 0, 18}, {20217, 2, 0, 20}, {20164, 2, 0, 22}, {1038, 2, 0, 26}, +{19876, 2, 0, 28}, {19752, 2, 0, 30}, {19888, 2, 0, 32}, {642, 2, 0, 34}, {19891, 2, 0, 36}, {6940, 2, 0, 46}, {53600, 2, 0, 75}} + +paladin_protection_spells_count = 18 +paladin_protection_bgs = {"Interface\\TalentFrame\\PaladinProtection-TopLeft", "Interface\\TalentFrame\\PaladinProtection-TopRight", +"Interface\\TalentFrame\\PaladinProtection-BottomLeft", "Interface\\TalentFrame\\PaladinProtection-BottomRight"} + +paladin_protection_talents = {{5,{63646,63647,63648,63649,63650},0,1,10,2,1442}, {5,{20262,20263,20264,20265,20266},0,1,10,3,2185}, +{3,{31844,31845,53519},0,1,15,1,1748}, {2,{20174,20175},0,1,15,2,1425}, {5,{20096,20097,20098,20099,20100},0,1,15,3,1629}, +{1,{64205},2,1,20,1,2280}, {3,{20468,20469,20470},0,1,20,2,1501}, {5,{20143,20144,20145,20146,20147},0,1,20,3,1423}, +{2,{53527,53530},0,1,25,1,2281}, {2,{20487,20488},0,1,25,2,1521}, {3,{20138,20139,20140},0,1,25,3,1422}, +{1,{20911},2,1,30,2,1431}, {5,{20177,20179,20181,20180,20182},0,1,30,3,1426}, +{2,{31848,31849},0,1,35,1,1750}, {3,{20196,20197,20198},0,1,35,3,1429}, +{2,{31785,33776},0,1,40,1,2282}, {1,{20925},2,1,40,2,1430}, {3,{31850,31851,31852},0,1,40,3,1751}, +{3,{20127,20130,20135},0,1,45,1,1421}, {3,{31858,31859,31860},0,1,45,3,1753}, +{3,{53590,53591,53592},0,1,50,1,2195}, {1,{31935},2,1,50,2,1754}, {2,{53583,53585},0,1,50,3,2194}, +{3,{53709,53710,53711},0,1,55,2,2204}, {2,{53695,53696},0,1,55,3,2200}, +{1,{53595},3,1,60,2,2196}} + +paladin_protection_talents_tab = 27 + + + diff --git a/extra_buttons_bar/character advancement/priest_vari.lua b/extra_buttons_bar/character advancement/priest_vari.lua new file mode 100644 index 0000000..12f6103 --- /dev/null +++ b/extra_buttons_bar/character advancement/priest_vari.lua @@ -0,0 +1,75 @@ +-- Documentation {5176, 2, 0, 1} {Spellid, Ability Essence, Talent Essence, Required Level} +-- Make sure to adjust Count if you add or subtract any spells +-- talent documentation {5,{16814,16814,16814,16814,16814},0,1,10,2,762} {number of ranks, {spellids}, AE cost, TE cost, required level, +-- column, talentId} +-- talents tab variables refers to talenttab dbc + +priest_discipline_spells = {{1243, 2, 0, 1}, {17, 2, 0, 6}, {588, 2, 0, 12}, {527, 2, 0, 18}, {9484, 2, 0, 20}, +{6346, 2, 0, 20}, {8129, 2, 0, 24}, {14752, 2, 0, 30}, {1706, 2, 0, 34}, {32375, 2, 0, 70}, {64901, 2, 0, 80}} + +priest_discipline_spells_count = 11 +priest_discipline_bgs = {"Interface\\TalentFrame\\PriestDiscipline-TopLeft", "Interface\\TalentFrame\\PriestDiscipline-TopRight", +"Interface\\TalentFrame\\PriestDiscipline-BottomLeft", "Interface\\TalentFrame\\PriestDiscipline-BottomRight"} + +priest_discipline_talents = {{5,{14522,14788,14789,14790,14791},0,1,10,2,342},{5,{47586,47587,47588,52802,52803},0,1,10,3,1898}, +{3,{14523,14784,14785},0,1,15,1,352}, {3,{14747,14770,14771},0,1,15,2,346}, {2,{14749,14767},0,1,15,3,344}, {2,{14531,14774},0,1,15,4,321}, +{3,{14521,14776,14777},0,1,20,1,347}, {1,{14751},2,1,20,2,348}, {3,{14748,14768,14769},0,1,20,3,343}, +{3,{33167,33171,33172},0,1,25,1,1769}, {3,{14520,14780,14781},0,1,25,2,341}, {2,{14750,14772},0,1,25,4,350}, +{2,{33201,33202},0,1,30,1,2268}, {5,{18551,18552,18553,18554,18555},0,1,30,2,1201}, {1,{63574},1,1,30,3,351}, +{2,{33186,33190},0,1,35,1,1771}, {3,{34908,34909,34910},0,1,35,3,1772}, +{3,{45234,45243,45244},0,1,40,1,1858}, {1,{10060},2,1,40,2,322}, {3,{63504,63505,63506},0,1,40,3,1773}, +{2,{57470,57472},0,1,45,1,2235}, {3,{47535,47536,47537},0,1,45,2,1896}, {2,{47507,47508},0,1,45,3,1894}, +{3,{47509,47511,47515},0,1,50,1,1895}, {1,{33206},2,1,50,2,1774}, {2,{47516,47517},0,1,50,3,1901}, +{5,{52795,52797,52798,52799,52800},0,1,55,2,1202}, +{1,{47540},3,1,60,2,1897}} + +priest_discipline_talents_tab = 10 + + + +priest_holy_spells = {{2050, 2, 0, 1}, {585, 2, 0, 1}, {139, 2, 0, 8}, {2006, 2, 0, 10}, {528, 2, 0, 14}, +{2054, 2, 0, 16}, {2061, 2, 0, 20}, {14914, 2, 0, 20}, {15237, 2, 0, 20}, {596, 2, 0, 30}, +{552, 2, 0, 32}, {2060, 2, 0, 40}, {32546, 2, 0, 64}, {33076, 2, 0, 68}, {64843, 2, 0, 80}} + +priest_holy_spells_count = 15 +priest_holy_bgs = {"Interface\\TalentFrame\\PriestHoly-TopLeft", "Interface\\TalentFrame\\PriestHoly-TopRight", +"Interface\\TalentFrame\\PriestHoly-BottomLeft", "Interface\\TalentFrame\\PriestHoly-BottomRight"} + +priest_holy_talents = {{2,{14913,15012},0,1,10,1,410}, {3,{14908,15020,17191},0,1,10,2,406}, {5,{14889,15008,15009,15010,15011},0,1,10,3,401}, +{5,{27900,27901,27902,27903,27904},0,1,15,2,411}, {5,{18530,18531,18533,18534,18535},0,1,15,3,1181}, +{1,{19236},2,1,20,1,442}, {3,{27811,27815,27816},0,1,20,2,1636}, {3,{14892,15362,15363},0,1,20,4,361}, +{2,{27789,27790},0,1,25,1,1635}, {3,{14912,15013,15014},0,1,25,2,408}, {5,{14909,15017,150171,150172,150173},0,1,25,3,403}, +{2,{14911,15018},0,1,30,1,413}, {1,{20711},1,1,30,2,1561}, {5,{14901,15028,15029,15030,15031},0,1,30,3,402}, +{2,{33150,33154},0,1,35,1,1766}, {5,{14898,15349,15354,15355,15356},0,1,35,3,404}, +{3,{34753,34859,34860},0,1,40,1,1768}, {1,{724},2,1,40,2,1637}, {3,{33142,33145,33146},0,1,40,3,1765}, +{2,{64127,64129},0,1,45,1,2279}, {5,{33158,33159,33160,33161,33162},0,1,45,2,1767}, {3,{63730,63733,63737},0,1,45,3,1904}, +{3,{63534,63542,63543},0,1,50,1,1902}, {1,{34861},2,1,50,2,1815}, {3,{47558,47559,47560},0,1,50,3,1903}, +{5,{47562,47564,47565,47566,47567},0,1,55,2,1905}, +{1,{47788},3,1,60,2,1911}} + +priest_holy_talents_tab = 11 + + + +priest_shadow_spells = {{589, 2, 0, 4}, {586, 2, 0, 8}, {8092, 2, 0, 10}, {8122, 2, 0, 10}, {2944, 2, 0, 20}, +{453, 1, 0, 20}, {2096, 2, 0, 22}, {976, 2, 0, 30}, {605, 2, 0, 30}, {32379, 2, 0, 62}, +{34433, 2, 0, 66}, {48045, 2, 0, 75}} + +priest_shadow_spells_count = 12 +priest_shadow_bgs = {"Interface\\TalentFrame\\PriestShadow-TopLeft", "Interface\\TalentFrame\\PriestShadow-TopRight", +"Interface\\TalentFrame\\PriestShadow-BottomLeft", "Interface\\TalentFrame\\PriestShadow-BottomRight"} + +priest_shadow_talents = {{3,{15270,15335,15336},0,1,10,1,465}, {2,{15337,15338},0,1,10,2,2027}, {5,{15259,15307,15308,15309,15310},0,1,10,3,462}, +{3,{15318,15272,15320},0,1,15,1,466}, {2,{15275,15317},0,1,15,2,482}, {3,{15260,15327,15328},0,1,15,3,463}, +{2,{15392,15448},0,1,20,1,542}, {5,{15273,15312,15313,15314,15316},0,1,20,2,481}, {1,{15407},2,1,20,3,501}, +{2,{15274,15311},0,1,25,2,483}, {2,{17322,17323},0,1,25,3,881}, {3,{15257,15331,15332},0,1,25,4,461}, +{1,{15487},2,1,30,1,541}, {1,{15286},2,1,30,2,484}, {2,{27839,27840},0,1,30,3,1638}, {3,{33213,33214,33215},0,1,30,4,1777}, +{2,{14910,33371},0,1,35,1,1781}, {3,{63625,63626,63627},0,1,35,3,2267}, +{1,{15473},2,1,40,2,521}, {5,{33221,33222,33223,33224,33225},0,1,40,3,1778}, +{2,{47569,47570},0,1,45,1,1906}, {3,{33191,33192,33193},0,1,45,3,1816}, +{1,{64044},2,1,50,1,1908}, {1,{34914},2,1,50,2,1779}, {3,{47580,47581,47582},0,1,50,3,1909}, +{5,{47573,47577,47578,51166,51167},0,1,55,3,1907}, +{1,{47585},3,1,60,2,1910}} + +priest_shadow_talents_tab = 12 + diff --git a/extra_buttons_bar/character advancement/rogue_vari.lua b/extra_buttons_bar/character advancement/rogue_vari.lua new file mode 100644 index 0000000..44dd03e --- /dev/null +++ b/extra_buttons_bar/character advancement/rogue_vari.lua @@ -0,0 +1,72 @@ +-- Documentation {5176, 2, 0, 1} {Spellid, Ability Essence, Talent Essence, Required Level} +-- Make sure to adjust Count if you add or subtract any spells +-- talent documentation {5,{16814,16814,16814,16814,16814},0,1,10,2,762} {number of ranks, {spellids}, AE cost, TE cost, required level, +-- column, talentId} +-- talents tab variables refers to talenttab dbc + +rogue_assassination_spells = {{2098, 2, 0, 1}, {5171, 2, 0, 10}, {8647, 2, 0, 14}, {703, 2, 0, 14}, {8676, 2, 0, 18}, +{1943, 2, 0, 20}, {2842, 2, 0, 20}, {1833, 2, 0, 26}, {408, 2, 0, 30}, {32645, 2, 0, 62}, {26679, 2, 0, 64}, {51722, 2, 0, 80}} + +rogue_assassination_spells_count = 12 +rogue_assassination_bgs = {"Interface\\TalentFrame\\RogueAssassination-TopLeft", "Interface\\TalentFrame\\RogueAssassination-TopRight", +"Interface\\TalentFrame\\RogueAssassination-BottomLeft", "Interface\\TalentFrame\\RogueAssassination-BottomRight"} + +rogue_assassination_talents = {{3,{14162,14163,14164},0,1,10,1,276}, {2,{14144,14148},0,1,10,2,272}, {5,{14138,14139,14140,14141,14142},0,1,10,3,270}, +{3,{14156,14160,14161},0,1,15,1,273}, {2,{51632,51633},0,1,15,2,2068}, {3,{13733,13865,13866},0,1,15,4,277}, +{1,{14983},1,1,20,1,382}, {2,{14168,14169},0,1,20,2,278}, {5,{14128,14132,14135,14136,14137},0,1,20,3,269}, +{3,{16513,16514,16515},0,1,25,2,682}, {5,{14113,14114,14115,14116,14117},0,1,25,3,268}, +{3,{31208,31209,312090},0,1,30,1,1721}, {1,{14177},2,1,30,2,280}, {3,{14174,14175,14176},0,1,30,3,279}, {2,{31244,31245},0,1,30,4,1762}, +{5,{14186,14190,14193,14194,14195},0,1,35,2,283}, {2,{14158,14159},0,1,35,3,274}, +{2,{51625,51626},0,1,40,1,2065}, {1,{58426},1,1,40,2,281}, {3,{31380,31382,31383},0,1,40,3,1723}, +{3,{51634,51635,51636},0,1,45,1,2069}, {3,{31234,31235,31236},0,1,45,3,1718}, +{3,{31226,31227,58410},0,1,50,1,1715}, {1,{1329},2,1,50,2,1719}, {3,{51627,51628,51629},0,1,50,3,2066}, +{5,{51664,51665,51667,51668,51669},0,1,55,2,2070}, +{1,{51662},3,1,60,2,2071}} + +rogue_assassination_talents_tab = 8 + + +rogue_combat_spells = {{1752, 2, 0, 1}, {53, 2, 0, 4}, {1776, 2, 0, 6}, {5277, 2, 0, 8}, {2983, 2, 0, 10}, +{1766, 2, 0, 12}, {1966, 2, 0, 16}, {5938, 2, 0, 70}, {51723, 2, 0, 80}} + +rogue_combat_spells_count = 9 +rogue_combat_bgs = {"Interface\\TalentFrame\\RogueCombat-TopLeft", "Interface\\TalentFrame\\RogueCombat-TopRight", +"Interface\\TalentFrame\\RogueCombat-BottomLeft", "Interface\\TalentFrame\\RogueCombat-BottomRight"} + +rogue_combat_talents = {{3,{13741,13793,13792},0,1,10,1,203},{2,{13732,13863},0,1,10,2,201},{5,{13715,13848,13849,13851,13852},0,1,10,3,221}, +{2,{14165,14166},0,1,15,1,1827}, {3,{13713,13853,13854},0,1,15,2,187}, {5,{13705,13832,13843,13844,13845},0,1,15,4,181}, +{2,{13742,13872},0,1,20,1,204}, {1,{14251},2,1,20,2,301}, {5,{13706,13804,13805,13806,13807},0,1,20,3,182}, +{2,{13754,13867},0,1,25,1,206}, {2,{13743,13875},0,1,25,2,222}, {3,{13712,13788,13789},0,1,25,3,186}, {5,{18427,18428,18429,61330,61331},0,1,25,4,1122}, +{5,{13709,13800,13801,13802,13803},0,1,30,1,184}, {1,{13877},2,1,30,2,223}, {5,{13960,13961,13962,13963,13964},0,1,30,3,242}, +{2,{30919,30920},0,1,35,2,1703}, {2,{31124,31126},0,1,35,3,1706}, +{3,{31122,31123,61329},0,1,40,1,1705}, {1,{13750},2,1,40,2,205}, {2,{31130,31131},0,1,40,3,1707}, +{2,{5952,51679},0,1,45,1,2072}, {5,{35541,35550,35551,35552,35553},0,1,45,3,1825}, +{2,{51672,51674},0,1,50,1,2073}, {1,{32601},1,1,50,2,1709}, {2,{51682,58413},0,1,50,3,2074}, +{5,{51685,51686,51687,51688,51689},0,1,55,2,2075}, +{1,{51690},3,1,60,2,2076}} + +rogue_combat_talents_tab = 7 + + + +rogue_subtlety_spells = {{1784, 2, 0, 1}, {921, 2, 0, 4}, {6770, 2, 0, 10}, {1725, 2, 0, 10}, {1804, 2, 0, 10}, {2836, 1, 0, 24}, +{1856, 2, 0, 35}, {1842, 1, 0, 30}, {2094, 2, 0, 34}, {1860, 1, 0, 40}, {31224, 2, 0, 66}, {57934, 2, 0, 80}} + +rogue_subtlety_spells_count = 12 +rogue_subtlety_bgs = {"Interface\\TalentFrame\\RogueSubtlety-TopLeft", "Interface\\TalentFrame\\RogueSubtlety-TopRight", +"Interface\\TalentFrame\\RogueSubtlety-BottomLeft", "Interface\\TalentFrame\\RogueSubtlety-BottomRight"} + +rogue_subtlety_talents = {{5,{14179,58422,58423,58424,58425},0,1,10,1,2244}, {5,{13958,13970,13971,813972,813973},0,1,10,2,241}, {2,{14057,14072},0,1,10,3,261}, +{2,{30892,30893},0,1,15,1,1700}, {2,{14076,14094},0,1,15,2,262}, {3,{13975,14062,14063},0,1,15,3,244}, +{2,{13981,14066},0,1,20,1,247}, {1,{14278},2,1,20,2,303}, {3,{14171,14172,14173},0,1,20,3,1123}, +{3,{13983,14070,14071},0,1,25,1,246}, {3,{13976,13979,13980},0,1,25,2,245}, {2,{14079,14080},0,1,25,3,263}, +{2,{30894,30895},0,1,30,1,1701}, {1,{14185},2,1,30,2,284}, {2,{14082,14083},0,1,30,3,265}, {1,{16511},2,1,30,4,681}, +{3,{31221,31222,31223},0,1,35,1,1713}, {5,{30902,30903,30904,30905,30906},0,1,35,3,1702}, +{3,{31211,31212,31213},0,1,40,1,1711}, {1,{14183},2,1,40,2,381}, {3,{31228,31229,31230},0,1,40,3,1722}, +{5,{31216,31217,31218,31219,31220},0,1,45,2,1712}, {2,{51692,51696},0,1,45,3,2077}, +{3,{51698,51700,51701},0,1,50,1,2078}, {1,{36554},2,1,50,2,1714}, {2,{58414,58415},0,1,50,3,2079}, +{5,{51708,51709,51710,51711,51712},0,1,55,2,2080}, +{1,{51713},3,1,60,2,2081}} + +rogue_subtlety_talents_tab = 9 + diff --git a/extra_buttons_bar/character advancement/shaman_vari.lua b/extra_buttons_bar/character advancement/shaman_vari.lua new file mode 100644 index 0000000..48e4377 --- /dev/null +++ b/extra_buttons_bar/character advancement/shaman_vari.lua @@ -0,0 +1,77 @@ +-- Documentation {5176, 2, 0, 1} {Spellid, Ability Essence, Talent Essence, Required Level} +-- Make sure to adjust Count if you add or subtract any spells +-- talent documentation {5,{16814,16814,16814,16814,16814},0,1,10,2,762} {number of ranks, {spellids}, AE cost, TE cost, required level, +-- column, talentId} +-- talents tab variables refers to talenttab dbc + +shaman_elemental_spells = {{403, 2, 0, 1}, {8042, 2, 0, 4}, {2484, 2, 0, 6}, {5730, 2, 0, 8}, {8050, 2, 0, 10}, +{3599, 2, 0, 10}, {1535, 2, 0, 12}, {370, 2, 0, 12}, {57994, 2, 0, 16}, {8056, 2, 0, 20}, {8190, 2, 0, 26}, +{66842, 2, 0, 30}, {421, 2, 0, 32}, {66843, 2, 0, 40}, {66844, 2, 0, 50}, {2894, 2, 0, 68}, {51505, 2, 0, 75}, +{51514, 2, 0, 80}} + +shaman_elemental_spells_count = 18 +shaman_elemental_bgs = {"Interface\\TalentFrame\\ShamanElementalcombat-TopLeft", "Interface\\TalentFrame\\ShamanElementalcombat-TopRight", +"Interface\\TalentFrame\\ShamanElementalcombat-BottomLeft", "Interface\\TalentFrame\\ShamanElementalcombat-BottomRight"} + +shaman_elemental_talents = {{5,{16039,16109,16110,16111,16112},0,1,10,2,564}, {5,{16035,16105,16106,16107,16108},0,1,10,3,563}, +{3,{16038,16160,16161},0,1,15,1,561}, {3,{28996,28997,28998},0,1,15,2,1640}, {3,{30160,29179,29180},0,1,15,3,1645}, +{5,{16040,16113,16114,16115,16116},0,1,20,1,575}, {1,{16164},1,1,20,2,574}, {5,{16089,60184,60185,60187,60188},0,1,20,3,565}, +{2,{16086,16544},0,1,25,1,567}, {3,{29062,29064,29065},0,1,25,4,1642}, +{2,{28999,29000},0,1,30,1,1641}, {1,{16041},1,1,30,2,562}, {3,{30664,30665,30666},0,1,30,4,1682}, +{3,{30672,30673,30674},0,1,35,1,1685}, {5,{16578,16579,16580,16581,16582},0,1,35,3,721}, +{1,{16166},2,1,40,2,573}, {3,{51483,51485,51486},0,1,40,3,2052}, +{2,{63370,63372},0,1,45,1,2262}, {2,{51466,51470},0,1,45,2,2049}, {3,{30675,30678,30679},0,1,45,3,1686}, +{3,{51474,51478,51479},0,1,50,1,2050}, {1,{30706},2,1,50,2,1687}, {3,{51480,51481,51482},0,1,50,3,2051}, +{5,{62097,62098,62099,62100,62101},0,1,55,2,2252}, +{1,{51490},3,1,60,2,2053}} + +shaman_elemental_talents_tab = 13 + + +shaman_enhancement_spells = {{8017, 2, 0, 1}, {8071, 2, 0, 4}, {324, 2, 0, 8}, {8024, 2, 0, 10}, {8075, 2, 0, 10}, +{2645, 2, 0, 20}, {8033, 2, 0, 20}, {131, 1, 0, 22}, {8181, 2, 0, 24}, {6196, 2, 0, 26}, {8184, 2, 0, 28}, +{8227, 2, 0, 28}, {546, 1, 0, 28}, {10595, 2, 0, 30}, {8232, 2, 0, 30}, {556, 2, 0, 30}, {8177, 2, 0, 30}, +{8512, 2, 0, 32}, {6495, 2, 0, 34}, {3738, 2, 0, 64}, {2825, 2, 0, 70}, {32182, 2, 0, 70}, {2062, 2, 0, 80}} + +shaman_enhancement_spells_count = 23 +shaman_enhancement_bgs = {"Interface\\TalentFrame\\ShamanEnhancement-TopLeft", "Interface\\TalentFrame\\ShamanEnhancement-TopRight", +"Interface\\TalentFrame\\ShamanEnhancement-BottomLeft", "Interface\\TalentFrame\\ShamanEnhancement-BottomRight"} + +shaman_enhancement_talents = {{3,{16259,16295,52456},0,1,10,1,610}, {2,{16043,16130},0,1,10,2,2101}, {5,{17485,17486,17487,17488,17489},0,1,10,3,614}, +{2,{16258,16293},0,1,15,1,609}, {5,{16255,16302,16303,16304,16305},0,1,15,2,613}, {2,{16262,16287},0,1,15,3,605}, {3,{16261,16290,51881},0,1,15,4,607}, +{3,{16266,29079,29080},0,1,20,1,611}, {1,{43338},1,1,20,3,617}, {3,{16254,16271,16272},0,1,20,4,601}, +{5,{16256,16281,16282,16283,16284},0,1,25,2,602}, {5,{16252,16306,16307,16308,16309},0,1,25,3,615}, +{2,{29192,29193},0,1,30,1,1647}, {3,{16268,18848,36591},0,1,30,2,616}, {3,{51883,51884,51885},0,1,30,3,2083}, +{3,{30802,30808,30809},0,1,35,1,1689}, {3,{29082,29084,29086},0,1,35,3,1643}, {2,{63373,63374},0,1,35,4,2263}, +{3,{30816,30818,30819},0,1,40,1,1692}, {0,{0},0,0,40,2,0}, {1,{17364},2,1,40,3,901}, +{5,{51525,51526,51527,975065,975066},0,1,45,1,2055}, {1,{60103},2,1,45,2,2249}, {2,{51521,51522},0,1,45,3,2054}, +{5,{30812,30813,30814,830815,830816},0,1,50,1,1691}, {1,{30823},2,1,50,2,1693}, {2,{51523,51524},0,1,50,3,2056}, +{5,{51528,51529,51530,51531,51532},0,1,55,2,2057}, +{1,{51533},3,1,60,2,2058}} + +shaman_enhancement_talents_tab = 15 + + + +shaman_restoration_spells = {{331, 2, 0 , 1}, {2008, 2, 0, 12}, {526, 2, 0, 16}, {8143, 2, 0, 18}, {5394, 2, 0, 20}, +{8004, 2, 0, 20}, {52127, 2, 0, 20}, {5675, 2, 0, 26}, {20608, 2, 0, 26}, {51730, 2, 0, 30}, {36936, 2, 0, 30}, {8170, 2, 0, 34}, +{1064, 2, 0, 40}} + +shaman_restoration_spells_count = 13 +shaman_restoration_bgs = {"Interface\\TalentFrame\\ShamanRestoration-TopLeft", "Interface\\TalentFrame\\ShamanRestoration-TopRight", +"Interface\\TalentFrame\\ShamanRestoration-BottomLeft", "Interface\\TalentFrame\\ShamanRestoration-BottomRight"} + +shaman_restoration_talents = {{5,{16182,16226,16227,16228,16229},0,1,10,2,586}, {5,{16173,16222,16223,16224,16225},0,1,10,3,595}, +{2,{16184,16209},0,1,15,1,589}, {3,{29187,29189,29191},0,1,15,2,1646}, {5,{16179,16214,16215,16216,16217},0,1,15,3,593}, +{3,{16180,16196,16198},0,1,20,1,583}, {3,{16181,16230,16232},0,1,20,2,587}, {1,{55198},2,1,20,3,582}, {3,{16176,16235,16240},0,1,20,4,581}, +{3,{16187,16205,16206},0,1,25,2,588}, {5,{16194,16218,16219,16220,16221},0,1,25,3,594}, +{3,{29206,29205,29202},0,1,30,1,1648}, {1,{16188},2,1,30,3,591}, {3,{30864,30865,30866},0,1,30,4,1695}, +{5,{16178,16210,16211,16212,16213},0,1,35,3,592}, +{5,{30881,30883,30884,30885,30886},0,1,40,1,1699}, {1,{16190},2,1,40,2,590}, {1,{51886},2,1,40,3,2084}, +{2,{51554,51555},0,1,45,1,2060}, {2,{30872,30873},0,1,45,2,1697}, {3,{30867,30868,30869},0,1,45,3,1696}, +{3,{51556,51557,51558},0,1,50,1,2061}, {1,{974},2,1,50,2,1698}, {2,{51560,51561},0,1,50,3,2059}, +{5,{51562,51563,51564,51565,51566},0,1,55,2,2063}, +{1,{61295},3,1,60,2,2064}} + +shaman_restoration_talents_tab = 14 + diff --git a/extra_buttons_bar/character advancement/warlock_vari.lua b/extra_buttons_bar/character advancement/warlock_vari.lua new file mode 100644 index 0000000..06ef51e --- /dev/null +++ b/extra_buttons_bar/character advancement/warlock_vari.lua @@ -0,0 +1,77 @@ +-- Documentation {5176, 2, 0, 1} {Spellid, Ability Essence, Talent Essence, Required Level} +-- Make sure to adjust Count if you add or subtract any spells +-- talent documentation {5,{16814,16814,16814,16814,16814},0,1,10,2,762} {number of ranks, {spellids}, AE cost, TE cost, required level, +-- column, talentId} +-- talents tab variables refers to talenttab dbc + +warlock_affliction_spells = {{702, 2, 0, 4}, {172, 2, 0, 4}, {1454, 2, 0, 6}, {980, 2, 0, 8}, {5782, 2, 0, 8}, +{1120, 2, 0, 10}, {689, 2, 0, 14}, {5138, 2, 0, 24}, {1714, 2, 0, 26}, {1490, 2, 0, 32}, {5484, 2, 0, 40}, +{6789, 2, 0, 42}, {603, 2, 0, 60}, {27243, 2, 0, 70}} + +warlock_affliction_spells_count = 14 +warlock_affliction_bgs = {"Interface\\TalentFrame\\Warlockcurses-TopLeft", "Interface\\TalentFrame\\Warlockcurses-TopRight", +"Interface\\TalentFrame\\Warlockcurses-BottomLeft", "Interface\\TalentFrame\\Warlockcurses-BottomRight"} + +warlock_affliction_talents = {{2,{18827,18829},0,1,10,1,1284}, {3,{18174,18175,18176},0,1,10,2,1005}, {5,{17810,17811,17812,17813,17814},0,1,10,3,1003}, +{2,{18179,18180},0,1,15,1,1006}, {2,{18213,18372},0,1,15,2,1101}, {2,{18182,18183},0,1,15,3,1007}, {2,{17804,17805},0,1,15,4,1004}, +{2,{53754,53759},0,1,20,1,2205}, {3,{17783,17784,17785},0,1,20,2,1001}, {1,{18288},1,1,20,3,1061}, +{2,{18218,18219},0,1,25,1,1021}, {2,{18094,18095},0,1,25,2,1002}, {3,{32381,32382,32383},0,1,25,4,1764}, +{5,{32385,32387,32392,32393,32394},0,1,30,1,1763}, {1,{63108},1,1,30,2,1041}, {1,{18223},2,1,30,3,1081}, +{2,{54037,54038},0,1,35,1,1873}, {5,{18271,18272,18273,18274,18275},0,1,35,2,1042}, +{3,{47195,47196,47197},0,1,40,1,1878}, {5,{30060,30061,30062,30063,30064},0,1,40,2,1669}, {1,{18220},2,1,40,3,1022}, +{2,{30054,30057},0,1,45,1,1668}, {3,{32477,32483,32484},0,1,45,3,1667}, +{3,{47198,47199,47200},0,1,50,1,1875}, {1,{30108},2,1,50,2,1670}, {1,{58435},1,1,50,3,2245}, +{5,{47201,47202,47203,47204,47205},0,1,55,2,1876}, +{1,{48181},3,1,60,2,2041}} + +warlock_affliction_talents_tab = 20 + + +warlock_demonology_spells = {{687, 2, 0, 1}, {688, 2, 0, 1}, {697, 2, 0, 10}, {6201, 2, 0, 10}, {755, 2, 0, 12}, +{5697, 1, 0, 16}, {693, 2, 0, 18}, {698, 2, 0, 20}, {712, 2, 0, 20}, {126, 1, 0, 22}, +{5500, 2, 0, 24}, {132, 2, 0, 26}, {710, 2, 0, 28}, {6366, 2, 0, 28}, {1098, 2, 0, 30}, {691, 2, 0, 30}, +{6229, 2, 0, 32}, {2362, 2, 0, 36}, {1122, 2, 0, 50}, +{18540, 2, 0, 60}, {28176, 2, 0, 62}, {29858, 2, 0, 66}, {29893, 2, 0, 68}, {48018, 2, 0, 80}, {48020, 2, 0, 80}} + +warlock_demonology_spells_count = 25 +warlock_demonology_bgs = {"Interface\\TalentFrame\\Warlocksummoning-TopLeft", "Interface\\TalentFrame\\Warlocksummoning-TopRight", +"Interface\\TalentFrame\\Warlocksummoning-BottomLeft", "Interface\\TalentFrame\\Warlocksummoning-BottomRight"} + +warlock_demonology_talents = {{2,{18692,18693},0,1,10,1,1221}, {3,{18694,18695,18696},0,1,10,2,1222}, {3,{18697,18698,18699},0,1,10,3,1223}, {2,{47230,47231},0,1,10,4,1883}, +{2,{18703,18704},0,1,15,1,1224}, {3,{18705,18706,18707},0,1,15,2,1225}, {3,{18731,18743,18744},0,1,15,3,1242}, +{3,{18754,18755,18756},0,1,20,1,1243}, {1,{19028},2,1,20,2,1282}, {1,{18708},2,1,20,3,1226}, {3,{30143,30144,30145},0,1,20,4,1671}, +{5,{18769,18770,18771,18772,18773},0,1,25,2,1262}, {2,{18709,18710},0,1,25,3,1227}, +{1,{30326},1,1,30,1,1281}, {2,{18767,18768},0,1,30,3,1261}, +{5,{23785,23822,23823,23824,23825},0,1,35,2,1244}, {3,{47245,47246,47247},0,1,35,3,1283}, +{3,{30319,30320,30321},0,1,40,1,1680}, {1,{47193},2,1,40,2,1880}, {3,{35691,35692,35693},0,1,40,3,1263}, +{5,{30242,30245,30246,30247,30248},0,1,45,2,1673}, {2,{63156,63158},0,1,45,3,2261}, +{3,{54347,54348,54349},0,1,50,1,1882}, {1,{30146},2,1,50,2,1672}, {3,{63117,63121,63123},0,1,50,3,1884}, +{5,{47236,47237,47238,47239,47240},0,1,55,2,1885}, +{1,{59672},3,1,60,2,1886}} + +warlock_demonology_talents_tab = 21 + + + +warlock_destruction_spells = {{686, 2, 0, 1}, {348, 2, 0, 6}, {5676, 2, 0, 18}, {5740, 2, 0, 20}, {1949, 2, 0, 30}, +{6353, 2, 0, 48}, {29722, 2, 0, 64}, {47897, 2, 0, 75}} + +warlock_destruction_spells_count = 8 +warlock_destruction_bgs = {"Interface\\TalentFrame\\WarlockDestruction-TopLeft", "Interface\\TalentFrame\\WarlockDestruction-TopRight", +"Interface\\TalentFrame\\WarlockDestruction-BottomLeft", "Interface\\TalentFrame\\WarlockDestruction-BottomRight"} + +warlock_destruction_talents = {{5,{17793,17796,17801,17802,17803},0,1,10,2,944}, {5,{17788,17789,17790,17791,17792},0,1,10,3,943}, +{2,{18119,18120},0,1,15,1,982}, {3,{63349,63350,63351},0,1,15,2,1887}, {3,{17778,17779,17780},0,1,15,3,941}, +{2,{18126,18127},0,1,20,1,983}, {1,{17877},2,1,20,2,963}, {5,{17959,59738,59739,59740,59741},0,1,20,3,967}, +{2,{18135,18136},0,1,25,1,985}, {2,{17917,17918},0,1,25,2,964}, {3,{17927,17929,17930},0,1,25,4,965}, +{3,{34935,34938,34939},0,1,30,1,1817}, {3,{17815,17833,17834},0,1,30,2,961}, {1,{18130},1,1,30,3,981}, +{3,{30299,30301,30302},0,1,35,1,1679}, {5,{17954,17955,17956,17957,17958},0,1,35,3,966}, +{1,{17962},2,1,40,2,968}, {3,{30293,30295,30296},0,1,40,3,1678}, {3,{18096,18073,63245},0,1,40,4,986}, +{5,{30288,30289,30290,30291,30292},0,1,45,2,1677}, {2,{54117,54118},0,1,45,3,1889}, +{3,{47258,47259,47260},0,1,50,1,1888}, {1,{30283},2,1,50,2,1676}, {3,{47220,47221,47223},0,1,50,3,2045}, +{5,{47266,47267,47268,47269,47270},0,1,55,2,1890}, +{1,{50796},3,1,60,2,1891}} + +warlock_destruction_talents_tab = 19 + + diff --git a/extra_buttons_bar/character advancement/warrior_vari.lua b/extra_buttons_bar/character advancement/warrior_vari.lua new file mode 100644 index 0000000..be5e491 --- /dev/null +++ b/extra_buttons_bar/character advancement/warrior_vari.lua @@ -0,0 +1,77 @@ +-- Documentation {5176, 2, 0, 1} {Spellid, Ability Essence, Talent Essence, Required Level} +-- Make sure to adjust Count if you add or subtract any spells +-- talent documentation {5,{16814,16814,16814,16814,16814},0,1,10,2,762} {number of ranks, {spellids}, AE cost, TE cost, required level, +-- column, talentId} +-- talents tab variables refers to talenttab dbc + +warrior_arms_spells = {{78, 2, 0, 1}, {2457, 2, 0, 1}, {100, 2, 0, 4}, {772, 2, 0, 4}, {6343, 2, 0, 6}, +{1715, 2, 0, 8}, {7384, 2, 0, 12}, {694, 2, 0, 18}, {20230, 2, 0, 20}, {64382, 2, 0, 71}, {57755, 2, 0, 80}} + +warrior_arms_spells_count = 11 +warrior_arms_bgs = {"Interface\\TalentFrame\\WarriorArms-TopLeft", "Interface\\TalentFrame\\WarriorArms-TopRight", +"Interface\\TalentFrame\\WarriorArms-BottomLeft", "Interface\\TalentFrame\\WarriorArms-BottomRight"} + +warrior_arms_talents = {{3,{12282,12663,12664},0,1,10,1,124}, {5,{16462,16463,16464,16465,16466},0,1,10,2,130}, {2,{12286,12658},0,1,10,3,127}, +{2,{12285,12697},0,1,15,1,126}, {3,{12300,12959,12960},0,1,15,2,641}, {3,{12295,12676,12677},0,1,15,3,128}, +{2,{12290,12963},0,1,20,1,131}, {1,{12296},1,1,20,2,137}, {2,{16493,16494},0,1,20,3,662}, {3,{12834,12849,12867},0,1,20,4,121}, +{3,{12163,12711,12712},0,1,25,2,136}, {3,{56636,56637,56638},0,1,25,3,2232}, +{5,{12700,12781,12783,12784,12785},0,1,30,1,132}, {1,{12328},2,1,30,2,133}, {5,{12284,12701,12702,12703,12704},0,1,30,3,125}, {5,{12281,12812,12813,12814,12815},0,1,30,4,123}, +{2,{20504,20505},0,1,35,1,134}, {3,{12289,12668,23695},0,1,35,3,129}, {2,{46854,46855},0,1,35,4,1859}, +{2,{29834,29838},0,1,40,1,1663}, {1,{12294},2,1,40,2,135}, {2,{46865,46866},0,1,40,3,1862}, {2,{12862,12330},0,1,40,4,2233}, +{1,{64976},1,1,45,1,2283}, {3,{35446,35448,35449},0,1,45,2,1824}, {2,{46859,46860},0,1,45,3,1860}, +{3,{29723,29725,29724},0,1,50,1,1662}, {1,{29623},1,1,50,2,1661}, {2,{29836,29859},0,1,50,3,1664}, +{5,{46867,56611,56612,56613,56614},0,1,55,2,2231}, +{1,{46924},3,1,60,2,1863}} + +warrior_arms_talents_tab = 4 + + + + +warrior_fury_spells = {{6673, 2, 0, 1}, {34428, 2, 0, 6}, {1160, 2, 0, 14}, {845, 2, 0, 20}, {5246, 2, 0, 22}, +{5308, 2, 0, 24}, {1161, 2, 0, 26}, {1464, 2, 0, 30}, {2458, 2, 0, 30}, {20252, 2, 0, 30}, {18499, 2, 0, 32}, +{1680, 2, 0, 36}, {6552, 2, 0, 38}, {1719, 2, 0, 50}, {55694, 2, 0, 75}} + +warrior_fury_spells_count = 15 +warrior_fury_bgs = {"Interface\\TalentFrame\\WarriorFury-TopLeft", "Interface\\TalentFrame\\WarriorFury-TopRight", +"Interface\\TalentFrame\\WarriorFury-BottomLeft", "Interface\\TalentFrame\\WarriorFury-BottomRight"} + +warrior_fury_talents = {{3,{61216,61221,61222},0,1,10,1,2250}, {2,{12321,12835},0,1,10,2,158}, {5,{12320,12852,12853,12855,12856},0,1,10,3,157}, +{5,{12324,12876,12877,12878,12879},0,1,15,2,161}, {5,{12322,12999,13000,13001,13002},0,1,15,3,159}, +{3,{12329,12950,20496},0,1,20,1,166}, {1,{12323},2,1,20,2,160}, {3,{16487,16489,16492},0,1,20,3,661}, {5,{12318,12857,12858,12860,12861},0,1,20,4,154}, +{5,{23584,23585,23586,23587,23588},0,1,25,1,1581}, {2,{20502,20503},0,1,25,2,1542}, {5,{12317,13045,13046,13047,13048},0,1,25,3,155}, +{3,{29590,29591,29592},0,1,30,1,1657}, {1,{12292},2,1,30,2,165}, {2,{29888,29889},0,1,30,3,1543}, +{2,{20500,20501},0,1,35,1,1541}, {5,{12319,12971,12972,12973,12974},0,1,35,3,156}, +{3,{46908,46909,56924},0,1,40,1,1864}, {1,{23881},2,1,40,2,167}, {2,{29721,29776},0,1,40,4,1655}, +{2,{46910,46911},0,1,45,1,1865}, {5,{29759,29760,29761,29762,29763},0,1,45,4,1658}, +{1,{60970},2,1,50,1,1868}, {1,{29801},2,1,50,2,1659}, {3,{46913,46914,46915},0,1,50,3,1866}, +{5,{56927,56929,56930,56931,56932},0,1,55,2,2234}, +{1,{46917},3,1,60,2,1867}} + +warrior_fury_talents_tab = 6 + + + +warrior_protection_spells = {{2687, 2, 0, 10}, {71, 2, 0, 10}, {7386, 2, 0, 10}, {355, 2, 0, 10}, {72, 2, 0, 12}, +{6572, 2, 0, 14}, {2565, 2, 0, 16}, {676, 2, 0, 18}, {12678, 1, 0, 20}, {871, 2, 0, 28}, {23922, 2, 0, 40}, +{23920, 2, 0, 64}, {3411, 2, 0, 70}} + +warrior_protection_spells_count = 13 +warrior_protection_bgs = {"Interface\\TalentFrame\\WarriorProtection-TopLeft", "Interface\\TalentFrame\\WarriorProtection-TopRight", +"Interface\\TalentFrame\\WarriorProtection-BottomLeft", "Interface\\TalentFrame\\WarriorProtection-BottomRight"} + +warrior_protection_talents = {{2,{12301,12818},0,1,10,1,142}, {5,{12298,12724,12725,12726,12727},0,1,10,2,1601}, {3,{12287,12665,12666},0,1,10,3,141}, +{3,{50685,50686,50687},0,1,15,2,144}, {5,{12297,12750,12751,12752,12753},0,1,15,3,138}, +{1,{12975},2,1,20,1,153}, {2,{12797,12799},0,1,20,2,147}, {2,{29598,29599},0,1,20,3,1654}, {5,{12299,12761,12762,12763,12764},0,1,20,4,140}, +{2,{59088,59089},0,1,25,1,2247}, {2,{12313,12804},0,1,25,2,151}, {3,{12308,12810,12811},0,1,25,3,146}, +{2,{12312,12803},0,1,30,1,150}, {1,{12809},2,1,30,2,152}, {2,{12311,12958},0,1,30,3,149}, +{5,{16538,16539,16540,16541,16542},0,1,35,3,702}, +{2,{29593,29594},0,1,40,1,1652}, {1,{50720},2,1,40,2,148}, {3,{29787,29790,29792},0,1,40,3,1660}, +{3,{29140,29143,29144},0,1,45,2,1653}, {2,{46945,46949},0,1,45,3,1870}, +{1,{57499},1,1,50,1,2236}, {1,{20243},2,1,50,2,1666}, {3,{47294,47295,47296},0,1,50,3,1893}, +{3,{46951,46952,46953},0,1,55,2,1871}, {2,{58872,58874},0,1,55,3,2246}, +{1,{46968},3,1,60,2,1872}} + +warrior_protection_talents_tab = 5 + + diff --git a/extra_buttons_bar/character advancement/zgeneral_vari.lua b/extra_buttons_bar/character advancement/zgeneral_vari.lua new file mode 100644 index 0000000..2ecdbc6 --- /dev/null +++ b/extra_buttons_bar/character advancement/zgeneral_vari.lua @@ -0,0 +1,5 @@ +general_spells = {{107, 1, 0, 1}, {3127, 2, 0, 1}, {774994, 2, 0, 1}, {674, 1, 0, 1}} + +--{668, 1, 0, 1}, {669, 1, 0, 1}, {670, 1, 0, 1}, {671, 1, 0, 1}, {672, 1, 0, 1}, {815, 1, 0, 1}, {7340, 1, 0, 1}, {7341, 1, 0, 1}, {17737, 1, 0, 1}} Languages + +general_spells_count = 4 \ No newline at end of file diff --git a/extra_buttons_bar/resets/ClientResets.lua b/extra_buttons_bar/resets/ClientResets.lua new file mode 100644 index 0000000..e69de29 diff --git a/extra_buttons_bar/resets/ServerResets.lua b/extra_buttons_bar/resets/ServerResets.lua new file mode 100644 index 0000000..e69de29 diff --git a/extra_buttons_bar/stat allocation/ClientStatAllocation.lua b/extra_buttons_bar/stat allocation/ClientStatAllocation.lua new file mode 100644 index 0000000..e69de29 diff --git a/extra_buttons_bar/stat allocation/ServerStatAllocation.lua b/extra_buttons_bar/stat allocation/ServerStatAllocation.lua new file mode 100644 index 0000000..e69de29 diff --git a/general_server_luas/Instance Variable System.lua b/general_server_luas/Instance Variable System.lua new file mode 100644 index 0000000..f4b095c --- /dev/null +++ b/general_server_luas/Instance Variable System.lua @@ -0,0 +1,81 @@ +maximumInstanceVariables = 5 + +instanceTotalIndices = 0 -- The total number of incices and their counters. +instanceIndex = {} -- The instance ID corresponding to an instance counter. +instanceVariables = {} -- An array of arrays containing variables. + + +function InstanceSystemCreateVariables(instanceId) + local hasBeenAdded = false + + for i=1,instanceTotalIndices,1 do + if (instanceVariables[i][1] == nil) then -- If the first value of an array is nil, then it can be reused. + instanceIndex[i] = instanceId + + instanceVariables[i] = {} + + -- Initalize instance variables. + for j=1,maximumInstanceVariables,1 do + instanceVariables[i][j] = 0 + end + + hasBeenAdded = true + break + end + end + + if (hasBeenAdded == false) then + instanceTotalIndices = instanceTotalIndices + 1 + + instanceIndex[instanceTotalIndices] = instanceId + + instanceVariables[instanceTotalIndices] = {} + -- Initalize instance variables. + for j=1,maximumInstanceVariables,1 do + instanceVariables[instanceTotalIndices][j] = 0 + end + end +end + +-- Returns the instance variable corresponding to the specified instanceId and index. +-- Returns nil if no variable was found for the specified instanceId and/or index. +function InstanceSystemGetVariable(instanceId, variableIndex) + for i=1,instanceTotalIndices,1 do + if (instanceIndex[i] == instanceId) then + return instanceVariables[i][variableIndex] + end + end + + return nil +end + +-- Attempts to set the variable for the specified instanceId at the specified index +-- in the variables array. +-- Does nothing if the specified instanceId doesn't correspond to any existing +-- entry. +function InstanceSystemSetVariable(instanceId, index, variable) + if (index < maximumInstanceVariables and index > 0) then + for i=1,instanceTotalIndices,1 do + if (instanceIndex[i] == instanceId) then + instanceVariables[i][index] = variable + end + end + end +end + +-- Resets all data held for the specified instanceId. +-- Does nothing if there was no data being held for the specified instanceId. +function InstanceSystemFinish(instanceId) + for i=1,instanceTotalIndices,1 do + if (instanceIndex[i] == instanceId) then + instanceIndex[i] = nil + + -- Initalize instance variables. + for j=1,maximumInstanceVariables,1 do + instanceVariables[i][j] = 0 + end + + break + end + end +end diff --git a/general_server_luas/awakening_config.lua b/general_server_luas/awakening_config.lua new file mode 100644 index 0000000..9a0094b --- /dev/null +++ b/general_server_luas/awakening_config.lua @@ -0,0 +1,45 @@ +--[[SYSTEM PREFERENCES + ------------------ + CustomClasses - Are Shard's custom classes installed? + EnableDeathAnnouncer - Set to true if you wish PvP deaths to be announced globally. + ClassColorCodes - Table of color codes, correspond to default WoW classes. + PvPExpRate - Experience Rate of the PvP Kill system. (Default: 1) +]] +EnableDeathAnnouncer = true +ClassColorCodes = {"C79C6E", "F58CBA", "ABD473", "FFF569", "FFFFFF", "C41F3B", "0070DE", "69CCF0", "9482C9", nil, "FF7D0A"} +PvPExpRate = 3.5 + +--[[AWAKENING PREFERENCES + ----------------- + SpellCooldownMult - Affects the rate of cooldown for all shard_spell_table defined spells. + StatPointsPerLevel - Amount of Stat Allocation points granted upon Level Up. + GroupBonusExpMultiplier - This number will be multiplied by the level of the killed mob to calculate bonus EXP gain. + GroupBonusExpLevelDiff - The maximum levels higher a player can be than the mob he kills to gain bonus EXP. + PvPLevelDiff - Players that die to a player that has this much of a level advantage will not drop loot. + xpdist - Distance at which group members will gain bonus experience when another group member scores a PvE kill. + tokenid - ID of token to be given to player on levelup +]] +-- blah +SpellCooldownMult = 1 +StatPointsPerLevel = 5 +GroupBonusExpMultiplier = 0 +GroupBonusExpLevelDiff = 5 +PvPLevelDiff = 5 +xpdist = 74 +spell_essence = 383080 +talent_essence = 383081 +spell_reset_token = 383082 +talent_reset_token = 383083 +safety_ids = {489, 529, 30, 562, 617, 559, 572, 566, 607} +nocapzones = {46, 1377, 15, 718} +free_spell_reset = false +free_talent_reset = false + +--[[COMMAND PREFERENCES + ------------------- + ReloadSpellsCommand - Reloads the shard_spells_table data. + CullCharactersCommand - Sweeps through the various Shard tables and deletes characters that don't exist in the "characters" table. +]] + +ReloadSpellsCommand = "%reload spells" +CullCharactersCommand = "%cull characters" --Disabled, incomplete/broken. diff --git a/general_server_luas/wholeThing.lua b/general_server_luas/wholeThing.lua new file mode 100644 index 0000000..ae9b6ca --- /dev/null +++ b/general_server_luas/wholeThing.lua @@ -0,0 +1,299 @@ + +local function On_LevelUp (event, player, oldLevel) + + player:AddItem(spell_essence, 1) + + if oldLevel >= 9 then + + player:AddItem(talent_essence, 1) + + end + +end + +RegisterPlayerEvent(13, On_LevelUp) + + + +--[[RANDOM ENCHANTMENT GENERATOR]] +--[[ +Enchantment slot test results: +0: WORKS +1: WORKS +2: DOES NOT WORK +3: DOES NOT WORK +4: DOES NOT WORK +5: WORKS +6: WORKS (DOES NOT DISPLAY) +7-11: DOES NOT WORK +]] + +function RollEnchant(item, player) + + local item_level = item:GetItemLevel() + local player_level = item:GetRequiredLevel() + local tier = 1 + local effect = nil + --local req_level = item + + local itemClass = "" + if (item:GetClass() == 2) then + itemClass = "WEAPON" + elseif (item:GetClass() == 4) then + itemClass = "ARMOR" + end + + if (1 <= player_level) and (player_level <=9) then + tier = 1 + + elseif (10 <= player_level) and (player_level <=18) then + tier = 2 + + elseif (19 <= player_level) and (player_level <=27) then + tier = 3 + + elseif (28 <= player_level) and (player_level <=36) then + tier = 4 + + elseif (37 <= player_level) and (player_level <=44) then + tier = 5 + + --elseif (46 <= player_level) and (player_level <=54) then + -- tier = 6 + + elseif ( (item_level >= 50) and (item_level <= 55) ) then + tier = 7 + + elseif ( (item_level >= 56) and (item_level <= 63) ) then + tier = 8 + + elseif ( (item_level >= 64) and (item_level <= 71) ) then + tier = 9 + + elseif ( (item_level >= 72) and (item_level <= 78) ) then + tier = 10 + + elseif ( (item_level >= 79) and (item_level <= 83) ) then + tier = 11 + + elseif (item_level >= 84) then + tier = 12 + + end + + if itemClass ~= "" then + local query = WorldDBQuery("SELECT enchantID FROM item_enchantment_random_tiers WHERE tier="..tier.." AND (class='"..itemClass.."' OR class='ANY') ORDER BY RAND() LIMIT 1;") + if (query) then + effect = query:GetInt32(0) + end + end + return effect +end + +function OnLoot(event, player, item, count) + --[[ + item quality will be checked in order to allow for a higher chance to get random enchants + item:GetQuality will return a number that will be equal to quality + 0 - grey + 1 - white + 2 - green + 3 - blue + 4 - purple + 5 - orange + 6 - red (not used?) + 7 - gold (bind to account) + ]] -- 0 1 2 3 4 5 + + --scarlet crusade tabard exception + if (item:GetEntry() == 23192) then + return false + end + -- + local chance_increaser = {101, 95, 30, 20, 0, 0} -- chances for each quality to get random_enchantments, the lower the number the higher the chance + + local slotBools = {} + local slotIDs = {} + local its = 0 + local item_class = item:GetClass() + local item_quality = item:GetQuality() + + if item_class == 2 or item_class == 4 then + local boolRoll1 = math.random(1,100) + boolRoll1 = math.random(1,100) + if (boolRoll1 >= chance_increaser[item_quality]) then + slotBools[1] = true + slotIDs[1] = RollEnchant(item, player) + else + slotBools[1] = false + end + + if (slotBools[1] == true) and (slotIDs[1] ~= nil) then + item:SetEnchantment(slotIDs[1], 5) + end + end +end + +RegisterPlayerEvent(32, OnLoot) + + + +function RemoveExhaustion(eventID, delay, pCall, player) + local CurrentEnergy = player:GetPower(3) + if (CurrentEnergy >= 200) and (player:GetAura(818013)) then + player:RemoveAura(818013) + player:RemoveEvents() + player:SendBroadcastMessage("You feel refreshed.") + end +end + +--[[DYNAMIC SPELL SYSTEM FUNCTIONS]] +function SendDamage(player, target, spellID, amount, school) --Sends damage to the target. + player:SendDamage(target, amount, spellID, school, false) +end +function SendHeal(player, target, spellID, amount) --Heals the target. + player:DealHeal(target, spellID, amount, false) +end +function SendCooldown(player, spellID, duration) --Sends the cooldown to the player. + player:SendCooldown(spellID, duration) +end +function SendAura(player, target, spellID, duration) --Sets the duration of the effect on the target. + player:AddAura(spellID, target) + local aura = target:GetAura(spellID) + if (aura) then + aura:SetMaxDuration(duration) + aura:SetDuration(duration) + end +end + +--[[ENERGY DRAIN Obsolete]] +function EnergyDrain(eventID, delay, pCall, player) + local CurrentEnergy = player:GetPower(3) + if (player:GetAura(818012)) then + if (player:GetPower(3) >= 25) then + local NewEnergy = (CurrentEnergy-25) + player:SetPower(3, NewEnergy) + else + player:RemoveEvents() + player:RemoveAura(818012) + end + else + player:RemoveEvents() + end +end + + + +--[[AUTO ATTACK]] +--function auto_attack(event, player, spell) + --if (spell:GetEntry()==7712) then + --if (player:GetPower(3)>=75) then + --player:CastSpell(player, 818001, false) + --else + --player:CastSpell(player, 818013, false) + --player:SendBroadcastMessage("|cffff0000I am exhausted!|r") + --player:RegisterEvent(RemoveExhaustion, 250, 0) + --end + --end +--end +--RegisterPlayerEvent(5, auto_attack) + + + + +function sprintcheck(event, player, spell) + if (spell:GetEntry()==818012) then + if (player:GetAura(818011)) then + player:RemoveAura(818011) + end + if (player:GetAura(818012)) then + spell:Cancel() + player:RemoveAura(818012) + player:RemoveEvents() + else + curen = player:GetPower(3) + player:RegisterEvent(EnergyDrain, 1700, 0) + end + end +end +RegisterPlayerEvent(5, sprintcheck) + + +function RestCheck(event, player, spell) + if (spell:GetEntry()==818011) then + player:SendBroadcastMessage("I am resting. . .") + if (player:GetAura(818012)) then + player:RemoveAura(818012) + end + if (player:GetAura(818011)) then + spell:Cancel() + player:RemoveAura(818011) + player:RemoveEvents() + -- else + -- player:RegisterEvent(BreakRest, 50, 0) + end + end +end +RegisterPlayerEvent(5, RestCheck) + + + +function On_LogIn (event, player) + player:AddAura(7711, player) --Modded in the DBC files, this is the aura that makes auto attacks cost energy. + player:RemoveSpell(668, player) + player:LearnSpell(668, player) --Language glitch band-aid. Teaches Player common + player:LearnSpell(669, player) --Language glitch band-aid. Teaches Player common + player:SetSkill(98, 1, 300, 300) + player:SetSkill(109, 1, 300, 300) + if (player:GetAura(818012)) then + player:RegisterEvent(EnergyDrain, 1000, 0) + end +end + + +function first_login (event, player) + CharDBExecute("INSERT INTO character_stat_points (guid) VALUES ("..player:GetGUIDLow()..")") + CharDBExecute("INSERT INTO character_stat_allocation (guid, str, agi, sta, inte, spi) VALUES ("..player:GetGUIDLow()..",0, 0, 0, 0, 0)") + player:LearnSpell(750) + player:LearnSpell(264) + player:LearnSpell(5011) + player:LearnSpell(1180) + player:LearnSpell(15590) + player:LearnSpell(266) + player:LearnSpell(196) + player:LearnSpell(198) + player:LearnSpell(201) + player:LearnSpell(200) + player:LearnSpell(3018) + player:LearnSpell(5019) + player:LearnSpell(227) + player:LearnSpell(264) + player:LearnSpell(197) + player:LearnSpell(199) + player:LearnSpell(202) + player:LearnSpell(5009) + player:AddItem(2504) + player:AddItem(2512, 400) + player:AddItem(25) + player:AddItem(2211) + player:AddItem(2508) + player:AddItem(2516, 400) + player:AddItem(2092) + player:AddItem(35) + player:AddItem(383082) + player:AddItem(383083) + player:RemoveSpell(78) + player:RemoveSpell(2457) + player:LearnSpell(818003) + player:LearnSpell(818004) + player:LearnSpell(818014) + player:LearnSpell(818011) + player:LearnSpell(818040) + player:LearnSpell(668, player) --Language glitch band-aid. Teaches Player common + player:LearnSpell(669, player) --Language glitch band-aid. Teaches Player common + player:SetSkill(98, 1, 300, 300) + player:SetSkill(109, 1, 300, 300) + +end + +RegisterPlayerEvent(30, first_login) + diff --git a/hardcore_pvp/InteractiveGuards.lua b/hardcore_pvp/InteractiveGuards.lua new file mode 100644 index 0000000..4bca3d3 --- /dev/null +++ b/hardcore_pvp/InteractiveGuards.lua @@ -0,0 +1,94 @@ + --[[INTERACTIVE GUARDS SYSTEM]]-- + +--Loading guard ids-- +local Guards_Entry = {} + +local Guard_Factions = { + 88, -- dwarwes of dungarok + 11, -- stormwind guards + 57, -- ironforge + 56, -- night watch + 71, -- undercity + 85, -- orgrimmar + 64, -- gnomerigan + 473, -- chernii woron + 1625, -- serebryanni rassvet + 814, -- serebryanni rassvet + 123, -- arathor + 1054, -- wildhammer dwarf + --1603, -- lunosvet + 76, -- dalaran mages (EASTERN KINGDOM) + 79, -- darnas + 1575, -- straji pustoti + 412, -- oskvernitely + 1577, -- liga arathora + 105, -- thousand needles guards (horde) + 83, -- thunder bluff + 150, -- theramore + 877, -- sen'jin watchers + 1515, -- warsong guard (barrens) + 854, --Everlook + 121, --Gadgetzan + 1857, --Light's Hope Argent Dawn + 475, --Steamwheel + 1254, -- Cenarion Circle + 1475, -- Thormium Point + +} +for k, v in pairs(Guard_Factions) do + local entry = WorldDBQuery("SELECT entry FROM creature_template WHERE faction = "..v..";") + if (entry) then + for i = 1, entry:GetRowCount() do + table.insert(Guards_Entry, entry:GetInt32(0)) + entry:NextRow() + end + end + end + +local function Guard_Back(eventId, delay, repeats, creature) + if (creature:GetFaction() == 7) and (not(creature:GetVictim()) or (creature:GetVictim():IsDead())) then + local faction = WorldDBQuery("SELECT faction FROM creature_template where entry = '"..creature:GetEntry().."';") + creature:SetFaction(faction:GetInt32(0)) + if (creature:GetWaypointPath()) then + creature:MoveHome() + creature:MoveWaypoint() + else + creature:MoveHome() + end + end +end + --attack player when player attacks player of the same faction +local function Guard_MainAction(event, killer, killed) + if not(killer:IsFFAPvP()) then + return false + end + if (killer:ToPlayer() and killed:ToPlayer()) and ( (killer:IsAlliance() and killed:IsAlliance()) or (killer:IsHorde() and killed:IsHorde()) ) then + + local FriendlyCreatures = killer:GetFriendlyUnitsInRange(60) + + for n, creature in pairs(FriendlyCreatures) do + for m,faction_g in pairs(Guard_Factions) do + if (faction_g == creature:GetFaction()) then + creature:SetFaction(7) + creature:AttackStart(killer) + creature:RegisterEvent(Guard_Back, 2000, 0) + if ((killer:GetLevel()-creature:GetLevel()) > 5) then + creature:AddAura(266602, creature) + end + end + end + end + end +end + +RegisterPlayerEvent(33, Guard_MainAction) + + +--[[for k,v in pairs(Guards_Entry) do + RegisterCreatureEvent(v, 2, Guard_Back) -- on leave combat + RegisterCreatureEvent(v, 3, Guard_Back) -- on target died + RegisterCreatureEvent(v, 5, Guard_Back) -- on spawn + --RegisterCreatureEvent(v, 10, Guard_Back) -- on precombat + RegisterCreatureEvent(v, 7, Guard_Back) -- on aiupdate + --RegisterCreatureEvent(v, 23, Guard_Back) +end]]-- \ No newline at end of file diff --git a/hardcore_pvp/PvPClient.lua b/hardcore_pvp/PvPClient.lua new file mode 100644 index 0000000..abb4562 --- /dev/null +++ b/hardcore_pvp/PvPClient.lua @@ -0,0 +1,331 @@ + +local AIO = AIO or require("AIO") + + +if AIO.AddAddon() then + return +end + + +local MyHandlers = AIO.AddHandlers("PvP", {}) + + +Framework = CreateFrame("Frame", "first_frame", UIParent, nil) +local FullLootFrame = Framework +FullLootFrame:SetSize(416, 310) +--FullLootFrame:SetScale(0.88) --making everything more or less fit standart sizes of blizz interfaces +FullLootFrame:SetMovable(true) +FullLootFrame:EnableMouse(true) +FullLootFrame:RegisterForDrag("LeftButton") +FullLootFrame:SetPoint("BOTTOMRIGHT", -270, 60) +FullLootFrame:SetToplevel(true) +FullLootFrame:SetClampedToScreen(true) +FullLootFrame:SetBackdrop({ + bgFile = "Interface\\AddOns\\AwAddons\\Textures\\misc\\loot", + insets = { left = -30, right = -30, top = -101, bottom = -101} + }) +FullLootFrame:SetScript("OnDragStart", FullLootFrame.StartMoving) +FullLootFrame:SetScript("OnHide", FullLootFrame.StopMovingOrSizing) +FullLootFrame:SetScript("OnDragStop", FullLootFrame.StopMovingOrSizing) + +FullLootFrame_scroll = CreateFrame("ScrollFrame", nil, FullLootFrame) +FullLootFrame_scroll:SetSize(500,198) +FullLootFrame_scroll:SetPoint("CENTER", -25, -25) +FullLootFrame_content = CreateFrame("Frame", nil, FullLootFrame) +FullLootFrame_content:SetSize(FullLootFrame_scroll:GetSize()) +FullLootFrame_content:SetPoint("CENTER") + +FullLootscrollbar = CreateFrame("Slider", nil, FullLootFrame_scroll, "UIPanelScrollBarTemplate") +FullLootscrollbar:SetPoint("TOPLEFT", FullLootFrame, "TOPRIGHT", -79, -57) +FullLootscrollbar:SetPoint("BOTTOMLEFT", FullLootFrame, "BOTTOMRIGHT", -79, 33) + +FullLootscrollbar:SetMinMaxValues(1, 1250) +FullLootscrollbar:SetValueStep(1) +FullLootscrollbar.scrollStep = 1 +FullLootscrollbar:SetValue(0) +FullLootscrollbar:SetWidth(16) +FullLootscrollbar:SetScript("OnValueChanged", +function (self, value) +FullLootFrame_scroll:SetVerticalScroll(value) +end) +local FLscrollbg = FullLootscrollbar:CreateTexture(nil, "BACKGROUND") +FLscrollbg:SetAllPoints(FullLootscrollbar) +FLscrollbg:SetTexture(0, 0, 0, 0.4) + +FullLootFrame_scroll:SetScrollChild(FullLootFrame_content) +FullLootFrame:Hide() + +local FullLootFrame_TitleText = FullLootFrame:CreateFontString("FullLootFrame_TitleText") +FullLootFrame_TitleText:SetFont("Fonts\\FRIZQT__.TTF", 12.2) +FullLootFrame_TitleText:SetSize(300, 5) +FullLootFrame_TitleText:SetFontObject(GameFontNormal) +FullLootFrame_TitleText:SetPoint("TOP", -15, -25) +FullLootFrame_TitleText:SetShadowOffset(1, -1) +FullLootFrame_TitleText:SetText("Unclaimed Belongings") +local FullLootFrame_CloseButton = CreateFrame("Button", "FullLootFrame_CloseButton", FullLootFrame, "UIPanelCloseButton") +FullLootFrame_CloseButton:SetPoint("TOPRIGHT", -55, -12) +FullLootFrame_CloseButton:EnableMouse(true) +--FullLootFrame_CloseButton:SetSize(31, 30) + + FullLootFrame:EnableMouseWheel(true) + FullLootFrame:SetScript("OnMouseWheel", function(self, delta) + if (FullLootscrollbar:IsVisible()) then + local value = FullLootscrollbar:GetValue() + FullLootscrollbar:SetValue(value-delta*50) + end + end) + + + +local FullLoot_Button1 = CreateFrame("Button", "FullLoot_Button1", FullLootFrame_content, nil) +local FullLoot_Button2 = CreateFrame("Button", "FullLoot_Button2", FullLootFrame_content, nil) +local FullLoot_Button3 = CreateFrame("Button", "FullLoot_Button3", FullLootFrame_content, nil) +local FullLoot_Button4 = CreateFrame("Button", "FullLoot_Button4", FullLootFrame_content, nil) +local FullLoot_Button5 = CreateFrame("Button", "FullLoot_Button5", FullLootFrame_content, nil) +local FullLoot_Button6 = CreateFrame("Button", "FullLoot_Button6", FullLootFrame_content, nil) +local FullLoot_Button7 = CreateFrame("Button", "FullLoot_Button7", FullLootFrame_content, nil) +local FullLoot_Button8 = CreateFrame("Button", "FullLoot_Button8", FullLootFrame_content, nil) +local FullLoot_Button9 = CreateFrame("Button", "FullLoot_Button9", FullLootFrame_content, nil) +local FullLoot_Button10 = CreateFrame("Button", "FullLoot_Button10", FullLootFrame_content, nil) +local FullLoot_Button11 = CreateFrame("Button", "FullLoot_Button11", FullLootFrame_content, nil) +local FullLoot_Button12 = CreateFrame("Button", "FullLoot_Button12", FullLootFrame_content, nil) +local FullLoot_Button13 = CreateFrame("Button", "FullLoot_Button13", FullLootFrame_content, nil) +local FullLoot_Button14 = CreateFrame("Button", "FullLoot_Button14", FullLootFrame_content, nil) +local FullLoot_Button15 = CreateFrame("Button", "FullLoot_Button15", FullLootFrame_content, nil) +local FullLoot_Button16 = CreateFrame("Button", "FullLoot_Button16", FullLootFrame_content, nil) +local FullLoot_Button17 = CreateFrame("Button", "FullLoot_Button17", FullLootFrame_content, nil) +local FullLoot_Button18 = CreateFrame("Button", "FullLoot_Button18", FullLootFrame_content, nil) +local FullLoot_Button19 = CreateFrame("Button", "FullLoot_Button19", FullLootFrame_content, nil) +local FullLoot_Button20 = CreateFrame("Button", "FullLoot_Button20", FullLootFrame_content, nil) +local FullLoot_Button21 = CreateFrame("Button", "FullLoot_Button21", FullLootFrame_content, nil) +local FullLoot_Button22 = CreateFrame("Button", "FullLoot_Button22", FullLootFrame_content, nil) +local FullLoot_Button23 = CreateFrame("Button", "FullLoot_Button23", FullLootFrame_content, nil) +local FullLoot_Button24 = CreateFrame("Button", "FullLoot_Button24", FullLootFrame_content, nil) +local FullLoot_Button25 = CreateFrame("Button", "FullLoot_Button25", FullLootFrame_content, nil) + +local FullLoot_Text1 = FullLoot_Button1:CreateFontString("FullLoot_Text1") +local FullLoot_Text2 = FullLoot_Button2:CreateFontString("FullLoot_Text2") +local FullLoot_Text3 = FullLoot_Button3:CreateFontString("FullLoot_Text3") +local FullLoot_Text4 = FullLoot_Button4:CreateFontString("FullLoot_Text4") +local FullLoot_Text5 = FullLoot_Button5:CreateFontString("FullLoot_Text5") +local FullLoot_Text6 = FullLoot_Button6:CreateFontString("FullLoot_Text6") +local FullLoot_Text7 = FullLoot_Button7:CreateFontString("FullLoot_Text7") +local FullLoot_Text8 = FullLoot_Button8:CreateFontString("FullLoot_Text8") +local FullLoot_Text9 = FullLoot_Button9:CreateFontString("FullLoot_Text9") +local FullLoot_Text10 = FullLoot_Button10:CreateFontString("FullLoot_Text10") +local FullLoot_Text11 = FullLoot_Button11:CreateFontString("FullLoot_Text11") +local FullLoot_Text12 = FullLoot_Button12:CreateFontString("FullLoot_Text12") +local FullLoot_Text13 = FullLoot_Button13:CreateFontString("FullLoot_Text13") +local FullLoot_Text14 = FullLoot_Button14:CreateFontString("FullLoot_Text14") +local FullLoot_Text15 = FullLoot_Button15:CreateFontString("FullLoot_Text15") +local FullLoot_Text16 = FullLoot_Button16:CreateFontString("FullLoot_Text16") +local FullLoot_Text17 = FullLoot_Button17:CreateFontString("FullLoot_Text17") +local FullLoot_Text18 = FullLoot_Button18:CreateFontString("FullLoot_Text18") +local FullLoot_Text19 = FullLoot_Button19:CreateFontString("FullLoot_Text19") +local FullLoot_Text20 = FullLoot_Button20:CreateFontString("FullLoot_Text20") +local FullLoot_Text21 = FullLoot_Button21:CreateFontString("FullLoot_Text21") +local FullLoot_Text22 = FullLoot_Button22:CreateFontString("FullLoot_Text22") +local FullLoot_Text23 = FullLoot_Button23:CreateFontString("FullLoot_Text23") +local FullLoot_Text24 = FullLoot_Button24:CreateFontString("FullLoot_Text24") +local FullLoot_Text25 = FullLoot_Button25:CreateFontString("FullLoot_Text25") + +local FullLootIconTable = {} +local FullLoot_Icon1 = FullLoot_Button1:CreateTexture("FullLoot_Icon1") +local FullLoot_Icon2 = FullLoot_Button2:CreateTexture("FullLoot_Icon2") +local FullLoot_Icon3 = FullLoot_Button3:CreateTexture("FullLoot_Icon3") +local FullLoot_Icon4 = FullLoot_Button4:CreateTexture("FullLoot_Icon4") +local FullLoot_Icon5 = FullLoot_Button5:CreateTexture("FullLoot_Icon5") +local FullLoot_Icon6 = FullLoot_Button6:CreateTexture("FullLoot_Icon6") +local FullLoot_Icon7 = FullLoot_Button7:CreateTexture("FullLoot_Icon7") +local FullLoot_Icon8 = FullLoot_Button8:CreateTexture("FullLoot_Icon8") +local FullLoot_Icon9 = FullLoot_Button9:CreateTexture("FullLoot_Icon9") +local FullLoot_Icon10 = FullLoot_Button10:CreateTexture("FullLoot_Icon10") +local FullLoot_Icon11 = FullLoot_Button11:CreateTexture("FullLoot_Icon11") +local FullLoot_Icon12 = FullLoot_Button12:CreateTexture("FullLoot_Icon12") +local FullLoot_Icon13 = FullLoot_Button13:CreateTexture("FullLoot_Icon13") +local FullLoot_Icon14 = FullLoot_Button14:CreateTexture("FullLoot_Icon14") +local FullLoot_Icon15 = FullLoot_Button15:CreateTexture("FullLoot_Icon15") +local FullLoot_Icon16 = FullLoot_Button16:CreateTexture("FullLoot_Icon16") +local FullLoot_Icon17 = FullLoot_Button17:CreateTexture("FullLoot_Icon17") +local FullLoot_Icon18 = FullLoot_Button18:CreateTexture("FullLoot_Icon18") +local FullLoot_Icon19 = FullLoot_Button19:CreateTexture("FullLoot_Icon19") +local FullLoot_Icon20 = FullLoot_Button20:CreateTexture("FullLoot_Icon20") +local FullLoot_Icon21 = FullLoot_Button21:CreateTexture("FullLoot_Icon21") +local FullLoot_Icon22 = FullLoot_Button22:CreateTexture("FullLoot_Icon22") +local FullLoot_Icon23 = FullLoot_Button23:CreateTexture("FullLoot_Icon23") +local FullLoot_Icon24 = FullLoot_Button24:CreateTexture("FullLoot_Icon24") +local FullLoot_Icon25 = FullLoot_Button25:CreateTexture("FullLoot_Icon25") +for i = 1, 25 do + table.insert(FullLootIconTable, _G["FullLoot_Icon"..i]) +end + +local FullLoot_ButtonTable = {FullLoot_Button1, FullLoot_Button2, FullLoot_Button3, FullLoot_Button4, FullLoot_Button5, +FullLoot_Button6, FullLoot_Button7, FullLoot_Button8, FullLoot_Button9, FullLoot_Button10, FullLoot_Button11, FullLoot_Button12, +FullLoot_Button13, FullLoot_Button14, FullLoot_Button15, FullLoot_Button16, FullLoot_Button17, FullLoot_Button18, FullLoot_Button19, +FullLoot_Button20, FullLoot_Button21, FullLoot_Button22, FullLoot_Button23, FullLoot_Button24, FullLoot_Button25} + +local FullLoot_TextTable = {FullLoot_Text1, FullLoot_Text2, FullLoot_Text3, FullLoot_Text4, FullLoot_Text5, +FullLoot_Text6, FullLoot_Text7, FullLoot_Text8, FullLoot_Text9, FullLoot_Text10, FullLoot_Text11, FullLoot_Text12, +FullLoot_Text13, FullLoot_Text14, FullLoot_Text15, FullLoot_Text16, FullLoot_Text17, FullLoot_Text18, FullLoot_Text19, +FullLoot_Text20, FullLoot_Text21, FullLoot_Text22, FullLoot_Text23, FullLoot_Text24, FullLoot_Text25} + + +function MyHandlers.ReceiveItems(player,itemNumber, itemList, objectid) + itemHoldList = {} + playerKilledName = nil + + objectPass = objectid + + nullItems = 25 - itemNumber + + if playerKilledName ~= nil then + + FullLootFrame_TitleText:SetText("|cff230d21"..playerKilledName.."'s Belongings|r") + + else + + FullLootFrame_TitleText:SetText("Unclaimed Belongings") + + end + + repeat + + local FullLoot_Button_null = FullLoot_ButtonTable[itemNumber + nullItems] + local FullLoot_Text_null = FullLoot_TextTable[itemNumber + nullItems] + local FullLootIconTable_null = FullLootIconTable[itemNumber + nullItems] + + FullLoot_Button_null:Hide() + FullLoot_Text_null:Hide() + FullLootIconTable_null:Hide() + + nullItems = nullItems - 1 + + until(nullItems <= 0) + + if itemNumber > 0 then + + if itemList[itemNumber][1] ~= nil and itemList[itemNumber][2] ~= nil and itemList[itemNumber][3] ~= nil then + + repeat + local FullLoot_Button = FullLoot_ButtonTable[itemNumber] + local FullLoot_Text = FullLoot_TextTable[itemNumber] + local FullLoot_Icon = FullLootIconTable[itemNumber] + + FullLoot_Button:SetSize(256, 52) + FullLoot_Button:SetPoint("TOP", 0, (-10-((itemNumber-1)*64))) + FullLoot_Button:EnableMouse(true) + FullLoot_Button:SetHighlightTexture("Interface/Buttons/UI-Listbox-Highlight") + FullLoot_Button:SetBackdrop({ + bgFile = "Interface\\AddOns\\AwAddons\\Textures\\Misc\\lootbg", + insets = { + left = -102, + right = -102, + top = -34, + bottom = -34} + }) + item_idd = itemList[itemNumber][2] + item_name = itemList[itemNumber][1] + item_stuff = itemList[itemNumber][3] + table.insert (itemHoldList, {FullLoot_Button, item_idd, item_name, item_stuff}) + + + function FullLoot_Button_Tooltip_OnEnter(self, motion) + local item_rec = "Error, no item found" + + for i, v in ipairs(itemHoldList) do + if v[1] == self then + item_rec = v[2] + break + end + end + + GameTooltip:SetOwner(self,"ANCHOR_RIGHT") + GameTooltip:SetHyperlink("item:"..item_rec..":0:0:0:0:0:0:0") + GameTooltip:Show() + end + FullLoot_Button:SetScript("OnEnter", FullLoot_Button_Tooltip_OnEnter) + function FullLoot_Button_Tooltip_OnLeave(self, motion) + GameTooltip:Hide() + end + FullLoot_Button:SetScript("OnLeave", FullLoot_Button_Tooltip_OnLeave) + FullLoot_Text:SetFont("Fonts\\FRIZQT__.TTF", 14) + FullLoot_Text:SetSize(200, 20) + FullLoot_Text:SetPoint("CENTER", 20, 0) + FullLoot_Text:SetShadowOffset(1, -1) + local texture_x = "Interface\\Icons\\INV_Chest_Samurai" + local name_x, link_x, quality_x, iLevel_x, reqLevel_x, class_x, subclass_x, maxStack_x, equipSlot_x, texture_x2, vendorPrice_x = GetItemInfo(itemList[itemNumber][2]) + if (texture_x2) then + texture_x = texture_x2 + end + FullLoot_Icon:SetWidth(32); + FullLoot_Icon:SetHeight(34); + FullLoot_Icon:SetTexture(texture_x) + FullLoot_Icon:SetPoint("LEFT", 8, 0) + FullLoot_Text:SetText(itemList[itemNumber][1].." x"..itemList[itemNumber][3]) -- edited + FullLoot_Text:SetJustifyH("LEFT") + + + function ClickItem(self) + local item_rec = "Error, no item found" + local item_link = 0 + local item_stuffy = 0 + local bag1, _ = GetContainerNumFreeSlots(0) + local bag2, _ = GetContainerNumFreeSlots(1) + local bag3, _ = GetContainerNumFreeSlots(2) + local bag4, _ = GetContainerNumFreeSlots(3) + local bag5, _ = GetContainerNumFreeSlots(4) + local slots_open = bag1+bag2+bag3+bag4+bag5 + bagslot_free = true + if slots_open == 0 then + bagslot_free = false + end + + + + if bagslot_free == true then + + for i, v in ipairs(itemHoldList) do + if v[1] == self then + item_rec = v[2] + item_link = v[3] + item_stuffy = v[4] + break + end + end + FullLoot_Button:Hide() + FullLoot_Text:SetText("|cff9d9d9dLooted Item|r") + FullLoot_Button:Disable() + AIO.Handle("PvP", "AddPlayerItem", item_rec, item_stuffy, objectPass) + else + + print("|cffFFFF00You don't have enough space in bags|r") + + end + end + FullLoot_Button:SetScript("OnMouseUp", ClickItem) + + FullLoot_Button:Show() + FullLoot_Text:Show() + FullLoot_Icon:Show() + + itemNumber = itemNumber - 1 + until(itemNumber <= 0) + + else + + local FullLoot_Button_null = FullLoot_ButtonTable[itemNumber] + local FullLoot_Text_null = FullLoot_TextTable[itemNumber] + local FullLootIconTable_null = FullLootIconTable[itemNumber] + + FullLoot_Button_null:Hide() + FullLoot_Text_null:Hide() + FullLootIconTable_null:Hide() + + itemNumber = itemNumber - 1 + + end + + end + + FullLootFrame:Show() +end \ No newline at end of file diff --git a/hardcore_pvp/PvPServer.lua b/hardcore_pvp/PvPServer.lua new file mode 100644 index 0000000..c791859 --- /dev/null +++ b/hardcore_pvp/PvPServer.lua @@ -0,0 +1,434 @@ + +local AIO = AIO or require("AIO") + + +local MyHandlers = AIO.AddHandlers("PvP", {}) + +--local guid_linking_table = {} +item_table = {} +local prohibited_items = { +6948, +597600, +597601, +977020, +977021, +5863, +22115, +22048, +21984, +22047, +22046, +800096, +98457, +977025, +23720, +69228, +38576, +54811, +33225, +977019, +777998, +} +local dropmodifier = 5 +local item_looted = {} +--local playerdeath = true +--local creaturedeath = true +--local leveldiff = 6 + +-- this function is never called for some unknown reason, known bug with ElunaCore +--[[function Remove_FullLootContainer(event, delay, call, object) + print("I got here!") + print("I got here!") + local nearbyplayers = object:GetPlayersInRange(100) + for k, v in pairs(nearbyplayers) do + v:SendBroadcastMessage("|CFFFF8040The sack of items turns to dust, and blows away with the wind.|r") + end + object:Despawn() + object:RemoveFromWorld(false) + FullLootFrame:Hide() + guid_linking_table[object:GetGUIDLow()] = nil + item_table[object:GetGUIDLow()] = nil + print("Chest removed from world") +end]]-- +local SafeCostModifier = 3540 +function SafeSlotGetLostCost(item) + local cost = nil + cost = item:GetItemLevel() * SafeCostModifier -- Temporary was 2285 + return cost +end + +local function PVP_ItemCheck(item, target) + for k,v in pairs(prohibited_items) do + if (item:GetEntry() == v) then + return false + end + end -- check for special item ids + if (target:HasQuestForItem(item:GetEntry()) or (item:IsBag()==true)) then + return false + end -- check for bags and quest items + + local mv = WorldDBQuery("SELECT bonding FROM item_template WHERE entry = "..item:GetEntry().."") + if (mv:GetInt32(0) >= 4) then + return false + end + + return true +end + +local function EntropyPvP(event, pKiller, pKilled) + --PLAYER_EVENT_ON_KILLED_BY_CREATURE + if pKiller:ToCreature() then + if not(pKiller:GetOwner()) then + return false + end + + if not(pKiller:GetOwner():ToPlayer()) then + return false + end + + pKiller = pKiller:GetOwner():ToPlayer() + end + --PLAYER_EVENT_ON_KILLED_BY_CREATURE + math.random(1,10) + local check_safe = false + local pKiller_loc = pKiller:GetMapId() + local pKiller_zone = pKiller:GetZoneId() + local items_droplist = {} + local spawnType = 2 + local instanceID = pKiller:GetInstanceId() + local DropGold = 0 + for i,v in ipairs(safety_ids) do + if v == pKiller_loc then + check_safe = true + break + end + end + for k,z in ipairs(nocapzones) do + if z == pKiller_zone then + setcap = true + else + setcap = false + end + end + if setcap == true then + leveldiff = 255 + else + leveldiff = 5 + end --some checks for safe zones and other stuff + if not (pKilled == pKiller) then -- if player commited suicide, no drop + -- check for honorless target + if pKilled:HasAura(2479) == false then + if (check_safe == false and instanceID == 0) then -- begin main action + + if (((pKiller:GetLevel()-pKilled:GetLevel())<=leveldiff) and ((pKiller:GetLevel()-pKilled:GetLevel())>=(leveldiff * -1))) then -- level difference check + local pKilledGUID = pKilled:GetGUIDLow() + local pKillerGUID = pKiller:GetGUIDLow() + local x,y,z,o = pKilled:GetX(),pKilled:GetY(),pKilled:GetZ(),pKilled:GetO() + local ContainerID = 818001 + local FullLootContainer = PerformIngameSpawn(spawnType,ContainerID,pKiller_loc,instanceID, x, y, z, o) --Spawn a Sack of Belongings + item_table[FullLootContainer:GetGUIDLow()] = {} + -- my updated part + local amountofdroppeditems = math.ceil(pKilled:GetLevel()/dropmodifier) + if (amountofdroppeditems >= 1) then + --list of items player have + for i = 1, 8 do + math.random(1,10) + slot = math.random(0,38) + if (pKilled:GetItemByPos(255, slot)) then + if not(pKilled:HasQuestForItem(pKilled:GetItemByPos(255, slot):GetEntry())) and not(pKilled:GetItemByPos(255, slot):IsBag()==true) then + table.insert(items_droplist, {255,slot}) + end + end + end + for slot = 0,35 do + for bag = 19,22 do + if (pKilled:GetItemByPos(bag, slot)) then + if not(pKilled:HasQuestForItem(pKilled:GetItemByPos(bag, slot):GetEntry())) and not(pKilled:GetItemByPos(bag, slot):IsBag()==true) then + table.insert(items_droplist, {bag,slot}) + end + end + end + end + -- list is done + if (items_droplist[1]) then + for i = 1, amountofdroppeditems do + math.random(1,10) + local itemslot_temp = math.random(1,#items_droplist) + local item = pKilled:GetItemByPos(items_droplist[itemslot_temp][1],items_droplist[itemslot_temp][2]) + if (item) then + local itemcount = math.random(1,item:GetCount()) + if (PVP_ItemCheck(item,pKilled)) then + -- Get Money for item part-- + + --SQL CHECK IF ITEM IS "SAFE" + local SafeSQL = nil + if ((items_droplist[itemslot_temp][2]<19) and (items_droplist[itemslot_temp][1] == 255)) then + SafeSQL = CharDBQuery("SELECT slot"..items_droplist[itemslot_temp][2].." FROM custom_iteminsurance WHERE playerguid = "..pKilled:GetGUIDLow()..";") + end + local DropSafeCost = SafeSlotGetLostCost(item) + if (SafeSQL and (SafeSQL:GetInt32(0) == 1) and (pKilled:GetCoinage() >= DropSafeCost)) then + pKilled:ModifyMoney(-DropSafeCost) + pKiller:ModifyMoney(DropSafeCost) + DropGold = DropGold + DropSafeCost + else + if (item:GetClass() == 2 or item:GetClass() == 4) then + if (item:GetEnchantmentId(5) == 0 or item:GetEnchantmentId(5) == nil) then + table.insert (item_table[FullLootContainer:GetGUIDLow()], {item:GetItemLink(), item:GetEntry(), itemcount, pKilled:GetName()}) + else + table.insert (item_table[FullLootContainer:GetGUIDLow()], {item:GetItemLink(), item:GetEntry(), itemcount, pKilled:GetName(), item:GetEnchantmentId(5)}) + end + else + table.insert (item_table[FullLootContainer:GetGUIDLow()], {item:GetItemLink(), item:GetEntry(), itemcount, pKilled:GetName()}) + end + pKilled:RemoveItem(item:GetEntry(), itemcount) + end + + else + amountofdroppeditems = amountofdroppeditems+1 + end + end + end + end + end + + if not(item_table[FullLootContainer:GetGUIDLow()][1]) then + FullLootContainer:Despawn() + FullLootContainer:RemoveFromWorld(true) + end + end -- end of lvl diff check + + end -- end of main action + end -- end of aura check + else + pKilled:SendBroadcastMessage("You have commited suicide, none of your items were lost") + end -- end of suicide check + + if (DropGold > 0) then + local gold,silver,copper = GetGoldForMoney(DropGold) + pKiller:SendBroadcastMessage("You recieved |cffFFFFFF"..gold.."|TInterface\\MONEYFRAME\\UI-GoldIcon.blp:11:11:0:-1|t "..silver.."|TInterface\\MONEYFRAME\\UI-SilverIcon.blp:11:11:0:-1|t "..copper.."|TInterface\\MONEYFRAME\\UI-CopperIcon.blp:11:11:0:-1|t|r from killing this player") + pKilled:SendBroadcastMessage("You lost |cffFFFFFF"..gold.."|TInterface\\MONEYFRAME\\UI-GoldIcon.blp:11:11:0:-1|t "..silver.."|TInterface\\MONEYFRAME\\UI-SilverIcon.blp:11:11:0:-1|t "..copper.."|TInterface\\MONEYFRAME\\UI-CopperIcon.blp:11:11:0:-1|t|r but saved your items by Fel Commutation") + end +end + +--[[local function CreatureDeath (event, pKiller, pKilled) + local check_safe = false + local pKilled_loc = pKilled:GetMapId() + local spawnType = 2 + local instanceID = pKilled:GetInstanceId() + for i,v in ipairs(safety_ids) do + if v == pKilled_loc then + check_safe = true + break + end + end + if (pKiller:GetOwner() == nil or pKiller:GetOwner() == 0) then + petkill = false + --print("No Owner") + else + local plrs = pKiller:GetPlayersInRange(20) + for h,p in pairs(plrs) do + if p == pKiller:GetOwner() then + petkill = true + print("Has owner") + end + end + end + if petkill == false then + npcleveldiff = 255 + else + npcleveldiff = 6 + end + if (creaturedeath==true and check_safe == false and instanceID == 0 and ((pKiller:GetLevel()-pKilled:GetLevel())<=npcleveldiff))then + local pKilledGUID = pKilled:GetGUIDLow() + local x,y,z,o = pKilled:GetX(),pKilled:GetY(),pKilled:GetZ(),pKilled:GetO() + local ContainerID = 818001 + local kill_message = math.random(1,6) + local FullLootContainer = PerformIngameSpawn(spawnType,ContainerID,pKilled_loc,instanceID, x, y, z, o, false, 10) --Spawn a Sack of Belongings + guid_linking_table[FullLootContainer:GetGUIDLow()] = pKilled:GetGUIDLow() + --Get Items + local bagslot = 255 + local inven_ticker = 0 + local item_ticker = 0 + local maxitems = 25 --Equal to amount of buttons that I have declared. + item_table[FullLootContainer:GetGUIDLow()] = {} + remove_table[FullLootContainer:GetGUIDLow()] = {} + repeat + local SlotRange = 35 + inven_ticker = inven_ticker+1 + local bagToTake = math.random(3) + if bagToTake < 3 then + SlotRange = 38 + bagToTake = 255 + else + bagToTake = math.random(4) + if petkill == true then + bagToTake = bagToTake + 6 + else + bagToTake = bagToTake + 6 + end + end + local slotToTake = math.random(SlotRange) + + local checkitem = pKilled:GetItemByPos(bagToTake, slotToTake) + if not(checkitem) then + return false + end + safe_to_take = true + if petkill == false then + if checkitem:GetClass() == 12 then + + safe_to_take = false + + elseif checkitem:GetClass() == 0 then + + if checkitem:GetDisplayId() == 34802 then + + safe_to_take = false + + end + + end + end + if petkill == false then + if (checkitem~=nil) and (checkitem:IsBag()==false) and (checkitem:GetEntry()~=6948) and safe_to_take == true then + item_ticker = item_ticker+1 + if (checkitem:GetClass() == 2 or checkitem:GetClass() == 4) then + if (checkitem:GetEnchantmentId(5) == 0 or checkitem:GetEnchantmentId(5) == nil) then + table.insert (item_table[FullLootContainer:GetGUIDLow()], {checkitem:GetItemLink(), checkitem:GetEntry(), pKilled:GetItemCount(checkitem:GetEntry()), pKilled:GetName()}) + else + table.insert (item_table[FullLootContainer:GetGUIDLow()], {checkitem:GetItemLink(), checkitem:GetEntry(), pKilled:GetItemCount(checkitem:GetEntry()), pKilled:GetName(), checkitem:GetEnchantmentId(5)}) + end + end + table.insert (remove_table[FullLootContainer:GetGUIDLow()], {item_ticker, false}) + pKilled:RemoveItem(checkitem:GetEntry(), pKilled:GetItemCount(checkitem:GetEntry())) + end + else + if (checkitem ~= 0) then -- Checks to make sure player has an item + if (checkitem~=nil) and (checkitem:IsBag()==false) and (checkitem:GetEntry()~=6948) then + item_ticker = item_ticker+1 + if (checkitem:GetClass() == 2 or checkitem:GetClass() == 4) then + if (checkitem:GetEnchantmentId(5) == 0 or checkitem:GetEnchantmentId(5) == nil) then + table.insert (item_table[FullLootContainer:GetGUIDLow()], {checkitem:GetItemLink(), checkitem:GetEntry(), pKilled:GetItemCount(checkitem:GetEntry()), pKilled:GetName()}) + else + table.insert (item_table[FullLootContainer:GetGUIDLow()], {checkitem:GetItemLink(), checkitem:GetEntry(), pKilled:GetItemCount(checkitem:GetEntry()), pKilled:GetName(), checkitem:GetEnchantmentId(5)}) + end + end + table.insert (remove_table[FullLootContainer:GetGUIDLow()], {item_ticker, false}) + pKilled:RemoveItem(checkitem:GetEntry(), pKilled:GetItemCount(checkitem:GetEntry())) + end + end + end + until (inven_ticker>=38) or (item_ticker>=maxitems) + end + if petkill == true then + local killed_color = ClassColorCodes[pKilled:GetClass()] + local killer_color = ClassColorCodes[pKiller:GetOwner():GetClass()] + local killerguild_name = ", a Lone Wolf" + local killedguild_name = ", a Lone Wolf" + --Kill Announcer + local DeathAnnouncements = { + "[PvP]: |CFF"..killed_color..""..pKilled:GetName().."|r"..killedguild_name..", was slain by |CFF"..killer_color..""..pKiller:GetOwner():GetName().."|r"..killerguild_name.."!", + "[PvP]: |CFF"..killed_color..""..pKilled:GetName().."|r"..killedguild_name..", met the maker to the hand of |CFF"..killer_color..""..pKiller:GetOwner():GetName().."|r"..killerguild_name.."!", + "[PvP]: |CFF"..killed_color..""..pKilled:GetName().."|r"..killedguild_name..", was vanquished by |CFF"..killer_color..""..pKiller:GetOwner():GetName().."|r"..killerguild_name.."!", + "[PvP]: |CFF"..killed_color..""..pKilled:GetName().."|r"..killedguild_name..", has fallen to |CFF"..killer_color..""..pKiller:GetOwner():GetName().."|r"..killerguild_name.."!", + "[PvP]: |CFF"..killed_color..""..pKilled:GetName().."|r"..killedguild_name..", died a swift death, courtesy of |CFF"..killer_color..""..pKiller:GetOwner():GetName().."|r"..killerguild_name..".", + "[PvP]: |CFF"..killed_color..""..pKilled:GetName().."|r"..killedguild_name..", wanted a piece of |CFF"..killer_color..""..pKiller:GetOwner():GetName().."|r"..killerguild_name..", but bit off a little more than they could chew!" + } + if (pKilled == pKiller) then + EnableDeathAnnouncer = false + else + if (EnableDeathAnnouncer==true) then + local DeathAnnounce_Roll = math.random(1,6) + SendWorldMessage(DeathAnnouncements[DeathAnnounce_Roll]) + end + end + end +end]]-- + + +local function Init_FullLootFrame(event, player, object) + + local itemNumber = 0 + local playerKilledName = "h" + local itemList = {} + local objectid = object:GetGUIDLow() + + for k, v in ipairs(item_table[objectid]) do + + if v[1] ~= nil then + + table.insert (itemList, v) + + itemNumber = itemNumber + 1 + + end + + end + + + sendItemsToPlayer(AIO.Msg(), player, itemNumber, itemList, objectid):Send(player) + +end + +function sendItemsToPlayer(msg, player, itemNumber, itemList, playerKilledName, object) + + return msg:Add("PvP", "ReceiveItems", itemNumber, itemList, playerKilledName) + +end + +function MyHandlers.AddPlayerItem(player, itemEntry, itemCount, object) + --AIO ADDITIONAL CHECK-- + local expectedData = {"number","number","number"} + local values = {itemEntry,itemCount,object} + if not(DataTypeCheck(expectedData, values)) then + return false + end + --MAIN ACTION-- + for i,v in pairs(item_table[object]) do + if v[2] == itemEntry then + -- check the possibility to add item + if (player:AddItem(itemEntry, itemCount)) then + item_table[object][i][2] = nil + item_table[object][i][1] = nil + item_table[object][i][3] = nil + if (item_table[object][i][5] ~= nil or item_table[object][i][5] ~= 0) then + player:GetItemByEntry(itemEntry):SetEnchantment(item_table[object][i][5], 5) + item_table[object][i][5] = nil + end + else + player:SendBroadcastMessage("You don't have enough space in bags") + end + end + end + +end + +local function Container_Interact(event, player, object) + if (item_looted[object:GetGUIDLow()]) then + return false + end + table.insert(item_looted, object:GetGUIDLow()) + Init_FullLootFrame(event, player, object) + object:Despawn() + object:RemoveFromWorld(false) + return false +end + + +RegisterPlayerEvent(8, EntropyPvP) +RegisterPlayerEvent(6, EntropyPvP) +RegisterGameObjectGossipEvent(818001, 1, Container_Interact) + + +--[[Demonic rune fix +local function DemonicRuneFix(event, player, spell, skipCheck) + if not(spell:GetEntry() == 16666) then + return false + end + + if player:IsDead() then + print("you died by using demonic rune") + end + +end +RegisterPlayerEvent(5, DemonicRuneFix)]]-- \ No newline at end of file diff --git a/hardcore_pvp/SanctuaryFix.lua b/hardcore_pvp/SanctuaryFix.lua new file mode 100644 index 0000000..4bf10c6 --- /dev/null +++ b/hardcore_pvp/SanctuaryFix.lua @@ -0,0 +1,60 @@ +--[[ + ToDO: +1. Set up chair fix - In Progress + a) Try emote states - FAILED + b) Try Gameobject hook - N/A + c) Create a beacon - N/A +2. Find a way to prevent players from attacking at all once in sanctuary - Not Started + a) Find a way to change their target + i) Clear target - N/A + ii) Select Self - N/A + +]] + +local function sanctuary_fix_2(eventId, delay, repeats, player) -- using to prevent saving flags after leaving the inn +if not(player:HasFlag(150,0x00000020)) and not(player:IsFFAPvP()) then + if (player:GetLevel()<20) then + if player:IsPvPFlagged() then + player:SetFFA(true) + end + else + player:SetFFA(true) + end +end + +if (player:HasFlag(150,0x00000020)) and (player:IsFFAPvP()) then + player:SetFFA(false) +end + +if (player:GetLevel()<20) then + if not(player:IsPvPFlagged()) then + player:SetFFA(false) + end + end + +if (player:IsInCombat() and player:GetVictim()) then + if not(player:GetVictim():ToPlayer()) then + + return false + end + local victim = player:GetVictim():ToPlayer() + if (player:IsAlliance() and victim:IsAlliance()) or (player:IsHorde() and victim:IsHorde()) then + if not(victim:IsFFAPvP()) then + player:ClearInCombat() + end + end + end + + --special check for mrgmreview + if (player:GetGUIDLow() == 1458) then + player:SetFFA(false) + end + --end +end + +local function TimingChecks(event,player) + player:RegisterEvent(sanctuary_fix_2, 2000, 0) + --player:RegisterEvent(Asc_Glory_Check, 30000, 0) +end +RegisterPlayerEvent(28, TimingChecks) +--RegisterPlayerEvent(3, TimingChecks) \ No newline at end of file diff --git a/hunger_system/HungerClient.lua-- b/hunger_system/HungerClient.lua-- new file mode 100644 index 0000000..f7d7dd4 --- /dev/null +++ b/hunger_system/HungerClient.lua-- @@ -0,0 +1,126 @@ + +local AIO = AIO or require("AIO") + + +if AIO.AddAddon() then + return +end + + +local MyHandlers = AIO.AddHandlers("HungerBar", {}) + + +Framework = CreateFrame("Frame", "first_frame", UIParent, nil) +local frame = Framework + + +frame:SetSize(142, 40) +frame:RegisterForDrag("LeftButton") +frame:SetPoint("TOPLEFT", 100, -100) +frame:SetToplevel(false) +frame:SetClampedToScreen(true) +frame:SetMovable(true) +frame:EnableMouse(true) +frame:SetScript("OnDragStart", frame.StartMoving) +frame:SetScript("OnDragStop", frame.StopMovingOrSizing) + +local Food_Ico = frame:CreateTexture(nil, "ARTWORK") + Food_Ico:SetWidth(26); + Food_Ico:SetHeight(26); + Food_Ico:SetTexture("Interface\\AddOns\\AwAddons\\Textures\\misc\\Food") + Food_Ico:SetPoint("LEFT", -15,0) + +local Hunger_BackGround = frame:CreateTexture(nil, "BACKGROUND") + Hunger_BackGround:SetWidth(105); + Hunger_BackGround:SetHeight(19); + Hunger_BackGround:SetTexture("Interface/CHARACTERFRAME/UI-Party-Background") + Hunger_BackGround:SetVertexColor(1,1,1,0.6) + Hunger_BackGround:SetPoint("CENTER") + +local Hunger_BackGround_edge = CreateFrame("Frame", "Hunger_BackGround_edge", frame,nil) + Hunger_BackGround_edge:SetSize(frame:GetSize()) + Hunger_BackGround_edge:SetBackdrop({bgFile = "Interface\\AddOns\\AwAddons\\Textures\\misc\\WowUI_Horizontal_Frame"}); + Hunger_BackGround_edge:SetPoint("CENTER") + Hunger_BackGround_edge:SetFrameStrata("HIGH") + + + + + +AIO.SavePosition(frame) + + +second_frame = CreateFrame("StatusBar", "Second_Frame", frame) +second_frame:SetSize(105,19) +second_frame:RegisterForDrag("LeftButton") +second_frame:SetPoint("CENTER") +second_frame:SetToplevel(true) +second_frame:SetClampedToScreen(true) +second_frame:SetMovable(false) +second_frame:SetFrameStrata("MEDIUM") +second_frame:EnableMouse(false) +second_frame:SetMinMaxValues(0, 100) +second_frame:SetStatusBarTexture("Interface\\TargetingFrame\\UI-StatusBar") +second_frame:SetStatusBarColor(1,0,.7,0.8) +local function frame2_Tooltip_OnEnter(self, motion) + GameTooltip:SetOwner(self, "ANCHOR_RIGHT") + GameTooltip:SetText("Hunger Bar\nEat food to raise it!") + GameTooltip:Show() + end +frame:SetScript("OnEnter", frame2_Tooltip_OnEnter) +local function frame2_Tooltip_OnLeave(self, motion) + GameTooltip:Hide() + end +frame:SetScript("OnLeave", frame2_Tooltip_OnLeave) + + + +function MyHandlers.GetHungerPct(player,current_hunger, food_hack) + + local level = UnitLevel("player") + + + local max_hunger = (level * 5) + 100 + + local rough_pct = ((current_hunger ) / max_hunger) * 100 + + + local percent = rough_pct - (rough_pct % 1) + + if percent <= 0 then + if not(food_hack) then + print("|cffFFFF00I am extremely hungry, and I am beginning to starve.|r") -- edited + end + + elseif percent < 25 then + + second_frame:SetStatusBarColor(1,.35,0,0.8) + if not(food_hack) then + print("|cffFFFF00I must eat soon or I will start taking damage.|r") -- edited + end + + elseif percent < 65 then + + second_frame:SetStatusBarColor(.9,.9,.3,0.8) + + end + + if percent > 65 then + second_frame:SetStatusBarColor(1,0,.7,0.8) + end + + + second_frame:SetValue(percent) + +end + + + + +function MyHandlers.ShowFrame(player) + frame:Show() + second_frame:Show() + +end + + diff --git a/hunger_system/HungerServer.lua-- b/hunger_system/HungerServer.lua-- new file mode 100644 index 0000000..2898637 --- /dev/null +++ b/hunger_system/HungerServer.lua-- @@ -0,0 +1,179 @@ +local AIO = AIO or require("AIO") + + +local MyHandlers = AIO.AddHandlers("HungerBar", {}) + +-- max_hunger = (level * 5) + 100 MAX HUNGER IS PLAYERLEVEL*5+100 + +local player_hunger_table = {} -- table for adding hunger level during player playing game + +local player_hunger_itemused = {} -- table for food itemlevel player used last time + + +local auras = {433, 434, 435, 1127, 1129, 1131, 2639, 5004, 5005, + 5006, 5007, 6410, 7737, 10256, 18229, 18230, 18231, 18232, 18233, + 18234, 22731, 24005, 24800, 24869, 25660, 25690, 25691, 27094, 29008, + 29073, 32112, 33253, 33255, 33258, 33260, 33262, 33264, 33266, 33269, + 33725, 35270, 35271, 40768, 41030, 42309, 43180, 43763, 43777, 45548, + 45618, 46683, 46898, 48720, 53283, 61874, 64056, 65418, 65419, 65420, 65421, 65422} -- food auras + +local all_food_drink = {117, 414, 422, 724, 733, 787, 961, 1017, 1082, 1113, 1114, 1326, 1487, 1707, 2070, +2287, 2679, 2680, 2681, 2682, 2683, 2684, 2685, 2687, 2888, 3220, 3448, 3662, 3663, 3664, 3665, 3666, 3726, +3727, 3728, 3729, 3770, 3771, 3927, 4457, 4536, 4537, 4538, 4539, 4540, 4541, 4542, 4544, 4592, 4593, 4594, +4599, 4601, 4602, 4604, 4605, 4606, 4607, 4608, 4656, 5057, 5066, 5095, 5349, 5472, 5473, 5474, 5476, 5477, +5478, 5479, 5480, 5525, 5526, 5527, 6038, 6289, 6290, 6291, 6299, 6316, 6807, 6887, 6888, 6890, 7097, 7228, +7806, 7807, 7808, 8075, 8076, 8364, 8932, 8948, 8950, 8952, 8953, 8957, 9681, 11109, 11415, 11444, 11584, +12209, 12210, 12212, 12213, 12214, 12215, 12216, 12218, 12224, 12238, 13546, 13755, 13851, 13893, 13927, +13928, 13929, 13930, 13931, 13932, 13933, 13934, 13935, 16166, 16167, 16168, 16169, 16170, 16171, 16766, +16971, 17119, 17197, 17222, 17344, 17406, 17407, 17408, 18045, 18254, 18255, 18632, 18633, 18635, 19223, +19224, 19225, 19304, 19305, 19306, 19696, 19994, 19995, 19996, 20074, 20452, 20516, 20857, 21023, 21030, +21031, 21033, 21072, 21217, 21235, 21254, 21552, 22019, 22324, 22645, 22895, 23160, 23495, 23756, 24008, +24009, 24072, 24105, 24338, 24539, 27635, 27636, 27651, 27655, 27657, 27658, 27659, 27660, 27661, 27662, +27663, 27664, 27665, 27666, 27667, 27854, 27855, 27856, 27857, 27858, 27859, 28486, 28501, 29292, 29393, +29394, 29412, 29448, 29449, 29450, 29451, 29452, 29453, 30155, 30355, 30357, 30358, 30359, 30361, 30458, +30610, 30816, 31672, 31673, 32685, 32686, 32721, 33004, 33048, 33052, 33053, 33443, 33449, 33451, 33452, +33454, 33867, 33872, 33924, 34747, 35563, 35565, 35947, 35948, 35949, 35950, 35951, 35952, 35953, 37252, +37452, 38427, 38428, 38706, 40202, 40356, 40358, 40359, 41729, 41751, 42428, 42429, 42430, 42431, 42432, +42433, 42434, 42778, 42779, 43087, 44049, 44071, 44072, 44607, 44608, 44609, 44722, 44749, 44791, 44836, +44837, 44838, 44839, 44840, 44854, 44855, 44940, 46690, 46691, 46793, 46797, +} -- food item ids + +-- 818053 -- positive buff +-- 818054 -- negative buff +-- 818055 -- starvation +local function update_display_hunger(msg, player,food_hack) + local hunger = player_hunger_table[player:GetGUIDLow()] + local level = player:GetLevel() + local max_hunger = (level * 5) + 100 + local percent = (player_hunger_table[player:GetGUIDLow()] / max_hunger) * 100 + if percent >= 80 then + player:RemoveAura(818053) + player:AddAura(818053, player) + player:RemoveAura(818054) + player:RemoveAura(818055) + elseif percent <= 20 then + player:AddAura(818054, player) + player:CastSpell(player, 818055) + player:RemoveAura(818053) + elseif (percent >= 21 and percent <= 79) then + if player:HasAura(818053) then + player:RemoveAura(818053) + elseif (player:HasAura(818054) or player:HasAura(818055)) then + player:RemoveAura(818054) + player:RemoveAura(818055) + end + end + return msg:Add("HungerBar", "GetHungerPct", hunger,food_hack) +end + +local function hunger_ticker(event, timer, delay, player) -- deal damage if player has low hunger level, runs all the time after OnLoginPlayer + local level = player:GetLevel() + local damage_dealt = 25 + local deficit = 5 + if level > 10 then + damage_dealt = level * 15 + elseif level > 30 then + deficit = 20 + damage_dealt = level * 30 + elseif level > 50 then + deficit = 40 + damage_dealt = level * 45 + end + if (player:IsDead() == false) then + player_hunger_table[player:GetGUIDLow()] = player_hunger_table[player:GetGUIDLow()] - (deficit) + end + if player_hunger_table[player:GetGUIDLow()] <= 0 and (player:GetGMRank() <= 2) then + player_hunger_table[player:GetGUIDLow()] = 0 + player:DealDamage(player, damage_dealt, false, 7) + end + update_display_hunger(AIO.Msg(), player,false):Send(player) + + end + +local function fill_hunger(event, timer, delay, player) + local level = player:GetLevel() + local itemLevel = player_hunger_itemused[player:GetGUIDLow()] + local hunger = player_hunger_table[player:GetGUIDLow()] + local max_hunger = (level * 5) + 100 + local food = 0 + + if not(hunger) then + return false + end + + --local drinks = {430, 431, 432, 1133, 1135, 1137, 22734, 27089, 34291, 43182, 43183, 43706, 45020, 5291} + + for k, v in pairs(auras) do + + --- + if (itemLevel>level) or ((itemLevel+5)>=level) then + food = 25 + elseif ((itemLevel+5) < level) and ((itemLevel+10) >= level) then + food = 10 + else + food = 5 + end + + end + + player_hunger_table[player:GetGUIDLow()] = player_hunger_table[player:GetGUIDLow()]+food + if (hunger > max_hunger) then + player_hunger_table[player:GetGUIDLow()] = max_hunger + end + + update_display_hunger(AIO.Msg(), player,true):Send(player) +end + + +local function OnItemUse(event, player, item, target) + local max_hunger = (player:GetLevel() * 5) + 100 + local itemLevel = item:GetItemLevel() + player_hunger_itemused[player:GetGUIDLow()] = itemLevel + + if (player:IsMoving() == false) then + player:RegisterEvent(fill_hunger, 5000, 6) + else + player:SendBroadcastMessage("You can't do that while moving.") + end +end + + + +-- drink = {159, 1179, 1205, 1645, 1708, 2136, 2288, 3772, 4791, 5350, 8077, 8078, 8079, 8766, 9451, 10841, +--17404, 18300, 19299, 19300, 22018, 27860, 28399, 29395, 29401, 29454, 30457, 30703, 32453, 32455, 32668, 33042, +--33444, 33445, 33825, 34411, 35954, 37253, 38429, 38430, 38431, 38698, 40357, 41731, 42777, 43086, 43236, 44750, 44941} + +for k,v in ipairs(all_food_drink) do + RegisterItemEvent(v, 2, OnItemUse) +end + + + + +local function OnLoginPlayer(event, player) -- load hunger from table, works ok + local guid = player:GetGUIDLow() + local char_query = CharDBQuery("select hunger from character_saved_hunger where guid = "..guid) + local player_hunger = 100 + if char_query == nil then + CharDBExecute("INSERT INTO character_saved_hunger(guid, hunger) VALUES("..guid..",100)") + else + --print("Successfully loaded from table") + player_hunger = char_query:GetInt32(0) + end + player_hunger_table[guid] = player_hunger + AIO.Handle(player, "HungerBar", "OnLogin") + player:RegisterEvent(hunger_ticker, 78000, 0) -- register deal damage function + update_display_hunger(AIO.Msg(), player,false):Send(player) +end + +local function OnLogoutPlayer(event ,player) + local guid = player:GetGUIDLow() + local hunger = player_hunger_table[guid] + if(hunger) then + CharDBExecute("UPDATE character_saved_hunger SET hunger = "..hunger.." WHERE guid = "..guid) +end +end + +--RegisterPlayerEvent(3, OnLoginPlayer) +RegisterPlayerEvent(28, OnLoginPlayer) +RegisterPlayerEvent(4, OnLogoutPlayer) diff --git a/mass_purge/mass_purge.lua b/mass_purge/mass_purge.lua new file mode 100644 index 0000000..10e2f7e --- /dev/null +++ b/mass_purge/mass_purge.lua @@ -0,0 +1,177 @@ +function MassPurgeCheck(event, player) + + local player_guid = player:GetGUIDLow() + + local player_query_check = CharDBQuery("SELECT guid FROM purge_players WHERE guid = "..player_guid) + + if player_query_check == nil then + player:SendBroadcastMessage("Performing character purge") + + + -- ############ Removing all spell tomes from player ########################## + --local all_tomes = WorldDBQuery('SELECT entry FROM item_template WHERE name like "%tome:%"') + + --if all_tomes == nil then + --print("No tomes in the item_template") + --end + + --local current_tome = all_tomes:GetInt32(0) + + --while player:HasItem(current_tome,1,true) == true do + --player:RemoveItem(current_tome, 1) + --end + + --local bool_nextRow = all_tomes:NextRow() + + --if bool_nextRow == true then + --while bool_nextRow == true do + + --current_tome = all_tomes:GetInt32(0) + + --while player:HasItem(current_tome, 1, true) == true do + --player:RemoveItem(current_tome, 1) + --end + --bool_nextRow = all_tomes:NextRow() + --end + --end + + + -- #################### removing all spells from player ###################################### + local all_spell_lists = {druid_balance_spells, druid_feral_spells, druid_restoration_spells, + hunter_beastmastery_spells, hunter_marksmanship_spells, hunter_survival_spells, + mage_arcane_spells, mage_fire_spells, mage_frost_spells, + paladin_holy_spells, paladin_protection_spells, paladin_retribution_spells, + priest_discipline_spells, priest_holy_spells, priest_shadow_spells, + rogue_assassination_spells, rogue_combat_spells, rogue_subtlety_spells, + shaman_elemental_spells, shaman_enhancement_spells, shaman_restoration_spells, + warlock_affliction_spells, warlock_demonology_spells, warlock_destruction_spells, + warrior_arms_spells, warrior_fury_spells, warrior_protection_spells} + + --FROM ServerEBB.lua MyHandlers.ResetSpells(player) + for s, sid in pairs(noTEspells) do -- noTEspells are now only in ServerEBB.lua + if player:HasSpell(sid) then + player:RemoveSpell(sid) + end + end + -- + for listloc,spec in ipairs(all_spell_lists) do + for loc,spell in ipairs(spec) do + local spellid = spell[1] + if player:HasSpell(spellid) == true then + player:RemoveSpell(spellid) + if player:HasAura(spellid) == true then + player:RemoveAura(spellid) + end + end + end + end + + -- ############ Removing all talents from player ############################################## + local all_talent_lists = {druid_balance_talents, druid_feral_talents, druid_restoration_talents, + hunter_beastmastery_talents, hunter_marksmanship_talents, hunter_survival_talents, + mage_arcane_talents, mage_fire_talents, mage_frost_talents, + paladin_holy_talents, paladin_protection_talents, paladin_retribution_talents, + priest_discipline_talents, priest_holy_talents, priest_shadow_talents, + rogue_assassination_talents, rogue_combat_talents, rogue_subtlety_talents, + shaman_elemental_talents, shaman_enhancement_talents, shaman_restoration_talents, + warlock_affliction_talents, warlock_demonology_talents, warlock_destruction_talents, + warrior_arms_talents, warrior_fury_talents, warrior_protection_talents} + + for i,v in ipairs(all_talent_lists) do + for listloc,talent in ipairs(v) do + for slot,spellid in ipairs(talent[2]) do + if player:HasSpell(spellid) == true then + player:RemoveSpell(spellid) + if player:HasAura(spellid) == true then + player:RemoveAura(spellid) + end + end + end + end + end + + -- ############ adding appropriate amount of essences based on level ########################## + local AE_count = player:GetItemCount(spell_essence, true) + local TE_count = player:GetItemCount(talent_essence, true) + local player_level = player:GetLevel() + + local AE_add_amount = player_level - AE_count + local TE_add_amount = (player_level - 9) - TE_count + + if AE_add_amount < 0 then + player:RemoveItem(spell_essence, -AE_add_amount) + elseif AE_add_amount > 0 then + player:AddItem(spell_essence, AE_add_amount) + end + + if TE_add_amount < 0 then + player:RemoveItem(talent_essence, -TE_add_amount) + elseif TE_add_amount > 0 then + player:AddItem(talent_essence, TE_add_amount) + end + + player:SendBroadcastMessage("Purge complete") + + + CharDBExecute("INSERT INTO purge_players(guid) VALUES ("..player_guid..")") + + end + + + +end + +local function add_player_list(event,player) + local player_guid = player:GetGUIDLow() + CharDBExecute("INSERT INTO purge_players(guid) VALUES ("..player_guid..")") + +end + +RegisterPlayerEvent(3, MassPurgeCheck) +RegisterPlayerEvent(30,add_player_list) + +--Purge Command-- +local function Asc_Purgeplayer(event, player, msg, Type, lang) +if msg:find("%%purge") then -- main message + +local _,_,Type = msg:find("%%purge (%S+)") + if not(Type) then + player:SendBroadcastMessage("Syntax: %purge player, %purge all") + return false + end + + + +if (player:GetGMRank() ~= 3) then + if (player:GetGMRank() < 5) then + player:SendBroadcastMessage("You're not allowed to do this") + return false + end +end + +if (Type == "player") then + +local Target = player:GetPlayerTarget() +if not(Target) then + player:SendBroadcastMessage("You have to select a target to make a reset") + return false +end + +if not(Target:ToPlayer()) then + player:SendBroadcastMessage("Your target have to be a player") + return false + end + +CharDBExecute("DELETE FROM purge_players WHERE guid = "..player:GetGUIDLow()..";") +player:SendBroadcastMessage("Your target kicked from game for relog. Purge is done") +Target:KickPlayer() + +elseif (Type == "all") then +CharDBExecute("DELETE FROM purge_players;") +player:SendBroadcastMessage("You just purged everyone, make a restart to see the changes") +end + +end +end + + RegisterPlayerEvent(18,Asc_Purgeplayer) \ No newline at end of file diff --git a/masterscript.lua b/masterscript.lua new file mode 100644 index 0000000..0b1b000 --- /dev/null +++ b/masterscript.lua @@ -0,0 +1,7 @@ +print("\n") +print(" _____ _ _ ") +print("| _ |_ _ _ ___| |_ ___ ___|_|___ ___ ") +print("| | | | | .'| '_| -_| | | | . |") +print("|__|__|_____|__,|_,_|___|_|_|_|_|_|_ |") +print(" Quality custom content |___|") +print("==================================") diff --git a/progression/CustomizeTokens.lua b/progression/CustomizeTokens.lua new file mode 100644 index 0000000..30c3327 --- /dev/null +++ b/progression/CustomizeTokens.lua @@ -0,0 +1,37 @@ +local customizeToken = 910201 +local raceChangeToken = 200001 +local factionChangeToken = 200000 +local factionChangeToken2 = 910200 + +local function CustomizeMe (event, player, item, target) + if (player:HasItem(customizeToken) == true) then + player:RemoveItem(customizeToken, 1) + player:SetAtLoginFlag(8) + player:SendBroadcastMessage("Please return to the character select screen to continue the customization process.") + end +end + +local function ChangeRace (event, player, item, target) + if (player:HasItem(raceChangeToken) == true) then + player:RemoveItem(raceChangeToken, 1) + player:SetAtLoginFlag(128) + player:SendBroadcastMessage("Please return to the character select screen to change your race.") + end +end + +local function FactionChange (event, player, item, target) + if (player:HasItem(factionChangeToken) or player:HasItem(factionChangeToken2)) then + if (player:HasItem(factionChangeToken)) then + player:RemoveItem(factionChangeToken, 1) + else + player:RemoveItem(factionChangeToken2, 1) + end + player:SetAtLoginFlag(64) + player:SendBroadcastMessage("Please return to the character select screen to change your faction.") + end +end + +RegisterItemEvent(customizeToken, 2, CustomizeMe) +RegisterItemEvent(raceChangeToken, 2, ChangeRace) +RegisterItemEvent(factionChangeToken, 2, FactionChange) +RegisterItemEvent(factionChangeToken2, 2, FactionChange) \ No newline at end of file diff --git a/progression/LevelUpToken.lua b/progression/LevelUpToken.lua new file mode 100644 index 0000000..1554511 --- /dev/null +++ b/progression/LevelUpToken.lua @@ -0,0 +1,44 @@ +local itemid = 977019 + +local function gainLevels(event, delay, pCall, player) + local levelToGive = 1 + local currentLevel = player:GetLevel() + if (currentLevel < 1) then + local newLevel = levelToGive + currentLevel + player:GiveLevel(newLevel) + end +end + +local function fixTalents(event, delay, pCall, player) + player:ResetTalents() +end + +local function maxLevel(event, delay, pCall, player) + player:SetLevel(60) + player:AddItem(978021) + player:AdvanceAllSkills(300) + player:AdvanceSkill(176, 300) + player:RegisterEvent(fixTalents, 500, 1, player) +end + +local function LevelUpOnUse (event, player, item, target) + if (player:HasItem(itemid) == true) then + player:RemoveItem(itemid, 1) + local AP = 59 - player:GetLevel() + local TE = 59 - player:GetLevel() + player:AddItem(383080, AP) + if (player:GetLevel() >= 1 and player:GetLevel() <= 9) then + player:AddItem(383081, 51) + else + player:AddItem(383081, TE) + end + player:RegisterEvent(gainLevels, 500, 5, player) + player:RegisterEvent(maxLevel, 3000, 1, player) + + --else + -- player:SendAreaTriggerMessage("|cffff0000You must be level 1!|r") + --player:LogoutPlayer() + end +end + +RegisterItemEvent(itemid, 2, LevelUpOnUse) \ No newline at end of file diff --git a/progression/ProfessionToken.lua b/progression/ProfessionToken.lua new file mode 100644 index 0000000..680ae24 --- /dev/null +++ b/progression/ProfessionToken.lua @@ -0,0 +1,177 @@ +local ITEM_ID = 777998 +local maxSkill = 300 + +local alchemy = 171 +local bs = 164 +local ench = 333 +local eng = 202 +local insc = 773 +local jc = 755 +local lw = 165 +local tail = 197 + +local herb = 182 +local mining = 186 +local skin = 393 + +local cook = 185 +local aid = 129 +local fish = 356 + + +function ProfessionToken_Gossip(event, plr, item) +if (plr:IsInCombat() == false) then + plr:GossipMenuAddItem(0, "|TInterface/ICONS/Trade_Alchemy:45:45:-25:1|t|rAlchemy", 0, 101, false, "Are you sure you want to choose Alchemy ?") + plr:GossipMenuAddItem(0, "|TInterface/ICONS/Trade_Blacksmithing:45:45:-25:1|t|rBlacksmithing", 0, 102, false, "Are you sure you want to choose Blacksmithing ?") + plr:GossipMenuAddItem(0, "|TInterface/ICONS/Trade_Engraving:45:45:-25:1|t|rEnchanting", 0, 103, false, "Are you sure you want to choose Enchanting ?") + plr:GossipMenuAddItem(0, "|TInterface/ICONS/Trade_Engineering:45:45:-25:1|t|rEngineering", 0, 104, false, "Are you sure you want to choose Engineering ?") + --plr:GossipMenuAddItem(0, "|TInterface/ICONS/inv_inscription_tradeskill01:45:45:-25:1|t|rInscription", 0, 105, false, "Are you sure you want to choose Inscription ?") + --plr:GossipMenuAddItem(0, "|TInterface/ICONS/inv_misc_gem_01:45:45:-25:1|t|rJewelcrafting", 0, 106, false, "Are you sure you want to choose Jewelcrafting ?") + plr:GossipMenuAddItem(0, "|TInterface/ICONS/inv_misc_armorkit_17:45:45:-25:1|t|rLeatherworking", 0, 107, false, "Are you sure you want to choose Leatherworking ?") + plr:GossipMenuAddItem(0, "|TInterface/ICONS/Trade_Tailoring:45:45:-25:1w|t|rTailoring", 0, 108, false, "Are you sure you want to choose Tailoring ?") + plr:GossipMenuAddItem(0, " ", 0, 100, 0) + plr:GossipMenuAddItem(0, "|TInterface/ICONS/spell_nature_naturetouchgrow:45:45:-25:1w|t|rHerbalism", 0, 111, false, "Are you sure you want to choose Herbalism ?") + plr:GossipMenuAddItem(0, "|TInterface/ICONS/trade_mining:45:45:-25:1w|t|rMining", 0, 112, false, "Are you sure you want to choose Mining ?") + plr:GossipMenuAddItem(0, "|TInterface/ICONS/inv_misc_pelt_wolf_01:45:45:-25:1w|t|rSkining", 0, 113, false, "Are you sure you want to choose Skining ?") + plr:GossipMenuAddItem(0, " ", 0, 100, 0) + plr:GossipMenuAddItem(0, "|TInterface/ICONS/inv_misc_food_15:45:45:-25:1w|t|rCooking", 0, 121, false, "Are you sure you want to choose Cooking ?") + plr:GossipMenuAddItem(0, "|TInterface/ICONS/spell_holy_sealofsacrifice:45:45:-25:1w|t|rFirst Aid", 0, 122, false, "Are you sure you want to choose First Aid ?") + plr:GossipMenuAddItem(0, "|TInterface/ICONS/trade_fishing:45:45:-25:1w|t|rFishing", 0, 123, false, "Are you sure you want to choose Fishing ?") + plr:GossipSendMenu(1, item) + else + plr:SendBroadcastMessage("You need to be out of combat.") + end +end + +function ProfessionToken_Event(event, plr, item, arg2, intid) + if (intid > 100) then + + if (plr:HasItem(777998) == false) then + plr:SendBroadcastMessage("You don't have enough tokens to complete this operation.") + else + if (intid == 101) then + if(plr:GetSkillValue(alchemy) == maxSkill) then plr:SendBroadcastMessage("You already maxed out this profession") + else + plr:SetSkill(alchemy, 0, 375, 375) + plr:LearnSpell(28596) + plr:RemoveItem(ITEM_ID, 1) + end + end + if (intid == 102) then + if(plr:GetSkillValue(bs) == maxSkill) then plr:SendBroadcastMessage("You already maxed out this profession") + else + plr:SetSkill(bs, 0, 375, 375) + plr:LearnSpell(29844) + plr:RemoveItem(ITEM_ID, 1) + end + end + if (intid == 103) then + if(plr:GetSkillValue(ench) == maxSkill) then plr:SendBroadcastMessage("You already maxed out this profession") + else + plr:SetSkill(ench, 0, 375, 375) + plr:LearnSpell(28029) + plr:RemoveItem(ITEM_ID, 1) + end + end + if (intid == 104) then + if(plr:GetSkillValue(eng) == maxSkill) then plr:SendBroadcastMessage("You already maxed out this profession") + else + plr:SetSkill(eng, 0, 375, 375) + plr:LearnSpell(30350) + plr:RemoveItem(ITEM_ID, 1) + end + end + if (intid == 105) then + if(plr:GetSkillValue(insc) == maxSkill) then plr:SendBroadcastMessage("You already maxed out this profession") + else + plr:SetSkill(insc, 0, 375, 375) + plr:LearnSpell(45361) + plr:RemoveItem(ITEM_ID, 1) + end + end + if (intid == 106) then + if(plr:GetSkillValue(jc) == maxSkill) then plr:SendBroadcastMessage("You already maxed out this profession") + else + plr:SetSkill(jc, 0, 375, 375) + plr:LearnSpell(28897) + plr:RemoveItem(ITEM_ID, 1) + end + end + if (intid == 107) then + if(plr:GetSkillValue(lw) == maxSkill) then plr:SendBroadcastMessage("You already maxed out this profession") + else + plr:SetSkill(lw, 0, 375, 375) + plr:LearnSpell(32549) + plr:RemoveItem(ITEM_ID, 1) + end + end + if (intid == 108) then + if(plr:GetSkillValue(tail) == maxSkill) then plr:SendBroadcastMessage("You already maxed out this profession") + else + plr:SetSkill(tail, 0, 375, 375) + plr:LearnSpell(26790) + plr:RemoveItem(ITEM_ID, 1) + end + end + + if (intid == 111) then + if(plr:GetSkillValue(herb) == maxSkill) then plr:SendBroadcastMessage("You already maxed out this profession") + else + plr:SetSkill(herb, 0, 375, 375) + plr:LearnSpell(28695) + plr:RemoveItem(ITEM_ID, 1) + end + end + if (intid == 112) then + if(plr:GetSkillValue(mining) == maxSkill) then plr:SendBroadcastMessage("You already maxed out this profession") + else + plr:SetSkill(mining, 0, 375, 375) + plr:LearnSpell(29354) + plr:RemoveItem(ITEM_ID, 1) + end + end + if (intid == 113) then + if(plr:GetSkillValue(skin) == maxSkill) then plr:SendBroadcastMessage("You already maxed out this profession") + else + plr:SetSkill(skin, 0, 375, 375) + plr:LearnSpell(32678) + plr:RemoveItem(ITEM_ID, 1) + end + end + + if (intid == 121) then + if(plr:GetSkillValue(cook) == maxSkill) then plr:SendBroadcastMessage("You already maxed out this profession") + else + plr:SetSkill(cook, 0, 375, 375) + plr:LearnSpell(33359) + plr:RemoveItem(ITEM_ID, 1) + end + end + if (intid == 122) then + if(plr:GetSkillValue(aid) == maxSkill) then plr:SendBroadcastMessage("You already maxed out this profession") + else + plr:SetSkill(aid, 0, 375, 375) + plr:LearnSpell(27028) + plr:RemoveItem(ITEM_ID, 1) + end + end + if (intid == 123) then + if(plr:GetSkillValue(fish) == maxSkill) then plr:SendBroadcastMessage("You already maxed out this profession") + else + plr:SetSkill(fish, 0, 375, 375) + plr:LearnSpell(33095) + plr:RemoveItem(ITEM_ID, 1) + end + end + plr:GossipComplete() + + end + else + plr:SendBroadcastMessage("You've clicked on a separator, woops.") + end + +end + + +RegisterItemGossipEvent(ITEM_ID, 1, ProfessionToken_Gossip) +RegisterItemGossipEvent(ITEM_ID, 2, ProfessionToken_Event) \ No newline at end of file diff --git a/push_log.bat b/push_log.bat new file mode 100644 index 0000000..a27b823 --- /dev/null +++ b/push_log.bat @@ -0,0 +1,4 @@ +cd C:\Users\Administrator\Desktop\Awakening\lua_scripts +git add Eluna.log +git commit -m updating_log +git push https://drdread987:slayer1996@github.com/Serenity-/Awakening_LUA_Master.git \ No newline at end of file diff --git a/update_dbc.bat b/update_dbc.bat new file mode 100644 index 0000000..b297f97 --- /dev/null +++ b/update_dbc.bat @@ -0,0 +1,2 @@ +cd C:\Users\Administrator\Desktop\Awakening\dbc +git pull https://drdread987:slayer1996@github.com/Serenity-/Awakening-DBC-MASTER.git \ No newline at end of file diff --git a/update_lua.bat b/update_lua.bat new file mode 100644 index 0000000..0b62dc0 --- /dev/null +++ b/update_lua.bat @@ -0,0 +1,2 @@ +cd C:\Users\Administrator\Desktop\Awakening\lua_scripts +git pull https://drdread987:slayer1996@github.com/Serenity-/Awakening_LUA_Master.git \ No newline at end of file diff --git a/update_lua.lua b/update_lua.lua new file mode 100644 index 0000000..45f8e05 --- /dev/null +++ b/update_lua.lua @@ -0,0 +1,95 @@ +function update(event, player, msg, Type, lang) + + player_type = player:GetGMRank() + + if player_type >= 5 then + + if msg == "%push lua sargeras" then + + os.execute ('bash /home/develop/awake/main/bin/lua_scripts/update_lua.sh &') + player:SendBroadcastMessage("Successfully pushed Lua Scripts. This is a stable version push. Don't forget to merge changes in from master. Some Modules require restarts or .reload eluna") + + elseif msg == "%push log sargeras" then + + os.execute ('bash /home/develop/awake/main/bin/lua_scripts/push_log.sh &') + player:SendBroadcastMessage("Successfully pushed Lua Log") + + elseif msg == "%push dbc sargeras" then + + os.execute ('bash /home/develop/awake/main/bin/lua_scripts/update_dbc.sh &') + player:SendBroadcastMessage("Successfully pushed DBC Files. This requires a restart. This is a stable version push. Don't forget to merge changes in from master.") + + elseif msg == "%push core sargeras" then + + os.execute ('bash /home/develop/compile_sargeras.sh &') + player:SendBroadcastMessage("Successfully started compiling core. This requires a restart but please wait a few minutes for compiling to finish. This is a stable version push. Don't forget to merge changes in from master.") + + elseif msg == "%push lua proudmoore" then + + os.execute ('bash /home/develop/awake/proudmoore/bin/lua_scripts/update_lua.sh &') + player:SendBroadcastMessage("Successfully pushed Lua Scripts. Some Modules require restarts or .reload eluna") + + elseif msg == "%push log proudmoore" then + + os.execute ('bash /home/develop/awake/proudmoore/bin/lua_scripts/push_log.sh &') + player:SendBroadcastMessage("Successfully pushed Lua Log") + + elseif msg == "%push dbc proudmoore" then + + os.execute ('bash /home/develop/awake/proudmoore/bin/lua_scripts/update_dbc.sh &') + player:SendBroadcastMessage("Successfully pushed DBC Files. This requires a restart") + + elseif msg == "%push core proudmoore" then + + os.execute ('bash /home/develop/compile_proudmoore.sh &') + player:SendBroadcastMessage("Successfully started compiling core. This requires a restart but please wait a few minutes for compiling to finish.") + + elseif msg == "%push lua andorhal" then + + os.execute ('bash /home/develop/awake/andorhal/bin/lua_scripts/update_lua.sh &') + player:SendBroadcastMessage("Successfully pushed Lua Scripts. Some Modules require restarts or .reload eluna") + + elseif msg == "%push log andorhal" then + + os.execute ('bash /home/develop/awake/andorhal/bin/lua_scripts/push_log.sh &') + player:SendBroadcastMessage("Successfully pushed Lua Log") + + elseif msg == "%push dbc andorhal" then + + os.execute ('bash /home/develop/awake/andorhal/bin/lua_scripts/update_dbc.sh &') + player:SendBroadcastMessage("Successfully pushed DBC Files. This requires a restart") + + elseif msg == "%push core andorhal" then + + os.execute ('bash /home/develop/compile_andorhal.sh &') + player:SendBroadcastMessage("Successfully started compiling core. This requires a restart but please wait a few minutes for compiling to finish.") + + + elseif msg == "%push lua tichondrius" then + + os.execute ('bash /home/develop/awake/tichondrius/bin/lua_scripts/update_lua.sh &') + player:SendBroadcastMessage("Successfully pushed Lua Scripts. Some Modules require restarts or .reload eluna") + + elseif msg == "%push log tichondrius" then + + os.execute ('bash /home/develop/awake/tichondrius/bin/lua_scripts/push_log.sh &') + player:SendBroadcastMessage("Successfully pushed Lua Log") + + elseif msg == "%push dbc tichondrius" then + + os.execute ('bash /home/develop/awake/tichondrius/bin/lua_scripts/update_dbc.sh &') + player:SendBroadcastMessage("Successfully pushed DBC Files. This requires a restart") + + elseif msg == "%push core tichondrius" then + + os.execute ('bash /home/develop/compile_tichondrius.sh &') + player:SendBroadcastMessage("Successfully started compiling core. This requires a restart but please wait a few minutes for compiling to finish.") + + + + end + end +end + + +RegisterPlayerEvent(18,update)