mirror of
https://bitbucket.org/Ioncannon/project-meteor-server.git
synced 2025-04-02 19:42:05 -04:00
Fixed bug in equip script causing the classChange function to be called multiple times due to classId not being a local variable. Added some test scripts for Request Information/QuestJournal Command.
This commit is contained in:
parent
335ec414d6
commit
d9bccb5bff
@ -74,10 +74,9 @@ end
|
|||||||
|
|
||||||
function loadGearset(player, classId)
|
function loadGearset(player, classId)
|
||||||
player:getEquipment():ToggleDBWrite(false);
|
player:getEquipment():ToggleDBWrite(false);
|
||||||
gearset = player:getGearset(classId);
|
local gearset = player:getGearset(classId);
|
||||||
|
|
||||||
if gearset == nil then
|
if gearset == nil then
|
||||||
player:getEquipment():ToggleDBWrite(true);
|
|
||||||
return;
|
return;
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -103,19 +102,50 @@ function loadGearset(player, classId)
|
|||||||
|
|
||||||
player:getEquipment():ToggleDBWrite(true);
|
player:getEquipment():ToggleDBWrite(true);
|
||||||
|
|
||||||
player:doClassChange(classId);
|
|
||||||
end
|
end
|
||||||
|
|
||||||
function equipItem(player, equipSlot, item)
|
function equipItem(player, equipSlot, item)
|
||||||
if (item ~= nil) then
|
if (item ~= nil) then
|
||||||
worldMaster = getWorldMaster();
|
local classId = nil;
|
||||||
|
local worldMaster = getWorldMaster();
|
||||||
|
local gItem = getItemGamedata(item.itemId);
|
||||||
|
|
||||||
|
--If it's the mainhand, begin class change based on weapon
|
||||||
|
if (equipSlot == EQUIPSLOT_MAINHAND) then
|
||||||
|
if (gItem:IsNailWeapon()) then classId = 2;
|
||||||
|
elseif (gItem:IsSwordWeapon()) then classId = 3;
|
||||||
|
elseif (gItem:IsAxeWeapon()) then classId = 4;
|
||||||
|
elseif (gItem:IsBowWeapon()) then classId = 7;
|
||||||
|
elseif (gItem:IsLanceWeapon()) then classId = 8;
|
||||||
|
|
||||||
|
elseif (gItem:IsThaumaturgeWeapon()) then classId = 22;
|
||||||
|
elseif (gItem:IsConjurerWeapon()) then classId = 23;
|
||||||
|
|
||||||
|
elseif (gItem:IsCarpenterWeapon()) then classId = 29;
|
||||||
|
elseif (gItem:IsBlackSmithWeapon()) then classId = 30;
|
||||||
|
elseif (gItem:IsArmorerWeapon()) then classId = 31;
|
||||||
|
elseif (gItem:IsGoldSmithWeapon()) then classId = 32;
|
||||||
|
elseif (gItem:IsTannerWeapon()) then classId = 33;
|
||||||
|
elseif (gItem:IsWeaverWeapon()) then classId = 34;
|
||||||
|
elseif (gItem:IsAlchemistWeapon()) then classId = 35;
|
||||||
|
elseif (gItem:IsCulinarianWeapon()) then classId = 36;
|
||||||
|
|
||||||
|
elseif (gItem:IsMinerWeapon()) then classId = 39;
|
||||||
|
elseif (gItem:IsBotanistWeapon()) then classId = 40;
|
||||||
|
elseif (gItem:IsFishingWeapon()) then classId = 41;
|
||||||
|
end
|
||||||
|
|
||||||
|
if (classId ~= nil) then
|
||||||
|
player:sendGameMessage(player, worldMaster, 30103, 0x20, 0, 0, player, classId);
|
||||||
|
player:prepareClassChange(classId);
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
--Item Equipped message
|
--Item Equipped message
|
||||||
player:sendGameMessage(player, worldMaster, 30601, 0x20, equipSlot+1, item.itemId, item.quality, 0, 0, 1);
|
player:sendGameMessage(player, worldMaster, 30601, 0x20, equipSlot+1, item.itemId, item.quality, 0, 0, 1);
|
||||||
|
|
||||||
player:getEquipment():Equip(equipSlot, item);
|
player:getEquipment():Equip(equipSlot, item);
|
||||||
|
|
||||||
gItem = getItemGamedata(item.itemId);
|
|
||||||
|
|
||||||
if (equipSlot == EQUIPSLOT_MAINHAND and gItem:IsNailWeapon() == false and gItem:IsBowWeapon() == false) then graphicSlot = GRAPHICSLOT_MAINHAND;
|
if (equipSlot == EQUIPSLOT_MAINHAND and gItem:IsNailWeapon() == false and gItem:IsBowWeapon() == false) then graphicSlot = GRAPHICSLOT_MAINHAND;
|
||||||
elseif (equipSlot == EQUIPSLOT_OFFHAND) then graphicSlot = GRAPHICSLOT_OFFHAND;
|
elseif (equipSlot == EQUIPSLOT_OFFHAND) then graphicSlot = GRAPHICSLOT_OFFHAND;
|
||||||
@ -144,33 +174,12 @@ function equipItem(player, equipSlot, item)
|
|||||||
player:graphicChange(GRAPHICSLOT_L_EAR, item);
|
player:graphicChange(GRAPHICSLOT_L_EAR, item);
|
||||||
end
|
end
|
||||||
|
|
||||||
--If it's the mainhand, begin class change based on weapon
|
--Load gearset for new class and begin class change
|
||||||
if (equipSlot == EQUIPSLOT_MAINHAND) then
|
if (classId ~= nil) then
|
||||||
if (gItem:IsNailWeapon()) then classId = 2;
|
|
||||||
elseif (gItem:IsSwordWeapon()) then classId = 3;
|
|
||||||
elseif (gItem:IsAxeWeapon()) then classId = 4;
|
|
||||||
elseif (gItem:IsBowWeapon()) then classId = 7;
|
|
||||||
elseif (gItem:IsLanceWeapon()) then classId = 8;
|
|
||||||
|
|
||||||
elseif (gItem:IsThaumaturgeWeapon()) then classId = 22;
|
|
||||||
elseif (gItem:IsConjurerWeapon()) then classId = 23;
|
|
||||||
|
|
||||||
elseif (gItem:IsCarpenterWeapon()) then classId = 29;
|
|
||||||
elseif (gItem:IsBlackSmithWeapon()) then classId = 30;
|
|
||||||
elseif (gItem:IsArmorerWeapon()) then classId = 31;
|
|
||||||
elseif (gItem:IsGoldSmithWeapon()) then classId = 32;
|
|
||||||
elseif (gItem:IsTannerWeapon()) then classId = 33;
|
|
||||||
elseif (gItem:IsWeaverWeapon()) then classId = 34;
|
|
||||||
elseif (gItem:IsAlchemistWeapon()) then classId = 35;
|
|
||||||
elseif (gItem:IsCulinarianWeapon()) then classId = 36;
|
|
||||||
|
|
||||||
elseif (gItem:IsMinerWeapon()) then classId = 39;
|
|
||||||
elseif (gItem:IsBotanistWeapon()) then classId = 40;
|
|
||||||
elseif (gItem:IsFishingWeapon()) then classId = 41;
|
|
||||||
end
|
|
||||||
|
|
||||||
loadGearset(player, classId);
|
loadGearset(player, classId);
|
||||||
|
player:doClassChange(classId);
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
13
scripts/commands/RequestInformationCommand.lua
Normal file
13
scripts/commands/RequestInformationCommand.lua
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
--[[
|
||||||
|
|
||||||
|
|
||||||
|
--]]
|
||||||
|
|
||||||
|
function onEventStarted(player, actor, questId)
|
||||||
|
player:sendRequestedInfo("requestedData", "activegl", 7, nil, nil, nil, nil, nil, nil, nil);
|
||||||
|
-- player:sendRequestedInfo("requestedData", "glHist", 10, 0x1D4F2, 1009, 12464, 11727, 12485, 12526);
|
||||||
|
end
|
||||||
|
|
||||||
|
function onEventUpdate(player, actor, step, arg1)
|
||||||
|
|
||||||
|
end
|
12
scripts/commands/RequestQuestJournalCommand.lua
Normal file
12
scripts/commands/RequestQuestJournalCommand.lua
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
--[[
|
||||||
|
|
||||||
|
|
||||||
|
--]]
|
||||||
|
|
||||||
|
function onEventStarted(player, actor, questId)
|
||||||
|
player:sendRequestedInfo("requestedData", "qtdata", 0x1D4F2);
|
||||||
|
end
|
||||||
|
|
||||||
|
function onEventUpdate(player, actor, step, arg1)
|
||||||
|
|
||||||
|
end
|
Loading…
Reference in New Issue
Block a user