├── LICENSE ├── README.md ├── lua_scripts ├── base │ └── sc_default.lua ├── custom │ ├── boss_kill_announcer.lua │ ├── chat_log.lua │ ├── npc_exchange.lua │ ├── npc_experience_eliminator.lua │ ├── premium.lua │ ├── pvp_announcer.lua │ ├── pvp_token.lua │ ├── teleporter.lua │ ├── transmogrification.lua │ └── world_chat.lua ├── eastern_kingdoms │ └── elwynn_forest │ │ ├── elwynn_forest.lua │ │ └── stormwind │ │ └── Creature_466_GeneralMarcusJonathan.lua ├── examples │ ├── example_chat_command.lua │ ├── example_creature_on_quest_accept.lua │ ├── example_creature_on_quest_complete.lua │ ├── example_creature_weather_gossip.lua │ └── example_gameobject_gossip.lua ├── extensions │ ├── ObjectVariables.ext │ └── _Misc.ext ├── kalimdor │ └── tanaris │ │ └── Quest_2882_Cuergo_Gold.lua └── masterscript.lua └── sql ├── character_premium.sql └── drop_event_ai.sql /LICENSE: -------------------------------------------------------------------------------- 1 | GNU GENERAL PUBLIC LICENSE 2 | Version 2, June 1991 3 | 4 | Copyright (C) 1989, 1991 Free Software Foundation, Inc., 5 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 6 | Everyone is permitted to copy and distribute verbatim copies 7 | of this license document, but changing it is not allowed. 8 | 9 | Preamble 10 | 11 | The licenses for most software are designed to take away your 12 | freedom to share and change it. By contrast, the GNU General Public 13 | License is intended to guarantee your freedom to share and change free 14 | software--to make sure the software is free for all its users. This 15 | General Public License applies to most of the Free Software 16 | Foundation's software and to any other program whose authors commit to 17 | using it. (Some other Free Software Foundation software is covered by 18 | the GNU Lesser General Public License instead.) You can apply it to 19 | your programs, too. 20 | 21 | When we speak of free software, we are referring to freedom, not 22 | price. Our General Public Licenses are designed to make sure that you 23 | have the freedom to distribute copies of free software (and charge for 24 | this service if you wish), that you receive source code or can get it 25 | if you want it, that you can change the software or use pieces of it 26 | in new free programs; and that you know you can do these things. 27 | 28 | To protect your rights, we need to make restrictions that forbid 29 | anyone to deny you these rights or to ask you to surrender the rights. 30 | These restrictions translate to certain responsibilities for you if you 31 | distribute copies of the software, or if you modify it. 32 | 33 | For example, if you distribute copies of such a program, whether 34 | gratis or for a fee, you must give the recipients all the rights that 35 | you have. You must make sure that they, too, receive or can get the 36 | source code. And you must show them these terms so they know their 37 | rights. 38 | 39 | We protect your rights with two steps: (1) copyright the software, and 40 | (2) offer you this license which gives you legal permission to copy, 41 | distribute and/or modify the software. 42 | 43 | Also, for each author's protection and ours, we want to make certain 44 | that everyone understands that there is no warranty for this free 45 | software. If the software is modified by someone else and passed on, we 46 | want its recipients to know that what they have is not the original, so 47 | that any problems introduced by others will not reflect on the original 48 | authors' reputations. 49 | 50 | Finally, any free program is threatened constantly by software 51 | patents. We wish to avoid the danger that redistributors of a free 52 | program will individually obtain patent licenses, in effect making the 53 | program proprietary. To prevent this, we have made it clear that any 54 | patent must be licensed for everyone's free use or not licensed at all. 55 | 56 | The precise terms and conditions for copying, distribution and 57 | modification follow. 58 | 59 | GNU GENERAL PUBLIC LICENSE 60 | TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 61 | 62 | 0. This License applies to any program or other work which contains 63 | a notice placed by the copyright holder saying it may be distributed 64 | under the terms of this General Public License. The "Program", below, 65 | refers to any such program or work, and a "work based on the Program" 66 | means either the Program or any derivative work under copyright law: 67 | that is to say, a work containing the Program or a portion of it, 68 | either verbatim or with modifications and/or translated into another 69 | language. (Hereinafter, translation is included without limitation in 70 | the term "modification".) Each licensee is addressed as "you". 71 | 72 | Activities other than copying, distribution and modification are not 73 | covered by this License; they are outside its scope. The act of 74 | running the Program is not restricted, and the output from the Program 75 | is covered only if its contents constitute a work based on the 76 | Program (independent of having been made by running the Program). 77 | Whether that is true depends on what the Program does. 78 | 79 | 1. You may copy and distribute verbatim copies of the Program's 80 | source code as you receive it, in any medium, provided that you 81 | conspicuously and appropriately publish on each copy an appropriate 82 | copyright notice and disclaimer of warranty; keep intact all the 83 | notices that refer to this License and to the absence of any warranty; 84 | and give any other recipients of the Program a copy of this License 85 | along with the Program. 86 | 87 | You may charge a fee for the physical act of transferring a copy, and 88 | you may at your option offer warranty protection in exchange for a fee. 89 | 90 | 2. You may modify your copy or copies of the Program or any portion 91 | of it, thus forming a work based on the Program, and copy and 92 | distribute such modifications or work under the terms of Section 1 93 | above, provided that you also meet all of these conditions: 94 | 95 | a) You must cause the modified files to carry prominent notices 96 | stating that you changed the files and the date of any change. 97 | 98 | b) You must cause any work that you distribute or publish, that in 99 | whole or in part contains or is derived from the Program or any 100 | part thereof, to be licensed as a whole at no charge to all third 101 | parties under the terms of this License. 102 | 103 | c) If the modified program normally reads commands interactively 104 | when run, you must cause it, when started running for such 105 | interactive use in the most ordinary way, to print or display an 106 | announcement including an appropriate copyright notice and a 107 | notice that there is no warranty (or else, saying that you provide 108 | a warranty) and that users may redistribute the program under 109 | these conditions, and telling the user how to view a copy of this 110 | License. (Exception: if the Program itself is interactive but 111 | does not normally print such an announcement, your work based on 112 | the Program is not required to print an announcement.) 113 | 114 | These requirements apply to the modified work as a whole. If 115 | identifiable sections of that work are not derived from the Program, 116 | and can be reasonably considered independent and separate works in 117 | themselves, then this License, and its terms, do not apply to those 118 | sections when you distribute them as separate works. But when you 119 | distribute the same sections as part of a whole which is a work based 120 | on the Program, the distribution of the whole must be on the terms of 121 | this License, whose permissions for other licensees extend to the 122 | entire whole, and thus to each and every part regardless of who wrote it. 123 | 124 | Thus, it is not the intent of this section to claim rights or contest 125 | your rights to work written entirely by you; rather, the intent is to 126 | exercise the right to control the distribution of derivative or 127 | collective works based on the Program. 128 | 129 | In addition, mere aggregation of another work not based on the Program 130 | with the Program (or with a work based on the Program) on a volume of 131 | a storage or distribution medium does not bring the other work under 132 | the scope of this License. 133 | 134 | 3. You may copy and distribute the Program (or a work based on it, 135 | under Section 2) in object code or executable form under the terms of 136 | Sections 1 and 2 above provided that you also do one of the following: 137 | 138 | a) Accompany it with the complete corresponding machine-readable 139 | source code, which must be distributed under the terms of Sections 140 | 1 and 2 above on a medium customarily used for software interchange; or, 141 | 142 | b) Accompany it with a written offer, valid for at least three 143 | years, to give any third party, for a charge no more than your 144 | cost of physically performing source distribution, a complete 145 | machine-readable copy of the corresponding source code, to be 146 | distributed under the terms of Sections 1 and 2 above on a medium 147 | customarily used for software interchange; or, 148 | 149 | c) Accompany it with the information you received as to the offer 150 | to distribute corresponding source code. (This alternative is 151 | allowed only for noncommercial distribution and only if you 152 | received the program in object code or executable form with such 153 | an offer, in accord with Subsection b above.) 154 | 155 | The source code for a work means the preferred form of the work for 156 | making modifications to it. For an executable work, complete source 157 | code means all the source code for all modules it contains, plus any 158 | associated interface definition files, plus the scripts used to 159 | control compilation and installation of the executable. However, as a 160 | special exception, the source code distributed need not include 161 | anything that is normally distributed (in either source or binary 162 | form) with the major components (compiler, kernel, and so on) of the 163 | operating system on which the executable runs, unless that component 164 | itself accompanies the executable. 165 | 166 | If distribution of executable or object code is made by offering 167 | access to copy from a designated place, then offering equivalent 168 | access to copy the source code from the same place counts as 169 | distribution of the source code, even though third parties are not 170 | compelled to copy the source along with the object code. 171 | 172 | 4. You may not copy, modify, sublicense, or distribute the Program 173 | except as expressly provided under this License. Any attempt 174 | otherwise to copy, modify, sublicense or distribute the Program is 175 | void, and will automatically terminate your rights under this License. 176 | However, parties who have received copies, or rights, from you under 177 | this License will not have their licenses terminated so long as such 178 | parties remain in full compliance. 179 | 180 | 5. You are not required to accept this License, since you have not 181 | signed it. However, nothing else grants you permission to modify or 182 | distribute the Program or its derivative works. These actions are 183 | prohibited by law if you do not accept this License. Therefore, by 184 | modifying or distributing the Program (or any work based on the 185 | Program), you indicate your acceptance of this License to do so, and 186 | all its terms and conditions for copying, distributing or modifying 187 | the Program or works based on it. 188 | 189 | 6. Each time you redistribute the Program (or any work based on the 190 | Program), the recipient automatically receives a license from the 191 | original licensor to copy, distribute or modify the Program subject to 192 | these terms and conditions. You may not impose any further 193 | restrictions on the recipients' exercise of the rights granted herein. 194 | You are not responsible for enforcing compliance by third parties to 195 | this License. 196 | 197 | 7. If, as a consequence of a court judgment or allegation of patent 198 | infringement or for any other reason (not limited to patent issues), 199 | conditions are imposed on you (whether by court order, agreement or 200 | otherwise) that contradict the conditions of this License, they do not 201 | excuse you from the conditions of this License. If you cannot 202 | distribute so as to satisfy simultaneously your obligations under this 203 | License and any other pertinent obligations, then as a consequence you 204 | may not distribute the Program at all. For example, if a patent 205 | license would not permit royalty-free redistribution of the Program by 206 | all those who receive copies directly or indirectly through you, then 207 | the only way you could satisfy both it and this License would be to 208 | refrain entirely from distribution of the Program. 209 | 210 | If any portion of this section is held invalid or unenforceable under 211 | any particular circumstance, the balance of the section is intended to 212 | apply and the section as a whole is intended to apply in other 213 | circumstances. 214 | 215 | It is not the purpose of this section to induce you to infringe any 216 | patents or other property right claims or to contest validity of any 217 | such claims; this section has the sole purpose of protecting the 218 | integrity of the free software distribution system, which is 219 | implemented by public license practices. Many people have made 220 | generous contributions to the wide range of software distributed 221 | through that system in reliance on consistent application of that 222 | system; it is up to the author/donor to decide if he or she is willing 223 | to distribute software through any other system and a licensee cannot 224 | impose that choice. 225 | 226 | This section is intended to make thoroughly clear what is believed to 227 | be a consequence of the rest of this License. 228 | 229 | 8. If the distribution and/or use of the Program is restricted in 230 | certain countries either by patents or by copyrighted interfaces, the 231 | original copyright holder who places the Program under this License 232 | may add an explicit geographical distribution limitation excluding 233 | those countries, so that distribution is permitted only in or among 234 | countries not thus excluded. In such case, this License incorporates 235 | the limitation as if written in the body of this License. 236 | 237 | 9. The Free Software Foundation may publish revised and/or new versions 238 | of the General Public License from time to time. Such new versions will 239 | be similar in spirit to the present version, but may differ in detail to 240 | address new problems or concerns. 241 | 242 | Each version is given a distinguishing version number. If the Program 243 | specifies a version number of this License which applies to it and "any 244 | later version", you have the option of following the terms and conditions 245 | either of that version or of any later version published by the Free 246 | Software Foundation. If the Program does not specify a version number of 247 | this License, you may choose any version ever published by the Free Software 248 | Foundation. 249 | 250 | 10. If you wish to incorporate parts of the Program into other free 251 | programs whose distribution conditions are different, write to the author 252 | to ask for permission. For software which is copyrighted by the Free 253 | Software Foundation, write to the Free Software Foundation; we sometimes 254 | make exceptions for this. Our decision will be guided by the two goals 255 | of preserving the free status of all derivatives of our free software and 256 | of promoting the sharing and reuse of software generally. 257 | 258 | NO WARRANTY 259 | 260 | 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY 261 | FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN 262 | OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES 263 | PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED 264 | OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 265 | MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS 266 | TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE 267 | PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, 268 | REPAIR OR CORRECTION. 269 | 270 | 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING 271 | WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR 272 | REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, 273 | INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING 274 | OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED 275 | TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY 276 | YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER 277 | PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE 278 | POSSIBILITY OF SUCH DAMAGES. 279 | 280 | END OF TERMS AND CONDITIONS 281 | 282 | How to Apply These Terms to Your New Programs 283 | 284 | If you develop a new program, and you want it to be of the greatest 285 | possible use to the public, the best way to achieve this is to make it 286 | free software which everyone can redistribute and change under these terms. 287 | 288 | To do so, attach the following notices to the program. It is safest 289 | to attach them to the start of each source file to most effectively 290 | convey the exclusion of warranty; and each file should have at least 291 | the "copyright" line and a pointer to where the full notice is found. 292 | 293 | {description} 294 | Copyright (C) {year} {fullname} 295 | 296 | This program is free software; you can redistribute it and/or modify 297 | it under the terms of the GNU General Public License as published by 298 | the Free Software Foundation; either version 2 of the License, or 299 | (at your option) any later version. 300 | 301 | This program is distributed in the hope that it will be useful, 302 | but WITHOUT ANY WARRANTY; without even the implied warranty of 303 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 304 | GNU General Public License for more details. 305 | 306 | You should have received a copy of the GNU General Public License along 307 | with this program; if not, write to the Free Software Foundation, Inc., 308 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 309 | 310 | Also add information on how to contact you by electronic and paper mail. 311 | 312 | If the program is interactive, make it output a short notice like this 313 | when it starts in an interactive mode: 314 | 315 | Gnomovision version 69, Copyright (C) year name of author 316 | Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. 317 | This is free software, and you are welcome to redistribute it 318 | under certain conditions; type `show c' for details. 319 | 320 | The hypothetical commands `show w' and `show c' should show the appropriate 321 | parts of the General Public License. Of course, the commands you use may 322 | be called something other than `show w' and `show c'; they could even be 323 | mouse-clicks or menu items--whatever suits your program. 324 | 325 | You should also get your employer (if you work as a programmer) or your 326 | school, if any, to sign a "copyright disclaimer" for the program, if 327 | necessary. Here is a sample; alter the names: 328 | 329 | Yoyodyne, Inc., hereby disclaims all copyright interest in the program 330 | `Gnomovision' (which makes passes at compilers) written by James Hacker. 331 | 332 | {signature of Ty Coon}, 1 April 1989 333 | Ty Coon, President of Vice 334 | 335 | This General Public License does not permit incorporating your program into 336 | proprietary programs. If your program is a subroutine library, you may 337 | consider it more useful to permit linking proprietary applications with the 338 | library. If this is what you want to do, use the GNU Lesser General 339 | Public License instead of this License. -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | LuaScripts 2 | ========== 3 | 4 | Eluna Scripts for MangosZero 5 | -------------------------------------------------------------------------------- /lua_scripts/base/sc_default.lua: -------------------------------------------------------------------------------- 1 | -- 2 | -- Cooldown Methods by Foereaper 3 | -- 4 | -- player:SetLuaCooldown(seconds[, opt_id]) -- Sets the cooldown timer to X seconds, optionally a specific cooldown ID can be set. Default ID: 1 5 | -- player:GetLuaCooldown([opt_id]) -- Returns cooldown or 0 if none, default cooldown checked is ID 1, unless other is specified. 6 | -- 7 | 8 | local cooldowns = {}; 9 | 10 | function Player:SetLuaCooldown(seconds, opt_id) 11 | assert(type(self) == "userdata"); 12 | seconds = assert(tonumber(seconds)); 13 | opt_id = opt_id or 1; 14 | local guid, source = self:GetGUIDLow(), debug.getinfo(2, 'S').short_src; 15 | 16 | if (not cooldowns[guid]) then 17 | cooldowns[guid] = { [source] = {}; }; 18 | end 19 | 20 | cooldowns[guid][source][opt_id] = os.clock() + seconds; 21 | end 22 | 23 | function Player:GetLuaCooldown(opt_id) 24 | assert(type(self) == "userdata"); 25 | local guid, source = self:GetGUIDLow(), debug.getinfo(2, 'S').short_src; 26 | opt_id = opt_id or 1; 27 | 28 | if (not cooldowns[guid]) then 29 | cooldowns[guid] = { [source] = {}; }; 30 | end 31 | 32 | local cd = cooldowns[guid][source][opt_id]; 33 | if (not cd or cd < os.clock()) then 34 | cooldowns[guid][source][opt_id] = 0 35 | return 0; 36 | else 37 | return cooldowns[guid][source][opt_id] - os.clock(); 38 | end 39 | end 40 | 41 | -- 42 | -- GossipSetText Methods by Rochet2 43 | -- 44 | -- player:GossipMenuAddItem(0, "Text", 0, 0) 45 | -- player:GossipMenuAddItem(0, "Text", 0, 0) 46 | -- player:GossipSetText("Text") 47 | -- player:GossipSendMenu(0x7FFFFFFF, creature) 48 | -- 49 | 50 | local SMSG_NPC_TEXT_UPDATE = 384 51 | local MAX_GOSSIP_TEXT_OPTIONS = 8 52 | 53 | function Player:GossipSetText(text) 54 | data = CreatePacket(SMSG_NPC_TEXT_UPDATE, 100); 55 | data:WriteULong(0x7FFFFFFF) 56 | for i = 1, MAX_GOSSIP_TEXT_OPTIONS do 57 | data:WriteFloat(0) -- Probability 58 | data:WriteString(text) -- Text 59 | data:WriteString(text) -- Text 60 | data:WriteULong(0) -- language 61 | data:WriteULong(0) -- emote 62 | data:WriteULong(0) -- emote 63 | data:WriteULong(0) -- emote 64 | data:WriteULong(0) -- emote 65 | data:WriteULong(0) -- emote 66 | data:WriteULong(0) -- emote 67 | end 68 | self:SendPacket(data) 69 | end 70 | 71 | -- 72 | -- WorldState methods by Foereaper 73 | -- 74 | -- player:InitializeWorldState(Map, Zone, StateID, Value) 75 | -- player:UpdateWorldState(StateID, Value) 76 | -- 77 | 78 | local SMSG_INIT_WORLD_STATES = 0x2C2 79 | local SMSG_UPDATE_WORLD_STATE = 0x2C3 80 | 81 | function Player:InitializeWorldState(Map, Zone, StateID, Value) 82 | local data = CreatePacket(SMSG_INIT_WORLD_STATES, 18); 83 | data:WriteULong(Map); 84 | data:WriteULong(Zone); 85 | data:WriteULong(0); 86 | data:WriteUShort(1); 87 | data:WriteULong(StateID); 88 | data:WriteULong(Value); 89 | self:SendPacket(data) 90 | end 91 | 92 | function Player:UpdateWorldState(StateID, Value) 93 | local data = CreatePacket(SMSG_UPDATE_WORLD_STATE, 8); 94 | data:WriteULong(StateID); 95 | data:WriteULong(Value); 96 | self:SendPacket(data) 97 | end 98 | 99 | function ChatMsg(type) 100 | if (type == 0x00) then 101 | return("System") 102 | elseif (type == 0x01) then 103 | return("Says") 104 | elseif (type == 0x02) then 105 | return("Party") 106 | elseif (type == 0x03) then 107 | return("Raid") 108 | elseif (type == 0x04) then 109 | return("Guild["..pg.."]") 110 | elseif (type == 0x05) then 111 | return("Guild Officer["..pg.."]") 112 | elseif (type == 0x06) then 113 | return("Yells") 114 | elseif (type == 0x07) then 115 | return("Whisper") 116 | elseif (type == 0x11) then 117 | return("(General/Trade/Local Defense/LFG/Custom)") 118 | elseif (type == 0x2C) then 119 | return("Battleground") 120 | elseif (type == 0x2D) then 121 | return("Battleground Leader") 122 | else 123 | return tostring(type) 124 | end 125 | end 126 | -------------------------------------------------------------------------------- /lua_scripts/custom/boss_kill_announcer.lua: -------------------------------------------------------------------------------- 1 | local T = {} 2 | 3 | local function KilledCreature(event, player, enemy) 4 | if(not enemy:IsWorldBoss()) then return end -- not world boss, skip 5 | local pguid, cguid = player:GetGUIDLow(), enemy:GetGUIDLow() -- get guids 6 | 7 | local ktime = 0 -- get time (default to 0) 8 | if(T[pguid] and T[pguid][cguid]) then 9 | ktime = os.time() - T[pguid][cguid] -- (now - start) = passed time (seconds) 10 | T[pguid][cguid] = nil -- erase record 11 | end 12 | 13 | local participants 14 | if(player:IsInGroup()) then 15 | participants = "with his friends (Total: "..player:GetGroup():GetMembersCount().." guys, " 16 | else 17 | participants = "Alone! (" 18 | end 19 | 20 | SendWorldMessage("[PVE] |Hplayer:"..player:GetName().."|h["..player:GetName().."]|h killed ["..enemy:GetName().."] "..participants.."Use: "..ktime.." seconds)") 21 | end 22 | 23 | local function EnterCombat(event, player, enemy) 24 | if(not enemy:IsWorldBoss()) then return end -- not world boss, skip saving time etc 25 | local pguid, cguid = player:GetGUIDLow(), enemy:GetGUIDLow() -- get guids 26 | 27 | if(not T[pguid]) then -- if the player doesnt have a table 28 | T[pguid] = {} -- create a new table for him 29 | elseif(T[pguid][cguid]) then -- check that we are not already in combat with the creature (already saved a time) 30 | return -- we are, already a time saved. Stop before saving 31 | end 32 | T[pguid][cguid] = os.time() -- save combat start time 33 | end 34 | 35 | local function LeaveCombat(event, player) 36 | if(T[player:GetGUIDLow()]) then 37 | T[player:GetGUIDLow()] = nil -- erase combat time records 38 | end 39 | end 40 | 41 | RegisterPlayerEvent(7, KilledCreature) -- executes when a player kills a creature 42 | RegisterPlayerEvent(33, EnterCombat) -- executes on each player attack attempt (spammy) 43 | RegisterPlayerEvent(34, LeaveCombat) -- executes when a player leaves combat -------------------------------------------------------------------------------- /lua_scripts/custom/chat_log.lua: -------------------------------------------------------------------------------- 1 | -- Include sc_default 2 | require "lua_scripts/base/sc_default" 3 | 4 | local file = io.open("lua_scripts/ChatLog.log", "a") 5 | 6 | cddcdm = "" 7 | 8 | function OnChat_Command(event, player, message, type, language) 9 | swm = string.lower(message) 10 | 11 | local plrname = player:GetName() 12 | local accname = player:GetAccountName() 13 | local giddy = message:gsub(cddcdm.."","") 14 | 15 | if (swm:find(cddcdm.." ") == false) then 16 | else 17 | pg = player:GetGuildName() 18 | msgtype = ChatMsg(type) 19 | tom = type 20 | 21 | if (language ~= -1) then 22 | if (tom == 10) then 23 | file:write("("..os.date()..") "..GmCheck(player)" ["..accname.."] ["..plrname.."] "..giddy"\n") 24 | else 25 | file:write("("..os.date()..") ["..accname.."] ["..plrname.."] "..msgtype..": "..giddy.."\n") 26 | file:flush() 27 | end 28 | end 29 | end 30 | end 31 | 32 | function GmCheck(player) 33 | if (player:IsGm() == true) then 34 | return("[GM]") 35 | end 36 | end 37 | 38 | RegisterPlayerEvent(18, OnChat_Command) 39 | RegisterPlayerEvent(19, OnChat_Command) 40 | RegisterPlayerEvent(20, OnChat_Command) 41 | RegisterPlayerEvent(21, OnChat_Command) 42 | RegisterPlayerEvent(22, OnChat_Command) -------------------------------------------------------------------------------- /lua_scripts/custom/npc_exchange.lua: -------------------------------------------------------------------------------- 1 | -- Include sc_default 2 | require "lua_scripts/base/sc_default" 3 | 4 | local NPC_ENTRY = 5 | 6 | local ITEM_1_ENTRY = 20558 -- Warsong Gulch Mark of Honor 7 | local ITEM_2_ENTRY = 20559 -- Arathi Basin Mark of Honor 8 | 9 | local ITEM_1_COUNT = 2 10 | local ITEM_2_COUNT = 1 11 | 12 | local ITEM_1_NAME = GetItemLink(ITEM_1_ENTRY) 13 | local ITEM_2_NAME = GetItemLink(ITEM_2_ENTRY) 14 | 15 | local function ItemExChangeOnHello(event, player, unit) 16 | player:GossipMenuAddItem(0, "Convert "..ITEM_1_COUNT.."x "..ITEM_1_NAME.."to "..ITEM_2_COUNT.."x "..ITEM_2_NAME.."", 0, 1) 17 | player:GossipMenuAddItem(0, "Nevermind..", 0, 2) 18 | player:GossipSetText("|CFFFF0303Hello "..player:GetName().."|r") 19 | player:GossipSendMenu(0x7FFFFFFF, unit) 20 | end 21 | 22 | local function ItemExChangeOnSelect(event, player, unit, sender, intid, code) 23 | if (intid == 1) then 24 | if (player:HasItem(ITEM_1_ENTRY, ITEM_1_COUNT)) then 25 | player:RemoveItem(ITEM_1_ENTRY, ITEM_1_COUNT) 26 | player:SendBroadcastMessage("|CFF7BBEF7 Remove "..ITEM_1_COUNT.."x "..ITEM_1_NAME.." |r") 27 | player:AddItem(ITEM_2_ENTRY, ITEM_2_COUNT) 28 | player:SendBroadcastMessage("|CFF7BBEF7 Added "..ITEM_2_COUNT.."x "..ITEM_2_NAME.." |r") 29 | else 30 | player:SendBroadcastMessage("|CFF7BBEF7 You need "..ITEM_1_COUNT.."x "..ITEM_1_NAME.."|CFF7BBEF7 for Convert to "..ITEM_2_COUNT.."x "..ITEM_2_NAME.."|r") 31 | end 32 | elseif (intid == 2) then 33 | player:GossipComplete() 34 | end 35 | end 36 | 37 | RegisterCreatureGossipEvent(NPC_ENTRY, 1, ItemExChangeOnHello) 38 | RegisterCreatureGossipEvent(NPC_ENTRY, 2, ItemExChangeOnSelect) -------------------------------------------------------------------------------- /lua_scripts/custom/npc_experience_eliminator.lua: -------------------------------------------------------------------------------- 1 | -- Include sc_default 2 | require "lua_scripts/base/sc_default" 3 | 4 | local NpcId = 5 | local MoneyCount = 100000 6 | 7 | local function GossipHello_ExperienceEliminator(event, player, unit) 8 | 9 | if (player:HasFlag(190, 524288)) then 10 | player:GossipMenuAddItem(0, "I want to be able to gain experience again.", 0, 1) 11 | else 12 | player:GossipMenuAddItem(0, "I don't want to gain experience anymore.", 0, 2) 13 | end 14 | 15 | player:GossipMenuAddItem(0, "I need nothing...", 0, 3) 16 | player:GossipSetText("Hello "..player:GetName().." it costs "..MoneyCount.." Chopper!") 17 | player:GossipSendMenu(0x7FFFFFFF, unit) 18 | end 19 | 20 | local function GossipSelect_ExperienceEliminator(event, player, unit, sender, intid, code) 21 | if (intid == 1) then 22 | if (player:GetCoinage() < MoneyCount) then 23 | unit:SendUnitSay("Too little money "..player:GetName().." come back when you have "..MoneyCount.." Chopper!", 0) 24 | else 25 | player:ModifyMoney(-MoneyCount) 26 | player:RemoveFlag(190, 524288) 27 | unit:SendUnitSay("Thanks! "..player:GetName().." see you.", 0) 28 | end 29 | player:GossipComplete() 30 | elseif (intid == 2) then 31 | if (player:GetCoinage() < MoneyCount) then 32 | unit:SendUnitSay("Too little money "..player:GetName().." come back when you have "..MoneyCount.." Chopper!", 0) 33 | else 34 | player:ModifyMoney(-MoneyCount) 35 | player:SetFlag(190, 524288) 36 | unit:SendUnitSay("Thanks! "..player:GetName().." see you.", 0) 37 | end 38 | player:GossipComplete() 39 | elseif (intid == 3) then 40 | player:GossipComplete() 41 | end 42 | end 43 | 44 | RegisterCreatureGossipEvent(NpcId, 1, GossipHello_ExperienceEliminator) 45 | RegisterCreatureGossipEvent(NpcId, 2, GossipSelect_ExperienceEliminator) -------------------------------------------------------------------------------- /lua_scripts/custom/premium.lua: -------------------------------------------------------------------------------- 1 | -- Include sc_default 2 | require "lua_scripts/base/sc_default" 3 | 4 | -- NOTE: need to insert character_premium.sql in your characters database 5 | 6 | local function PremiumOnLogin(event, player) -- Send a welcome massage to player and tell him is premium or not 7 | local result = CharDBQuery("SELECT AccountId FROM premium WHERE active=1 and AccountId = "..player:GetAccountId()) 8 | if (result) then 9 | player:SendBroadcastMessage("|CFFE55BB0[Premium]|r|CFFFE8A0E Welcome "..player:GetName().." you are Premium! |r") 10 | else 11 | player:SendBroadcastMessage("|CFFE55BB0[Premium]|r|CFFFE8A0E Welcome "..player:GetName().." you are NOT Premium! |r") 12 | end 13 | end 14 | 15 | local function PremiumOnChat(event, player, msg, _, lang) 16 | local result = CharDBQuery("SELECT AccountId FROM premium WHERE active=1 and AccountId = "..player:GetAccountId()) 17 | if (msg == "#premium") then -- Use #premium for sending the gossip menu 18 | if (result) then 19 | OnPremiumHello(event, player) 20 | else 21 | player:SendBroadcastMessage("|CFFE55BB0[Premium]|r|CFFFE8A0E Sorry "..player:GetName().." you are NOT Premium! |r") 22 | end 23 | end 24 | end 25 | 26 | function OnPremiumHello(event, player) 27 | player:GossipClearMenu() 28 | player:GossipMenuAddItem(0, "Show Bank", 0, 3) 29 | player:GossipMenuAddItem(0, "Show AuctionsHouse", 0, 4) 30 | player:GossipMenuAddItem(0, "Nevermind..", 0, 1) 31 | -- Room for more premium things 32 | player:GossipSetText("|CFFFF0303Hello "..player:GetName().."|r") 33 | player:GossipSendMenu(0x7FFFFFFF, player, 100) 34 | end 35 | 36 | function OnPremiumSelect(event, player, _, sender, intid, code) 37 | if (intid == 1) then -- Close the Gossip 38 | player:GossipComplete() 39 | elseif (intid == 2) then -- Go back to main menu 40 | OnPremiumHello(event, player) 41 | elseif (intid == 3) then -- Send Bank Window 42 | player:SendShowBank(player) 43 | elseif (intid == 4) then -- Send Auctions Window 44 | player:SendAuctionMenu(player) 45 | end 46 | -- Room for more premium things 47 | end 48 | 49 | RegisterPlayerEvent(3, PremiumOnLogin) -- Register Event On Login 50 | RegisterPlayerEvent(18, PremiumOnChat) -- Register Evenet on Chat Command use 51 | RegisterPlayerGossipEvent(100, 2, OnPremiumSelect) -- Register Event for Gossip Select -------------------------------------------------------------------------------- /lua_scripts/custom/pvp_announcer.lua: -------------------------------------------------------------------------------- 1 | local function PvPAnnouncer(event, killer, killed) 2 | SendWorldMessage("[PVP] |Hplayer:"..killer:GetName().."|h["..killer:GetName().."]|h killed |Hplayer:"..killed:GetName().."|h["..killed:GetName().."]|h") 3 | end 4 | 5 | RegisterPlayerEvent(6, PvPAnnouncer) 6 | -------------------------------------------------------------------------------- /lua_scripts/custom/pvp_token.lua: -------------------------------------------------------------------------------- 1 | -- -- -- -- -- -- -- -- -- -- -- -- -- 2 | -- -- PvP Token System by Salja. -- -- 3 | -- -- -- -- -- -- -- -- -- -- -- -- -- 4 | 5 | -- Include sc_default 6 | require "lua_scripts/base/sc_default" 7 | 8 | -- Settings 9 | local ItemOrGold = 0 -- 0 = Gold and Item, 1 = Only Item, 2 = Only Gold 10 | local WorldAnnounce = true -- Sends a World Announce false = Off, true = On 11 | local GoldCount = 10000 -- Reward in copper 12 | local ItemEntry = 20558 -- Warsong Gulch Mark of Honor 13 | local ItemCount = 1 -- Count of the Item 14 | local ItemName = GetItemLink(ItemEntry) 15 | local KillCooldown = 180 -- Wehn you kill the same player in this time you become not gold or item (set to 0 for disable) 16 | 17 | 18 | local function PvPTokenSystem(event, killer, killed) 19 | local receiver = killer:GetGUIDLow() 20 | 21 | if (WorldAnnounce == 1) then 22 | SendWorldMessage("[PVP] |Hplayer:"..killer:GetName().."|h["..killer:GetName().."]|h killed |Hplayer:"..killed:GetName().."|h["..killed:GetName().."]|h") 23 | end 24 | 25 | if (ItemOrGold ~= 2) then 26 | if killed:GetLuaCooldown() == 0 then 27 | if (killer:AddItem(ItemEntry, ItemCount)) then 28 | if (ItemCount == 1) then 29 | killer:SendBroadcastMessage("|CFF20C000 You get: "..ItemName.."|CFF20C000.|r") 30 | killed:SetLuaCooldown(KillCooldown) 31 | else 32 | killer:SendBroadcastMessage("|CFF20C000 You get: "..ItemName.."|CFF20C000 x"..ItemCount..".|r") 33 | killed:SetLuaCooldown(KillCooldown) 34 | end 35 | else 36 | killer:SendBroadcastMessage("|cffff0000 Your bags are full, we will send it by mail.|r") 37 | SendMail("PvP Token System", "Your Bags are full we send via Mail", receiver, nil, 41, nil, ItemEntry, ItemCount) 38 | killed:SetLuaCooldown(KillCooldown) 39 | end 40 | else 41 | killer:SendBroadcastMessage(string.format("Set Cooldown for "..killed:GetName()..", to %s seconds for next token kill", math.ceil(killed:GetLuaCooldown()))) 42 | killed:SendBroadcastMessage(string.format("Set YOUR Cooldown, to %s seconds for next token kill", math.ceil(killed:GetLuaCooldown()))) 43 | end 44 | end 45 | 46 | if (ItemOrGold ~= 1) then 47 | if killed:GetLuaCooldown() == 0 then 48 | killer:ModifyMoney(GoldCount) 49 | killer:SendBroadcastMessage("|CFF20C000 You get: "..GoldCount.."|CFF20C000 Copper.|r") 50 | killed:SetLuaCooldown(KillCooldown) 51 | else 52 | killer:SendBroadcastMessage(string.format("Set Cooldown for "..killed:GetName()..", to %s seconds for next token kill", math.ceil(killed:GetLuaCooldown()))) 53 | killed:SendBroadcastMessage(string.format("Set YOUR Cooldown, to %s seconds for next token kill", math.ceil(killed:GetLuaCooldown()))) 54 | end 55 | end 56 | end 57 | 58 | RegisterPlayerEvent(6, PvPTokenSystem) -------------------------------------------------------------------------------- /lua_scripts/custom/teleporter.lua: -------------------------------------------------------------------------------- 1 | --[==[ 2 | = How to add new locations = 3 | 4 | Example: 5 | 6 | The first line will be the main menu ID (Here [1], 7 | increment this for each main menu option!), 8 | the main menu gossip title (Here "Horde Cities"), 9 | as well as which faction can use the said menu (Here 1 (Horde)). 10 | 0 = Alliance, 1 = Horde, 2 = Both 11 | 12 | The second line is the name of the main menu's sub menus, 13 | separated by name (Here "Orgrimmar") and teleport coordinates 14 | using Map, X, Y, Z, O (Here 1, 1503, -4415.5, 22, 0) 15 | 16 | [1] = { "Horde Cities", 1, -- This will be the main menu title, as well as which faction can use the said menu. 0 = Alliance, 1 = Horde, 2 = Both 17 | {"Orgrimmar", 1, 1503, -4415.5, 22, 0}, 18 | }, 19 | 20 | You can copy paste the above into the script and change the values as informed. 21 | ]==] 22 | 23 | local UnitEntry = 1 24 | 25 | local T = { 26 | [1] = { "Horde Cities", 1, 27 | {"Orgrimmar", 1, 1503, -4415.5, 22, 0}, 28 | {"Undercity", 0, 1831, 238.5, 61.6, 0}, 29 | {"Thunderbluff", 1, -1278, 122, 132, 0}, 30 | }, 31 | [2] = { "Alliance Cities", 0, 32 | {"Stormwind", 0, -8905, 560, 94, 0.62}, 33 | {"Ironforge", 0, -4795, -1117, 499, 0}, 34 | {"Darnassus", 1, 9952, 2280.5, 1342, 1.6}, 35 | }, 36 | [3] = { "PvP Locations", 2, 37 | {"Gurubashi Arena", 0, -13229, 226, 33, 1}, 38 | {"Dire Maul Arena", 1, -3669, 1094, 160, 3}, 39 | }, 40 | } 41 | 42 | -- CODE STUFFS! DO NOT EDIT BELOW 43 | -- UNLESS YOU KNOW WHAT YOU'RE DOING! 44 | 45 | local function OnGossipHello(event, player, unit) 46 | -- Show main menu 47 | for i, v in ipairs(T) do 48 | if (v[2] == 2 or v[2] == player:GetTeam()) then 49 | player:GossipMenuAddItem(0, v[1], i, 0) 50 | end 51 | end 52 | player:GossipSendMenu(1, unit) 53 | end 54 | 55 | local function OnGossipSelect(event, player, unit, sender, intid, code) 56 | if (sender == 0) then 57 | -- return to main menu 58 | OnGossipHello(event, player, unit) 59 | return 60 | end 61 | 62 | if (intid == 0) then 63 | -- Show teleport menu 64 | for i, v in ipairs(T[sender]) do 65 | if (i > 2) then 66 | player:GossipMenuAddItem(0, v[1], sender, i) 67 | end 68 | end 69 | player:GossipMenuAddItem(0, "Back", 0, 0) 70 | player:GossipSendMenu(1, unit) 71 | return 72 | else 73 | -- teleport 74 | local name, map, x, y, z, o = table.unpack(T[sender][intid]) 75 | player:Teleport(map, x, y, z, o) 76 | end 77 | 78 | player:GossipComplete() 79 | end 80 | 81 | RegisterCreatureGossipEvent(UnitEntry, 1, OnGossipHello) 82 | RegisterCreatureGossipEvent(UnitEntry, 2, OnGossipSelect) -------------------------------------------------------------------------------- /lua_scripts/custom/transmogrification.lua: -------------------------------------------------------------------------------- 1 | --[[ 2 | 4.0 3 | Transmogrification for Classic & TBC & WoTLK - Gossip Menu 4 | By Rochet2 5 | 6 | Eluna version 7 | 8 | TODO: 9 | Make DB saving even better (Deleting)? What about coding? 10 | 11 | Fix the cost formula 12 | 13 | TODO in the distant future: 14 | 15 | Are the qualities right? Blizzard might have changed the quality requirements. 16 | What can and cant be used as source or target..? 17 | 18 | Cant transmogrify: 19 | rediculus items -- Foereaper: would be fun to stab people with a fish 20 | -- Cant think of any good way to handle this easily 21 | 22 | Cataclysm: 23 | Test on cata : implement UI xD? 24 | Item link icon to Are You sure text 25 | ]] 26 | 27 | local NPC_Entry = 60000 28 | 29 | local RequireGold = 1 30 | local GoldModifier = 1.0 31 | local GoldCost = 100000 32 | 33 | local RequireToken = false 34 | local TokenEntry = 49426 35 | local TokenAmount = 1 36 | 37 | local AllowMixedArmorTypes = false 38 | local AllowMixedWeaponTypes = false 39 | 40 | local Qualities = 41 | { 42 | [0] = false, -- AllowPoor 43 | [1] = false, -- AllowCommon 44 | [2] = true , -- AllowUncommon 45 | [3] = true , -- AllowRare 46 | [4] = true , -- AllowEpic 47 | [5] = false, -- AllowLegendary 48 | [6] = false, -- AllowArtifact 49 | [7] = true , -- AllowHeirloom 50 | } 51 | 52 | local EQUIPMENT_SLOT_START = 0 53 | local EQUIPMENT_SLOT_HEAD = 0 54 | local EQUIPMENT_SLOT_NECK = 1 55 | local EQUIPMENT_SLOT_SHOULDERS = 2 56 | local EQUIPMENT_SLOT_BODY = 3 57 | local EQUIPMENT_SLOT_CHEST = 4 58 | local EQUIPMENT_SLOT_WAIST = 5 59 | local EQUIPMENT_SLOT_LEGS = 6 60 | local EQUIPMENT_SLOT_FEET = 7 61 | local EQUIPMENT_SLOT_WRISTS = 8 62 | local EQUIPMENT_SLOT_HANDS = 9 63 | local EQUIPMENT_SLOT_FINGER1 = 10 64 | local EQUIPMENT_SLOT_FINGER2 = 11 65 | local EQUIPMENT_SLOT_TRINKET1 = 12 66 | local EQUIPMENT_SLOT_TRINKET2 = 13 67 | local EQUIPMENT_SLOT_BACK = 14 68 | local EQUIPMENT_SLOT_MAINHAND = 15 69 | local EQUIPMENT_SLOT_OFFHAND = 16 70 | local EQUIPMENT_SLOT_RANGED = 17 71 | local EQUIPMENT_SLOT_TABARD = 18 72 | local EQUIPMENT_SLOT_END = 19 73 | 74 | local INVENTORY_SLOT_BAG_START = 19 75 | local INVENTORY_SLOT_BAG_END = 23 76 | 77 | local INVENTORY_SLOT_ITEM_START = 23 78 | local INVENTORY_SLOT_ITEM_END = 39 79 | 80 | local INVTYPE_CHEST = 5 81 | local INVTYPE_WEAPON = 13 82 | local INVTYPE_ROBE = 20 83 | local INVTYPE_WEAPONMAINHAND = 21 84 | local INVTYPE_WEAPONOFFHAND = 22 85 | 86 | local ITEM_CLASS_WEAPON = 2 87 | local ITEM_CLASS_ARMOR = 4 88 | 89 | local ITEM_SUBCLASS_WEAPON_BOW = 2 90 | local ITEM_SUBCLASS_WEAPON_GUN = 3 91 | local ITEM_SUBCLASS_WEAPON_CROSSBOW = 18 92 | local ITEM_SUBCLASS_WEAPON_FISHING_POLE = 20 93 | 94 | local EXPANSION_WOTLK = 2 95 | local EXPANSION_TBC = 1 96 | local PLAYER_VISIBLE_ITEM_1_ENTRYID 97 | local ITEM_SLOT_MULTIPLIER 98 | if GetCoreExpansion() < EXPANSION_TBC then 99 | PLAYER_VISIBLE_ITEM_1_ENTRYID = 260 100 | ITEM_SLOT_MULTIPLIER = 12 101 | elseif GetCoreExpansion() < EXPANSION_WOTLK then 102 | PLAYER_VISIBLE_ITEM_1_ENTRYID = 346 103 | ITEM_SLOT_MULTIPLIER = 16 104 | else 105 | PLAYER_VISIBLE_ITEM_1_ENTRYID = 283 106 | ITEM_SLOT_MULTIPLIER = 2 107 | end 108 | 109 | local INVENTORY_SLOT_BAG_0 = 255 110 | 111 | local SlotNames = { 112 | [EQUIPMENT_SLOT_HEAD ] = {"Head", nil, nil, nil, nil, nil, nil, nil, nil}, 113 | [EQUIPMENT_SLOT_SHOULDERS ] = {"Shoulders", nil, nil, nil, nil, nil, nil, nil, nil}, 114 | [EQUIPMENT_SLOT_BODY ] = {"Shirt", nil, nil, nil, nil, nil, nil, nil, nil}, 115 | [EQUIPMENT_SLOT_CHEST ] = {"Chest", nil, nil, nil, nil, nil, nil, nil, nil}, 116 | [EQUIPMENT_SLOT_WAIST ] = {"Waist", nil, nil, nil, nil, nil, nil, nil, nil}, 117 | [EQUIPMENT_SLOT_LEGS ] = {"Legs", nil, nil, nil, nil, nil, nil, nil, nil}, 118 | [EQUIPMENT_SLOT_FEET ] = {"Feet", nil, nil, nil, nil, nil, nil, nil, nil}, 119 | [EQUIPMENT_SLOT_WRISTS ] = {"Wrists", nil, nil, nil, nil, nil, nil, nil, nil}, 120 | [EQUIPMENT_SLOT_HANDS ] = {"Hands", nil, nil, nil, nil, nil, nil, nil, nil}, 121 | [EQUIPMENT_SLOT_BACK ] = {"Back", nil, nil, nil, nil, nil, nil, nil, nil}, 122 | [EQUIPMENT_SLOT_MAINHAND ] = {"Main hand", nil, nil, nil, nil, nil, nil, nil, nil}, 123 | [EQUIPMENT_SLOT_OFFHAND ] = {"Off hand", nil, nil, nil, nil, nil, nil, nil, nil}, 124 | [EQUIPMENT_SLOT_RANGED ] = {"Ranged", nil, nil, nil, nil, nil, nil, nil, nil}, 125 | [EQUIPMENT_SLOT_TABARD ] = {"Tabard", nil, nil, nil, nil, nil, nil, nil, nil}, 126 | } 127 | local Locales = { 128 | {"Update menu", nil, nil, nil, nil, nil, nil, nil, nil}, 129 | {"Remove all transmogrifications", nil, nil, nil, nil, nil, nil, nil, nil}, 130 | {"Remove transmogrifications from all equipped items?", nil, nil, nil, nil, nil, nil, nil, nil}, 131 | {"Using this item for transmogrify will bind it to you and make it non-refundable and non-tradeable.\nDo you wish to continue?", nil, nil, nil, nil, nil, nil, nil, nil}, 132 | {"Remove transmogrification from %s?", nil, nil, nil, nil, nil, nil, nil, nil}, 133 | {"Back..", nil, nil, nil, nil, nil, nil, nil, nil}, 134 | {"Remove transmogrification", nil, nil, nil, nil, nil, nil, nil, nil}, 135 | {"Transmogrifications removed from equipped items", nil, nil, nil, nil, nil, nil, nil, nil}, 136 | {"You have no transmogrified items equipped", nil, nil, nil, nil, nil, nil, nil, nil}, 137 | {"%s transmogrification removed", nil, nil, nil, nil, nil, nil, nil, nil}, 138 | {"No transmogrification on %s slot", nil, nil, nil, nil, nil, nil, nil, nil}, 139 | {"%s transmogrified", nil, nil, nil, nil, nil, nil, nil, nil}, 140 | {"Selected items are not suitable", nil, nil, nil, nil, nil, nil, nil, nil}, 141 | {"Selected item does not exist", nil, nil, nil, nil, nil, nil, nil, nil}, 142 | {"Equipment slot is empty", nil, nil, nil, nil, nil, nil, nil, nil}, 143 | {"You don't have enough %ss", nil, nil, nil, nil, nil, nil, nil, nil}, 144 | {"Not enough money", nil, nil, nil, nil, nil, nil, nil, nil}, 145 | } 146 | local function LocText(id, p) -- "%s":format("test") 147 | if Locales[id] then 148 | local s = Locales[id][p:GetDbcLocale()+1] or Locales[id][1] 149 | if s then 150 | return s 151 | end 152 | end 153 | return "Text not found: "..(id or 0) 154 | end 155 | --[[ 156 | typedef UNORDERED_MAP transmogData 157 | typedef UNORDERED_MAP transmogMap 158 | static transmogMap entryMap -- entryMap[pGUID][iGUID] = entry 159 | static transmogData dataMap -- dataMap[iGUID] = pGUID 160 | ]] 161 | local entryMap = {} 162 | local dataMap = {} 163 | 164 | local function GetSlotName(slot, locale) 165 | if not SlotNames[slot] then return end 166 | return locale and SlotNames[slot][locale+1] or SlotNames[slot][1] 167 | end 168 | 169 | local function GetFakePrice(item) 170 | local sellPrice = item:GetSellPrice() 171 | local minPrice = 10000 172 | if sellPrice < minPrice then 173 | sellPrice = minPrice 174 | end 175 | return sellPrice 176 | end 177 | 178 | local function GetFakeEntry(item) 179 | local guid = item and item:GetGUIDLow() 180 | if guid and dataMap[guid] then 181 | if entryMap[dataMap[guid]] then 182 | return entryMap[dataMap[guid]][guid] 183 | end 184 | end 185 | end 186 | 187 | local function DeleteFakeFromDB(itemGUID) 188 | if dataMap[itemGUID] then 189 | if entryMap[dataMap[itemGUID]] then 190 | entryMap[dataMap[itemGUID]][itemGUID] = nil 191 | end 192 | dataMap[itemGUID] = nil 193 | end 194 | CharDBExecute("DELETE FROM custom_transmogrification WHERE GUID = "..itemGUID) 195 | end 196 | 197 | local function DeleteFakeEntry(item) 198 | if not GetFakeEntry(item) then 199 | return false 200 | end 201 | item:GetOwner():UpdateUInt32Value(PLAYER_VISIBLE_ITEM_1_ENTRYID + (item:GetSlot() * ITEM_SLOT_MULTIPLIER), item:GetEntry()) 202 | DeleteFakeFromDB(item:GetGUIDLow()) 203 | return true 204 | end 205 | 206 | local function SetFakeEntry(item, entry) 207 | local player = item:GetOwner() 208 | if player then 209 | local pGUID = player:GetGUIDLow() 210 | local iGUID = item:GetGUIDLow() 211 | player:UpdateUInt32Value(PLAYER_VISIBLE_ITEM_1_ENTRYID + (item:GetSlot() * ITEM_SLOT_MULTIPLIER), entry) 212 | if not entryMap[pGUID] then 213 | entryMap[pGUID] = {} 214 | end 215 | entryMap[pGUID][iGUID] = entry 216 | dataMap[iGUID] = pGUID 217 | CharDBExecute("REPLACE INTO custom_transmogrification (GUID, FakeEntry, Owner) VALUES ("..iGUID..", "..entry..", "..pGUID..")") 218 | end 219 | end 220 | 221 | local function IsRangedWeapon(Class, SubClass) 222 | return Class == ITEM_CLASS_WEAPON and ( 223 | SubClass == ITEM_SUBCLASS_WEAPON_BOW or 224 | SubClass == ITEM_SUBCLASS_WEAPON_GUN or 225 | SubClass == ITEM_SUBCLASS_WEAPON_CROSSBOW) 226 | end 227 | 228 | local function SuitableForTransmogrification(player, transmogrified, transmogrifier) 229 | if not transmogrified or not transmogrifier then 230 | return false 231 | end 232 | 233 | if not Qualities[transmogrifier:GetQuality()] then 234 | return false 235 | end 236 | 237 | if not Qualities[transmogrified:GetQuality()] then 238 | return false 239 | end 240 | 241 | if transmogrified:GetDisplayId() == transmogrifier:GetDisplayId() then 242 | return false 243 | end 244 | 245 | local fentry = GetFakeEntry(transmogrified) 246 | if fentry and fentry == transmogrifier:GetEntry() then 247 | return false 248 | end 249 | 250 | if not player:CanUseItem(transmogrifier) then 251 | return false 252 | end 253 | 254 | local fierClass = transmogrifier:GetClass() 255 | local fiedClass = transmogrified:GetClass() 256 | local fierSubClass = transmogrifier:GetSubClass() 257 | local fiedSubClass = transmogrified:GetSubClass() 258 | local fierInventorytype = transmogrifier:GetInventoryType() 259 | local fiedInventorytype = transmogrified:GetInventoryType() 260 | 261 | if fiedInventorytype == INVTYPE_BAG or 262 | fiedInventorytype == INVTYPE_RELIC or 263 | -- fiedInventorytype == INVTYPE_BODY or 264 | fiedInventorytype == INVTYPE_FINGER or 265 | fiedInventorytype == INVTYPE_TRINKET or 266 | fiedInventorytype == INVTYPE_AMMO or 267 | fiedInventorytype == INVTYPE_QUIVER then 268 | return false 269 | end 270 | 271 | if fierInventorytype == INVTYPE_BAG or 272 | fierInventorytype == INVTYPE_RELIC or 273 | -- fierInventorytype == INVTYPE_BODY or 274 | fierInventorytype == INVTYPE_FINGER or 275 | fierInventorytype == INVTYPE_TRINKET or 276 | fierInventorytype == INVTYPE_AMMO or 277 | fierInventorytype == INVTYPE_QUIVER then 278 | return false 279 | end 280 | 281 | if fierClass ~= fiedClass then 282 | return false 283 | end 284 | 285 | if IsRangedWeapon(fiedClass, fiedSubClass) ~= IsRangedWeapon(fierClass, fierSubClass) then 286 | return false 287 | end 288 | 289 | if fierSubClass ~= fiedSubClass and not IsRangedWeapon(fiedClass, fiedSubClass) then 290 | if fierClass == ITEM_CLASS_ARMOR and not AllowMixedArmorTypes then 291 | return false 292 | end 293 | if fierClass == ITEM_CLASS_WEAPON and not AllowMixedWeaponTypes then 294 | return false 295 | end 296 | end 297 | 298 | if (fierInventorytype ~= fiedInventorytype) then 299 | if (fierClass == ITEM_CLASS_WEAPON and not ((IsRangedWeapon(fiedClass, fiedSubClass) or 300 | ((fiedInventorytype == INVTYPE_WEAPON or fiedInventorytype == INVTYPE_2HWEAPON) and 301 | (fierInventorytype == INVTYPE_WEAPON or fierInventorytype == INVTYPE_2HWEAPON)) or 302 | ((fiedInventorytype == INVTYPE_WEAPONMAINHAND or fiedInventorytype == INVTYPE_WEAPONOFFHAND) and 303 | (fierInventorytype == INVTYPE_WEAPON or fierInventorytype == INVTYPE_2HWEAPON))))) then 304 | return false 305 | end 306 | if (fierClass == ITEM_CLASS_ARMOR and 307 | not ((fierInventorytype == INVTYPE_CHEST or fierInventorytype == INVTYPE_ROBE) and 308 | (fiedInventorytype == INVTYPE_CHEST or fiedInventorytype == INVTYPE_ROBE))) then 309 | return false 310 | end 311 | end 312 | 313 | return true 314 | end 315 | 316 | local menu_id = math.random(1000) 317 | 318 | local function OnGossipHello(event, player, creature) 319 | player:GossipClearMenu() 320 | for slot = EQUIPMENT_SLOT_START, EQUIPMENT_SLOT_END-1 do 321 | local transmogrified = player:GetItemByPos(INVENTORY_SLOT_BAG_0, slot) 322 | if transmogrified then 323 | if Qualities[transmogrified:GetQuality()] then 324 | local slotName = GetSlotName(slot, player:GetDbcLocale()) 325 | if slotName then 326 | player:GossipMenuAddItem(3, slotName, EQUIPMENT_SLOT_END, slot) 327 | end 328 | end 329 | end 330 | end 331 | player:GossipMenuAddItem(4, LocText(2, player), EQUIPMENT_SLOT_END+2, 0, false, LocText(3, player), 0) 332 | player:GossipMenuAddItem(7, LocText(1, player), EQUIPMENT_SLOT_END+1, 0) 333 | player:GossipSendMenu(100, creature, menu_id) 334 | end 335 | 336 | local _items = {} 337 | local function OnGossipSelect(event, player, creature, slotid, uiAction) 338 | if slotid == EQUIPMENT_SLOT_END then -- Show items you can use 339 | local transmogrified = player:GetItemByPos(INVENTORY_SLOT_BAG_0, uiAction) 340 | if transmogrified then 341 | local lowGUID = player:GetGUIDLow() 342 | _items[lowGUID] = {} -- Remove this with logix 343 | local limit = 0 344 | local price = 0 345 | if RequireGold == 1 then 346 | price = GetFakePrice(transmogrified)*GoldModifier 347 | elseif RequireGold == 2 then 348 | price = GoldCost 349 | end 350 | 351 | for i = INVENTORY_SLOT_ITEM_START, INVENTORY_SLOT_ITEM_END-1 do 352 | if limit > 30 then 353 | break 354 | end 355 | local transmogrifier = player:GetItemByPos(INVENTORY_SLOT_BAG_0, i) 356 | if transmogrifier then 357 | local display = transmogrifier:GetDisplayId() 358 | if SuitableForTransmogrification(player, transmogrified, transmogrifier) then 359 | if not _items[lowGUID][display] then 360 | limit = limit + 1 361 | _items[lowGUID][display] = {transmogrifier:GetBagSlot(), transmogrifier:GetSlot()} 362 | local popup = LocText(4, player).."\n\n"..transmogrifier:GetItemLink(player:GetDbcLocale()).."\n" 363 | if RequireToken then 364 | popup = popup.."\n"..TokenAmount.." x "..GetItemLink(TokenEntry, player:GetDbcLocale()) 365 | end 366 | player:GossipMenuAddItem(4, transmogrifier:GetItemLink(player:GetDbcLocale()), uiAction, display, false, popup, price) 367 | end 368 | end 369 | end 370 | end 371 | 372 | for i = INVENTORY_SLOT_BAG_START, INVENTORY_SLOT_BAG_END-1 do 373 | local bag = player:GetItemByPos(INVENTORY_SLOT_BAG_0, i) 374 | if bag then 375 | for j = 0, bag:GetBagSize()-1 do 376 | if limit > 30 then 377 | break 378 | end 379 | local transmogrifier = player:GetItemByPos(i, j) 380 | if transmogrifier then 381 | local display = transmogrifier:GetDisplayId() 382 | if SuitableForTransmogrification(player, transmogrified, transmogrifier) then 383 | if not _items[lowGUID][display] then 384 | limit = limit + 1 385 | _items[lowGUID][display] = {transmogrifier:GetBagSlot(), transmogrifier:GetSlot()} 386 | player:GossipMenuAddItem(4, transmogrifier:GetItemLink(player:GetDbcLocale()), uiAction, display, false, popup, price) 387 | end 388 | end 389 | end 390 | end 391 | end 392 | end 393 | 394 | player:GossipMenuAddItem(4, LocText(7, player), EQUIPMENT_SLOT_END+3, uiAction, false, LocText(5, player):format(GetSlotName(uiAction, player:GetDbcLocale()))) 395 | player:GossipMenuAddItem(7, LocText(6, player), EQUIPMENT_SLOT_END+1, 0) 396 | player:GossipSendMenu(100, creature, menu_id) 397 | else 398 | OnGossipHello(event, player, creature) 399 | end 400 | elseif slotid == EQUIPMENT_SLOT_END+1 then -- Back 401 | OnGossipHello(event, player, creature) 402 | elseif slotid == EQUIPMENT_SLOT_END+2 then -- Remove Transmogrifications 403 | local removed = false 404 | for slot = EQUIPMENT_SLOT_START, EQUIPMENT_SLOT_END-1 do 405 | local transmogrifier = player:GetItemByPos(INVENTORY_SLOT_BAG_0, slot) 406 | if transmogrifier then 407 | if DeleteFakeEntry(transmogrifier) and not removed then 408 | removed = true 409 | end 410 | end 411 | end 412 | if removed then 413 | player:SendAreaTriggerMessage(LocText(8, player)) 414 | -- player:PlayDirectSound(3337) 415 | else 416 | player:SendNotification(LocText(9, player)) 417 | end 418 | OnGossipHello(event, player, creature) 419 | elseif slotid == EQUIPMENT_SLOT_END+3 then -- Remove Transmogrification from single item 420 | local transmogrifier = player:GetItemByPos(INVENTORY_SLOT_BAG_0, uiAction) 421 | if transmogrifier then 422 | if DeleteFakeEntry(transmogrifier) then 423 | player:SendAreaTriggerMessage(LocText(10, player):format(GetSlotName(uiAction, player:GetDbcLocale()))) 424 | -- player:PlayDirectSound(3337) 425 | else 426 | player:SendNotification(LocText(11, player):format(GetSlotName(uiAction, player:GetDbcLocale()))) 427 | end 428 | end 429 | OnGossipSelect(event, player, creature, EQUIPMENT_SLOT_END, uiAction) 430 | else -- Transmogrify 431 | local lowGUID = player:GetGUIDLow() 432 | if not RequireToken or player:GetItemCount(TokenEntry) >= TokenAmount then 433 | local transmogrified = player:GetItemByPos(INVENTORY_SLOT_BAG_0, slotid) 434 | if transmogrified then 435 | if _items[lowGUID] and _items[lowGUID][uiAction] and _items[lowGUID][uiAction] then 436 | local transmogrifier = player:GetItemByPos(_items[lowGUID][uiAction][1], _items[lowGUID][uiAction][2]) 437 | if transmogrifier:GetOwnerGUID() == player:GetGUID() and (transmogrifier:IsInBag() or transmogrifier:GetBagSlot() == INVENTORY_SLOT_BAG_0) and SuitableForTransmogrification(player, transmogrified, transmogrifier) then 438 | local price 439 | if RequireGold == 1 then 440 | price = GetFakePrice(transmogrified)*GoldModifier 441 | elseif RequireGold == 2 then 442 | price = GoldCost 443 | end 444 | if price then 445 | if player:GetCoinage() >= price then 446 | player:ModifyMoney(-1*price) 447 | if RequireToken then 448 | player:RemoveItem(TokenEntry, TokenAmount) 449 | end 450 | SetFakeEntry(transmogrified, transmogrifier:GetEntry()) 451 | -- transmogrifier:SetNotRefundable(player) 452 | transmogrifier:SetBinding(true) 453 | -- player:PlayDirectSound(3337) 454 | player:SendAreaTriggerMessage(LocText(12, player):format(GetSlotName(slotid, player:GetDbcLocale()))) 455 | else 456 | player:SendNotification(LocText(17, player)) 457 | end 458 | end 459 | else 460 | player:SendNotification(LocText(13, player)) 461 | end 462 | else 463 | player:SendNotification(LocText(14, player)) 464 | end 465 | else 466 | player:SendNotification(LocText(15, player)) 467 | end 468 | else 469 | player:SendNotification(LocText(16, player):format(GetItemLink(TokenEntry, player:GetDbcLocale()))) 470 | end 471 | _items[lowGUID] = {} 472 | OnGossipSelect(event, player, creature, EQUIPMENT_SLOT_END, slotid) 473 | end 474 | end 475 | 476 | local function OnLogin(event, player) 477 | local playerGUID = player:GetGUIDLow() 478 | entryMap[playerGUID] = {} 479 | local result = CharDBQuery("SELECT GUID, FakeEntry FROM custom_transmogrification WHERE Owner = "..playerGUID) 480 | if result then 481 | repeat 482 | local itemGUID = result:GetUInt32(0) 483 | local fakeEntry = result:GetUInt32(1) 484 | -- if sObjectMgr:GetItemTemplate(fakeEntry) then 485 | -- { 486 | dataMap[itemGUID] = playerGUID 487 | entryMap[playerGUID][itemGUID] = fakeEntry 488 | -- } 489 | -- else 490 | -- sLog:outError(LOG_FILTER_SQL, "Item entry (Entry: %u, itemGUID: %u, playerGUID: %u) does not exist, deleting.", fakeEntry, itemGUID, playerGUID) 491 | -- Transmogrification::DeleteFakeFromDB(itemGUID) 492 | -- end 493 | until not result:NextRow() 494 | 495 | for slot = EQUIPMENT_SLOT_START, EQUIPMENT_SLOT_END-1 do 496 | local item = player:GetItemByPos(INVENTORY_SLOT_BAG_0, slot) 497 | if item then 498 | if entryMap[playerGUID] then 499 | if entryMap[playerGUID][item:GetGUIDLow()] then 500 | player:UpdateUInt32Value(PLAYER_VISIBLE_ITEM_1_ENTRYID + (item:GetSlot() * ITEM_SLOT_MULTIPLIER), entryMap[playerGUID][item:GetGUIDLow()]) 501 | end 502 | end 503 | end 504 | end 505 | end 506 | end 507 | 508 | local function OnLogout(event, player) 509 | local pGUID = player:GetGUIDLow() 510 | entryMap[pGUID] = nil 511 | end 512 | 513 | local function OnEquip(event, player, item, bag, slot) 514 | local fentry = GetFakeEntry(item) 515 | if fentry then 516 | if item:GetOwnerGUID() ~= player:GetGUID() then 517 | DeleteFakeFromDB(item:GetGUIDLow()) 518 | return 519 | end 520 | player:SetUInt32Value(PLAYER_VISIBLE_ITEM_1_ENTRYID + (slot * ITEM_SLOT_MULTIPLIER), fentry) 521 | end 522 | end 523 | 524 | -- Note, Query is instant when Execute is delayed 525 | CharDBQuery([[ 526 | CREATE TABLE IF NOT EXISTS `custom_transmogrification` ( 527 | `GUID` INT(10) UNSIGNED NOT NULL COMMENT 'Item guidLow', 528 | `FakeEntry` INT(10) UNSIGNED NOT NULL COMMENT 'Item entry', 529 | `Owner` INT(10) UNSIGNED NOT NULL COMMENT 'Player guidLow', 530 | PRIMARY KEY (`GUID`) 531 | ) 532 | COMMENT='version 4.0' 533 | COLLATE='latin1_swedish_ci' 534 | ENGINE=InnoDB; 535 | ]]) 536 | 537 | print("Deleting non-existing transmogrification entries...") 538 | CharDBQuery("DELETE FROM custom_transmogrification WHERE NOT EXISTS (SELECT 1 FROM item_instance WHERE item_instance.guid = custom_transmogrification.GUID)") 539 | 540 | RegisterPlayerEvent(3, OnLogin) 541 | RegisterPlayerEvent(4, OnLogout) 542 | RegisterPlayerEvent(29, OnEquip) 543 | 544 | -- Test code 545 | --RegisterPlayerEvent(18, function(e,p,m,t,l) if m == "test" then OnGossipHello(e,p,p) end end) 546 | --RegisterPlayerGossipEvent(menu_id, 2, OnGossipSelect) 547 | 548 | RegisterCreatureGossipEvent(NPC_Entry, 1, OnGossipHello) 549 | RegisterCreatureGossipEvent(NPC_Entry, 2, OnGossipSelect) 550 | 551 | local plrs = GetPlayersInWorld() 552 | if plrs then 553 | for k, player in ipairs(plrs) do 554 | OnLogin(k, player) 555 | end 556 | end 557 | -------------------------------------------------------------------------------- /lua_scripts/custom/world_chat.lua: -------------------------------------------------------------------------------- 1 | local ChatPrefix = "#w"; 2 | local WorldChannelName = "World Channel"; 3 | local CooldownTimer = 5; -- Cooldown in seconds. Set to 0 for no CD obviously. 4 | 5 | local Class = { -- Class colors :) Prettier and easier than the elseif crap :) THESE ARE HEX COLORS! 6 | [1] = "C79C6E", -- Warrior 7 | [2] = "F58CBA", -- Paladin 8 | [3] = "ABD473", -- Hunter 9 | [4] = "FFF569", -- Rogue 10 | [5] = "FFFFFF", -- Priest 11 | [6] = "C41F3B", -- Death Knight 12 | [7] = "0070DE", -- Shaman 13 | [8] = "69CCF0", -- Mage 14 | [9] = "9482C9", -- Warlock 15 | [11] = "FF7d0A" -- Druid 16 | }; 17 | 18 | local Rank = { 19 | [0] = "7DFF00", -- Player 20 | [1] = "E700B1", -- Moderator 21 | [2] = "E7A200", -- Game Master 22 | [3] = "E7A200", -- Admin 23 | [4] = "E7A200" -- Console 24 | }; 25 | 26 | -- Do not edit below unless you know what you're doing :) 27 | if (ChatPrefix:sub(-1) ~= " ") then 28 | ChatPrefix = ChatPrefix.." "; 29 | end 30 | 31 | local RCD = {}; 32 | function ChatSystem(event, player, msg, _, lang) 33 | if (RCD[player:GetGUIDLow()] == nil) then 34 | RCD[player:GetGUIDLow()] = 0; 35 | end 36 | if (msg:sub(1, ChatPrefix:len()) == ChatPrefix) then 37 | local r = RCD[player:GetGUIDLow()] - os.clock(); 38 | if (0 < r) then 39 | local s = string.format("|cFFFF0000You must wait %i second(s) before sending another chat message!|r", math.floor(r)); 40 | player:SendAreaTriggerMessage(s); 41 | else 42 | RCD[player:GetGUIDLow()] = os.clock() + CooldownTimer; 43 | local t = table.concat({"|cff7DFF00[", WorldChannelName, "] [|r|cff", Rank[player:GetGMRank()] or Rank[0], "|Hplayer:", player:GetName(), "|h", player:GetName(), "|h|r|cff7DFF00]: |r|cff", Class[player:GetClass()], msg:sub(ChatPrefix:len()+1), "|r"}); 44 | SendWorldMessage(t); 45 | end 46 | return false; 47 | end 48 | end 49 | 50 | RegisterPlayerEvent(18, ChatSystem); 51 | RegisterPlayerEvent(4, function(_, player) RCD[player:GetGUIDLow()] = 0; end); -------------------------------------------------------------------------------- /lua_scripts/eastern_kingdoms/elwynn_forest/elwynn_forest.lua: -------------------------------------------------------------------------------- 1 | -- 2 | -- Kobold Vermin - Random Say on Aggro 3 | -- NPC Entry 6 4 | -- Script Complete 100% 5 | -- 6 | 7 | NPC_KOBOLD_VERMIN = 6 8 | 9 | local SAY_KOBOLD_VERMIN_1 = "You no take candle!" 10 | local SAY_KOBOLD_VERMIN_2 = "Yiieeeee! Me run!" 11 | 12 | local function KoboldVerminOnEnterCombat(event, creature, target) 13 | local chance = math.random(1, 2) 14 | 15 | if (chance == 1) then 16 | creature:SendUnitSay(SAY_KOBOLD_VERMIN_1, 0) 17 | elseif (chance == 2) then 18 | creature:SendUnitSay(SAY_KOBOLD_VERMIN_2, 0) 19 | end 20 | end 21 | 22 | local function KoboldVerminOnLeaveCombat(event, creature) 23 | creature:RemoveEvents() 24 | end 25 | 26 | RegisterCreatureEvent(NPC_KOBOLD_VERMIN, 1, KoboldVerminOnEnterCombat) 27 | RegisterCreatureEvent(NPC_KOBOLD_VERMIN, 2, KoboldVerminOnLeaveCombat) 28 | 29 | -- 30 | -- Defias Thug - Random Say on Aggro 31 | -- NPC Entry 38 32 | -- Script Complete 100% 33 | -- 34 | 35 | NPC_DEFIAS_THUG = 38 36 | 37 | local SAY_DEFIAS_THUG_1 = "The Brotherhood will not tolerate your actions." 38 | local SAY_DEFIAS_THUG_2 = "Ah, a chance to use this freshly sharpened blade." 39 | local SAY_DEFIAS_THUG_3 = "Feel the power of the Brotherhood!" 40 | 41 | local function DefiasThugOnEnterCombat(event, creature, target) 42 | local chance = math.random(1, 3) 43 | 44 | if (chance == 1) then 45 | creature:SendUnitSay(SAY_DEFIAS_THUG_1, 0) 46 | elseif (chance == 2) then 47 | creature:SendUnitSay(SAY_DEFIAS_THUG_2, 0) 48 | elseif (chance == 3) then 49 | creature:SendUnitSay(SAY_DEFIAS_THUG_3, 0) 50 | end 51 | end 52 | 53 | local function DefiasThugOnLeaveCombat(event, creature) 54 | creature:RemoveEvents() 55 | end 56 | 57 | RegisterCreatureEvent(NPC_DEFIAS_THUG, 1, DefiasThugOnEnterCombat) 58 | RegisterCreatureEvent(NPC_DEFIAS_THUG, 2, DefiasThugOnLeaveCombat) 59 | 60 | -- 61 | -- Thuros Lightfingers - Random Say on Aggro 62 | -- NPC Entry 61 63 | -- Script Complete 100% 64 | -- 65 | 66 | NPC_THUROS_LIGHTFINGERS = 61 67 | 68 | local SAY_THUROS_LIGHTFINGERS_1 = "The Brotherhood will not tolerate your actions." 69 | local SAY_THUROS_LIGHTFINGERS_2 = "Ah, a chance to use this freshly sharpened blade." 70 | local SAY_THUROS_LIGHTFINGERS_3 = "Feel the power of the Brotherhood!" 71 | 72 | local function ThurosLightfingersOnEnterCombat(event, creature, target) 73 | local chance = math.random(1, 3) 74 | 75 | if (chance == 1) then 76 | creature:SendUnitSay(SAY_THUROS_LIGHTFINGERS_1, 0) 77 | elseif (chance == 2) then 78 | creature:SendUnitSay(SAY_THUROS_LIGHTFINGERS_2, 0) 79 | elseif (chance == 3) then 80 | creature:SendUnitSay(SAY_THUROS_LIGHTFINGERS_3, 0) 81 | end 82 | end 83 | 84 | local function ThurosLightfingersOnLeaveCombat(event, creature) 85 | creature:RemoveEvents() 86 | end 87 | 88 | RegisterCreatureEvent(NPC_THUROS_LIGHTFINGERS, 1, ThurosLightfingersOnEnterCombat) 89 | RegisterCreatureEvent(NPC_THUROS_LIGHTFINGERS, 2, ThurosLightfingersOnLeaveCombat) 90 | 91 | -- 92 | -- Kobold Labourer - Random Say on Aggro 93 | -- NPC Entry 80 94 | -- Script Complete 100% 95 | -- 96 | 97 | NPC_KOBOLD_LABOURER = 80 98 | 99 | local SAY_KOBOLD_LABOURER_1 = "You no take candle!" 100 | local SAY_KOBOLD_LABOURER_2 = "Yiieeeee! Me run!" 101 | 102 | local function KoboldLabourerOnEnterCombat(event, creature, target) 103 | local chance = math.random(1, 2) 104 | 105 | if (chance == 1) then 106 | creature:SendUnitSay(SAY_KOBOLD_LABOURER_1, 0) 107 | elseif (chance == 2) then 108 | creature:SendUnitSay(SAY_KOBOLD_LABOURER_2, 0) 109 | end 110 | end 111 | 112 | local function KoboldLabourerOnLeaveCombat(event, creature) 113 | creature:RemoveEvents() 114 | end 115 | 116 | RegisterCreatureEvent(NPC_KOBOLD_LABOURER, 1, KoboldLabourerOnEnterCombat) 117 | RegisterCreatureEvent(NPC_KOBOLD_LABOURER, 2, KoboldLabourerOnLeaveCombat) 118 | -------------------------------------------------------------------------------- /lua_scripts/eastern_kingdoms/elwynn_forest/stormwind/Creature_466_GeneralMarcusJonathan.lua: -------------------------------------------------------------------------------- 1 | --[[ 2 | EmuDevs 3 | Eluna Lua Engine 4 | Eluna Scripts 5 | Eluna Wiki 6 | 7 | -= Script Information =- 8 | * Zone: Stormwind 9 | * Script Type: Creature 10 | * Creature: Jonathan (General Marcus Jonathan, Entry: 466) 11 | * Version: tested on Zero 12 | --]] 13 | 14 | -- This creates the table used to localize all variables and functions 15 | local Jonathan = { 16 | EMOTE_RECEIVE_WAVE = 101, -- wave emote from player character 17 | EMOTE_RECEIVE_SALUTE = 78, -- salute emote from player character 18 | EMOTE_SEND_SALUTE = 66, -- salute emote by creature 19 | ID = 466 -- creature_template Entry for General Marcus Jonathan 20 | } 21 | 22 | 23 | -- handle the incoming emotes 24 | function Jonathan.OnReceiveEmote(event, creature, player, emoteid) 25 | if (emoteid == Jonathan.EMOTE_RECEIVE_WAVE) then 26 | creature:SendUnitSay("Greetings, citizen.",7); 27 | elseif (emoteid == Jonathan.EMOTE_RECEIVE_SALUTE) then 28 | creature:Emote(Jonathan.EMOTE_SEND_SALUTE); 29 | end 30 | end 31 | 32 | -- Register the event 33 | RegisterCreatureEvent(Jonathan.ID, 8, Jonathan.OnReceiveEmote) 34 | 35 | -- for more creature events: http://wiki.emudevs.com/doku.php?id=eluna_creature_events 36 | -- for other in-game events: http://wiki.emudevs.com/doku.php?id=eluna 37 | 38 | -------------------------------------------------------------------------------- /lua_scripts/examples/example_chat_command.lua: -------------------------------------------------------------------------------- 1 | local ChatPrefix = "#example" 2 | 3 | local function ChatSystem(event, player, msg, _, lang) 4 | if (msg:sub(1, ChatPrefix:len()) == ChatPrefix) then 5 | player:SendNotification("Example Chat Command Works") 6 | end 7 | end 8 | 9 | RegisterPlayerEvent(18, ChatSystem) -------------------------------------------------------------------------------- /lua_scripts/examples/example_creature_on_quest_accept.lua: -------------------------------------------------------------------------------- 1 | local NpcId = 2 | local QuestId = 3 | 4 | local SAY_01 = "Example OnQuestAccept Works" 5 | 6 | local function OnQuestAccept(event, player, creature, quest) 7 | if (quest:GetId() == QuestId) then 8 | creature:SendUnitSay(SAY_01, 0) 9 | end 10 | end 11 | 12 | RegisterCreatureEvent(NpcId, 31, OnQuestAccept) -------------------------------------------------------------------------------- /lua_scripts/examples/example_creature_on_quest_complete.lua: -------------------------------------------------------------------------------- 1 | local NpcId = 2 | local QuestId = 3 | 4 | local SAY_01 = "Example OnQuestComplete Works" 5 | 6 | local function OnQuestComplete(event, player, creature, quest) 7 | if (quest:GetId() == QuestId) then 8 | creature:SendUnitSay(SAY_01, 0) 9 | end 10 | end 11 | 12 | RegisterCreatureEvent(NpcId, 33, OnQuestComplete) -------------------------------------------------------------------------------- /lua_scripts/examples/example_creature_weather_gossip.lua: -------------------------------------------------------------------------------- 1 | local NpcId = 2 | 3 | local function TestMenuWeather(event, plr, unit) 4 | plr:GossipMenuAddItem(0, "Test Weather", 0, 1) 5 | plr:GossipMenuAddItem(0, "Nevermind..", 0, 2) 6 | plr:GossipSendMenu(1, unit) 7 | end 8 | 9 | local function TestMenuSelectWeather(event, plr, unit, sender, intid, code) 10 | if (intid == 1) then 11 | local weather = FindWeather(plr:GetZoneId()) or AddWeather(plr:GetZoneId()) 12 | if (not weather) then 13 | error("Unable to find or add weather to zone ("..plr:GetZoneId()..")") 14 | return 15 | end 16 | 17 | print (weather:GetZoneId()) 18 | 19 | weather:SetWeather(2, 3) 20 | plr:GossipComplete() 21 | elseif (intid == 2) then 22 | plr:GossipComplete() 23 | end 24 | end 25 | 26 | RegisterCreatureGossipEvent(NpcId, 1, TestMenuWeather) 27 | RegisterCreatureGossipEvent(NpcId, 2, TestMenuSelectWeather) -------------------------------------------------------------------------------- /lua_scripts/examples/example_gameobject_gossip.lua: -------------------------------------------------------------------------------- 1 | local GobId = 2 | 3 | local function OnGossipHello(event, player, go) 4 | player:GossipMenuAddItem(0, "Test Eluna Gossip GameObject", 0, 1) 5 | player:GossipSendMenu(1, go) 6 | end 7 | 8 | local function OnGossipSelect(event, player, go, sender, intid, code) 9 | if (intid == 1) then 10 | player:GossipMenuAddItem(0, "Back", 0, 2) 11 | player:GossipSendMenu(1, go) 12 | elseif (intid == 2) then 13 | OnGossipHello(event, player, go) 14 | end 15 | end 16 | 17 | RegisterGameObjectGossipEvent(GobId, 1, OnGossipHello) 18 | RegisterGameObjectGossipEvent(GobId, 2, OnGossipSelect) -------------------------------------------------------------------------------- /lua_scripts/extensions/ObjectVariables.ext: -------------------------------------------------------------------------------- 1 | -- 2 | -- Copyright (C) 2010 - 2014 Eluna Lua Engine 3 | -- This program is free software licensed under GPL version 3 4 | -- Please see the included DOCS/LICENSE.md for more information 5 | -- 6 | 7 | local variableStores = { 8 | Map = {}, 9 | Player = {}, 10 | Creature = {}, 11 | GameObject = {}, 12 | } 13 | 14 | local function DestroyData(event, obj) 15 | if (event == 18) then 16 | local mapid = obj:GetMapId() 17 | local instid = obj:GetInstanceId() 18 | if (variableStores.Map[mapid]) then 19 | variableStores.Map[mapid][instid] = nil 20 | end 21 | else 22 | variableStores[obj:GetObjectType()][obj:GetGUIDLow()] = nil 23 | end 24 | end 25 | 26 | local function GetData(self, field) 27 | local Type = self:GetObjectType() 28 | local varStore = variableStores[Type] 29 | local id 30 | if (Type == "Map") then 31 | local mapid = self:GetMapId() 32 | varStore = varStore[mapid] 33 | if (not varStore) then 34 | return nil 35 | end 36 | id = self:GetInstanceId() 37 | else 38 | id = self:GetGUIDLow() 39 | end 40 | 41 | if (not varStore[id]) then 42 | return nil 43 | end 44 | 45 | if (field == nil) then 46 | return varStore[id] 47 | else 48 | return varStore[id][field] 49 | end 50 | end 51 | 52 | local function SetData(self, field, val) 53 | assert(field ~= nil, "field was nil", 2) 54 | 55 | local Type = self:GetObjectType() 56 | local varStore = variableStores[Type] 57 | local id 58 | if (Type == "Map") then 59 | local mapid = self:GetMapId() 60 | 61 | if (not varStore[mapid]) then 62 | varStore[mapid] = {} 63 | end 64 | varStore = varStore[mapid] 65 | 66 | id = self:GetInstanceId() 67 | else 68 | id = self:GetGUIDLow() 69 | end 70 | 71 | if (not varStore[id]) then 72 | varStore[id] = {} 73 | end 74 | 75 | varStore[id][field] = val 76 | end 77 | 78 | for k,v in pairs(variableStores) do 79 | _G[k].GetData = GetData 80 | _G[k].SetData = SetData 81 | end 82 | 83 | RegisterPlayerEvent(4, DestroyData) 84 | RegisterServerEvent(31, DestroyData) 85 | RegisterServerEvent(32, DestroyData) 86 | RegisterServerEvent(18, DestroyData) 87 | -------------------------------------------------------------------------------- /lua_scripts/extensions/_Misc.ext: -------------------------------------------------------------------------------- 1 | -- 2 | -- Copyright (C) 2010 - 2014 Eluna Lua Engine 3 | -- This program is free software licensed under GPL version 3 4 | -- Please see the included DOCS/LICENSE.md for more information 5 | -- 6 | 7 | -- Set correct require paths 8 | package.path = package.path.."lua_scripts\\?;lua_scripts\\?.dll;lua_scripts\\?.lua" 9 | -- Randomize random 10 | math.randomseed(tonumber(tostring(os.time()):reverse():sub(1,6))) 11 | -------------------------------------------------------------------------------- /lua_scripts/kalimdor/tanaris/Quest_2882_Cuergo_Gold.lua: -------------------------------------------------------------------------------- 1 | --[[ 2 | EmuDevs 3 | Eluna Lua Engine 4 | Eluna Scripts 5 | Eluna Wiki 6 | 7 | -= Script Information =- 8 | * Zone: Tanaris 9 | * Script Type: Quest (Cuergo's Gold 2882) 10 | * Creature: Sailor boys (Treasure Hunting Pirate: 7899, Treasure Hunting Swashbuckler: 7901, Treasure Hunting Buccaneer: 7902) 11 | * Game object: Pirate's treasure chest (142194) 12 | * Version: tested on Zero 13 | --]] 14 | 15 | -- This creates the table used to localize all variables and functions 16 | local CuergoGold = { 17 | GO_INCONSPICUOUS_LANDMARK = 142189, 18 | NPC_PIRATE = 7899, 19 | NPC_SWASHBUCKLER = 7901, 20 | NPC_BUCCANEER = 7902, 21 | GO_PIRATE_TREASURE = 142194, 22 | SPAWN_DURATION = 600000 -- pirates and chest will exist in world for 10 minutes 23 | } 24 | 25 | function CuergoGold.PirateTreasure_OnUse(event, player, go) 26 | -- despawn the chest 27 | go:Despawn(10) 28 | end 29 | 30 | function CuergoGold.SpawnPirates(player, totalPirates) 31 | for i = 1, totalPirates, 1 do 32 | local X, Y, Z, O = player:GetLocation() 33 | local X = X + math.random(5) 34 | local Y = Y + math.random(5) 35 | local pirate = math.random(1,3) 36 | if pirate == 1 then 37 | player:SummonCreature(CuergoGold.NPC_PIRATE, X, Y, Z, O, 1, CuergoGold.SPAWN_DURATION) 38 | elseif pirate == 2 then 39 | player:SummonCreature(CuergoGold.NPC_SWASHBUCKLER, X, Y, O, 0, 1, CuergoGold.SPAWN_DURATION) 40 | else 41 | player:SummonCreature(CuergoGold.NPC_BUCCANEER, X, Y, Z, O, 1, CuergoGold.SPAWN_DURATION) 42 | end 43 | end 44 | end 45 | 46 | function CuergoGold.InconspicuousLandmark_OnUse(event, player, go) 47 | local totalPirates = math.random(4,5) 48 | SpawnPirates(player, totalPirates) 49 | -- spawn the chest 50 | player:SummonGameObject(CuergoGold.GO_PIRATE_TREASURE, -10117.715, -4051.644, 5.407, 0, CuergoGold.SPAWN_DURATION) 51 | end 52 | 53 | -- Register the events 54 | RegisterGameObjectGossipEvent(CuergoGold.GO_INCONSPICUOUS_LANDMARK, 1, CuergoGold.InconspicuousLandmark_OnUse) 55 | RegisterGameObjectGossipEvent(CuergoGold.GO_PIRATE_TREASURE, 1, CuergoGold.PirateTreasure_OnUse) 56 | -------------------------------------------------------------------------------- /lua_scripts/masterscript.lua: -------------------------------------------------------------------------------- 1 | -- 2 | -- 3 | -- This is the Eluna for MaNGOS MasterScript 4 | -- 5 | -- 6 | print("\n") 7 | print("_______________$$$$") 8 | print("______________$$$$$$$") 9 | print("______________$$$$$$$$_____$_$_$") 10 | print("_______________$$$$$$$____$$$$$$") 11 | print("________________$$$$$$$____$$$") 12 | print("________$__$_$____$$$$$$$$$$$") 13 | print("_________$$$$$$___$$$$$$$$$$") 14 | print("__________$$$_$$$$$$$$$$$$$$$$") 15 | print("___________________$$$$$$$$$$$$") 16 | print("___________________$$$$$$$$$$$$") 17 | print("__Eluna LuaEngine___$$$$$$$$$$$$$$$$") 18 | print("____for_MaNGOS___$$$$$$$$$$$$$$___$$$") 19 | print("_________________$$$$___$$$$$______$$$$") 20 | print("_________________$$$_____$$$$$____$_$_$") 21 | print("_______________$$$$_______$$$$") 22 | print("________________$_$_$_____$$$$") 23 | print("__________________________$$$$") 24 | print("_____________$$$$$$_______$$$$") 25 | print("___________$$______$$_____$$$$") 26 | print("__________$$$______$$_____$$$") 27 | print("___________$$_____$______$$$") 28 | print("____________$$__________$$$") 29 | print("______________$$$___$$$$$") 30 | print("________________$$$$$") 31 | print("\n") -------------------------------------------------------------------------------- /sql/character_premium.sql: -------------------------------------------------------------------------------- 1 | -- ---------------------------- 2 | -- Table structure for premium 3 | -- ---------------------------- 4 | DROP TABLE IF EXISTS `premium`; 5 | CREATE TABLE `premium` ( 6 | `AccountId` int(11) unsigned NOT NULL, 7 | `active` int(11) unsigned NOT NULL default '1' 8 | ) ENGINE=MyISAM DEFAULT CHARSET=latin1; 9 | -------------------------------------------------------------------------------- /sql/drop_event_ai.sql: -------------------------------------------------------------------------------- 1 | -- Drop EventAI wehn using same Scripts in lua. 2 | 3 | DELETE FROM `creature_ai_scripts` WHERE `creature_id` IN (6, 38, 61, 80); 4 | DELETE FROM `creature_ai_texts` WHERE `entry` IN (-2, -3, -4, -7, -8); 5 | 6 | UPDATE `creature_template` SET `AIName` = '' WHERE `entry` IN (6, 38, 61, 80) 7 | --------------------------------------------------------------------------------