Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --##########################################
- --#
- --# - Script created by iThorgrim
- --#
- --# Forum : http://emulophye.fr
- --# Discord : https://discord.gg/nsEZtuS
- --#
- --# Support me : paypal.me/DevRainDash
- --#
- --##########################################
- local m_exp = {};
- local function OnConnect(event, player)
- local pGuid = player:GetGUIDLow()
- if not(m_exp[pGuid])then
- m_exp[pGuid] = {
- mod_exp = 1;
- }
- end
- local GetRateExp = CharDBQuery('SELECT mod_exp FROM ElunaDB.mod_rate_exp WHERE guid = '..pGuid..';')
- if GetRateExp ~= nil then
- m_exp[pGuid].mod_exp = GetRateExp:GetUInt32(0)
- else
- local AddRateExp = CharDBQuery('INSERT INTO ElunaDB.mod_rate_exp (guid, mod_exp) VALUES ('..pGuid..', 1);')
- m_exp[pGuid].mod_exp = 1
- end
- end
- RegisterPlayerEvent(3, OnConnect)
- local function OnDisconnect(event, player)
- local pGuid = player:GetGUIDLow()
- if not(m_exp[pGuid])then
- m_exp[pGuid] = {
- mod_exp = 1;
- }
- end
- local SaveRateExp = CharDBQuery('UPDATE ElunaDB.mod_rate_exp SET mod_exp = '..m_exp[pGuid].mod_exp..' WHERE guid = '..pGuid..';')
- end
- RegisterPlayerEvent(4, OnDisconnect)
- local function OnReceiveExp(event, player, amount, victim)
- local pGuid = player:GetGUIDLow()
- if not(m_exp[pGuid])then
- m_exp[pGuid] = {
- mod_exp = 1;
- }
- end
- return amount * m_exp[pGuid].mod_exp
- end
- RegisterPlayerEvent(12, OnReceiveExp)
- local function GetAllPlayerExp(event)
- for i, player in ipairs(GetPlayersInWorld()) do
- OnConnect(event, player)
- end
- end
- RegisterServerEvent(33, GetAllPlayerExp)
- local function SaveAllPlayerExp(event)
- for i, player in ipairs(GetPlayersInWorld()) do
- OnDisconnect(event, player)
- end
- end
- RegisterServerEvent(16, SaveAllPlayerExp)
- --[[
- NPC SECTION
- ]]--
- local NpcEntry = 45000;
- local function OnGossipHello(event, player, object)
- player:GossipClearMenu()
- player:GossipSetText("Bonjour,\n\nJe suis Epoque l'intemporel.\nJe viens de loin pour vous permettre d'accélerer votre avenir.\n\nGrace à moi vous pouvez modifier votre multiplicateur d'experience.\n\n\nÀ vous de choisir :")
- player:GossipMenuAddItem(4, 'Multiplier par 1', 1, 100)
- player:GossipMenuAddItem(4, 'Multiplier par 2', 1, 101)
- player:GossipMenuAddItem(4, 'Multiplier par 3', 1, 102)
- player:GossipSendMenu(0x7FFFFFFF, object)
- end
- RegisterCreatureGossipEvent(NpcEntry, 1, OnGossipHello)
- local function OnGossipSelect(event, player, object, sender, intid, code, menu_id)
- local pGuid = player:GetGUIDLow()
- if not(m_exp[pGuid])then
- m_exp[pGuid] = {
- mod_exp = 1;
- }
- end
- --
- if intid == 100 then
- m_exp[pGuid].mod_exp = 1;
- player:SendNotification('Votre rate d\'experience est désormais fixés à x1.')
- player:GossipComplete()
- elseif intid == 101 then
- m_exp[pGuid].mod_exp = 2;
- player:SendNotification('Votre rate d\'experience est désormais fixés à x2.')
- player:GossipComplete()
- elseif intid == 102 then
- m_exp[pGuid].mod_exp = 3;
- player:SendNotification('Votre rate d\'experience est désormais fixés à x3.')
- player:GossipComplete()
- end
- OnDisconnect(event, player)
- end
- RegisterCreatureGossipEvent(NpcEntry, 2, OnGossipSelect)
- CharDBQuery('CREATE DATABASE IF NOT EXISTS ElunaDB;')
- CharDBQuery('CREATE TABLE IF NOT EXISTS `ElunaDB`.`mod_rate_exp` (`guid` int(11) NOT NULL, `mod_exp` int(11) DEFAULT '1', PRIMARY KEY (`guid`)) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;')
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement