-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathsetskill.lua
150 lines (114 loc) · 4.5 KB
/
setskill.lua
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
--[[
you can type .skill alchemy # to set a profession skill to the value you entered.
If you don't have the skill already the rank Apprentice will be learned and then skill set to the vaulue entered.
You can type .spawn # to spawn an NPC but it must be an NPC that can attack you, not a friendly NPC.
--]]
local enabled = false
local gmonly = true
local hpmultiplier = 0.85 -- Spawned npc hp will be multiplied by players hp.
local proffession = {["mining"] = 186, ["tailoring"] = 197, ["blacksmithing"] = 164, ["herbalism"] = 182, ["alchemy"] = 171, ["engineering"] = 202, ["leatherworking"] = 165, ["inscription"] = 773, ["jewelcrafting"] = 755, ["enchanting"] = 333, ["skinning"] = 393, ["cooking"] = 185, ["firstaid"] = 129, ["fishing"] = 356,}
local spells = {[171] = 2259, [164] = 2018, [182] = 2366, [333] = 7411, [202] = 4036, [773] = 45357, [755] = 25229, [165] = 2108, [186] = 2575, [393] = 8613, [197] = 3908, [185] = 2550, [129] = 3273, [356] = 7620}
local function PlrMenu(event, player, message, Type, lang)
local text = message:lower()
local x = player:GetX()
local y = player:GetY()
local z = player:GetZ()
local o = player:GetO()
local level = player:GetLevel()
local playername = player:GetName()
local playerHP = player:GetMaxHealth()
local healammount = playerHP * hpmultiplier
local Taunts = {
"Hey "..playername.." u r so uglaaaay!!!! LMAO",
"You killed my Brother so prepare to Die "..playername.."!!!",
"Hey "..playername.." Fight me you coward!",
"Hey "..playername.." I will be the one to... take you down.",
"Hey "..playername.." You can't defeat me!",
"Hey "..playername.." Victory will be mine!",
"Hey "..playername.."! It's game over for you!",
"Hey "..playername.." What's up now!?",
"Hey "..playername.." Ready when you are!",
"Hey "..playername.." You'll get no sympathy from me!",
"Victory or Death!!!",
""..playername.." is about to cry like a baby.",
"Run "..playername.." run!",
"Hey "..playername.." whats that on ur head? oh yea my weapon.",
"Hey "..playername.." why don't apple jacks taste like apples?"
}
local commandskill = "^skill.*"
local commandspawn = "^spawn.*"
local get = string.sub(text,7,65)
local strip = get:gsub("%s+", "")
local extractedskill = tostring(get:gsub("%s+%d+", ""))
local extractedskillvalue = tostring(string.match(message, "%d+"))
local mingmrank = 3
if (gmonly and player:GetGMRank() < mingmrank) then
player:SendBroadcastMessage("|cff5af304You must be a GM to use this command.|r")
return false
else
if text:find(commandskill) ~= nil then
for k,v in pairs(proffession) do
if extractedskill == k then
if player:HasSkill( tonumber(v) ) then
local maxval = extractedskillvalue
local skillvalue = tonumber(extractedskillvalue)
if skillvalue < 75 then
maxval = 75
end
if skillvalue > 75 and skillvalue < 150 then
maxval = 150
end
if skillvalue > 150 and skillvalue < 225 then
maxval = 225
end
if skillvalue > 225 and skillvalue < 300 then
maxval = 300
end
if skillvalue > 300 and skillvalue < 375 then
maxval = 350
end
if skillvalue > 350 and skillvalue < 450 then
maxval = 450
end
if skillvalue > 450 then
maxval = 450
end
local curval = player:GetSkillValue( v )
if skillvalue > curval then
player:SetSkill(tonumber(v), extractedskillvalue, extractedskillvalue, maxval)
else
player:SendBroadcastMessage("|cff5af304You can't lower "..k.."only raise it. You entered "..skillvalue.." and your "..k.."is already at "..curval.."|r")
end
else
for p,s in pairs(spells) do
if v == p then
player:LearnSpell( s )
PlrMenu(event, player, message, Type, lang)
end
end
end
end
end
return false
end
if text:find(commandspawn) ~= nil then
local stripspawn = string.match(text, "[^spawn ].*")
local extractedspawn = string.match(stripspawn, "%d+")
spawnedCreature = player:SpawnCreature( extractedspawn, x+1, y+1, z+0.6, o-3.5, 1, 60 )
if spawnedCreature:CanStartAttack(player) then
spawnedCreature:SetLevel( level )
spawnedCreature:SetMaxHealth(playerHP * hpmultiplier)
spawnedCreature:DealHeal( spawnedCreature, 39334, healammount )
spawnedCreature:SendUnitSay(Taunts[math.random(1, #Taunts)], 0)
spawnedCreature:AttackStart(player)
else
spawnedCreature:DespawnOrUnsummon( 1 )
player:SendBroadcastMessage("|cff5af304NPC must be hostile towards you.|r")
end
return false
end
end
end
if enabled then
RegisterPlayerEvent(42, PlrMenu)
end