mirror of
https://bitbucket.org/Ioncannon/project-meteor-server.git
synced 2025-06-09 22:14:39 +02:00
Inventory.cs - GetItemQuantity() added
- AddItem functions to cast INV_ERROR to INT for LUA - Fixed unique item check. It was checking for Rare flag, not EX Scripts : Base - shop.lua : Functions for buying/selling from a variety of shop scripts Commands - EmoteStandardCommand.lua fixed not being able to use emotes when sitting - DiceCommand.lua fixed. No arguments sets default value of 100 as per the ingame description. Max value raised from 999 to 1000. GM Commands - speed.lua fixed when using single argument - nudge.lua fixed sanitizing. Made arguments reversible to allow !nudge up 10 & !nudge 10 up - giveitem.lua added inv_error handling. Need to do to rest of item commands at some point - givecurrency.lua changed to have you enter a regex'd name of item rather than item ID. Eg. "!givecurrency fire_crystal 10". Added inv_error handling to it. - warpplayer.lua added. Moves yourself to name of player, or moves first player to second player - warpid.lua added. For warping to the first instance of an actor's uniqueId the server comes across. - quest.lua added. For adding/adjusting quests for debugging them. Class Scripts - PopulaceBlackMarketeer.lua updated to utilize shop.lua - PopulaceShopSalesman.lua updated to utilize shop.lua - PopulaceCompanyShop.lua updated to utilize shop.lua - PopulaceCompanyBuffer.lua added and documented along with menu layout. Needs working status effect to finish. - PopulaceCompanyGLPublisher.lua added. Mostly documented, barely functional. - PopulaceCompanyGuide.lua added. Documented, fully functional. - PopulaceCompanyOfficer.lua added. Documented. Menus work. Needs GC rank table at some point for documenting GC ranks/seal caps. - PopulaceCompanySupply.lua added and mostly documented. Read-only basic menu flow, static LUA tables used to set it up, will need SQL tables at some point to replace them with. Some guesswork on what menus show since no video reference could be found. - PopulaceGuildShop.lua updated. Mostly documented. Read-only shop menus.
This commit is contained in:
parent
8ae4fbc045
commit
324ebab2d2
20 changed files with 1516 additions and 344 deletions
|
@ -25,6 +25,7 @@ Actorclass Id - 1500295 : Lalaroon, Ul'dah
|
|||
--]]
|
||||
|
||||
require ("global")
|
||||
require ("shop")
|
||||
|
||||
shopInfo = { -- [ index ] = { itemId, gilPrice, sealPrice, city, itemCategory }
|
||||
[1001] = {3020202, 100, 10000, 1, 1},
|
||||
|
@ -121,7 +122,7 @@ function processGilShop(player)
|
|||
location = INVENTORY_NORMAL;
|
||||
end
|
||||
|
||||
purchaseItem(player, shopInfo[buyResult][1], 1, 1, shopInfo[buyResult][3], gilCurrency, location);
|
||||
purchaseItem(player, location, shopInfo[buyResult][1], 1, 1, shopInfo[buyResult][3], gilCurrency);
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -150,44 +151,9 @@ function processSealShop(player)
|
|||
location = INVENTORY_NORMAL;
|
||||
end
|
||||
|
||||
purchaseItem(player, shopInfo[buyResult][1], 1, 1, shopInfo[buyResult][2], playerGCSeal, location);
|
||||
purchaseItem(player, location, shopInfo[buyResult][1], 1, 1, shopInfo[buyResult][2], playerGCSeal);
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function purchaseItem(player, itemId, quantity, quality, price, currency, location)
|
||||
|
||||
local worldMaster = GetWorldMaster();
|
||||
local cost = quantity * price;
|
||||
local gItemData = GetItemGamedata(itemId);
|
||||
local isUnique = gItemData.isRare;
|
||||
|
||||
if player:GetInventory(location):HasItem(itemId) and isUnique then
|
||||
-- You cannot have more than one <itemId> <quality> in your possession at any given time.
|
||||
player:SendGameMessage(player, worldMaster, 40279, MESSAGE_TYPE_SYSTEM, itemId, quality);
|
||||
return;
|
||||
end
|
||||
|
||||
if (not player:GetInventory(location):IsFull() or player:GetInventory(location):IsSpaceForAdd(itemId, quantity)) then
|
||||
if player:GetInventory(INVENTORY_CURRENCY):HasItem(currency, cost) then
|
||||
player:GetInventory(INVENTORY_CURRENCY):removeItem(currency, cost)
|
||||
player:GetInventory(location):AddItem(itemId, quantity, quality);
|
||||
if currency == 1000001 then
|
||||
-- You purchase <quantity> <itemId> <quality> for <cost> gil.
|
||||
player:SendGameMessage(player, worldMaster, 25061, MESSAGE_TYPE_SYSTEM, itemId, quality, quantity, cost);
|
||||
elseif currency == 1000201 or currency == 1000202 or currency == 1000203 then
|
||||
-- You exchange <quantity> <GC seals> for <quantity> <itemId> <quality>.
|
||||
player:SendGameMessage(player, GetWorldMaster(), 25275, MESSAGE_TYPE_SYSTEM, itemId, quality, quantity, price, player.gcCurrent);
|
||||
|
||||
end
|
||||
else
|
||||
-- You do not have enough gil. (Should never see this aside from packet injection, since client prevents buying if not enough currency)
|
||||
player:SendGameMessage(player, worldMaster, 25065, MESSAGE_TYPE_SYSTEM);
|
||||
end
|
||||
else
|
||||
-- Your inventory is full.
|
||||
player:SendGameMessage(player, worldMaster, 60022, MESSAGE_TYPE_SYSTEM);
|
||||
end
|
||||
return
|
||||
end
|
|
@ -0,0 +1,43 @@
|
|||
--[[
|
||||
|
||||
PopulaceCompanyBuffer Script
|
||||
|
||||
Functions:
|
||||
|
||||
eventTalkWelcome(player, boolean) - Welcome dialog. Boolean seems to be related to rank?
|
||||
eventTalkBufEffect() - Dialog for applying Sanction
|
||||
eventTalkBufEffectAfter(player) - Dialog after applying Sanction
|
||||
eventTalkStepBreak() - Returns to NPC's neutral state
|
||||
|
||||
--]]
|
||||
|
||||
require ("global")
|
||||
|
||||
function init(npc)
|
||||
return false, false, 0, 0;
|
||||
end
|
||||
|
||||
local gcRep = {
|
||||
[1500388] = 1, -- Maelstrom Representative
|
||||
[1500389] = 2, -- Adder Representative
|
||||
[1500390] = 3, -- Flame Representative
|
||||
}
|
||||
|
||||
function onEventStarted(player, npc, triggerName)
|
||||
local playerGC = player.gcCurrent;
|
||||
local playerGCRanks = {player.gcRankLimsa, player.gcRankGridania, player.gcRankUldah};
|
||||
|
||||
local choice = callClientFunction(player, "eventTalkWelcome", player, true);
|
||||
|
||||
if (choice == 1 and playerGCRanks[playerGC] > 10 and playerGCRanks[playerGC] < 112) then
|
||||
callClientFunction(player, "eventTalkBufEffect");
|
||||
callClientFunction(player, "eventTalkBufEffectAfter", player);
|
||||
-- TODO: Add Sanction buff
|
||||
else
|
||||
player:SendMessage(0x20, "", "Quit hex editing your memory.");
|
||||
end
|
||||
|
||||
callClientFunction(player, "eventTalkStepBreak");
|
||||
player:endEvent();
|
||||
end
|
||||
|
|
@ -0,0 +1,66 @@
|
|||
--[[
|
||||
|
||||
PopulaceCompanyGLPublisher Script
|
||||
|
||||
xtx_gcRank for GC Rank values
|
||||
|
||||
Functions:
|
||||
|
||||
talkOutsider() - Dialog for no affiliated with GC. Seems to always read Maelstrom?
|
||||
talkOfferWelcome(unk1) - Errors
|
||||
askCompanyLeve() - Errors
|
||||
askLeveDetail(unk1, unk2, unk3, unk4, unk5, unk6, unk7, unk8) - Errors
|
||||
|
||||
eventGLDifficulty() - Difficulty window, returns player choice
|
||||
eventGLStart(leveName, difficulty, unk1) - leveName from xtx_guildleve
|
||||
|
||||
talkAfterOffer()
|
||||
talkOfferLimit()
|
||||
|
||||
finishTalkTurn() - Resets NPC target/facing
|
||||
|
||||
eventGLPlay(leveName, guardianFavor, favorCost, difficulty) - Menu for active levequest
|
||||
eventGLShinpu(guardianFavor, favorCost) - Menu to accept favor buff. evenGLPlay() calls it
|
||||
eventGLThanks() - Errors
|
||||
|
||||
eventGLReward( -- Leve reward screen
|
||||
guildleveId,
|
||||
clearTime,
|
||||
missionBonus,
|
||||
difficultyBonus,
|
||||
factionNumber,
|
||||
factionBonus,
|
||||
factionCredit,
|
||||
glRewardItem,
|
||||
glRewardNumber,
|
||||
glRewardSubItem,
|
||||
glRewardSubNumber,
|
||||
difficulty
|
||||
)
|
||||
|
||||
|
||||
--]]
|
||||
|
||||
require ("global")
|
||||
|
||||
function init(npc)
|
||||
return false, false, 0, 0;
|
||||
end
|
||||
|
||||
gcOfficer = {
|
||||
[1500222] = 1, -- Storm Sergeant Hammil
|
||||
[1500223] = 1, -- Storm Sergeant Sternn
|
||||
[1500224] = 2, -- Serpent Sergeant Cordwyk
|
||||
[1500225] = 2, -- Serpent Sergeant Lodall
|
||||
[1500226] = 3, -- Flame Sergeant Byrne
|
||||
[1500227] = 3, -- Flame Sergeant Dalvag
|
||||
}
|
||||
|
||||
function onEventStarted(player, npc, triggerName)
|
||||
|
||||
callClientFunction(player, "talkOutsider");
|
||||
|
||||
callClientFunction(player, "finishTalkTurn");
|
||||
player:endEvent();
|
||||
end
|
||||
|
|
@ -0,0 +1,45 @@
|
|||
--[[
|
||||
|
||||
PopulaceCompanyGuide Script
|
||||
|
||||
Functions:
|
||||
|
||||
eventTalkWelcome() - Dialog for new recruits
|
||||
eventTalkProvisional() - Message for when rank isn't high enough?
|
||||
eventTalkExclusive() - Message for wrong GC.
|
||||
eventTalkComMember(nil, npc, isFoundationDay) - Information menus for various GC related activities
|
||||
eventTalkStepBreak() - Returns to NPC's neutral state
|
||||
|
||||
--]]
|
||||
|
||||
require ("global")
|
||||
|
||||
function init(npc)
|
||||
return false, false, 0, 0;
|
||||
end
|
||||
|
||||
local gcRep = {
|
||||
[1001737] = 1, -- Maelstrom Representative
|
||||
[1001738] = 2, -- Adder Representative
|
||||
[1001739] = 3, -- Flame Representative
|
||||
}
|
||||
|
||||
function onEventStarted(player, npc, triggerName)
|
||||
local playerGC = player.gcCurrent;
|
||||
local playerGCRanks = {player.gcRankLimsa, player.gcRankGridania, player.gcRankUldah};
|
||||
local npcGC = gcRep[npc:GetActorClassId()];
|
||||
|
||||
if (playerGC ~= npcGC and playerGCRanks[playerGC] == 127) then
|
||||
callClientFunction(player, "eventTalkWelcome");
|
||||
elseif (playerGC == npcGC and playerGCRanks[playerGC] == 127) then
|
||||
callClientFunction(player, "eventTalkProvisional");
|
||||
elseif (playerGC ~= npcGC and playerGCRanks[playerGC] ~= 127) then
|
||||
callClientFunction(player, "eventTalkExclusive");
|
||||
elseif (playerGC == npcGC and playerGCRanks[playerGC] > 10 and playerGCRanks[playerGC] < 112) then
|
||||
callClientFunction(player, "eventTalkComMember", nil, npc, true);
|
||||
end
|
||||
|
||||
callClientFunction(player, "eventTalkStepBreak");
|
||||
player:endEvent();
|
||||
end
|
||||
|
|
@ -33,6 +33,7 @@ eventTalkStepBreak() -- Returns NPC to their starting direction
|
|||
--]]
|
||||
|
||||
require ("global")
|
||||
require ("shop")
|
||||
|
||||
function init(npc)
|
||||
return false, false, 0, 0;
|
||||
|
@ -44,7 +45,7 @@ gcOfficer = {
|
|||
[1500201] = 3, -- Flame Shop
|
||||
}
|
||||
|
||||
shopInfo = { -- [index] = { itemID, itemQuality, itemQuantity, itemCost gcRank, city, special, itemCategory }
|
||||
shopInfo = { -- [index] = { itemID, itemQuality, itemQuantity, itemCost, gcRank, city, special, itemCategory }
|
||||
[100001] = {3010403, 1, 10, 20, 0, 1, 0, 1},
|
||||
[100002] = {3010402, 1, 10, 30, 0, 1, 0, 1},
|
||||
[100003] = {3020202, 1, 1, 50, 0, 1, 0, 1},
|
||||
|
@ -450,7 +451,7 @@ shopInfo = { -- [index] = { itemID, itemQuality, itemQuantity, itemCost gcRank,
|
|||
}
|
||||
|
||||
function onEventStarted(player, npc, triggerName)
|
||||
skipGCcheck = 1; -- 0 No, 1 Yes
|
||||
skipGCcheck = 0; -- 0 No, 1 Yes
|
||||
playerGC = player.gcCurrent;
|
||||
playerGCSeal = 1000200 + playerGC;
|
||||
playerCurrentRank = 13;
|
||||
|
@ -470,7 +471,7 @@ function onEventStarted(player, npc, triggerName)
|
|||
--player:SendMessage(0x20, "", "eventShopMenuOpen: " .. tostring(t1) .. ", ".. tostring(t2) .. ", ".. tostring(t3));
|
||||
|
||||
while (true) do
|
||||
-- TODO: ADD RANK CHECK, CITY CHECK, AND RANGE CHECK
|
||||
-- TODO: ADD RANK CHECK, CITY CHECK, AND ITEM-RANGE CHECK
|
||||
|
||||
buyResult, buyIndex = callClientFunction(player, "eventShopMenuAsk");
|
||||
|
||||
|
@ -486,7 +487,7 @@ function onEventStarted(player, npc, triggerName)
|
|||
end
|
||||
end
|
||||
|
||||
purchaseItem(player, shopInfo[buyIndex][1], shopInfo[buyIndex][3], shopInfo[buyIndex][2], shopInfo[buyIndex][4], playerGCSeal, location);
|
||||
purchaseItem(player, location, shopInfo[buyIndex][1], shopInfo[buyIndex][3], shopInfo[buyIndex][2], shopInfo[buyIndex][4], playerGCSeal);
|
||||
end
|
||||
|
||||
--player:SendMessage(0x20, "", "Player picked an item at gcSealShopIndex " .. tostring(buyResult) .. ", ".. tostring(buyIndex));
|
||||
|
@ -503,43 +504,6 @@ function onEventStarted(player, npc, triggerName)
|
|||
end
|
||||
|
||||
|
||||
function purchaseItem(player, itemId, quantity, quality, price, currency, location)
|
||||
|
||||
local worldMaster = GetWorldMaster();
|
||||
local cost = quantity * price;
|
||||
local gItemData = GetItemGamedata(itemId);
|
||||
local isUnique = gItemData.isRare;
|
||||
|
||||
if player:GetInventory(location):HasItem(itemId) and isUnique then
|
||||
-- You cannot have more than one <itemId> <quality> in your possession at any given time.
|
||||
player:SendGameMessage(player, worldMaster, 40279, MESSAGE_TYPE_SYSTEM, itemId, quality);
|
||||
return;
|
||||
end
|
||||
|
||||
if (not player:GetInventory(location):IsFull() or player:GetInventory(location):IsSpaceForAdd(itemId, quantity)) then
|
||||
if player:GetInventory(INVENTORY_CURRENCY):HasItem(currency, cost) then
|
||||
player:GetInventory(INVENTORY_CURRENCY):removeItem(currency, cost)
|
||||
player:GetInventory(location):AddItem(itemId, quantity, quality);
|
||||
if currency == 1000001 then
|
||||
-- You purchase <quantity> <itemId> <quality> for <cost> gil.
|
||||
player:SendGameMessage(player, worldMaster, 25061, MESSAGE_TYPE_SYSTEM, itemId, quality, quantity, cost);
|
||||
elseif currency == 1000201 or currency == 1000202 or currency == 1000203 then
|
||||
-- You exchange <quantity> <GC seals> for <quantity> <itemId> <quality>.
|
||||
player:SendGameMessage(player, GetWorldMaster(), 25275, MESSAGE_TYPE_SYSTEM, itemId, quality, quantity, price, player.gcCurrent);
|
||||
|
||||
end
|
||||
else
|
||||
-- You do not have enough gil. (Should never see this aside from packet injection, since client prevents buying if not enough currency)
|
||||
player:SendGameMessage(player, worldMaster, 25065, MESSAGE_TYPE_SYSTEM);
|
||||
end
|
||||
else
|
||||
-- Your inventory is full.
|
||||
player:SendGameMessage(player, worldMaster, 60022, MESSAGE_TYPE_SYSTEM);
|
||||
end
|
||||
return
|
||||
end
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
464
data/scripts/base/chara/npc/populace/PopulaceCompanySupply.lua
Normal file
464
data/scripts/base/chara/npc/populace/PopulaceCompanySupply.lua
Normal file
|
@ -0,0 +1,464 @@
|
|||
--[[
|
||||
|
||||
PopulaceCompanySupply Script
|
||||
|
||||
This class handles the menus for player's delivering specific items in exchange for grand company seals.
|
||||
The supply/provision schedule runs on a weekly rotation, which resets Monday at 12AM JST, with eight rotations total to cycle through.
|
||||
Each desired item has a server-wide max that it can be turned in, and when that is fulfilled, it moves to the next item in that week's list to work on.
|
||||
|
||||
NPCs involved in the script use the Noc001 script for dialog and menu interactions.
|
||||
|
||||
|
||||
Functions:
|
||||
|
||||
eventTalkPreJoin() - Dialog when you're not affiliated
|
||||
eventTalkExclusive() - Dialog when you're part of a GC but not the one of the actor?
|
||||
eventTalkJoined() - Salutes then softlocks the client due to removed dialog strings. Obsolete function.
|
||||
|
||||
eventQuestItemMenuOpen(itemId, itemPrice, itemPriceHq, supplyType) - supplyType: 1 = Supply, 2 = Provisioning, 3 = Totorak, 4 = Dzmael, 5 = Primal, 6 = NM drops
|
||||
eventQuestItemMenuSelect(quantity, quality, unk) - Brings up the shop-style menu for viewing item detail and confirming item delivery. Args appear to do nothing on client?
|
||||
eventQuestItemMenuClose() - Closes menu
|
||||
|
||||
eventQuestSupplyItemActor(unk1) -- Client calls this automatically for setting up Expeditionary window in some manner
|
||||
eventQuestSupplyItemID(unk1, unk2) -- eventQuestSupplyItemActor() calls this to sets item ranges based on category
|
||||
|
||||
getEventQuestSupplyMode() - Returns current supply mode set by eventQuestItemMenuOpen()
|
||||
eventTalkStepBreak() - Resets actor engage state
|
||||
|
||||
|
||||
Noc001 Functions:
|
||||
|
||||
pENPCAskSupplyWelcome(npcGC) -- Welcome dialog
|
||||
pENPCAskSupply(npcGC) -- Brings up the delivery selection menu
|
||||
eventQuestAskExWelcome(npcGC) -- Dialog when you pick Expeditionary
|
||||
eventQuestAskExArea(npcGC) -- Brings up the Expeditionary selection menu
|
||||
pENPCAskNowTalk(npcGC) -- Dialog for picking Delivery Status from pENPCAskSupply()
|
||||
|
||||
nowSup(itemId1, current1, max1, itemId2, current2, max2, itemId3, current3, max3) -- Says current 3 items and current amount delivered vs. max it'll take
|
||||
nowSupAddItem(itemId, current, max) -- Lists bonus item
|
||||
pItem(itemId1, unk1, itemId2, unk2, itemId3, unk3, itemId4, unk4) -- Lists which item(s) you want to delivery. Fourth item is the bonus, set 0 for hidden.
|
||||
|
||||
showSupplyLimit(minutes, seconds, current, required) -- Shows time remaining to finish delivery, shows current/required amount
|
||||
eventShowPrizeMessage(npcGC) -- Reward dialog for handing something in?
|
||||
|
||||
pELimitErr() -- Error msg for GC no longer accepting items.
|
||||
pETradeErr() -- Transaction error. Inventory error?
|
||||
pETradeErrLimit(minutes, seconds, current, required) -- Transaction error. Shows time remaining and current/required amount
|
||||
pESuppylMaxErrKeyWait(isShowLimit, minutes, seconds, current, required) -- Error msg for delivery quota already filled. Optional timer/amount display
|
||||
pESuppylSealMaxErr() -- Error msg for capped on GC seals, transaction incomplete
|
||||
|
||||
eventQuestCantEx(npcGC) -- Dialog explaining you need to be Private Second Class to do Expeditionary missions
|
||||
--]]
|
||||
|
||||
require ("global")
|
||||
require ("shop")
|
||||
|
||||
function init(npc)
|
||||
return false, false, 0, 0;
|
||||
end
|
||||
|
||||
local gcRep = {
|
||||
[1500210] = 1, -- Maelstrom Representative
|
||||
[1500211] = 2, -- Adder Representative
|
||||
[1500212] = 3, -- Flame Representative
|
||||
}
|
||||
|
||||
local gcItems = { -- Debug purposes. Static item list with seal value and max turn-in.
|
||||
[111] = {id = 10002015, seals = 8, cap = 1900},
|
||||
[112] = {id = 8031419, seals = 68, cap = 300},
|
||||
[113] = {id = 3010011, seals = 3, cap = 5000},
|
||||
[114] = {id = 8011108, seals = 89, cap = 400},
|
||||
|
||||
[115] = {id = 10004001, seals = 5, cap = 3000},
|
||||
[116] = {id = 10008109, seals = 3, cap = 5000},
|
||||
[117] = {id = 12000180, seals = 5, cap = 3000},
|
||||
[118] = {id = 10004026, seals = 9, cap = 3400},
|
||||
|
||||
[121] = {id = 10008211, seals = 5, cap = 3000},
|
||||
[122] = {id = 3020407, seals = 5, cap = 2500},
|
||||
[123] = {id = 8030220, seals = 92, cap = 200},
|
||||
[124] = {id = 8030922, seals = 99, cap = 400},
|
||||
|
||||
[125] = {id = 10001014, seals = 3, cap = 5000},
|
||||
[126] = {id = 10008007, seals = 5, cap = 3000},
|
||||
[127] = {id = 3011217, seals = 3, cap = 5000},
|
||||
[128] = {id = 3011207, seals = 3, cap = 6000},
|
||||
|
||||
[131] = {id = 4030204, seals = 69, cap = 300},
|
||||
[132] = {id = 10004103, seals = 9, cap = 1700},
|
||||
[133] = {id = 10009208, seals = 6, cap = 3000},
|
||||
[134] = {id = 1, seals = 1, cap = 1}, -- Unknown
|
||||
|
||||
[135] = {id = 10004008, seals = 9, cap = 1700},
|
||||
[136] = {id = 10008007, seals = 5, cap = 3000},
|
||||
[137] = {id = 3011201, seals = 5, cap = 3000},
|
||||
[138] = {id = 10009401, seals = 6, cap = 6000},
|
||||
|
||||
[211] = {id = 10002012, seals = 5, cap = 3000},
|
||||
[212] = {id = 4100007, seals = 51, cap = 300},
|
||||
[213] = {id = 3010108, seals = 2, cap = 3000},
|
||||
[214] = {id = 8080825, seals = 42, cap = 800},
|
||||
|
||||
[215] = {id = 10004003, seals = 5, cap = 3000},
|
||||
[216] = {id = 10002012, seals = 3, cap = 5000},
|
||||
[217] = {id = 3011104, seals = 2, cap = 3000},
|
||||
[218] = {id = 3011107, seals = 3, cap = 6000},
|
||||
|
||||
}
|
||||
|
||||
|
||||
local gcWeek = { -- Debug purposes. Static weekly item lists. [week] = { [city] = {[category] = { info } } }
|
||||
[1] = {
|
||||
[1] = { -- Limsa
|
||||
[1] = { -- Supply
|
||||
gcItems[111],
|
||||
gcItems[112],
|
||||
gcItems[113],
|
||||
gcItems[114],
|
||||
},
|
||||
[2] = { -- Provision
|
||||
gcItems[115],
|
||||
gcItems[116],
|
||||
gcItems[117],
|
||||
gcItems[118],
|
||||
}
|
||||
},
|
||||
[2] = { -- Gridania
|
||||
[1] = { -- Supply
|
||||
gcItems[121],
|
||||
gcItems[122],
|
||||
gcItems[123],
|
||||
gcItems[124],
|
||||
},
|
||||
[2] = { -- Provision
|
||||
gcItems[125],
|
||||
gcItems[126],
|
||||
gcItems[127],
|
||||
gcItems[128],
|
||||
}
|
||||
},
|
||||
[3] = { -- Ul'dah
|
||||
[1] = { -- Supply
|
||||
gcItems[131],
|
||||
gcItems[132],
|
||||
gcItems[133],
|
||||
gcItems[134],
|
||||
},
|
||||
[2] = { -- Provision
|
||||
gcItems[135],
|
||||
gcItems[136],
|
||||
gcItems[137],
|
||||
gcItems[138],
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
[2] = {
|
||||
[1] = { -- Limsa
|
||||
[1] = { -- Supply
|
||||
gcItems[211],
|
||||
gcItems[212],
|
||||
gcItems[213],
|
||||
gcItems[214],
|
||||
},
|
||||
[2] = { -- Provision
|
||||
gcItems[215],
|
||||
gcItems[216],
|
||||
gcItems[217],
|
||||
gcItems[218],
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
local gcDelivery = { -- Debug purposes. Holds values for current turned in amount and 4th item bonus status.
|
||||
week = 1,
|
||||
currentCount = {
|
||||
{
|
||||
{49, 81, 5000, 5}, {2402, 4779, 589, 2} -- Limsa Supply/Provision
|
||||
},
|
||||
{
|
||||
{1, 2, 3, 4}, {5, 6, 7, 8} -- Gridania Supply/Provision
|
||||
},
|
||||
{
|
||||
{10, 32, 9, 18}, {23, 49, 9, 300} -- Ul'dah Supply/Provision
|
||||
}
|
||||
},
|
||||
bonus = { {1, 1}, {0,1}, {0,1} }; -- City -> {Supply, Provision}
|
||||
timeRemainingMinutes = 99,
|
||||
timeRemainingSeconds = 59,
|
||||
}
|
||||
|
||||
local supplyQuest = GetStaticActor("Noc001");
|
||||
local skipGCcheck = false; -- Debug
|
||||
local skipRankCheck = false; -- Debug
|
||||
local gcCheckProceed = false; -- Debug
|
||||
|
||||
|
||||
|
||||
|
||||
function onEventStarted(player, npc, triggerName)
|
||||
local playerGC = player.gcCurrent;
|
||||
local limsaRank = player.gcRankLimsa;
|
||||
local gridaniaRank = player.gcRankGridania;
|
||||
local uldahRank = player.gcRankUldah;
|
||||
local playerGCSeal = 1000200 + playerGC;
|
||||
|
||||
local npcId = npc:GetActorClassId();
|
||||
local npcGC = gcRep[npcId];
|
||||
|
||||
if (skipGCcheck == true) then
|
||||
gcCheckProceed = true;
|
||||
end
|
||||
|
||||
if ((playerGC ~= npcGC) and skipGCcheck == false) then
|
||||
if (playerGC == 0) then
|
||||
callClientFunction(player, "eventTalkPreJoin");
|
||||
else
|
||||
callClientFunction(player, "eventTalkExclusive");
|
||||
end
|
||||
else
|
||||
gcCheckProceed = true;
|
||||
end
|
||||
|
||||
if gcCheckProceed then
|
||||
callClientFunction(player, "delegateEvent", player, supplyQuest, "pENPCAskSupplyWelcome", gcRep[npcId]);
|
||||
while (true) do
|
||||
|
||||
local choice = callClientFunction(player, "delegateEvent", player, supplyQuest, "pENPCAskSupply", gcRep[npcId]);
|
||||
|
||||
if (choice == 2) then -- Supply
|
||||
deliveryMenuInfo(player, npcGC, 1);
|
||||
|
||||
elseif (choice == 3) then -- Provision
|
||||
deliveryMenuInfo(player, npcGC, 2);
|
||||
|
||||
elseif (choice == 4) then -- Expeditionary
|
||||
local proceed = false;
|
||||
|
||||
if (skipRankCheck == true) then
|
||||
proceed = true;
|
||||
else
|
||||
if (playerGC == 1 and limsaRank >= 13 and limsaRank <= 111)
|
||||
or (playerGC == 2 and gridaniaRank >= 13 and gridaniaRank <= 111)
|
||||
or (playerGC == 3 and uldahRank >= 13 and uldahRank <= 111) then
|
||||
proceed = true
|
||||
end
|
||||
end
|
||||
|
||||
if proceed == true then
|
||||
callClientFunction(player, "delegateEvent", player, supplyQuest, "eventQuestAskExWelcome", gcRep[npcId]);
|
||||
while (true) do
|
||||
local exChoice = callClientFunction(player, "delegateEvent", player, supplyQuest, "eventQuestAskExArea", gcRep[npcId]);
|
||||
|
||||
if (exChoice >= 3) then
|
||||
deliveryMenuOpen(player, npc, 0,0,0, exChoice);
|
||||
else
|
||||
break;
|
||||
end
|
||||
end
|
||||
else
|
||||
callClientFunction(player, "delegateEvent", player, supplyQuest, "eventQuestCantEx",gcRep[npcId]);
|
||||
end
|
||||
|
||||
elseif (choice == 5) then -- Requested item
|
||||
deliveryStatus(player, npcGC);
|
||||
else
|
||||
break;
|
||||
end
|
||||
|
||||
wait(1);
|
||||
end
|
||||
end
|
||||
|
||||
callClientFunction(player, "eventTalkStepBreak");
|
||||
player:endEvent()
|
||||
|
||||
end
|
||||
|
||||
|
||||
function deliveryMenuInfo(player, city, category)
|
||||
|
||||
local gcContents = getWeeklyItems(city, category);
|
||||
local gcCurrent = getCurrentCount(city, category);
|
||||
local supplyChoice = 0;
|
||||
|
||||
while (true) do
|
||||
|
||||
if gcDelivery.bonus[city][category] == 1 then -- Show fourth item if condition is met, otherwise show three.
|
||||
|
||||
supplyChoice = callClientFunction
|
||||
(
|
||||
player,
|
||||
"delegateEvent",
|
||||
player,
|
||||
supplyQuest,
|
||||
"pItem",
|
||||
gcContents[1].id,
|
||||
1,
|
||||
gcContents[2].id,
|
||||
1,
|
||||
gcContents[3].id,
|
||||
1,
|
||||
gcContents[4].id,
|
||||
1
|
||||
);
|
||||
else
|
||||
supplyChoice = callClientFunction
|
||||
(
|
||||
player,
|
||||
"delegateEvent",
|
||||
player,
|
||||
supplyQuest,
|
||||
"pItem",
|
||||
gcContents[1].id,
|
||||
1,
|
||||
gcContents[2].id,
|
||||
1,
|
||||
gcContents[3].id,
|
||||
1,
|
||||
0,
|
||||
0
|
||||
);
|
||||
end
|
||||
|
||||
if supplyChoice >= 2 then
|
||||
|
||||
if gcCurrent[supplyChoice-1] < gcContents[supplyChoice-1].cap then
|
||||
local hqPrice = math.ceil(gcContents[supplyChoice-1].seals * 1.5);
|
||||
|
||||
deliveryMenuOpen
|
||||
(
|
||||
player,
|
||||
npc,
|
||||
gcContents[supplyChoice-1].id,
|
||||
gcContents[supplyChoice-1].seals,
|
||||
hqPrice,
|
||||
category
|
||||
);
|
||||
|
||||
else
|
||||
callClientFunction(player, "delegateEvent", player, supplyQuest, "pESuppylMaxErrKeyWait");
|
||||
end
|
||||
elseif supplyChoice == 1 then
|
||||
break;
|
||||
end
|
||||
wait(1);
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
function deliveryMenuOpen(player, npc, itemId, price, hqPrice, supplyType)
|
||||
|
||||
callClientFunction(player, "eventQuestItemMenuOpen", itemId, price, hqPrice, supplyType);
|
||||
|
||||
while (true) do
|
||||
|
||||
local choice, quantity, quality, itemSlot, Type7Param = callClientFunction(player, "eventQuestItemMenuSelect");
|
||||
|
||||
if choice == false then
|
||||
callClientFunction(player, "eventQuestItemMenuClose");
|
||||
break;
|
||||
end
|
||||
|
||||
--[[
|
||||
player:SendMessage(0x20, "", "Choice: " .. tostring(choice));
|
||||
player:SendMessage(0x20, "", "Quantity: " .. tostring(quantity));
|
||||
player:SendMessage(0x20, "", "Quality: " .. tostring(quality));
|
||||
player:SendMessage(0x20, "", "Slot: " .. tostring(itemSlot)); -- Broke at some point, always return 0, investigate sometime
|
||||
player:SendMessage(0x20, "", "Type7Param: " .. tostring(Type7Param.slot));
|
||||
--]]
|
||||
|
||||
pickedItem = GetItemGamedata(player:GetInventory(INVENTORY_NORMAL):GetItemAtSlot(Type7Param.slot).itemId).name;
|
||||
player:SendMessage(0x20, "", "Player tried to deliver " .. quantity .. " " .. pickedItem);
|
||||
|
||||
-- TODO: Add error handling for capped seals, no-long-available-to-deliver, etc
|
||||
wait(1);
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
|
||||
function deliveryStatus(player, city)
|
||||
local gcContents = getWeeklyItems(city, 1);
|
||||
local gcCurrent = getCurrentCount(city, 1);
|
||||
|
||||
callClientFunction(player, "delegateEvent", player, supplyQuest, "pENPCAskNowTalk", gcRep[npcId]);
|
||||
callClientFunction
|
||||
(
|
||||
player,
|
||||
"delegateEvent",
|
||||
player,
|
||||
supplyQuest,
|
||||
"nowSup",
|
||||
gcContents[1].id,
|
||||
gcCurrent[1],
|
||||
gcContents[1].cap,
|
||||
gcContents[2].id,
|
||||
gcCurrent[2],
|
||||
gcContents[2].cap,
|
||||
gcContents[3].id,
|
||||
gcCurrent[3],
|
||||
gcContents[3].cap
|
||||
);
|
||||
if gcDelivery.bonus[city][1] == 1 then
|
||||
callClientFunction
|
||||
(
|
||||
player,
|
||||
"delegateEvent",
|
||||
player,
|
||||
supplyQuest,
|
||||
"nowSupAddItem",
|
||||
gcContents[4].id,
|
||||
gcCurrent[4],
|
||||
gcContents[4].cap
|
||||
);
|
||||
end;
|
||||
|
||||
gcContents = getWeeklyItems(city, 2);
|
||||
gcCurrent = getCurrentCount(city, 2);
|
||||
|
||||
callClientFunction
|
||||
(
|
||||
player,
|
||||
"delegateEvent",
|
||||
player,
|
||||
supplyQuest,
|
||||
"nowSup",
|
||||
gcContents[1].id,
|
||||
gcCurrent[1],
|
||||
gcContents[1].cap,
|
||||
gcContents[2].id,
|
||||
gcCurrent[2],
|
||||
gcContents[2].cap,
|
||||
gcContents[3].id,
|
||||
gcCurrent[3],
|
||||
gcContents[3].cap
|
||||
);
|
||||
if gcDelivery.bonus[city][2] == 1 then
|
||||
callClientFunction
|
||||
(
|
||||
player,
|
||||
"delegateEvent",
|
||||
player,
|
||||
supplyQuest,
|
||||
"nowSupAddItem",
|
||||
gcContents[4].id,
|
||||
gcCurrent[4],
|
||||
gcContents[4].cap
|
||||
);
|
||||
end;
|
||||
|
||||
callClientFunction(player, "delegateEvent", player, supplyQuest, "showSupplyLimit", gcDelivery.timeRemainingMinutes, gcDelivery.timeRemainingSeconds, 2, 8);
|
||||
end
|
||||
|
||||
|
||||
function getWeeklyItems(city, category)
|
||||
return gcWeek[gcDelivery.week][city][category]
|
||||
end
|
||||
|
||||
function getCurrentCount(city, category)
|
||||
return gcDelivery.currentCount[city][category];
|
||||
end
|
||||
|
|
@ -1,63 +1,108 @@
|
|||
--[[
|
||||
|
||||
PopulaceGuildShop Script
|
||||
|
||||
In 1.20, the devs removed Guild Marks as acquirable. In 1.21, this class was set up to allow exchanging them for
|
||||
a variety of materia/crystals/gil, as well as refunding traits purchased with marks. Traits used to be purchased
|
||||
to slot in, where-as with late-XIV they are just automatically unlocked once the appropriate level is met.
|
||||
|
||||
Functions:
|
||||
|
||||
cashbackTalkCommand(arg1 through arg10) -- Dialog for refunding purchased skills prior to Job update. Args are xtx_command values for command names.
|
||||
cashbackTalk(nil, refundAmount, arg3 through arg10) -- Dialog for refunding treaties to guild marks. Arg3 through 10 use xtx_itemName values.
|
||||
selectMode(nil, npcId, isShowExchange, guildCurrency, unk) -- Menus for exchanging leftover marks, undoing class points, and learning about guild. Unk seems related to point resetting
|
||||
|
||||
maskShopListIndex(shopPack?, isSomething) -- Presumably hides an item in the shop list. Needs to be called after openShopBuy or errors client.
|
||||
guildExplain(npcId, player) -- Guild Mark tutorial dialog. selectMode calls this on its own
|
||||
|
||||
--]]
|
||||
|
||||
|
||||
require ("global")
|
||||
require ("shop")
|
||||
|
||||
function init(npc)
|
||||
return false, false, 0, 0;
|
||||
return false, false, 0, 0;
|
||||
end
|
||||
|
||||
guildShopInfo = { -- [actor id] = { saySheetId, guildmarkCurrency }
|
||||
[1000157] = {9, 1000103}, -- Marauder, S'raemha
|
||||
[1000158] = {24, 1000120}, -- Culinarian, Noline
|
||||
[1000162] = {18, 1000114}, -- Blacksmith, Qhas Chalahko
|
||||
[1000164] = {16, 1000123}, -- Fishermen, Faucillien
|
||||
[1000459] = {21, 1000117}, -- Leatherworker, Gallia
|
||||
[1000460] = {13, 1000111}, -- Conjurer, Hetzkin
|
||||
[1000461] = {15, 1000122}, -- Botanist, Kipopo
|
||||
[1000462] = {11, 1000107}, -- Lancer, Clarembald
|
||||
[1000464] = {10, 1000106}, -- Archer, Cassandra
|
||||
[1000466] = {17, 1000113}, -- Carpenter, Frances
|
||||
[1000631] = {8, 1000102}, -- Gladiator, Coynach
|
||||
[1000632] = {7, 1000101}, -- Pugilist, Moruith
|
||||
[1000633] = {12, 1000110}, -- Thaumaturge, Nyunoeya
|
||||
[1000634] = {23, 1000119}, -- Alchemist, Kylene
|
||||
[1000635] = {20, 1000116}, -- Goldsmith, Hnaufrid
|
||||
[1000636] = {22, 1000118}, -- Weaver, Lafla Morfla
|
||||
[1000637] = {14, 1000121}, -- Miner, Shilgen
|
||||
[1001461] = {19, 1000115}, -- Armorer, Notrelchamps
|
||||
}
|
||||
|
||||
|
||||
|
||||
function onEventStarted(player, npc)
|
||||
|
||||
saySheetId = 1;
|
||||
local npcId = npc:GetActorClassId();
|
||||
local saySheetId = guildShopInfo[npcId][1];
|
||||
local shopCurrency = guildShopInfo[npcId][2];
|
||||
local gilCurrency = 1000001;
|
||||
local keepersHymn = 3020410;
|
||||
local shopPack = 0;
|
||||
|
||||
callClientFunction(player, "welcomeTalk", nil, saySheetId, player);
|
||||
|
||||
if (npc:GetActorClassId() == 1000157) then
|
||||
saySheetId = 9;
|
||||
elseif (npc:GetActorClassId() == 1000158) then
|
||||
saySheetId = 24;
|
||||
elseif (npc:GetActorClassId() == 1000162) then
|
||||
saySheetId = 18;
|
||||
elseif (npc:GetActorClassId() == 1000164) then
|
||||
saySheetId = 16;
|
||||
elseif (npc:GetActorClassId() == 1000459) then
|
||||
saySheetId = 21;
|
||||
elseif (npc:GetActorClassId() == 1000460) then
|
||||
saySheetId = 13;
|
||||
elseif (npc:GetActorClassId() == 1000461) then
|
||||
saySheetId = 15;
|
||||
elseif (npc:GetActorClassId() == 1000462) then
|
||||
saySheetId = 11;
|
||||
elseif (npc:GetActorClassId() == 1000464) then
|
||||
saySheetId = 10;
|
||||
elseif (npc:GetActorClassId() == 1000466) then
|
||||
saySheetId = 17;
|
||||
elseif (npc:GetActorClassId() == 1000631) then
|
||||
saySheetId = 8;
|
||||
elseif (npc:GetActorClassId() == 1000632) then
|
||||
saySheetId = 7;
|
||||
elseif (npc:GetActorClassId() == 1000633) then
|
||||
saySheetId = 12;
|
||||
elseif (npc:GetActorClassId() == 1000634) then
|
||||
saySheetId = 23;
|
||||
elseif (npc:GetActorClassId() == 1000635) then
|
||||
saySheetId = 20;
|
||||
elseif (npc:GetActorClassId() == 1000636) then
|
||||
saySheetId = 22;
|
||||
elseif (npc:GetActorClassId() == 1000637) then
|
||||
saySheetId = 14;
|
||||
elseif (npc:GetActorClassId() == 1001461) then
|
||||
saySheetId = 19;
|
||||
end
|
||||
while (true) do
|
||||
local choice = callClientFunction(player, "selectMode", nil, npcId, true, shopCurrency, 100);
|
||||
|
||||
callClientFunction(player, "welcomeTalk", nil, saySheetId, player);
|
||||
|
||||
while (true) do
|
||||
choice = callClientFunction(player, "selectMode", nil, npc:GetActorClassId(), false, 1000001); --Step 2, state your business
|
||||
|
||||
if (choice == 3) then
|
||||
|
||||
elseif (choice == 4) then
|
||||
player:EndEvent();
|
||||
break;
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
end
|
||||
if (choice == 3) then -- Undo Point Allotment
|
||||
-- TODO: Add point reset handling
|
||||
elseif (choice == 4) then -- Leave menu selected
|
||||
player:EndEvent();
|
||||
break;
|
||||
elseif (choice == nil) then -- Escape key hit to leave menu
|
||||
player:EndEvent();
|
||||
break
|
||||
elseif (choice >= 102 and choice <= 120) then -- Exchange marks for Materia
|
||||
shopPack = choice + 18; -- Index offset
|
||||
if (choice == 119) then
|
||||
shopPack = shopPack + 1;
|
||||
elseif (choice == 120) then -- Exchange marks for Crystals
|
||||
shopPack = 144;
|
||||
end;
|
||||
processGuildShop(player, shopPack, shopCurrency);
|
||||
elseif (choice == 121) then -- Exchange marks for Gil. 1 mark = 4 gil
|
||||
local markAmount = player:GetInventory(INVENTORY_CURRENCY):GetItemQuantity(shopCurrency);
|
||||
purchaseItem(player, INVENTORY_CURRENCY, gilCurrency, markAmount*4, 1, markAmount, shopCurrency);
|
||||
|
||||
end
|
||||
end
|
||||
|
||||
player:EndEvent()
|
||||
end
|
||||
|
||||
|
||||
|
||||
function processGuildShop(player, choice, currency)
|
||||
|
||||
callClientFunction(player, "openShopBuy", player, choice, currency);
|
||||
--callClientFunction(player, "maskShopListIndex", 137, true);
|
||||
|
||||
while (true) do
|
||||
buyResult, quantity = callClientFunction(player, "selectShopBuy", player);
|
||||
|
||||
if (buyResult == 0) then
|
||||
callClientFunction(player, "closeShopBuy", player);
|
||||
break;
|
||||
else
|
||||
player:SendMessage(0x20, "", string.format("Player purchased %s item(s) at index %s in shopPack %s.", quantity, buyResult, choice));
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -18,6 +18,8 @@ openShopSell(player) - Call this to open sell window
|
|||
selectShopSell(player) - Call after openShopSell()
|
||||
closeShopSell(player) - Closes the sell window
|
||||
|
||||
confirmSellingItem(itemId, quality, quantity, gil) - Simple Sell confirmation window
|
||||
|
||||
selectFacility(?, sheetId, 3) - Opens the facility chooser.
|
||||
confirmUseFacility(player, cost) - Facility cost confirm
|
||||
|
||||
|
@ -30,139 +32,259 @@ finishTalkTurn() - Done at the end.
|
|||
--]]
|
||||
|
||||
require ("global")
|
||||
require ("shop")
|
||||
|
||||
shopInfo = { -- [actorclass id] = { welcomeText, shopMode, shopPack{s} }
|
||||
[1000159] = {34, 0, 1016},
|
||||
[1000163] = {49, 0, 1017},
|
||||
[1000165] = {74, 0, 1019},
|
||||
[1001458] = {44, 0, 1018},
|
||||
[1500405] = {320, 0, 1013},
|
||||
[1500407] = {321, 0, 1012},
|
||||
[1500411] = {322, 0, 2017},
|
||||
[1500414] = {324, 0, 1012},
|
||||
[1500419] = {327, 0, 1012},
|
||||
[1500422] = {332, 0, 1013},
|
||||
[1500423] = {331, 0, 2017},
|
||||
[1500429] = {328, 0, 2017},
|
||||
[1500430] = {281, 0, 5121},
|
||||
[1600001] = {6, 0, 1006},
|
||||
[1600002] = {7, 0, 1007},
|
||||
[1600003] = {8, 0, 1008},
|
||||
[1600004] = {9, 0, 1009},
|
||||
[1600005] = {10, 0, 1010},
|
||||
[1600006] = {11, 0, 1011},
|
||||
[1600007] = {12, 0, 1012},
|
||||
[1600008] = {13, 0, 1013},
|
||||
[1600009] = {14, 0, 1014},
|
||||
[1600010] = {15, 0, 1015},
|
||||
[1600011] = {1, 0, 1001},
|
||||
[1600012] = {2, 0, 1002},
|
||||
[1600013] = {3, 0, 1003},
|
||||
[1600014] = {4, 0, 1004},
|
||||
[1600016] = {5, 0, 1005},
|
||||
[1600017] = {39, 0, 2020},
|
||||
[1600018] = {59, 0, 2021},
|
||||
[1600019] = {75, 0, 2022},
|
||||
[1600020] = {77, 0, 2010},
|
||||
[1600021] = {78, 0, 2011},
|
||||
[1600022] = {79, 0, 2012},
|
||||
[1600023] = {80, 0, 2013},
|
||||
[1600024] = {81, 0, 2014},
|
||||
[1600025] = {82, 0, 2015},
|
||||
[1600026] = {83, 0, 2016},
|
||||
[1600027] = {84, 0, 2017},
|
||||
[1600028] = {85, 0, 2018},
|
||||
[1600029] = {86, 0, 2019},
|
||||
[1600030] = {87, 0, 2001},
|
||||
[1600031] = {88, 0, 2003},
|
||||
[1600032] = {89, 0, 2002},
|
||||
[1600033] = {90, 0, 2004},
|
||||
[1600034] = {91, 0, 2005},
|
||||
[1600035] = {92, 0, 2006},
|
||||
[1600036] = {93, 0, 2007},
|
||||
[1600037] = {94, 0, 2008},
|
||||
[1600039] = {69, 0, 3020},
|
||||
[1600040] = {54, 0, 3019},
|
||||
[1600041] = {64, 0, 3021},
|
||||
[1600042] = {76, 0, 3022},
|
||||
[1600043] = {96, 0, 3009},
|
||||
[1600044] = {97, 0, 3010},
|
||||
[1600045] = {98, 0, 3011},
|
||||
[1600046] = {99, 0, 3012},
|
||||
[1600047] = {100, 0, 3013},
|
||||
[1600048] = {101, 0, 3014},
|
||||
[1600049] = {102, 0, 3016},
|
||||
[1600050] = {103, 0, 3015},
|
||||
[1600051] = {104, 0, 3017},
|
||||
[1600052] = {105, 0, 3004},
|
||||
[1600053] = {106, 0, 3007},
|
||||
[1600054] = {107, 0, 3018},
|
||||
[1600055] = {108, 0, 3006},
|
||||
[1600056] = {109, 0, 3005},
|
||||
[1600057] = {110, 0, 3002},
|
||||
[1600058] = {111, 0, 3003},
|
||||
[1600059] = {112, 0, 3001},
|
||||
[1600064] = {235, 0, 2023},
|
||||
[1600066] = {237, 0, 3023},
|
||||
[1600075] = {245, 1, {5021,5022,5023,5024,5025,5026} },
|
||||
[1600076] = {247, 1, {5027,5028,5029,5030,5031,5032} },
|
||||
[1600077] = {248, 1, {5033,5034,5035,5036,5037,5038} },
|
||||
[1600080] = {251, 1, {5051,5052,5053,5054,5055,5056} },
|
||||
[1600081] = {255, 1, {5075,5076,5077,5078,5079,5080} },
|
||||
[1600089] = {260, 1, {5105,5106,5107,5108,5109,5110} },
|
||||
[1600092] = {263, 0, 2024},
|
||||
[1600094] = {265, 0, 3024},
|
||||
[1600100] = {281, 2, {5001, 5002, 5007, 5008} },
|
||||
}
|
||||
|
||||
|
||||
function init(npc)
|
||||
return false, false, 0, 0;
|
||||
return false, false, 0, 0;
|
||||
end
|
||||
|
||||
function onEventStarted(player, npc, triggerName)
|
||||
|
||||
require("/unique/".. npc.zone.zoneName .."/PopulaceShopSalesman/" .. npc:GetUniqueId())
|
||||
|
||||
if (shopInfo.shopCurrancy == nil) then
|
||||
shopInfo.shopCurrancy = 1000001;
|
||||
end
|
||||
|
||||
callClientFunction(player, "welcomeTalk", shopInfo.welcomeText, player);
|
||||
|
||||
while (true) do
|
||||
|
||||
tutorialId = -8;
|
||||
|
||||
if (shopInfo.tutorialId ~= nil) then
|
||||
tutorialAskMode = shopInfo.tutorialId;
|
||||
end
|
||||
|
||||
if (shopInfo.selectMode == nil or shopInfo.selectMode == 0) then
|
||||
choice = callClientFunction(player, "selectMode", tutorialId);
|
||||
elseif (shopInfo.selectMode == 1) then
|
||||
choice = callClientFunction(player, "selectModeOfClassVendor");
|
||||
elseif (shopInfo.selectMode == 2) then
|
||||
choice = callClientFunction(player, "selectModeOfMultiWeaponVendor", tutorialId);
|
||||
elseif (shopInfo.selectMode == 3) then
|
||||
choice = callClientFunction(player, "selectModeOfMultiArmorVendor", tutorialId);
|
||||
end
|
||||
|
||||
if (choice == nil) then
|
||||
break;
|
||||
end
|
||||
|
||||
if (shopInfo.selectMode == nil or shopInfo.selectMode == 0) then
|
||||
processNormalShop(player, choice);
|
||||
elseif (shopInfo.selectMode == 1) then
|
||||
processNormalShop(player, choice);
|
||||
elseif (shopInfo.selectMode == 2) then
|
||||
processMultiShop(player, choice);
|
||||
elseif (shopInfo.selectMode == 3) then
|
||||
processMultiShop(player, choice);
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
callClientFunction(player, "finishTalkTurn", player);
|
||||
player:EndEvent();
|
||||
|
||||
-- require("/unique/".. npc.zone.zoneName .."/PopulaceShopSalesman/" .. npc:GetUniqueId())
|
||||
npcId = npc:GetActorClassId();
|
||||
|
||||
if shopInfo[npcId] == nil then
|
||||
errorMsg = string.format("This PopulaceShopSalesman actor has no shop set. Actor Class Id: %s", npcId);
|
||||
player:SendMessage(MESSAGE_TYPE_SYSTEM_ERROR, "", errorMsg );
|
||||
player:EndEvent();
|
||||
return;
|
||||
end;
|
||||
|
||||
shopCurrancy = 1000001;
|
||||
callClientFunction(player, "welcomeTalk", shopInfo[npcId][1], player);
|
||||
|
||||
if npcId == 1000159 then -- DoH Guild NPCs with Facility menu
|
||||
tutorialId = 36;
|
||||
elseif npcId == 1000163 then
|
||||
tutorialId = 31;
|
||||
elseif npcId == 1001458 then
|
||||
tutorialId = 30;
|
||||
elseif npcId == 1600017 then
|
||||
tutorialId = 29;
|
||||
elseif npcId == 1600018 then
|
||||
tutorialId = 33;
|
||||
elseif npcId == 1600039 then
|
||||
tutorialId = 35;
|
||||
elseif npcId == 1600040 then
|
||||
tutorialId = 32;
|
||||
elseif npcId == 1600041 then
|
||||
tutorialId = 34;
|
||||
else
|
||||
tutorialId = -8;
|
||||
end
|
||||
|
||||
|
||||
|
||||
while (true) do
|
||||
|
||||
if (shopInfo[npcId][2] == 0) then
|
||||
choice = callClientFunction(player, "selectMode", tutorialId);
|
||||
elseif (shopInfo[npcId][2] == 1) then
|
||||
choice = callClientFunction(player, "selectModeOfClassVendor");
|
||||
elseif (shopInfo[npcId][2] == 2) then
|
||||
choice = callClientFunction(player, "selectModeOfMultiWeaponVendor", tutorialId);
|
||||
elseif (shopInfo[npcId][2] == 3) then
|
||||
choice = callClientFunction(player, "selectModeOfMultiArmorVendor", tutorialId);
|
||||
end
|
||||
|
||||
if (choice == nil or choice == -3) then
|
||||
break;
|
||||
end
|
||||
|
||||
if (shopInfo[npcId][2] == 0) then
|
||||
processNormalShop(player, choice);
|
||||
elseif (shopInfo[npcId][2] == 1) then
|
||||
processMultiShop(player, choice);
|
||||
elseif (shopInfo[npcId][2] == 2) then
|
||||
processMultiShop(player, choice);
|
||||
elseif (shopInfo[npcId][2] == 3) then
|
||||
processMultiShop(player, choice);
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
callClientFunction(player, "finishTalkTurn", player);
|
||||
player:EndEvent();
|
||||
|
||||
end
|
||||
|
||||
function processNormalShop(player, choice)
|
||||
if (choice == 1) then
|
||||
callClientFunction(player, "openShopBuy", player, shopInfo.shopPack, shopInfo.shopCurrancy);
|
||||
|
||||
while (true) do
|
||||
buyResult, index, quantity = callClientFunction(player, "selectShopBuy", player);
|
||||
|
||||
player:GetInventory(location):AddItem(3020308, 1);
|
||||
if (buyResult == 0) then
|
||||
callClientFunction(player, "closeShopBuy", player);
|
||||
break;
|
||||
else
|
||||
player:SendMessage(0x20, "", "Player bought a thing at slot " .. tostring(buyResult).. " with quantity "..tostring(index)..".");
|
||||
end
|
||||
|
||||
end
|
||||
elseif (choice == 2) then
|
||||
callClientFunction(player, "openShopSell", player);
|
||||
|
||||
while (true) do
|
||||
sellResult = callClientFunction(player, "selectShopSell", player);
|
||||
|
||||
if (sellResult == nil) then
|
||||
callClientFunction(player, "closeShopSell", player);
|
||||
break;
|
||||
else
|
||||
player:SendMessage(0x20, "", "Player sold a thing at slot " .. tostring(sellResult)..".");
|
||||
|
||||
itemToSell = player:GetInventory(0x00):GetItemAtSlot(sellResult.slot);
|
||||
gItemTOSell = GetItemGamedata(itemToSell.itemId);
|
||||
|
||||
player:GetInventory(0x63):AddItem(shopInfo.shopCurrancy, gItemTOSell.sellPrice);
|
||||
player:GetInventory(0x00):RemoveItemAtSlot(sellResult.slot);
|
||||
end
|
||||
|
||||
end
|
||||
elseif (choice == 3) then
|
||||
callClientFunction(player, "selectFacility", 2, 35, 3);
|
||||
callClientFunction(player, "confirmUseFacility", player, 35);
|
||||
elseif (choice == 4) then
|
||||
callClientFunction(player, "startTutorial", nil, shopInfo.classAskMode);
|
||||
end
|
||||
if (choice == 1) then
|
||||
callClientFunction(player, "openShopBuy", player, shopInfo[npcId][3], shopCurrancy);
|
||||
|
||||
while (true) do
|
||||
buyResult, quantity = callClientFunction(player, "selectShopBuy", player);
|
||||
|
||||
if (buyResult == 0) then
|
||||
callClientFunction(player, "closeShopBuy", player);
|
||||
break;
|
||||
else
|
||||
-- purchaseItem(player, shopInfo.shopContents[buyResult].id, quantity, shopInfo.shopContents[buyResult].hq, shopInfo.shopContents[buyResult].gil, shopInfo.shopCurrancy);
|
||||
end
|
||||
end
|
||||
elseif (choice == 2) then
|
||||
openSellMenu(player);
|
||||
elseif (choice == 3) then
|
||||
local classFacility = (shopInfo[npcId][1] + 1) or 35;
|
||||
facilityChoice = callClientFunction(player, "selectFacility", nil, classFacility, 3);
|
||||
|
||||
if facilityChoice == 1 then
|
||||
callClientFunction(player, "confirmUseFacility", player, 200);
|
||||
elseif facilityChoice == 2 then
|
||||
callClientFunction(player, "confirmUseFacility", player, 400);
|
||||
elseif facilityChoice == 3 then
|
||||
callClientFunction(player, "confirmUseFacility", player, 1000);
|
||||
end
|
||||
|
||||
elseif (choice == 4) then
|
||||
callClientFunction(player, "startTutorial", nil, tutorialId);
|
||||
end
|
||||
end
|
||||
|
||||
function processMultiShop(player, choice, sellType)
|
||||
|
||||
if (choice >= 1 and choice <= 4) then
|
||||
callClientFunction(player, "openShopBuy", player, shopInfo.shopPack[choice], shopInfo.shopCurrancy);
|
||||
|
||||
while (true) do
|
||||
buyResult, index, quantity = callClientFunction(player, "selectShopBuy", player);
|
||||
player:GetInventory(location):AddItem(3020308, 1);
|
||||
if (buyResult == 0) then
|
||||
callClientFunction(player, "closeShopBuy", player);
|
||||
break;
|
||||
else
|
||||
player:SendMessage(0x20, "", "Player bought a thing at slot " .. tostring(buyResult)..".");
|
||||
end
|
||||
|
||||
end
|
||||
elseif (choice == 0) then
|
||||
callClientFunction(player, "openShopSell", player);
|
||||
if (choice >= 1 and choice <= 6) then
|
||||
callClientFunction(player, "openShopBuy", player, shopInfo[npcId][3][choice], shopCurrancy);
|
||||
|
||||
while (true) do
|
||||
buyResult, quantity = callClientFunction(player, "selectShopBuy", player);
|
||||
|
||||
if (buyResult == 0) then
|
||||
callClientFunction(player, "closeShopBuy", player);
|
||||
break;
|
||||
else
|
||||
-- purchaseItem(player, shopInfo.shopContents[choice][buyResult].id, quantity, shopInfo.shopContents[choice][buyResult].hq, shopInfo.shopContents[choice][buyResult].gil, shopInfo.shopCurrancy);
|
||||
end
|
||||
end
|
||||
elseif (choice == 0) then
|
||||
openSellMenu(player);
|
||||
elseif (choice == 6) then
|
||||
callClientFunction(player, "selectFacility", 2, 35, 3);
|
||||
callClientFunction(player, "confirmUseFacility", player, 35);
|
||||
elseif (choice == 7) then
|
||||
callClientFunction(player, "startTutorial", nil, tutorialId);
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
|
||||
function openSellMenu(player)
|
||||
callClientFunction(player, "openShopSell", player);
|
||||
|
||||
while (true) do
|
||||
sellResult, sellQuantity, sellState, unknown, sellItemSlot = callClientFunction(player, "selectShopSell", player);
|
||||
|
||||
if (sellResult == nil) then
|
||||
callClientFunction(player, "closeShopSell", player);
|
||||
break;
|
||||
else
|
||||
if sellState == 1 then
|
||||
itemToSell = player:GetInventory(INVENTORY_NORMAL):GetItemAtSlot(sellItemSlot-1);
|
||||
gItemSellId = itemToSell.itemId;
|
||||
gItemQuality = itemToSell.quality;
|
||||
gItemPrice = GetItemGamedata(gItemSellId);
|
||||
gItemPrice = gItemPrice.sellPrice;
|
||||
|
||||
|
||||
if gItemQuality == 2 then -- +1
|
||||
gItemPrice = (math.floor(gItemPrice * 1.10));
|
||||
elseif gItemQuality == 3 then -- +2
|
||||
gItemPrice = (math.floor(gItemPrice * 1.25));
|
||||
elseif gItemQuality == 4 then -- +3
|
||||
gItemPrice = (math.floor(gItemPrice * 1.50));
|
||||
end
|
||||
|
||||
callClientFunction(player, "informSellPrice", 1, sellItemSlot, gItemPrice);
|
||||
|
||||
elseif sellState == nil then
|
||||
sellItem(player, gItemSellId, sellQuantity, gItemQuality, gItemPrice, sellItemSlot-1, shopCurrancy);
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
while (true) do
|
||||
sellResult = callClientFunction(player, "selectShopSell", player);
|
||||
|
||||
if (sellResult == nil) then
|
||||
callClientFunction(player, "closeShopSell", player);
|
||||
break;
|
||||
else
|
||||
player:SendMessage(0x20, "", "Player sold a thing at slot " .. tostring(sellResult)..".");
|
||||
end
|
||||
|
||||
end
|
||||
elseif (choice == 6) then
|
||||
callClientFunction(player, "selectFacility", 2, 35, 3);
|
||||
callClientFunction(player, "confirmUseFacility", player, 35);
|
||||
elseif (choice == 7) then
|
||||
callClientFunction(player, "startTutorial", nil, shopInfo.classAskMode);
|
||||
end
|
||||
|
||||
end
|
Loading…
Add table
Add a link
Reference in a new issue