Skip to content
This repository was archived by the owner on Dec 4, 2020. It is now read-only.

Commit d19c7ed

Browse files
committed
Merge branch 'feature/crafting_expert_lb' into release
# Conflicts: # scripts/zones/Windurst_Woods/npcs/Ponono.lua
2 parents 6243173 + b8fa7c0 commit d19c7ed

File tree

11 files changed

+535
-97
lines changed

11 files changed

+535
-97
lines changed

scripts/globals/crafting.lua

+31-32
Original file line numberDiff line numberDiff line change
@@ -26,16 +26,16 @@ guild =
2626
-- Table for Test Item
2727
-----------------------------------
2828

29-
local TI_Alchemy = {937, 4157, 4163, 947, 16543, 4116, 16479, 4120, 16609, 10792}
30-
local TI_Bonecraft = {13442, 13441, 13323, 13459, 13091, 17299, 16420, 12508, 13987, 11058} -- Way of The Boneworker + Hajduk Ring
31-
local TI_Clothcraft = {13583, 13584, 13204, 13075, 12723, 13586, 13752, 12612, 14253, 11000}
32-
local TI_Cooking = {4355, 4416, 4489, 4381, 4413, 4558, 4546, 4440, 4561, } -- Sprightly Soup + Way of the Culinarian
33-
local TI_Fishing = {4401, 4379, 4469, 4480, 4462, 4479, 4471, 4478, 4474, 5817, } -- Tiger shark
34-
local TI_Goldsmithing = {12496, 12497, 12495, 13082, 13446, 13084, 12545, 13125, 16515, } -- Evader Earring**Guild item must be made with an Inferno Crystal
35-
local TI_Leathercraft = {13594, 16386, 13588, 13195, 12571, 12572, 12980, 12702, 12447, } -- Urja Trousers(Signed with Terra Crystal)
36-
local TI_Smithing = {16530, 12299, 16512, 16650, 16651, 16559, 12427, 16577, 12428, } -- Gorkhali Kukri
37-
local TI_Woodworking = {22, 23, 17354, 17348, 17053, 17156, 17054, 56, 17101, } -- Vejovis wand signed
38-
local TI_Synergy = {}
29+
local TI_Alchemy = { 937, 4157, 4163, 947, 16543, 4116, 16479, 4120, 16609, 10792}
30+
local TI_Bonecraft = {13442, 13441, 13323, 13459, 13091, 17299, 16420, 12508, 13987, 11058}
31+
local TI_Clothcraft = {13583, 13584, 13204, 13075, 12723, 13586, 13752, 12612, 14253, 11000}
32+
local TI_Cooking = { 4355, 4416, 4489, 4381, 4413, 4558, 4546, 4440, 4561, 5930}
33+
local TI_Fishing = { 4401, 4379, 4469, 4480, 4462, 4479, 4471, 4478, 4474, 5817}
34+
local TI_Goldsmithing = {12496, 12497, 12495, 13082, 13446, 13084, 12545, 13125, 16515, 11060}
35+
local TI_Leathercraft = {13594, 16386, 13588, 13195, 12571, 12572, 12980, 12702, 12447, 10577}
36+
local TI_Smithing = {16530, 12299, 16512, 16650, 16651, 16559, 12427, 16577, 12428, 19788}
37+
local TI_Woodworking = { 22, 23, 17354, 17348, 17053, 17156, 17054, 56, 17101, 18884}
38+
local TI_Synergy = {}
3939

4040
local HQCrystals = {
4141
[1] = {
@@ -89,7 +89,6 @@ function isGuildMember(player, guild)
8989
else
9090
bit[i]=0
9191
end
92-
--printf("bit %u: %u", i, bit[i])
9392
end
9493

9594
return bit[guild]
@@ -115,16 +114,16 @@ function getTestItem(player, npc, craftID)
115114

116115
switch (npc:getName()): caseof
117116
{
118-
["Abd-al-Raziq"] = function (x) TItemList = TI_Alchemy end,
119-
["Peshi_Yohnts"] = function (x) TItemList = TI_Bonecraft end,
120-
["Ponono"] = function (x) TItemList = TI_Clothcraft end,
121-
["Piketo-Puketo"] = function (x) TItemList = TI_Cooking end,
122-
["Thubu_Parohren"] = function (x) TItemList = TI_Fishing end,
123-
["Reinberta"] = function (x) TItemList = TI_Goldsmithing end,
124-
["Faulpie"] = function (x) TItemList = TI_Leathercraft end,
125-
["Mevreauche"] = function (x) TItemList = TI_Smithing end,
126-
["Ghemp"] = function (x) TItemList = TI_Smithing end,
127-
["Cheupirudaux"] = function (x) TItemList = TI_Woodworking end,
117+
["Abd-al-Raziq"] = function (x) TItemList = TI_Alchemy end,
118+
["Peshi_Yohnts"] = function (x) TItemList = TI_Bonecraft end,
119+
["Ponono"] = function (x) TItemList = TI_Clothcraft end,
120+
["Piketo-Puketo"] = function (x) TItemList = TI_Cooking end,
121+
["Thubu_Parohren"] = function (x) TItemList = TI_Fishing end,
122+
["Reinberta"] = function (x) TItemList = TI_Goldsmithing end,
123+
["Faulpie"] = function (x) TItemList = TI_Leathercraft end,
124+
["Mevreauche"] = function (x) TItemList = TI_Smithing end,
125+
["Ghemp"] = function (x) TItemList = TI_Smithing end,
126+
["Cheupirudaux"] = function (x) TItemList = TI_Woodworking end,
128127
}
129128

130129
return TItemList[NextRank]
@@ -139,24 +138,24 @@ function canGetNewRank(player, skillLvL, craftID)
139138
local Rank = player:getSkillRank(craftID) + 1
140139
local canGet = 0
141140

142-
-- 0 fonctionne pas en lua donc rank + 1
143141
if (Rank == 1 and skillLvL >= 256 or
144-
Rank == 2 and skillLvL >= 577 or
145-
Rank == 3 and skillLvL >= 898 or
146-
Rank == 4 and skillLvL >= 1219 or
147-
Rank == 5 and skillLvL >= 1540 or
148-
Rank == 6 and skillLvL >= 1861 or
149-
Rank == 7 and skillLvL >= 2182 or
150-
Rank == 8 and skillLvL >= 2503 or
151-
Rank == 9 and skillLvL >= 2824) then
152-
-- Rank == 10 and skillLvL >= 3145) then
142+
Rank == 2 and skillLvL >= 577 or
143+
Rank == 3 and skillLvL >= 898 or
144+
Rank == 4 and skillLvL >= 1219 or
145+
Rank == 5 and skillLvL >= 1540 or
146+
Rank == 6 and skillLvL >= 1861 or
147+
Rank == 7 and skillLvL >= 2182 or
148+
Rank == 8 and skillLvL >= 2503 or
149+
Rank == 9 and skillLvL >= 2824 or
150+
Rank == 10 and skillLvL >= 3145) then
153151
canGet = 1
154152
end
155153

156154
return canGet
157155

158156
end
159157

158+
160159
-----------------------------------
161160
-- tradeTestItem Action
162161
-----------------------------------
@@ -167,12 +166,12 @@ function tradeTestItem(player, npc, trade, craftID)
167166
local skillLvL = player:getSkillLevel(craftID)
168167
local myTI = getTestItem(player, npc, craftID)
169168
local newRank = 0
169+
local signed = trade:getItem():getSignature() == player:getName() and 1 or 0
170170

171171
if (canGetNewRank(player, skillLvL, craftID) == 1 and
172172
trade:hasItemQty(myTI, 1) and
173173
trade:getItemCount() == 1) then
174174
newRank = player:getSkillRank(craftID) + 1
175-
player:tradeComplete()
176175
if player:getCharVar('[GUILD]currentGuild') == guildID + 1 then
177176
player:setCharVar('[GUILD]daily_points', -1)
178177
end

scripts/zones/Bastok_Markets/npcs/Reinberta.lua

+50-6
Original file line numberDiff line numberDiff line change
@@ -10,39 +10,83 @@ require("scripts/globals/status")
1010
-----------------------------------
1111

1212
function onTrade(player, npc, trade)
13+
local signed = trade:getItem():getSignature() == player:getName() and 1 or 0
1314
local newRank = tradeTestItem(player, npc, trade, tpz.skill.GOLDSMITHING)
1415

15-
if (newRank ~= 0) then
16+
if
17+
newRank > 9 and
18+
player:getCharVar("GoldsmithingExpertQuest") == 1 and
19+
player:hasKeyItem(tpz.keyItem.WAY_OF_THE_GOLDSMITH)
20+
then
21+
if signed ~=0 then
22+
player:setSkillRank(tpz.skill.GOLDSMITHING, newRank)
23+
player:startEvent(301, 0, 0, 0, 0, newRank, 1)
24+
player:setCharVar("GoldsmithingExpertQuest",0)
25+
player:setLocalVar("GoldsmithingTraded",1)
26+
else
27+
player:startEvent(301, 0, 0, 0, 0, newRank, 0)
28+
end
29+
elseif newRank ~= 0 and newRank <=9 then
1630
player:setSkillRank(tpz.skill.GOLDSMITHING, newRank)
1731
player:startEvent(301, 0, 0, 0, 0, newRank)
32+
player:setLocalVar("GoldsmithingTraded",1)
1833
end
1934
end
2035

2136
function onTrigger(player, npc)
22-
local getNewRank = 0
2337
local craftSkill = player:getSkillLevel(tpz.skill.GOLDSMITHING)
2438
local testItem = getTestItem(player, npc, tpz.skill.GOLDSMITHING)
2539
local guildMember = isGuildMember(player, 6)
40+
local rankCap = getCraftSkillCap(player, tpz.skill.GOLDSMITHING)
41+
local expertQuestStatus = 0
42+
local Rank = player:getSkillRank(tpz.skill.GOLDSMITHING)
43+
local realSkill = (craftSkill - Rank) / 32
2644
if (guildMember == 1) then guildMember = 150995375; end
27-
if (canGetNewRank(player, craftSkill, tpz.skill.GOLDSMITHING) == 1) then getNewRank = 100; end
45+
if player:getCharVar("GoldsmithingExpertQuest") == 1 then
46+
if player:hasKeyItem(tpz.keyItem.WAY_OF_THE_GOLDSMITH) then
47+
expertQuestStatus = 600
48+
else
49+
expertQuestStatus = 550
50+
end
51+
end
2852

29-
player:startEvent(300, testItem, getNewRank, 30, guildMember, 44, 0, 0, 0)
53+
if expertQuestStatus == 600 then
54+
--[[ Feeding the proper parameter currently hangs the client in cutscene. This may
55+
possibly be due to an unimplemented packet or function (display recipe?) Work
56+
around to present dialog to player to let them know the trade is ready to be
57+
received by triggering with lower rank up parameters. ]]--
58+
player:showText(npc, 7188)
59+
player:showText(npc, 7190)
60+
player:startEvent(300, testItem, realSkill, 44, guildMember, 0, 0, 0, 0)
61+
else
62+
player:startEvent(300, testItem, realSkill, rankCap, guildMember, expertQuestStatus, 0, 0, 0)
63+
end
3064
end
3165

3266
-- 300 301 402
3367
function onEventUpdate(player, csid, option)
3468
end
3569

3670
function onEventFinish(player, csid, option)
37-
if (csid == 300 and option == 1) then
38-
local crystal = 4096 -- fire crystal
71+
local guildMember = isGuildMember(player, 6)
3972

73+
if (csid == 300 and option == 2) then
74+
if guildMember == 1 then
75+
player:setCharVar("GoldsmithingExpertQuest",1)
76+
end
77+
elseif (csid == 300 and option == 1) then
78+
local crystal = 4096 -- fire crystal
4079
if (player:getFreeSlotsCount() == 0) then
4180
player:messageSpecial(ID.text.ITEM_CANNOT_BE_OBTAINED, crystal)
4281
else
4382
player:addItem(crystal)
4483
player:messageSpecial(ID.text.ITEM_OBTAINED, crystal)
4584
signupGuild(player, guild.goldsmithing)
4685
end
86+
else
87+
if player:getLocalVar("GoldsmithingTraded") == 1 then
88+
player:tradeComplete()
89+
player:setLocalVar("GoldsmithingTraded",0)
90+
end
4791
end
4892
end

scripts/zones/Bastok_Mines/npcs/Abd-al-Raziq.lua

+50-8
Original file line numberDiff line numberDiff line change
@@ -11,25 +11,48 @@ require("scripts/globals/status")
1111
-----------------------------------
1212

1313
function onTrade(player, npc, trade)
14+
local signed = trade:getItem():getSignature() == player:getName() and 1 or 0
1415
local newRank = tradeTestItem(player, npc, trade, tpz.skill.ALCHEMY)
1516

16-
if (newRank ~= 0) then
17+
if
18+
newRank > 9 and
19+
player:getCharVar("AlchemyExpertQuest") == 1 and
20+
player:hasKeyItem(tpz.keyItem.WAY_OF_THE_ALCHEMIST)
21+
then
22+
if signed ~=0 then
23+
player:setSkillRank(tpz.skill.ALCHEMY, newRank)
24+
player:startEvent(121, 0, 0, 0, 0, newRank, 1)
25+
player:setCharVar("AlchemyExpertQuest",0)
26+
player:setLocalVar("AlchemyTraded",1)
27+
else
28+
player:startEvent(121, 0, 0, 0, 0, newRank, 0)
29+
end
30+
elseif newRank ~= 0 and newRank <=9 then
1731
player:setSkillRank(tpz.skill.ALCHEMY, newRank)
1832
player:startEvent(121, 0, 0, 0, 0, newRank)
33+
player:setLocalVar("AlchemyTraded",1)
1934
end
2035
end
2136

2237
function onTrigger(player, npc)
23-
local getNewRank = 0
2438
local craftSkill = player:getSkillLevel(tpz.skill.ALCHEMY)
2539
local testItem = getTestItem(player, npc, tpz.skill.ALCHEMY)
2640
local guildMember = isGuildMember(player, 1)
27-
41+
local rankCap = getCraftSkillCap(player, tpz.skill.ALCHEMY)
42+
local expertQuestStatus = 0
43+
local Rank = player:getSkillRank(tpz.skill.ALCHEMY)
44+
local realSkill = (craftSkill - Rank) / 32
45+
local canRankUp = rankCap - realSkill -- used to make sure rank up isn't overridden by ASA mission
2846
if (guildMember == 1) then guildMember = 150995375; end
47+
if player:getCharVar("AlchemyExpertQuest") == 1 then
48+
if player:hasKeyItem(tpz.keyItem.WAY_OF_THE_ALCHEMIST) then
49+
expertQuestStatus = 550
50+
else
51+
expertQuestStatus = 600
52+
end
53+
end
2954

30-
if (canGetNewRank(player, craftSkill, tpz.skill.ALCHEMY) == 1) then getNewRank = 100; end
31-
32-
if (player:getCurrentMission(ASA) == tpz.mission.id.asa.THAT_WHICH_CURDLES_BLOOD and guildMember == 150995375 and getNewRank ~= 100) then
55+
if (player:getCurrentMission(ASA) == tpz.mission.id.asa.THAT_WHICH_CURDLES_BLOOD and guildMember == 150995375 and canRankUp >= 3) then
3356
local item = 0
3457
local asaStatus = player:getCharVar("ASA_Status")
3558

@@ -42,16 +65,30 @@ function onTrigger(player, npc)
4265

4366
-- The Parameters are Item IDs for the Recipe
4467
player:startEvent(590, item, 2774, 929, 4103, 2777, 4103)
68+
elseif expertQuestStatus == 550 then
69+
--[[ Feeding the proper parameter currently hangs the client in cutscene. This may
70+
possibly be due to an unimplemented packet or function (display recipe?) Work
71+
around to present dialog to player to let them know the trade is ready to be
72+
received by triggering with lower rank up parameters. ]]--
73+
player:showText(npc, 7237)
74+
player:showText(npc, 7239)
75+
player:startEvent(120, testItem, realSkill, 44, guildMember, 0, 0, 0, 0)
4576
else
46-
player:startEvent(120, testItem, getNewRank, 30, guildMember, 44, 0, 0, 0)
77+
player:startEvent(120, testItem, realSkill, rankCap, guildMember, expertQuestStatus, 0, 0, 0)
4778
end
4879
end
4980

5081
function onEventUpdate(player, csid, option)
5182
end
5283

5384
function onEventFinish(player, csid, option)
54-
if (csid == 120 and option == 1) then
85+
local guildMember = isGuildMember(player, 1)
86+
87+
if (csid == 120 and option == 2) then
88+
if guildMember == 1 then
89+
player:setCharVar("AlchemyExpertQuest",1)
90+
end
91+
elseif (csid == 120 and option == 1) then
5592
local crystal = 4101 -- water crystal
5693

5794
if (player:getFreeSlotsCount() == 0) then
@@ -61,5 +98,10 @@ function onEventFinish(player, csid, option)
6198
player:messageSpecial(ID.text.ITEM_OBTAINED, crystal)
6299
signupGuild(player, guild.alchemy)
63100
end
101+
else
102+
if player:getLocalVar("AlchemyTraded") == 1 then
103+
player:tradeComplete()
104+
player:setLocalVar("AlchemyTraded",0)
105+
end
64106
end
65107
end

scripts/zones/Metalworks/npcs/Ghemp.lua

+51-5
Original file line numberDiff line numberDiff line change
@@ -10,37 +10,83 @@ require("scripts/globals/status")
1010
-----------------------------------
1111

1212
function onTrade(player, npc, trade)
13+
local signed = trade:getItem():getSignature() == player:getName() and 1 or 0
1314
local newRank = tradeTestItem(player, npc, trade, tpz.skill.SMITHING)
1415

15-
if (newRank ~= 0) then
16+
if
17+
newRank > 9 and
18+
player:getCharVar("SmithingExpertQuest") == 1 and
19+
player:hasKeyItem(tpz.keyItem.WAY_OF_THE_BLACKSMITH)
20+
then
21+
if signed ~=0 then
22+
player:setSkillRank(tpz.skill.SMITHING, newRank)
23+
player:startEvent(102, 0, 0, 0, 0, newRank, 1)
24+
player:setCharVar("SmithingExpertQuest",0)
25+
player:setLocalVar("SmithingTraded",1)
26+
else
27+
player:startEvent(102, 0, 0, 0, 0, newRank, 0)
28+
end
29+
elseif newRank ~= 0 and newRank <=9 then
1630
player:setSkillRank(tpz.skill.SMITHING, newRank)
1731
player:startEvent(102, 0, 0, 0, 0, newRank)
32+
player:setLocalVar("SmithingTraded",1)
1833
end
1934
end
2035

2136
function onTrigger(player, npc)
22-
local getNewRank = 0
2337
local craftSkill = player:getSkillLevel(tpz.skill.SMITHING)
2438
local testItem = getTestItem(player, npc, tpz.skill.SMITHING)
2539
local guildMember = isGuildMember(player, 8)
40+
local rankCap = getCraftSkillCap(player, tpz.skill.SMITHING)
41+
local expertQuestStatus = 0
42+
local Rank = player:getSkillRank(tpz.skill.SMITHING)
43+
local realSkill = (craftSkill - Rank) / 32
2644
if (guildMember == 1) then guildMember = 150995375; end
27-
if (canGetNewRank(player, craftSkill, tpz.skill.SMITHING) == 1) then getNewRank = 100; end
2845

29-
player:startEvent(101, testItem, getNewRank, 30, guildMember, 44, 0, 0, 0)
46+
if player:getCharVar("SmithingExpertQuest") == 1 then
47+
if player:hasKeyItem(tpz.keyItem.WAY_OF_THE_BLACKSMITH) then
48+
expertQuestStatus = 550
49+
else
50+
expertQuestStatus = 600
51+
end
52+
end
53+
54+
if expertQuestStatus == 550 then
55+
--[[ Feeding the proper parameter currently hangs the client in cutscene. This may
56+
possibly be due to an unimplemented packet or function (display recipe?) Work
57+
around to present dialog to player to let them know the trade is ready to be
58+
received by triggering with lower rank up parameters. ]]--
59+
player:showText(npc, 6838)
60+
player:showText(npc, 6840)
61+
player:startEvent(101, testItem, realSkill, 44, guildMember, 0, 0, 0, 0)
62+
else
63+
player:startEvent(101, testItem, realSkill, rankCap, guildMember, expertQuestStatus, 0, 0, 0)
64+
end
3065
end
3166

3267
-- 908 909 910 920 927 101 102
3368
function onEventUpdate(player, csid, option)
3469
end
3570

3671
function onEventFinish(player, csid, option)
37-
if (csid == 101 and option == 1) then
72+
local guildMember = isGuildMember(player, 8)
73+
74+
if (csid == 101 and option == 2) then
75+
if guildMember == 1 then
76+
player:setCharVar("SmithingExpertQuest",1)
77+
end
78+
elseif (csid == 101 and option == 1) then
3879
if (player:getFreeSlotsCount() == 0) then
3980
player:messageSpecial(ID.text.ITEM_CANNOT_BE_OBTAINED, 4096)
4081
else
4182
player:addItem(4096)
4283
player:messageSpecial(ID.text.ITEM_OBTAINED, 4096) -- Fire Crystal
4384
signupGuild(player, guild.smithing)
4485
end
86+
else
87+
if player:getLocalVar("SmithingTraded") == 1 then
88+
player:tradeComplete()
89+
player:setLocalVar("SmithingTraded",0)
90+
end
4591
end
4692
end

0 commit comments

Comments
 (0)