mirror of
				https://bitbucket.org/Ioncannon/project-meteor-server.git
				synced 2025-05-20 08:26:59 -04:00 
			
		
		
		
	Bunch of shop scripts added (by Jorge)
This commit is contained in:
		
							
								
								
									
										510
									
								
								Data/scripts/base/chara/npc/populace/PopulaceCompanyShop.lua
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										510
									
								
								Data/scripts/base/chara/npc/populace/PopulaceCompanyShop.lua
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,510 @@ | ||||
| --[[ | ||||
|  | ||||
| PopulaceCompanyShop Script | ||||
|  | ||||
|  | ||||
| Functions: | ||||
|  | ||||
| eventTalkStepCantUse()      -- When player tries to buy from another GC's shop | ||||
| eventTalkPreJoin()          -- Dialog for the shop | ||||
| eventTalkPreJoinQuest()     -- Tutorial dialog for the shop? | ||||
| eventTalkJoined(???)        -- Dialog for the shop, they salute.  Orphaned parameter? | ||||
|  | ||||
| eventTalkFestival()         -- Festival Day Event Dialog | ||||
| eventTalkFestival2()        -- Festival Day Event Follow-up Dialog | ||||
|  | ||||
| eventTalkMainMenu(???, ???) -- Shop menu for picking GC items | ||||
| eventShopMenuOpen()         -- Sets up shop menu.  Calls getSpecialEventWork, value 8 shows GC firework & 11 a Patriot's Choker | ||||
| eventShopMenuAsk()          -- Opens up the shop menu. | ||||
| eventShopMenuClose() | ||||
|  | ||||
| eventGuideChocoboWhistle(???)   -- Tutorial dialog after purchasing Chocobo issuance slip.  Orphaned parameter? | ||||
| eventGuideTownTransport(index)  -- Tutorial dialog after purchasing an aetherpass.  Index is item ID. | ||||
| eventAskChocoboCustomize(index, price)  -- Chocobo Barding purchase dialog.  Index is item ID. | ||||
| eventChocoboCustomize()                 -- Follow-up dialog if you purchase Chocobo Barding. | ||||
|  | ||||
| getGrandCompanyNumber()         -- Returns GC value of the NPC | ||||
| getShopItemStartIndex(index)    -- Gets starting index value based on GC shop | ||||
| getShopItemEndIndex(index)      -- Gets ending index value based on GC shop | ||||
| getShopSellingItemMax(???)      -- | ||||
| getShopSellingItemDetail(player, ???, ???) | ||||
|  | ||||
| eventTalkStepBreak()            -- Returns NPC to their starting direction | ||||
| --]] | ||||
|  | ||||
| require ("global") | ||||
| require ("shop") | ||||
|  | ||||
| function init(npc) | ||||
| 	return false, false, 0, 0;	 | ||||
| end | ||||
|  | ||||
| gcOfficer = {  | ||||
| [1500202] = 1, -- Limsa Shop | ||||
| [1500203] = 2, -- Grid Shop | ||||
| [1500201] = 3, -- Flame Shop | ||||
| } | ||||
|  | ||||
| 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}, | ||||
| [100004] = {3020406, 1, 20, 10, 0, 1, 0, 1}, | ||||
| [100005] = {3020403, 1, 10, 15, 0, 1, 0, 1}, | ||||
| [100006] = {3020402, 1, 5, 60, 0, 1, 0, 1}, | ||||
| [100007] = {3020404, 1, 5, 100, 0, 1, 0, 1}, | ||||
| [100008] = {3020528, 1, 5, 50, 0, 1, 0, 1}, | ||||
| [100009] = {3020516, 1, 5, 50, 0, 1, 0, 1}, | ||||
| [100010] = {3020411, 1, 1, 15, 0, 1, 0, 1}, | ||||
| [100011] = {3020412, 1, 1, 200, 0, 1, 0, 1}, | ||||
| [100012] = {3020509, 1, 1, 200, 0, 1, 0, 1}, | ||||
| [100013] = {3020510, 1, 1, 200, 0, 1, 0, 1}, | ||||
| [100014] = {10013001, 1, 20, 5, 0, 1, 0, 1}, | ||||
| [100015] = {10013002, 1, 20, 25, 0, 1, 0, 1}, | ||||
| [100016] = {10013003, 1, 20, 45, 0, 1, 0, 1}, | ||||
| [100017] = {10013004, 1, 20, 100, 0, 1, 0, 1}, | ||||
| [100018] = {10013005, 1, 20, 150, 0, 1, 0, 1}, | ||||
| [100019] = {3910402, 1, 99, 85, 0, 1, 0, 1}, | ||||
| [100020] = {3910103, 1, 99, 120, 0, 1, 0, 1}, | ||||
| [100021] = {3910203, 1, 99, 120, 0, 1, 0, 1}, | ||||
| [100022] = {3910305, 1, 99, 85, 0, 1, 0, 1}, | ||||
| [100023] = {3920004, 1, 999, 50, 0, 1, 0, 1}, | ||||
| [100024] = {3920006, 1, 999, 70, 0, 1, 0, 1}, | ||||
| [100025] = {3920003, 1, 999, 115, 0, 1, 0, 1}, | ||||
| [100026] = {3910005, 1, 99, 75, 0, 1, 0, 1}, | ||||
| [100027] = {3910006, 1, 99, 90, 0, 1, 0, 1}, | ||||
| [100028] = {3940011, 1, 20, 20, 0, 1, 0, 1}, | ||||
| [100029] = {3940010, 1, 20, 30, 0, 1, 0, 1}, | ||||
| [100030] = {3020504, 1, 1, 400, 15, 1, 0, 1}, | ||||
| [100031] = {3020505, 1, 1, 400, 15, 1, 0, 1}, | ||||
| [100032] = {3020506, 1, 1, 300, 31, 1, 0, 1}, | ||||
| [101001] = {4040010, 1, 1, 500, 0, 1, 0, 2}, | ||||
| [101002] = {4040110, 1, 1, 1000, 0, 1, 0, 2}, | ||||
| [101003] = {4040205, 1, 1, 1400, 0, 1, 0, 2}, | ||||
| [101004] = {4040305, 1, 1, 3000, 0, 1, 0, 2}, | ||||
| [101005] = {4040204, 1, 1, 4000, 0, 1, 0, 2}, | ||||
| [101006] = {4080304, 1, 1, 950, 0, 1, 0, 2}, | ||||
| [101007] = {4080211, 1, 1, 1000, 0, 1, 0, 2}, | ||||
| [101008] = {4080106, 1, 1, 2000, 0, 1, 0, 2}, | ||||
| [101009] = {4080303, 1, 1, 4000, 0, 1, 0, 2}, | ||||
| [101010] = {5020010, 1, 1, 900, 0, 1, 0, 2}, | ||||
| [101011] = {5020209, 1, 1, 1000, 0, 1, 0, 2}, | ||||
| [101012] = {5020213, 1, 1, 1600, 0, 1, 0, 2}, | ||||
| [101013] = {5020305, 1, 1, 4000, 0, 1, 0, 2}, | ||||
| [101014] = {8030350, 1, 1, 750, 0, 1, 0, 2}, | ||||
| [101015] = {8030447, 1, 1, 750, 0, 1, 0, 2}, | ||||
| [101016] = {8031223, 1, 1, 750, 0, 1, 0, 2}, | ||||
| [101017] = {8032008, 1, 1, 750, 0, 1, 0, 2}, | ||||
| [101018] = {9050029, 1, 1, 900, 0, 1, 0, 2}, | ||||
| [101019] = {9050044, 1, 1, 1900, 0, 1, 0, 2}, | ||||
| [101020] = {9040032, 1, 1, 950, 0, 1, 0, 2}, | ||||
| [101021] = {9040025, 1, 1, 1500, 0, 1, 0, 2}, | ||||
| [101022] = {8013201, 1, 1, 1000, 11, 1, 0, 2}, | ||||
| [101023] = {8032601, 1, 1, 1000, 11, 1, 0, 2}, | ||||
| [101024] = {8071301, 1, 1, 1000, 11, 1, 0, 2}, | ||||
| [101025] = {8081701, 1, 1, 1000, 11, 1, 0, 2}, | ||||
| [101026] = {8050620, 1, 1, 1200, 11, 1, 0, 2}, | ||||
| [101027] = {8050243, 1, 1, 1200, 11, 1, 0, 2}, | ||||
| [101028] = {8050344, 1, 1, 1200, 11, 1, 0, 2}, | ||||
| [101029] = {8050028, 1, 1, 1200, 11, 1, 0, 2}, | ||||
| [101030] = {8090706, 1, 1, 1200, 11, 1, 0, 2}, | ||||
| [101031] = {4030205, 1, 1, 2500, 13, 1, 0, 2}, | ||||
| [101032] = {4020306, 1, 1, 2500, 13, 1, 0, 2}, | ||||
| [101033] = {4040014, 1, 1, 2500, 13, 1, 0, 2}, | ||||
| [101034] = {4080408, 1, 1, 2500, 13, 1, 0, 2}, | ||||
| [101035] = {4070310, 1, 1, 2500, 13, 1, 0, 2}, | ||||
| [101036] = {5030307, 1, 1, 2500, 13, 1, 0, 2}, | ||||
| [101037] = {5020112, 1, 1, 2500, 13, 1, 0, 2}, | ||||
| [101038] = {4100205, 1, 1, 2000, 13, 1, 0, 2}, | ||||
| [101039] = {8011609, 1, 1, 3000, 15, 1, 0, 2}, | ||||
| [101040] = {8032311, 1, 1, 3000, 15, 1, 0, 2}, | ||||
| [101041] = {8071017, 1, 1, 3000, 15, 1, 0, 2}, | ||||
| [101042] = {8050132, 1, 1, 3000, 15, 1, 0, 2}, | ||||
| [101043] = {8081123, 1, 1, 3000, 15, 1, 0, 2}, | ||||
| [101044] = {4030117, 1, 1, 4500, 17, 1, 0, 2}, | ||||
| [101045] = {4020210, 1, 1, 4500, 17, 1, 0, 2}, | ||||
| [101046] = {4040406, 1, 1, 4500, 17, 1, 0, 2}, | ||||
| [101047] = {4080107, 1, 1, 4500, 17, 1, 0, 2}, | ||||
| [101048] = {4070108, 1, 1, 4500, 17, 1, 0, 2}, | ||||
| [101049] = {5030111, 1, 1, 4500, 17, 1, 0, 2}, | ||||
| [101050] = {5020013, 1, 1, 4500, 17, 1, 0, 2}, | ||||
| [101051] = {4100405, 1, 1, 4000, 17, 1, 0, 2}, | ||||
| [101052] = {8011610, 1, 1, 5000, 21, 1, 0, 2}, | ||||
| [101053] = {8032312, 1, 1, 5000, 21, 1, 0, 2}, | ||||
| [101054] = {8071018, 1, 1, 5000, 21, 1, 0, 2}, | ||||
| [101055] = {8050133, 1, 1, 5000, 21, 1, 0, 2}, | ||||
| [101056] = {8050769, 1, 1, 5000, 21, 1, 0, 2}, | ||||
| [101057] = {8081124, 1, 1, 5000, 21, 1, 0, 2}, | ||||
| [101058] = {8080565, 1, 1, 5000, 21, 1, 0, 2}, | ||||
| [101059] = {8090609, 1, 1, 5000, 21, 1, 0, 2}, | ||||
| [101060] = {9050021, 1, 1, 1000, 21, 1, 0, 2}, | ||||
| [101061] = {9050022, 1, 1, 1000, 21, 1, 0, 2}, | ||||
| [101062] = {9010025, 1, 1, 1000, 21, 1, 0, 2}, | ||||
| [101063] = {4100804, 1, 1, 5500, 23, 1, 0, 2}, | ||||
| [101064] = {8013614, 1, 1, 5500, 23, 1, 0, 2}, | ||||
| [101065] = {8032820, 1, 1, 5500, 23, 1, 0, 2}, | ||||
| [101066] = {8051516, 1, 1, 5500, 23, 1, 0, 2}, | ||||
| [101067] = {8071520, 1, 1, 5500, 23, 1, 0, 2}, | ||||
| [101068] = {9030060, 1, 1, 5500, 23, 1, 0, 2}, | ||||
| [101069] = {9050067, 1, 1, 5500, 23, 1, 0, 2}, | ||||
| [101070] = {8013615, 1, 1, 6000, 25, 1, 0, 2}, | ||||
| [101071] = {8013616, 1, 1, 6000, 25, 1, 0, 2}, | ||||
| [101072] = {8032821, 1, 1, 6000, 25, 1, 0, 2}, | ||||
| [101073] = {8071521, 1, 1, 6000, 25, 1, 0, 2}, | ||||
| [101074] = {8081914, 1, 1, 6000, 25, 1, 0, 2}, | ||||
| [101075] = {9040065, 1, 1, 6000, 25, 1, 0, 2}, | ||||
| [101076] = {9010061, 1, 1, 6000, 25, 1, 0, 2}, | ||||
| [101077] = {4100805, 1, 1, 6500, 27, 1, 0, 2}, | ||||
| [101078] = {4020408, 1, 1, 6500, 27, 1, 0, 2}, | ||||
| [101079] = {4040508, 1, 1, 6500, 27, 1, 0, 2}, | ||||
| [101080] = {4080508, 1, 1, 6500, 27, 1, 0, 2}, | ||||
| [101081] = {4070408, 1, 1, 6500, 27, 1, 0, 2}, | ||||
| [101082] = {5030408, 1, 1, 6500, 27, 1, 0, 2}, | ||||
| [101083] = {5020408, 1, 1, 6500, 27, 1, 0, 2}, | ||||
| [101084] = {4030604, 1, 1, 25000, 31, 1, 0, 2}, | ||||
| [101085] = {4020404, 1, 1, 25000, 31, 1, 0, 2}, | ||||
| [101086] = {4040504, 1, 1, 25000, 31, 1, 0, 2}, | ||||
| [101087] = {4080504, 1, 1, 25000, 31, 1, 0, 2}, | ||||
| [101088] = {4070404, 1, 1, 25000, 31, 1, 0, 2}, | ||||
| [101089] = {5030404, 1, 1, 25000, 31, 1, 0, 2}, | ||||
| [101090] = {5020404, 1, 1, 25000, 31, 1, 0, 2}, | ||||
| [101091] = {8013204, 1, 1, 6000, 31, 1, 0, 2}, | ||||
| [101092] = {8032604, 1, 1, 6000, 31, 1, 0, 2}, | ||||
| [101093] = {8071304, 1, 1, 6000, 31, 1, 0, 2}, | ||||
| [101094] = {8081704, 1, 1, 6000, 31, 1, 0, 2}, | ||||
| [102001] = {3020601, 1, 20, 5, 0, 1, 8, 3}, | ||||
| [102002] = {9040018, 1, 1, 1000, 11, 1, 11, 3}, | ||||
| [103001] = {2001004, 1, 1, 3000, 11, 1, 0, 4}, | ||||
| [103002] = {2001014, 1, 1, 3000, 15, 1, 0, 4}, | ||||
| [103003] = {2001017, 1, 1, 2000, 21, 1, 0, 4}, | ||||
| [103004] = {2001018, 1, 1, 3000, 21, 1, 0, 4}, | ||||
| [103005] = {2001019, 1, 1, 4000, 21, 1, 0, 4}, | ||||
| [103006] = {2001026, 1, 1, 25000, 27, 1, 0, 4}, | ||||
| [200001] = {3010403, 1, 10, 20, 0, 2, 0, 1}, | ||||
| [200002] = {3010402, 1, 10, 30, 0, 2, 0, 1}, | ||||
| [200003] = {3020203, 1, 1, 50, 0, 2, 0, 1}, | ||||
| [200004] = {3020406, 1, 20, 10, 0, 2, 0, 1}, | ||||
| [200005] = {3020403, 1, 10, 15, 0, 2, 0, 1}, | ||||
| [200006] = {3020402, 1, 5, 60, 0, 2, 0, 1}, | ||||
| [200007] = {3020404, 1, 5, 100, 0, 2, 0, 1}, | ||||
| [200008] = {3020528, 1, 5, 50, 0, 2, 0, 1}, | ||||
| [200009] = {3020516, 1, 5, 50, 0, 2, 0, 1}, | ||||
| [200010] = {3020411, 1, 1, 15, 0, 2, 0, 1}, | ||||
| [200011] = {3020412, 1, 1, 200, 0, 2, 0, 1}, | ||||
| [200012] = {3020509, 1, 1, 200, 0, 2, 0, 1}, | ||||
| [200013] = {3020510, 1, 1, 200, 0, 2, 0, 1}, | ||||
| [200014] = {10013001, 1, 20, 5, 0, 2, 0, 1}, | ||||
| [200015] = {10013002, 1, 20, 25, 0, 2, 0, 1}, | ||||
| [200016] = {10013003, 1, 20, 45, 0, 2, 0, 1}, | ||||
| [200017] = {10013004, 1, 20, 100, 0, 2, 0, 1}, | ||||
| [200018] = {10013005, 1, 20, 150, 0, 2, 0, 1}, | ||||
| [200019] = {3910402, 1, 99, 85, 0, 2, 0, 1}, | ||||
| [200020] = {3910103, 1, 99, 120, 0, 2, 0, 1}, | ||||
| [200021] = {3910203, 1, 99, 120, 0, 2, 0, 1}, | ||||
| [200022] = {3910305, 1, 99, 85, 0, 2, 0, 1}, | ||||
| [200023] = {3920004, 1, 999, 50, 0, 2, 0, 1}, | ||||
| [200024] = {3920006, 1, 999, 70, 0, 2, 0, 1}, | ||||
| [200025] = {3920003, 1, 999, 115, 0, 2, 0, 1}, | ||||
| [200026] = {3910005, 1, 99, 75, 0, 2, 0, 1}, | ||||
| [200027] = {3910006, 1, 99, 90, 0, 2, 0, 1}, | ||||
| [200028] = {3940011, 1, 20, 20, 0, 2, 0, 1}, | ||||
| [200029] = {3940010, 1, 20, 30, 0, 2, 0, 1}, | ||||
| [200030] = {3020504, 1, 1, 400, 15, 2, 0, 1}, | ||||
| [200031] = {3020505, 1, 1, 400, 15, 2, 0, 1}, | ||||
| [200032] = {3020506, 1, 1, 300, 31, 2, 0, 1}, | ||||
| [201001] = {5030107, 1, 1, 350, 0, 2, 0, 2}, | ||||
| [201002] = {5030207, 1, 1, 750, 0, 2, 0, 2}, | ||||
| [201003] = {5030206, 1, 1, 1000, 0, 2, 0, 2}, | ||||
| [201004] = {5030029, 1, 1, 1500, 0, 2, 0, 2}, | ||||
| [201005] = {5030031, 1, 1, 2400, 0, 2, 0, 2}, | ||||
| [201006] = {5030209, 1, 1, 3000, 0, 2, 0, 2}, | ||||
| [201007] = {5030028, 1, 1, 4000, 0, 2, 0, 2}, | ||||
| [201008] = {4020109, 1, 1, 800, 0, 2, 0, 2}, | ||||
| [201009] = {4020106, 1, 1, 1000, 0, 2, 0, 2}, | ||||
| [201010] = {4020008, 1, 1, 2200, 0, 2, 0, 2}, | ||||
| [201011] = {4020305, 1, 1, 4000, 0, 2, 0, 2}, | ||||
| [201012] = {4100005, 1, 1, 1000, 0, 2, 0, 2}, | ||||
| [201013] = {4100109, 1, 1, 4000, 0, 2, 0, 2}, | ||||
| [201014] = {8030035, 1, 1, 750, 0, 2, 0, 2}, | ||||
| [201015] = {8030919, 1, 1, 750, 0, 2, 0, 2}, | ||||
| [201016] = {8031821, 1, 1, 750, 0, 2, 0, 2}, | ||||
| [201017] = {8032220, 1, 1, 750, 0, 2, 0, 2}, | ||||
| [201018] = {9050029, 1, 1, 900, 0, 2, 0, 2}, | ||||
| [201019] = {9050044, 1, 1, 1900, 0, 2, 0, 2}, | ||||
| [201020] = {9040035, 1, 1, 950, 0, 2, 0, 2}, | ||||
| [201021] = {9040025, 1, 1, 1500, 0, 2, 0, 2}, | ||||
| [201022] = {8013202, 1, 1, 1000, 11, 2, 0, 2}, | ||||
| [201023] = {8032602, 1, 1, 1000, 11, 2, 0, 2}, | ||||
| [201024] = {8071302, 1, 1, 1000, 11, 2, 0, 2}, | ||||
| [201025] = {8081702, 1, 1, 1000, 11, 2, 0, 2}, | ||||
| [201026] = {8050148, 1, 1, 1200, 11, 2, 0, 2}, | ||||
| [201027] = {8050244, 1, 1, 1200, 11, 2, 0, 2}, | ||||
| [201028] = {8051222, 1, 1, 1200, 11, 2, 0, 2}, | ||||
| [201029] = {8050029, 1, 1, 1200, 11, 2, 0, 2}, | ||||
| [201030] = {8090707, 1, 1, 1200, 11, 2, 0, 2}, | ||||
| [201031] = {4030710, 1, 1, 2500, 13, 2, 0, 2}, | ||||
| [201032] = {4020211, 1, 1, 2500, 13, 2, 0, 2}, | ||||
| [201033] = {4040407, 1, 1, 2500, 13, 2, 0, 2}, | ||||
| [201034] = {4080213, 1, 1, 2500, 13, 2, 0, 2}, | ||||
| [201035] = {4070215, 1, 1, 2500, 13, 2, 0, 2}, | ||||
| [201036] = {5030113, 1, 1, 2500, 13, 2, 0, 2}, | ||||
| [201037] = {5020014, 1, 1, 2500, 13, 2, 0, 2}, | ||||
| [201038] = {4100608, 1, 1, 2000, 13, 2, 0, 2}, | ||||
| [201039] = {8010566, 1, 1, 3000, 15, 2, 0, 2}, | ||||
| [201040] = {8030625, 1, 1, 3000, 15, 2, 0, 2}, | ||||
| [201041] = {8070724, 1, 1, 3000, 15, 2, 0, 2}, | ||||
| [201042] = {8050618, 1, 1, 3000, 15, 2, 0, 2}, | ||||
| [201043] = {8080715, 1, 1, 3000, 15, 2, 0, 2}, | ||||
| [201044] = {4030016, 1, 1, 4500, 17, 2, 0, 2}, | ||||
| [201045] = {4020012, 1, 1, 4500, 17, 2, 0, 2}, | ||||
| [201046] = {4040111, 1, 1, 4500, 17, 2, 0, 2}, | ||||
| [201047] = {4080010, 1, 1, 4500, 17, 2, 0, 2}, | ||||
| [201048] = {4070013, 1, 1, 4500, 17, 2, 0, 2}, | ||||
| [201049] = {5030308, 1, 1, 4500, 17, 2, 0, 2}, | ||||
| [201050] = {5020113, 1, 1, 4500, 17, 2, 0, 2}, | ||||
| [201051] = {4100507, 1, 1, 4000, 17, 2, 0, 2}, | ||||
| [201052] = {8010567, 1, 1, 5000, 21, 2, 0, 2}, | ||||
| [201053] = {8030626, 1, 1, 5000, 21, 2, 0, 2}, | ||||
| [201054] = {8070725, 1, 1, 5000, 21, 2, 0, 2}, | ||||
| [201055] = {8050619, 1, 1, 5000, 21, 2, 0, 2}, | ||||
| [201056] = {8050768, 1, 1, 5000, 21, 2, 0, 2}, | ||||
| [201057] = {8080716, 1, 1, 5000, 21, 2, 0, 2}, | ||||
| [201058] = {8080564, 1, 1, 5000, 21, 2, 0, 2}, | ||||
| [201059] = {8090506, 1, 1, 5000, 21, 2, 0, 2}, | ||||
| [201060] = {9050025, 1, 1, 1000, 21, 2, 0, 2}, | ||||
| [201061] = {9050026, 1, 1, 1000, 21, 2, 0, 2}, | ||||
| [201062] = {9010025, 1, 1, 1000, 21, 2, 0, 2}, | ||||
| [201063] = {4100806, 1, 1, 5500, 23, 2, 0, 2}, | ||||
| [201064] = {8013617, 1, 1, 5500, 23, 2, 0, 2}, | ||||
| [201065] = {8032822, 1, 1, 5500, 23, 2, 0, 2}, | ||||
| [201066] = {8051517, 1, 1, 5500, 23, 2, 0, 2}, | ||||
| [201067] = {8071522, 1, 1, 5500, 23, 2, 0, 2}, | ||||
| [201068] = {9030061, 1, 1, 5500, 23, 2, 0, 2}, | ||||
| [201069] = {9050068, 1, 1, 5500, 23, 2, 0, 2}, | ||||
| [201070] = {8013618, 1, 1, 6000, 25, 2, 0, 2}, | ||||
| [201071] = {8013619, 1, 1, 6000, 25, 2, 0, 2}, | ||||
| [201072] = {8032823, 1, 1, 6000, 25, 2, 0, 2}, | ||||
| [201073] = {8071523, 1, 1, 6000, 25, 2, 0, 2}, | ||||
| [201074] = {8081915, 1, 1, 6000, 25, 2, 0, 2}, | ||||
| [201075] = {9040066, 1, 1, 6000, 25, 2, 0, 2}, | ||||
| [201076] = {9010062, 1, 1, 6000, 25, 2, 0, 2}, | ||||
| [201077] = {4100807, 1, 1, 6500, 27, 2, 0, 2}, | ||||
| [201078] = {4020409, 1, 1, 6500, 27, 2, 0, 2}, | ||||
| [201079] = {4040509, 1, 1, 6500, 27, 2, 0, 2}, | ||||
| [201080] = {4080509, 1, 1, 6500, 27, 2, 0, 2}, | ||||
| [201081] = {4070409, 1, 1, 6500, 27, 2, 0, 2}, | ||||
| [201082] = {5030409, 1, 1, 6500, 27, 2, 0, 2}, | ||||
| [201083] = {5020409, 1, 1, 6500, 27, 2, 0, 2}, | ||||
| [201084] = {4030605, 1, 1, 25000, 31, 2, 0, 2}, | ||||
| [201085] = {4020405, 1, 1, 25000, 31, 2, 0, 2}, | ||||
| [201086] = {4040505, 1, 1, 25000, 31, 2, 0, 2}, | ||||
| [201087] = {4080505, 1, 1, 25000, 31, 2, 0, 2}, | ||||
| [201088] = {4070405, 1, 1, 25000, 31, 2, 0, 2}, | ||||
| [201089] = {5030405, 1, 1, 25000, 31, 2, 0, 2}, | ||||
| [201090] = {5020405, 1, 1, 25000, 31, 2, 0, 2}, | ||||
| [201091] = {8013205, 1, 1, 6000, 31, 2, 0, 2}, | ||||
| [201092] = {8032605, 1, 1, 6000, 31, 2, 0, 2}, | ||||
| [201093] = {8071305, 1, 1, 6000, 31, 2, 0, 2}, | ||||
| [201094] = {8081705, 1, 1, 6000, 31, 2, 0, 2}, | ||||
| [202001] = {3020603, 1, 20, 5, 0, 2, 8, 3}, | ||||
| [202002] = {9040018, 1, 1, 1000, 11, 2, 11, 3}, | ||||
| [203001] = {2001005, 1, 1, 3000, 11, 2, 0, 4}, | ||||
| [203002] = {2001015, 1, 1, 3000, 15, 2, 0, 4}, | ||||
| [203003] = {2001020, 1, 1, 2000, 21, 2, 0, 4}, | ||||
| [203004] = {2001021, 1, 1, 3000, 21, 2, 0, 4}, | ||||
| [203005] = {2001022, 1, 1, 4000, 21, 2, 0, 4}, | ||||
| [203006] = {2001026, 1, 1, 25000, 27, 2, 0, 4}, | ||||
| [300001] = {3010403, 1, 10, 20, 0, 3, 0, 1}, | ||||
| [300002] = {3010402, 1, 10, 30, 0, 3, 0, 1}, | ||||
| [300003] = {3020204, 1, 1, 50, 0, 3, 0, 1}, | ||||
| [300004] = {3020406, 1, 20, 10, 0, 3, 0, 1}, | ||||
| [300005] = {3020403, 1, 10, 15, 0, 3, 0, 1}, | ||||
| [300006] = {3020402, 1, 5, 60, 0, 3, 0, 1}, | ||||
| [300007] = {3020404, 1, 5, 100, 0, 3, 0, 1}, | ||||
| [300008] = {3020528, 1, 5, 50, 0, 3, 0, 1}, | ||||
| [300009] = {3020516, 1, 5, 50, 0, 3, 0, 1}, | ||||
| [300010] = {3020411, 1, 1, 15, 0, 3, 0, 1}, | ||||
| [300011] = {3020412, 1, 1, 200, 0, 3, 0, 1}, | ||||
| [300012] = {3020509, 1, 1, 200, 0, 3, 0, 1}, | ||||
| [300013] = {3020510, 1, 1, 200, 0, 3, 0, 1}, | ||||
| [300014] = {10013001, 1, 20, 5, 0, 3, 0, 1}, | ||||
| [300015] = {10013002, 1, 20, 25, 0, 3, 0, 1}, | ||||
| [300016] = {10013003, 1, 20, 45, 0, 3, 0, 1}, | ||||
| [300017] = {10013004, 1, 20, 100, 0, 3, 0, 1}, | ||||
| [300018] = {10013005, 1, 20, 150, 0, 3, 0, 1}, | ||||
| [300019] = {3910402, 1, 99, 85, 0, 3, 0, 1}, | ||||
| [300020] = {3910103, 1, 99, 120, 0, 3, 0, 1}, | ||||
| [300021] = {3910203, 1, 99, 120, 0, 3, 0, 1}, | ||||
| [300022] = {3910305, 1, 99, 85, 0, 3, 0, 1}, | ||||
| [300023] = {3920004, 1, 999, 50, 0, 3, 0, 1}, | ||||
| [300024] = {3920006, 1, 999, 70, 0, 3, 0, 1}, | ||||
| [300025] = {3920003, 1, 999, 115, 0, 3, 0, 1}, | ||||
| [300026] = {3910005, 1, 99, 75, 0, 3, 0, 1}, | ||||
| [300027] = {3910006, 1, 99, 90, 0, 3, 0, 1}, | ||||
| [300028] = {3940011, 1, 20, 20, 0, 3, 0, 1}, | ||||
| [300029] = {3940010, 1, 20, 30, 0, 3, 0, 1}, | ||||
| [300030] = {3020504, 1, 1, 400, 15, 3, 0, 1}, | ||||
| [300031] = {3020505, 1, 1, 400, 15, 3, 0, 1}, | ||||
| [300032] = {3020506, 1, 1, 300, 31, 3, 0, 1}, | ||||
| [301001] = {4030006, 1, 1, 400, 0, 3, 0, 2}, | ||||
| [301002] = {4030015, 1, 1, 1000, 0, 3, 0, 2}, | ||||
| [301003] = {4030405, 1, 1, 1600, 0, 3, 0, 2}, | ||||
| [301004] = {4030506, 1, 1, 3200, 0, 3, 0, 2}, | ||||
| [301005] = {4030505, 1, 1, 4000, 0, 3, 0, 2}, | ||||
| [301006] = {4070011, 1, 1, 550, 0, 3, 0, 2}, | ||||
| [301007] = {4070105, 1, 1, 1000, 0, 3, 0, 2}, | ||||
| [301008] = {4070212, 1, 1, 1500, 0, 3, 0, 2}, | ||||
| [301009] = {4070211, 1, 1, 4000, 0, 3, 0, 2}, | ||||
| [301010] = {4100710, 1, 1, 450, 0, 3, 0, 2}, | ||||
| [301011] = {4100403, 1, 1, 1000, 0, 3, 0, 2}, | ||||
| [301012] = {4100404, 1, 1, 1900, 0, 3, 0, 2}, | ||||
| [301013] = {4100306, 1, 1, 4000, 0, 3, 0, 2}, | ||||
| [301014] = {8030248, 1, 1, 750, 0, 3, 0, 2}, | ||||
| [301015] = {8030548, 1, 1, 750, 0, 3, 0, 2}, | ||||
| [301016] = {8031021, 1, 1, 750, 0, 3, 0, 2}, | ||||
| [301017] = {8031513, 1, 1, 750, 0, 3, 0, 2}, | ||||
| [301018] = {9050029, 1, 1, 900, 0, 3, 0, 2}, | ||||
| [301019] = {9050044, 1, 1, 1900, 0, 3, 0, 2}, | ||||
| [301020] = {9040036, 1, 1, 950, 0, 3, 0, 2}, | ||||
| [301021] = {9040025, 1, 1, 1500, 0, 3, 0, 2}, | ||||
| [301022] = {8013203, 1, 1, 1000, 11, 3, 0, 2}, | ||||
| [301023] = {8032603, 1, 1, 1000, 11, 3, 0, 2}, | ||||
| [301024] = {8071303, 1, 1, 1000, 11, 3, 0, 2}, | ||||
| [301025] = {8081703, 1, 1, 1000, 11, 3, 0, 2}, | ||||
| [301026] = {8050520, 1, 1, 1200, 11, 3, 0, 2}, | ||||
| [301027] = {8051024, 1, 1, 1200, 11, 3, 0, 2}, | ||||
| [301028] = {8050345, 1, 1, 1200, 11, 3, 0, 2}, | ||||
| [301029] = {8050449, 1, 1, 1200, 11, 3, 0, 2}, | ||||
| [301030] = {8090708, 1, 1, 1200, 11, 3, 0, 2}, | ||||
| [301031] = {4030305, 1, 1, 2500, 13, 3, 0, 2}, | ||||
| [301032] = {4020011, 1, 1, 2500, 13, 3, 0, 2}, | ||||
| [301033] = {4040208, 1, 1, 2500, 13, 3, 0, 2}, | ||||
| [301034] = {4080306, 1, 1, 2500, 13, 3, 0, 2}, | ||||
| [301035] = {4070012, 1, 1, 2500, 13, 3, 0, 2}, | ||||
| [301036] = {5030037, 1, 1, 2500, 13, 3, 0, 2}, | ||||
| [301037] = {5020217, 1, 1, 2500, 13, 3, 0, 2}, | ||||
| [301038] = {4100112, 1, 1, 2000, 13, 3, 0, 2}, | ||||
| [301039] = {8011522, 1, 1, 3000, 15, 3, 0, 2}, | ||||
| [301040] = {8030744, 1, 1, 3000, 15, 3, 0, 2}, | ||||
| [301041] = {8070361, 1, 1, 3000, 15, 3, 0, 2}, | ||||
| [301042] = {8050766, 1, 1, 3000, 15, 3, 0, 2}, | ||||
| [301043] = {8080562, 1, 1, 3000, 15, 3, 0, 2}, | ||||
| [301044] = {4030408, 1, 1, 4500, 17, 3, 0, 2}, | ||||
| [301045] = {4020113, 1, 1, 4500, 17, 3, 0, 2}, | ||||
| [301046] = {4040306, 1, 1, 4500, 17, 3, 0, 2}, | ||||
| [301047] = {4080409, 1, 1, 4500, 17, 3, 0, 2}, | ||||
| [301048] = {4070311, 1, 1, 4500, 17, 3, 0, 2}, | ||||
| [301049] = {5030210, 1, 1, 4500, 17, 3, 0, 2}, | ||||
| [301050] = {5020307, 1, 1, 4500, 17, 3, 0, 2}, | ||||
| [301051] = {4100712, 1, 1, 4000, 17, 3, 0, 2}, | ||||
| [301052] = {8011523, 1, 1, 5000, 21, 3, 0, 2}, | ||||
| [301053] = {8030745, 1, 1, 5000, 21, 3, 0, 2}, | ||||
| [301054] = {8070362, 1, 1, 5000, 21, 3, 0, 2}, | ||||
| [301055] = {8050811, 1, 1, 5000, 21, 3, 0, 2}, | ||||
| [301056] = {8050767, 1, 1, 5000, 21, 3, 0, 2}, | ||||
| [301057] = {8080015, 1, 1, 5000, 21, 3, 0, 2}, | ||||
| [301058] = {8080563, 1, 1, 5000, 21, 3, 0, 2}, | ||||
| [301059] = {8090709, 1, 1, 5000, 21, 3, 0, 2}, | ||||
| [301060] = {9050023, 1, 1, 1000, 21, 3, 0, 2}, | ||||
| [301061] = {9050024, 1, 1, 1000, 21, 3, 0, 2}, | ||||
| [301062] = {9010025, 1, 1, 1000, 21, 3, 0, 2}, | ||||
| [301063] = {4100808, 1, 1, 5500, 23, 3, 0, 2}, | ||||
| [301064] = {8013620, 1, 1, 5500, 23, 3, 0, 2}, | ||||
| [301065] = {8032824, 1, 1, 5500, 23, 3, 0, 2}, | ||||
| [301066] = {8051518, 1, 1, 5500, 23, 3, 0, 2}, | ||||
| [301067] = {8071524, 1, 1, 5500, 23, 3, 0, 2}, | ||||
| [301068] = {9030062, 1, 1, 5500, 23, 3, 0, 2}, | ||||
| [301069] = {9050069, 1, 1, 5500, 23, 3, 0, 2}, | ||||
| [301070] = {8013621, 1, 1, 6000, 25, 3, 0, 2}, | ||||
| [301071] = {8013622, 1, 1, 6000, 25, 3, 0, 2}, | ||||
| [301072] = {8032825, 1, 1, 6000, 25, 3, 0, 2}, | ||||
| [301073] = {8071525, 1, 1, 6000, 25, 3, 0, 2}, | ||||
| [301074] = {8081916, 1, 1, 6000, 25, 3, 0, 2}, | ||||
| [301075] = {9040067, 1, 1, 6000, 25, 3, 0, 2}, | ||||
| [301076] = {9010063, 1, 1, 6000, 25, 3, 0, 2}, | ||||
| [301077] = {4100809, 1, 1, 6500, 27, 3, 0, 2}, | ||||
| [301078] = {4020410, 1, 1, 6500, 27, 3, 0, 2}, | ||||
| [301079] = {4040510, 1, 1, 6500, 27, 3, 0, 2}, | ||||
| [301080] = {4080510, 1, 1, 6500, 27, 3, 0, 2}, | ||||
| [301081] = {4070410, 1, 1, 6500, 27, 3, 0, 2}, | ||||
| [301082] = {5030410, 1, 1, 6500, 27, 3, 0, 2}, | ||||
| [301083] = {5020410, 1, 1, 6500, 27, 3, 0, 2}, | ||||
| [301084] = {4030606, 1, 1, 25000, 31, 3, 0, 2}, | ||||
| [301085] = {4020406, 1, 1, 25000, 31, 3, 0, 2}, | ||||
| [301086] = {4040506, 1, 1, 25000, 31, 3, 0, 2}, | ||||
| [301087] = {4080506, 1, 1, 25000, 31, 3, 0, 2}, | ||||
| [301088] = {4070406, 1, 1, 25000, 31, 3, 0, 2}, | ||||
| [301089] = {5030406, 1, 1, 25000, 31, 3, 0, 2}, | ||||
| [301090] = {5020406, 1, 1, 25000, 31, 3, 0, 2}, | ||||
| [301091] = {8013206, 1, 1, 6000, 31, 3, 0, 2}, | ||||
| [301092] = {8032606, 1, 1, 6000, 31, 3, 0, 2}, | ||||
| [301093] = {8071306, 1, 1, 6000, 31, 3, 0, 2}, | ||||
| [301094] = {8081706, 1, 1, 6000, 31, 3, 0, 2}, | ||||
| [302001] = {3020602, 1, 20, 5, 0, 3, 8, 3}, | ||||
| [302002] = {9040018, 1, 1, 1000, 11, 3, 11, 3}, | ||||
| [303001] = {2001006, 1, 1, 3000, 11, 3, 0, 4}, | ||||
| [303002] = {2001016, 1, 1, 3000, 15, 3, 0, 4}, | ||||
| [303003] = {2001023, 1, 1, 2000, 21, 3, 0, 4}, | ||||
| [303004] = {2001024, 1, 1, 3000, 21, 3, 0, 4}, | ||||
| [303005] = {2001025, 1, 1, 4000, 21, 3, 0, 4}, | ||||
| [303006] = {2001026, 1, 1, 25000, 27, 3, 0, 4}, | ||||
| } | ||||
|  | ||||
| function onEventStarted(player, npc, triggerName) | ||||
|     skipGCcheck = 0; -- 0 No,  1 Yes | ||||
|     playerGC = player.gcCurrent; | ||||
|     playerGCSeal = 1000200 + playerGC; | ||||
|     playerCurrentRank = 13; | ||||
|     npcId = npc:GetActorClassId();  | ||||
|        | ||||
|     if (playerGC == gcOfficer[npcId] or  skipGCcheck == 1) then | ||||
|         callClientFunction(player, "eventTalkPreJoin"); | ||||
|         --player:SendMessage(0x20, "", "[Info]: Client takes awhile to load GC shops"); | ||||
|         while (true) do | ||||
|              | ||||
|             eventTalkChoice = callClientFunction(player, "eventTalkMainMenu", 8, 11); | ||||
|             --player:SendMessage(0x20, "", "eventTalkMainMenu: " .. tostring(eventTalkChoice)); | ||||
|  | ||||
|             if (eventTalkChoice == 1) then  | ||||
|                 t1, t2, t3 = callClientFunction(player, "eventShopMenuOpen"); | ||||
|                  | ||||
|                 --player:SendMessage(0x20, "", "eventShopMenuOpen: " .. tostring(t1) .. ", ".. tostring(t2) .. ", ".. tostring(t3)); | ||||
|  | ||||
|                 while (true) do | ||||
|                     -- TODO:  ADD RANK CHECK, CITY CHECK, AND ITEM-RANGE CHECK | ||||
|                      | ||||
|                     buyResult, buyIndex = callClientFunction(player, "eventShopMenuAsk"); | ||||
|                      | ||||
|                     if (buyIndex == -1) then | ||||
|                         callClientFunction(player, "eventShopMenuClose"); | ||||
|                         break; | ||||
|                     else | ||||
|                         -- [index] = { itemID, itemQuality, itemQuantity, itemCost gcRank, city, special, itemCategory } | ||||
|                         if (shopInfo[buyIndex][8] == 4) then | ||||
|                             location = INVENTORY_KEYITEMS; | ||||
|                         else     | ||||
|                             location = INVENTORY_NORMAL;   | ||||
|                         end | ||||
|                     end | ||||
|              | ||||
|                     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)); | ||||
|              | ||||
|             elseif (eventTalkChoice == -1) then | ||||
|                 break; | ||||
|             end | ||||
|         end | ||||
|     else | ||||
|         callClientFunction(player, "eventTalkStepCantUse"); | ||||
|     end         | ||||
|     callClientFunction(player, "eventTalkStepBreak"); | ||||
|     player:endEvent(); | ||||
| end | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
							
								
								
									
										107
									
								
								Data/scripts/base/chara/npc/populace/shop/PopulaceGuildShop.lua
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										107
									
								
								Data/scripts/base/chara/npc/populace/shop/PopulaceGuildShop.lua
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,107 @@ | ||||
| --[[ | ||||
|  | ||||
| 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;   | ||||
| 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) | ||||
|  | ||||
|     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); | ||||
|  | ||||
|     while (true) do  | ||||
|         local choice = callClientFunction(player, "selectMode", nil, npcId, true, shopCurrency, 100); | ||||
|  | ||||
|         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:GetItemPackage(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 | ||||
| @@ -0,0 +1,655 @@ | ||||
| --[[ | ||||
|  | ||||
| PopulaceShopSalesman Script | ||||
|  | ||||
| Functions: | ||||
|  | ||||
| welcomeTalk(sheetId, player) - Start Message | ||||
| selectMode(askMode) - Shows buy/sell modes. If askmode > 0 show guild tutorial. If askmode == -7/-8/-9 show nothing. Else show affinity/condition tutorials. | ||||
| selectModeOfClassVendor() - Opens categories for class weapons and gear | ||||
| selectModeOfMultiWeaponVendor(consumptionmenuId) - Opens categories for weapons/tools (war/magic/land/hand). Arg consumptionmenuId appends location of item repair person. -1: Ul'dah, -2: Gridania, -3: Limsa  | ||||
| selectModeOfMultiArmorVendor(consumptionmenuId) - Opens categories for armor in different slots. Arg consumptionmenuId appends location of item repair person. -1: Ul'dah, -2: Gridania, -3: Limsa  | ||||
|  | ||||
| openShopBuy(player, shopPack, CurrencyItemId) - ShopPack: Items to appear in window. CurrencyItemId: What is being used to buy these items. | ||||
| selectShopBuy(player) - Call after openShopBuy() to open widget | ||||
| closeShopBuy(player) - Closes the buy window | ||||
|  | ||||
| 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 | ||||
|  | ||||
| informSellPrice(1, chosenItem, price) - Shows sell confirm window. ChosenItem must be correct. | ||||
|  | ||||
| startTutorial(nil, menuId) - Opens up a tutorial menu for each guild type based on menuId | ||||
|  | ||||
| finishTalkTurn() - Done at the end. | ||||
|  | ||||
| --]] | ||||
|  | ||||
| require ("global") | ||||
| require ("shop") | ||||
|  | ||||
| shopInfo = {  | ||||
| --[[  | ||||
|     [actorclass id] =  | ||||
|         {  | ||||
|             welcomeText   - Dialog for the NPC to speak when interacting | ||||
|             menuId,       - Displays certain menu/dialog.  29-36 = DoH Facilities menus.  -1 Ul'dah, -2 Gridania, -3 Limsa.  -7/-8/-9/nil show nothing | ||||
|             shopMode,     - Type of shop. 0 = Single shop pack, 1 = Class vendor, 2 = Weapon vendor, 3 = Armor vendor, 4 = Hamlet vendor | ||||
|             shopPack{s},  - The item table index to send the client containing the list of items to display, shopmode 2/3 have a static list | ||||
|         } | ||||
| --]] | ||||
| [1000159] = {34, 36, 0, 1016}, | ||||
| [1000163] = {49, 31, 0, 1017}, | ||||
| [1000165] = {74, -8, 0, 1019}, | ||||
| [1001458] = {44, 30, 0, 1018}, | ||||
| [1500142] = {266, -1, 0, 5001}, | ||||
| [1500143] = {267, -1, 0, 5002}, | ||||
| [1500144] = {268, -1, 0, 5003}, | ||||
| [1500145] = {269, -1, 0, 5004}, | ||||
| [1500146] = {269, -1, 0, 5005}, | ||||
| [1500147] = {270, -1, 0, 5006}, | ||||
| [1500150] = {266, -8, 0, 5001}, | ||||
| [1500151] = {267, -8, 0, 5002}, | ||||
| [1500152] = {268, -8, 0, 5003}, | ||||
| [1500153] = {269, -8, 0, 5004}, | ||||
| [1500154] = {269, -8, 0, 5005}, | ||||
| [1500155] = {270, -8, 0, 5006}, | ||||
| [1500158] = {266, -8, 0, 5001}, | ||||
| [1500159] = {267, -8, 0, 5002}, | ||||
| [1500160] = {268, -8, 0, 5003}, | ||||
| [1500161] = {269, -8, 0, 5004}, | ||||
| [1500162] = {269, -8, 0, 5005}, | ||||
| [1500163] = {270, -8, 0, 5006}, | ||||
| [1500401] = {317, -8, 0, 1013}, | ||||
| [1500405] = {320, -8, 0, 1013}, | ||||
| [1500407] = {321, -8, 0, 1012}, | ||||
| [1500411] = {322, -8, 0, 2017}, | ||||
| [1500414] = {324, -8, 0, 1012}, | ||||
| [1500419] = {327, -8, 0, 1012}, | ||||
| [1500422] = {332, -8, 0, 1013}, | ||||
| [1500423] = {331, -8, 0, 2017}, | ||||
| [1500429] = {328, -8, 0, 2017}, | ||||
| [1500430] = {281, -8, 4, 5122}, | ||||
| [1500431] = {281, -8, 4, 5118}, | ||||
| [1500432] = {281, -8, 4, 5120}, | ||||
| [1600001] = {6, -8, 0, 1006}, | ||||
| [1600002] = {7, -8, 0, 1007}, | ||||
| [1600003] = {8, -8, 0, 1008}, | ||||
| [1600004] = {9, -8, 0, 1009}, | ||||
| [1600005] = {10, -8, 0, 1010}, | ||||
| [1600006] = {11, -8, 0, 1011}, | ||||
| [1600007] = {12, -8, 0, 1012}, | ||||
| [1600008] = {13, -8, 0, 1013}, | ||||
| [1600009] = {14, -8, 0, 1014}, | ||||
| [1600010] = {15, -8, 0, 1015}, | ||||
| [1600011] = {1, -8, 0, 1001}, | ||||
| [1600012] = {2, -8, 0, 1002}, | ||||
| [1600013] = {3, -8, 0, 1003}, | ||||
| [1600014] = {4, -8, 0, 1004}, | ||||
| [1600016] = {5, -8, 0, 1005}, | ||||
| [1600017] = {39, 29, 0, 2020}, | ||||
| [1600018] = {59, 33, 0, 2021}, | ||||
| [1600019] = {75, -8, 0, 2022}, | ||||
| [1600020] = {77, -8, 0, 2010}, | ||||
| [1600021] = {78, -8, 0, 2011}, | ||||
| [1600022] = {79, -8, 0, 2012}, | ||||
| [1600023] = {80, -8, 0, 2013}, | ||||
| [1600024] = {81, -8, 0, 2014}, | ||||
| [1600025] = {82, -8, 0, 2015}, | ||||
| [1600026] = {83, -8, 0, 2016}, | ||||
| [1600027] = {84, -8, 0, 2017}, | ||||
| [1600028] = {85, -8, 0, 2018}, | ||||
| [1600029] = {86, -8, 0, 2019}, | ||||
| [1600030] = {87, -8, 0, 2001}, | ||||
| [1600031] = {88, -8, 0, 2003}, | ||||
| [1600032] = {89, -8, 0, 2002}, | ||||
| [1600033] = {90, -8, 0, 2004}, | ||||
| [1600034] = {91, -8, 0, 2005}, | ||||
| [1600035] = {92, -8, 0, 2006}, | ||||
| [1600036] = {93, -8, 0, 2007}, | ||||
| [1600037] = {94, -8, 0, 2008}, | ||||
| [1600039] = {69, 35, 0, 3020}, | ||||
| [1600040] = {54, 32, 0, 3019}, | ||||
| [1600041] = {64, 34, 0, 3021}, | ||||
| [1600042] = {76, -8, 0, 3022}, | ||||
| [1600043] = {96, -8, 0, 3009}, | ||||
| [1600044] = {97, -8, 0, 3010}, | ||||
| [1600045] = {98, -8, 0, 3011}, | ||||
| [1600046] = {99, -8, 0, 3012}, | ||||
| [1600047] = {100, -8, 0, 3013}, | ||||
| [1600048] = {101, -8, 0, 3014}, | ||||
| [1600049] = {102, -8, 0, 3016}, | ||||
| [1600050] = {103, -8, 0, 3015}, | ||||
| [1600051] = {104, -8, 0, 3017}, | ||||
| [1600052] = {105, -8, 0, 3004}, | ||||
| [1600053] = {106, -8, 0, 3007}, | ||||
| [1600054] = {107, -8, 0, 3018}, | ||||
| [1600055] = {108, -8, 0, 3006}, | ||||
| [1600056] = {109, -8, 0, 3005}, | ||||
| [1600057] = {110, -8, 0, 3002}, | ||||
| [1600058] = {111, -8, 0, 3003}, | ||||
| [1600059] = {112, -8, 0, 3001}, | ||||
| [1600061] = {95, -8, 0, 2009}, | ||||
| [1600062] = {113, -8, 0, 3008}, | ||||
| [1600063] = {114, -8, 0, 4001}, | ||||
| [1600064] = {235, -8, 0, 2023}, | ||||
| [1600065] = {236, -8, 0, 1020}, | ||||
| [1600066] = {237, -8, 0, 3023}, | ||||
| [1600067] = {238, -8, 0, 5007}, | ||||
| [1600068] = {239, -8, 0, 5007}, | ||||
| [1600069] = {240, -1, 0, 5007}, | ||||
| [1600070] = {241, -8, 0, 5008}, | ||||
| [1600071] = {242, -8, 0, 5008}, | ||||
| [1600072] = {243, -8, 0, 5008}, | ||||
| [1600073] = {244, -8, 1, 5009},  | ||||
| [1600074] = {245, -8, 1, 5015}, | ||||
| [1600075] = {246, -8, 1, 5021}, | ||||
| [1600076] = {247, -8, 1, 5027}, | ||||
| [1600077] = {248, -8, 1, 5033}, | ||||
| [1600078] = {249, -8, 1, 5039}, | ||||
| [1600079] = {250, -8, 1, 5045}, | ||||
| [1600080] = {251, -8, 1, 5051}, | ||||
| [1600081] = {252, -8, 1, 5057}, | ||||
| [1600082] = {253, -8, 1, 5063}, | ||||
| [1600083] = {254, -8, 1, 5069}, | ||||
| [1600084] = {255, -8, 1, 5075}, | ||||
| [1600085] = {256, -8, 1, 5081}, | ||||
| [1600086] = {257, -8, 1, 5087}, | ||||
| [1600087] = {258, -8, 1, 5093}, | ||||
| [1600088] = {259, -8, 1, 5099}, | ||||
| [1600089] = {260, -8, 1, 5105}, | ||||
| [1600090] = {261, -8, 1, 5111}, | ||||
| [1600092] = {263, -8, 0, 2024}, | ||||
| [1600093] = {264, -8, 0, 1021}, | ||||
| [1600094] = {265, -8, 0, 3024}, | ||||
| [1600095] = {281, -8, 0, 1005}, | ||||
| [1600096] = {281, -8, 0, 2009}, | ||||
| [1600097] = {281, -8, 0, 4001}, | ||||
| [1600098] = {281, -8, 0, 4002}, | ||||
| [1600099] = {281, -8, 0, 2009}, | ||||
| [1600100] = {281, -2, 2, 0}, | ||||
| [1600101] = {281, -8, 0, 2009}, | ||||
| [1600103] = {281, -8, 0, 3008}, | ||||
| [1600104] = {281, -8, 0, 3008}, | ||||
| [1600107] = {281, -8, 3, 0}, | ||||
| [1600108] = {281, -8, 0, 3008}, | ||||
| [1600109] = {281, -3, 2, 0}, | ||||
| [1600110] = {281, -8, 0, 4001}, | ||||
| [1600111] = {281, -8, 0, 2009}, | ||||
| [1600112] = {281, -8, 0, 4002}, | ||||
| [1600113] = {281, -8, 0, 4001}, | ||||
| [1600117] = {281, -8, 0, 2009}, | ||||
| [1600119] = {281, -2, 3, 0}, | ||||
| [1600120] = {281, -8, 0, 3008}, | ||||
| [1600121] = {281, -8, 0, 2009}, | ||||
| [1600122] = {281, -8, 0, 3008}, | ||||
| [1600125] = {281, -8, 0, 1005}, | ||||
| [1600126] = {281, -8, 0, 3008}, | ||||
| [1600129] = {281, -1, 3, 0}, | ||||
| [1600130] = {281, -8, 0, 4001}, | ||||
| [1600133] = {281, -1, 2, 0}, | ||||
| [1600137] = {281, -8, 0, 1005}, | ||||
| [1600142] = {281, -8, 0, 1005}, | ||||
|  | ||||
| } | ||||
|  | ||||
|  | ||||
| shopRange = {  --shopRangeStart, shopRangeEnd | ||||
| [101] = {101001, 101010}; | ||||
| [102] = {102001, 102010}; | ||||
| [103] = {103001, 103010}; | ||||
| [104] = {104001, 104010}; | ||||
| [105] = {105001, 105010}; | ||||
| [106] = {106001, 106010}; | ||||
| [107] = {107001, 107010}; | ||||
| [108] = {108001, 108017}; | ||||
| [109] = {109001, 109015}; | ||||
| [110] = {110001, 110018}; | ||||
| [111] = {111001, 111018}; | ||||
| [112] = {112001, 112018}; | ||||
| [113] = {113001, 113019}; | ||||
| [114] = {114001, 114015}; | ||||
| [115] = {115001, 115015}; | ||||
| [116] = {116001, 116010}; | ||||
| [117] = {117001, 117010}; | ||||
| [118] = {118001, 118010}; | ||||
| [120] = {120001, 120012}; | ||||
| [121] = {121001, 121012}; | ||||
| [122] = {122001, 122012}; | ||||
| [123] = {123001, 123012}; | ||||
| [124] = {124001, 124012}; | ||||
| [125] = {125001, 125012}; | ||||
| [126] = {126001, 126012}; | ||||
| [127] = {127001, 127012}; | ||||
| [128] = {128001, 128012}; | ||||
| [129] = {129001, 129016}; | ||||
| [130] = {130001, 130012}; | ||||
| [131] = {131001, 131012}; | ||||
| [132] = {132001, 132012}; | ||||
| [133] = {133001, 133012}; | ||||
| [134] = {134001, 134016}; | ||||
| [135] = {135001, 135012}; | ||||
| [136] = {136001, 136012}; | ||||
| [137] = {137001, 137012}; | ||||
| [138] = {138001, 138012}; | ||||
| [139] = {139001, 139012}; | ||||
| [140] = {140001, 140012}; | ||||
| [141] = {141001, 141012}; | ||||
| [142] = {142001, 142012}; | ||||
| [143] = {143001, 143016}; | ||||
| [144] = {144001, 144018}; | ||||
| [145] = {1071001, 1071002}; | ||||
| [146] = {1072001, 1072006}; | ||||
| [1001] = {1001001, 1001008}; | ||||
| [1002] = {1002001, 1002008}; | ||||
| [1003] = {1003001, 1003007}; | ||||
| [1004] = {1004001, 1004002}; | ||||
| [1005] = {1005001, 1005017}; | ||||
| [1006] = {1006001, 1006006}; | ||||
| [1007] = {1007001, 1007010}; | ||||
| [1008] = {1008001, 1008009}; | ||||
| [1009] = {1009001, 1009012}; | ||||
| [1010] = {1010001, 1010014}; | ||||
| [1011] = {1011001, 1011010}; | ||||
| [1012] = {1012001, 1012007}; | ||||
| [1013] = {1013001, 1013011}; | ||||
| [1014] = {1014001, 1014006}; | ||||
| [1015] = {1015001, 1015007}; | ||||
| [1016] = {1016001, 1016016}; | ||||
| [1017] = {1018001, 1018010}; | ||||
| [1018] = {1017001, 1017013}; | ||||
| [1019] = {1019001, 1019005}; | ||||
| [1020] = {1066001, 1066004}; | ||||
| [1021] = {1069001, 1069005}; | ||||
| [2001] = {1020001, 1020008}; | ||||
| [2002] = {1021001, 1021006}; | ||||
| [2003] = {1022001, 1022007}; | ||||
| [2004] = {1023001, 1023008}; | ||||
| [2005] = {1024001, 1024003}; | ||||
| [2006] = {1025001, 1025008}; | ||||
| [2007] = {1026001, 1026006}; | ||||
| [2008] = {1027001, 1027004}; | ||||
| [2009] = {1028001, 1028016}; | ||||
| [2010] = {1029001, 1029009}; | ||||
| [2011] = {1030001, 1030008}; | ||||
| [2012] = {1031001, 1031010}; | ||||
| [2013] = {1032001, 1032010}; | ||||
| [2014] = {1033001, 1033012}; | ||||
| [2015] = {1034001, 1034015}; | ||||
| [2016] = {1035001, 1035013}; | ||||
| [2017] = {1036001, 1036006}; | ||||
| [2018] = {1037001, 1037006}; | ||||
| [2019] = {1038001, 1038008}; | ||||
| [2020] = {1039001, 1039009}; | ||||
| [2021] = {1040001, 1040010}; | ||||
| [2022] = {1041001, 1041005}; | ||||
| [2023] = {1065001, 1065006}; | ||||
| [2024] = {1068001, 1068006}; | ||||
| [3001] = {1042001, 1042008}; | ||||
| [3002] = {1043001, 1043008}; | ||||
| [3003] = {1044001, 1044008}; | ||||
| [3004] = {1045001, 1045008}; | ||||
| [3005] = {1046001, 1046010}; | ||||
| [3006] = {1047001, 1047008}; | ||||
| [3007] = {1048001, 1048006}; | ||||
| [3008] = {1049001, 1049016}; | ||||
| [3009] = {1050001, 1050013}; | ||||
| [3010] = {1051001, 1051008}; | ||||
| [3011] = {1052001, 1052009}; | ||||
| [3012] = {1053001, 1053010}; | ||||
| [3013] = {1054001, 1054006}; | ||||
| [3014] = {1055001, 1055013}; | ||||
| [3015] = {1056001, 1056005}; | ||||
| [3016] = {1057001, 1057008}; | ||||
| [3017] = {1058001, 1058011}; | ||||
| [3018] = {1059001, 1059007}; | ||||
| [3019] = {1060001, 1060011}; | ||||
| [3020] = {1061001, 1061014}; | ||||
| [3021] = {1062001, 1062016}; | ||||
| [3022] = {1063001, 1063004}; | ||||
| [3023] = {1067001, 1067008}; | ||||
| [3024] = {1070001, 1070004}; | ||||
| [4001] = {1064001, 1064011}; | ||||
| [4002] = {1064001, 1064011}; | ||||
| [5001] = {2001001, 2001018}; | ||||
| [5002] = {2002001, 2002006}; | ||||
| [5003] = {2003001, 2003010}; | ||||
| [5004] = {2004001, 2004009}; | ||||
| [5005] = {2005001, 2005010}; | ||||
| [5006] = {2006001, 2006012}; | ||||
| [5007] = {2007001, 2007010}; | ||||
| [5008] = {2008001, 2008016}; | ||||
| [5009] = {2009001, 2009007}; | ||||
| [5010] = {2009101, 2009104}; | ||||
| [5011] = {2009201, 2009204}; | ||||
| [5012] = {2009301, 2009304}; | ||||
| [5013] = {2009401, 2009404}; | ||||
| [5014] = {2009501, 2009504}; | ||||
| [5015] = {2010001, 2010004}; | ||||
| [5016] = {2010101, 2010104}; | ||||
| [5017] = {2010201, 2010204}; | ||||
| [5018] = {2010301, 2010304}; | ||||
| [5019] = {2010401, 2010404}; | ||||
| [5020] = {2010501, 2010504}; | ||||
| [5021] = {2011001, 2011004}; | ||||
| [5022] = {2011101, 2011104}; | ||||
| [5023] = {2011201, 2011204}; | ||||
| [5024] = {2011301, 2011304}; | ||||
| [5025] = {2011401, 2011404}; | ||||
| [5026] = {2011501, 2011504}; | ||||
| [5027] = {2012001, 2012007}; | ||||
| [5028] = {2012101, 2012104}; | ||||
| [5029] = {2012201, 2012204}; | ||||
| [5030] = {2012301, 2012304}; | ||||
| [5031] = {2012401, 2012404}; | ||||
| [5032] = {2012501, 2012504}; | ||||
| [5033] = {2013001, 2013004}; | ||||
| [5034] = {2013101, 2013104}; | ||||
| [5035] = {2013201, 2013204}; | ||||
| [5036] = {2013301, 2013304}; | ||||
| [5037] = {2013401, 2013404}; | ||||
| [5038] = {2013501, 2013504}; | ||||
| [5039] = {2014001, 2014007}; | ||||
| [5040] = {2014101, 2014104}; | ||||
| [5041] = {2014201, 2014204}; | ||||
| [5042] = {2014301, 2014304}; | ||||
| [5043] = {2014401, 2014404}; | ||||
| [5044] = {2014501, 2014504}; | ||||
| [5045] = {2015001, 2015007}; | ||||
| [5046] = {2015101, 2015104}; | ||||
| [5047] = {2015201, 2015204}; | ||||
| [5048] = {2015301, 2015304}; | ||||
| [5049] = {2015401, 2015404}; | ||||
| [5050] = {2015501, 2015504}; | ||||
| [5051] = {2016001, 2016006}; | ||||
| [5052] = {2016101, 2016104}; | ||||
| [5053] = {2016201, 2016204}; | ||||
| [5054] = {2016301, 2016304}; | ||||
| [5055] = {2016401, 2016404}; | ||||
| [5056] = {2016501, 2016504}; | ||||
| [5057] = {2017001, 2017006}; | ||||
| [5058] = {2017101, 2017104}; | ||||
| [5059] = {2017201, 2017204}; | ||||
| [5060] = {2017301, 2017304}; | ||||
| [5061] = {2017401, 2017404}; | ||||
| [5062] = {2017501, 2017504}; | ||||
| [5063] = {2018001, 2018006}; | ||||
| [5064] = {2018101, 2018104}; | ||||
| [5065] = {2018201, 2018204}; | ||||
| [5066] = {2018301, 2018304}; | ||||
| [5067] = {2018401, 2018404}; | ||||
| [5068] = {2018501, 2018504}; | ||||
| [5069] = {2019001, 2019006}; | ||||
| [5070] = {2019101, 2019104}; | ||||
| [5071] = {2019201, 2019204}; | ||||
| [5072] = {2019301, 2019304}; | ||||
| [5073] = {2019401, 2019404}; | ||||
| [5074] = {2019501, 2019504}; | ||||
| [5075] = {2020001, 2020006}; | ||||
| [5076] = {2020101, 2020104}; | ||||
| [5077] = {2020201, 2020204}; | ||||
| [5078] = {2020301, 2020304}; | ||||
| [5079] = {2020401, 2020404}; | ||||
| [5080] = {2020501, 2020504}; | ||||
| [5081] = {2021001, 2021006}; | ||||
| [5082] = {2021101, 2021104}; | ||||
| [5083] = {2021201, 2021204}; | ||||
| [5084] = {2021301, 2021304}; | ||||
| [5085] = {2021401, 2021404}; | ||||
| [5086] = {2021501, 2021504}; | ||||
| [5087] = {2022001, 2022006}; | ||||
| [5088] = {2022101, 2022104}; | ||||
| [5089] = {2022201, 2022204}; | ||||
| [5090] = {2022301, 2022304}; | ||||
| [5091] = {2022401, 2022404}; | ||||
| [5092] = {2022501, 2022504}; | ||||
| [5093] = {2023001, 2023006}; | ||||
| [5094] = {2023101, 2023104}; | ||||
| [5095] = {2023201, 2023204}; | ||||
| [5096] = {2023301, 2023304}; | ||||
| [5097] = {2023401, 2023404}; | ||||
| [5098] = {2023501, 2023504}; | ||||
| [5099] = {2024001, 2024006}; | ||||
| [5100] = {2024101, 2024104}; | ||||
| [5101] = {2024201, 2024204}; | ||||
| [5102] = {2024301, 2024304}; | ||||
| [5103] = {2024401, 2024404}; | ||||
| [5104] = {2024501, 2024504}; | ||||
| [5105] = {2025001, 2025006}; | ||||
| [5106] = {2025101, 2025104}; | ||||
| [5107] = {2025201, 2025204}; | ||||
| [5108] = {2025301, 2025304}; | ||||
| [5109] = {2025401, 2025404}; | ||||
| [5110] = {2025501, 2025504}; | ||||
| [5111] = {2026001, 2026006}; | ||||
| [5112] = {2026101, 2026104}; | ||||
| [5113] = {2026201, 2026204}; | ||||
| [5114] = {2026301, 2026304}; | ||||
| [5115] = {2026401, 2026404}; | ||||
| [5116] = {2026501, 2026504}; | ||||
| [5117] = {2026601, 2026606}; | ||||
| [5118] = {2026701, 2026708}; | ||||
| [5119] = {2026801, 2026808}; | ||||
| [5120] = {2026901, 2026908}; | ||||
| [5121] = {2027001, 2027008}; | ||||
| [5122] = {2027101, 2027110}; | ||||
| [5123] = {2027201, 2027211}; | ||||
| } | ||||
|  | ||||
|  | ||||
| function init(npc) | ||||
|     return false, false, 0, 0;   | ||||
| end | ||||
|  | ||||
| function onEventStarted(player, npc, triggerName) | ||||
|  | ||||
|     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; | ||||
|      | ||||
|     local shopCurrency = 1000001; | ||||
|     local welcomeText = 1; | ||||
|     local menuId = shopInfo[npcId][2]; | ||||
|     local shopCategory = shopInfo[npcId][3]; | ||||
|  | ||||
|     local itemShop = 0; | ||||
|     local classShop = 1; | ||||
|     local weaponShop = 2; | ||||
|     local armorShop = 3; | ||||
|     local hamletShop = 4; | ||||
|      | ||||
|     local weaponShopPack = {5001,5002,5007,5008}; | ||||
|     local armorShopPack = {5004,5005,5006,5003};  | ||||
|      | ||||
|     local menuBuy = 1; | ||||
|     local menuBuyCount = 1;                             -- For Shops with multiple buying categories | ||||
|     local menuSell = 2; | ||||
|     local menuFacility = 3; | ||||
|     local menuTutorial = 4; | ||||
|     local menuClose = -3; | ||||
|     local menuHasFacility = false; | ||||
|     local menuHasTutorial = false; | ||||
|      | ||||
|     local shopPack = shopInfo[npcId][4];                -- Starting value for the shopPack of the current NPC Actor | ||||
|     local chosenShopPackage = 0;                        -- Var to send to openShopMenu() once desired shopPack is determined | ||||
|     local choice;  | ||||
|  | ||||
|     callClientFunction(player, "welcomeTalk", shopInfo[npcId][welcomeText], player); | ||||
|      | ||||
|     while (true) do | ||||
|             | ||||
|         if (shopCategory == itemShop) then          | ||||
|             choice = callClientFunction(player, "selectMode", menuId); | ||||
|             menuHasFacility = true; | ||||
|             menuHasTutorial = true; | ||||
|         elseif (shopCategory == classShop) then    | ||||
|             choice = callClientFunction(player, "selectModeOfClassVendor");                   | ||||
|             menuBuyCount = 6; | ||||
|             menuSell = 0; | ||||
|         elseif (shopCategory == weaponShop) then     | ||||
|             choice = callClientFunction(player, "selectModeOfMultiWeaponVendor", menuId);    | ||||
|             menuBuyCount = 4; | ||||
|             menuSell = 0; | ||||
|         elseif (shopCategory == armorShop) then      | ||||
|             choice = callClientFunction(player, "selectModeOfMultiArmorVendor", menuId);     | ||||
|             menuBuyCount = 4; | ||||
|             menuSell = 0;    | ||||
|         elseif (shopCategory == hamletShop) then | ||||
|             choice = callClientFunction(player, "selectMode", menuId); | ||||
|  | ||||
|             local hamletRegion = shopPack;  | ||||
|             local hamletPackAleport = {5117, 5122, 5123}; | ||||
|             local hamletPackHyrstmill = {5117, 5118, 5119}; | ||||
|             local hamletPackGoldenBazaar = {5117, 5120, 5121}; | ||||
|             local hamletLevel = 3;   -- Defaulting to highest value for now | ||||
|              | ||||
|             if hamletRegion == 5122 then -- Aleport  | ||||
|                 -- hamletLevel = GetHamletStatus(idAleport); | ||||
|                 shopPack = hamletPackAleport[hamletLevel] or 5117; | ||||
|             elseif hamletRegion == 5118 then -- Hyrstmill | ||||
|                 -- hamletLevel = GetHamletStatus(idHyrstmill); | ||||
|                 shopPack = hamletPackHyrstmill[hamletLevel] or 5117; | ||||
|             elseif hamletRegion == 5120 then -- The Golden Bazaar            | ||||
|                 -- hamletLevel = GetHamletStatus(idGoldenBazaar); | ||||
|                 shopPack = hamletPackGoldenBazaar[hamletLevel] or 5117; | ||||
|             end | ||||
|         end | ||||
|  | ||||
|          | ||||
|         if choice and (choice >= menuBuy and choice <= menuBuyCount) then | ||||
|                 --player:SendMessage(0x20,"", "Menu option: "..choice); | ||||
|                  | ||||
|                 if (shopCategory == weaponShop) then | ||||
|                     chosenShopPackage = weaponShopPack[choice]; | ||||
|                 elseif (shopCategory == armorShop) then | ||||
|                     chosenShopPackage = armorShopPack[choice]; | ||||
|                 else | ||||
|                     chosenShopPackage = ((shopPack-1) + choice); | ||||
|                 end | ||||
|  | ||||
|                 openShopMenu( | ||||
|                     player,  | ||||
|                     menuId,  | ||||
|                     chosenShopPackage,  | ||||
|                     shopRange[chosenShopPackage][1], | ||||
|                     shopRange[chosenShopPackage][2],  | ||||
|                     shopCurrency | ||||
|                 );                 | ||||
|                      | ||||
|         elseif (choice == menuSell) then | ||||
|             openSellMenu(player); | ||||
|              | ||||
|         elseif (choice == menuFacility) and (menuHasFacility == true) then | ||||
|             if menuId > 0 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 | ||||
|             end         | ||||
|         elseif (choice == menuTutorial) and (menuHasTutorial == true) then | ||||
|             callClientFunction(player, "startTutorial", nil, menuId);             | ||||
|         end  | ||||
|          | ||||
|         if (choice == menuClose or choice == nil) then | ||||
|             break;   | ||||
|         end  | ||||
|     end | ||||
|      | ||||
|     callClientFunction(player, "finishTalkTurn", player); | ||||
|     player:EndEvent(); | ||||
|      | ||||
| end | ||||
|     | ||||
|  | ||||
|  | ||||
| function openShopMenu(player, menuId, shopPack, itemRangeStart, itemRangeEnd, shopCurrency) | ||||
|  | ||||
|     callClientFunction(player, "openShopBuy", player, shopPack, shopCurrency); | ||||
|      | ||||
|     player:SendMessage(0x20, "", "shopPack: "..shopPack.."   Range: "..itemRangeStart.."-"..itemRangeEnd); | ||||
|  | ||||
|     while (true) do      | ||||
|         buyResult, quantity = callClientFunction(player, "selectShopBuy", player); | ||||
|          | ||||
|         if (buyResult == 0) then | ||||
|             callClientFunction(player, "closeShopBuy", player);                  | ||||
|             break; | ||||
|         else | ||||
|             if itemRangeStart and itemRangeEnd then | ||||
|                 itemChosen =  (itemRangeStart - 1) + buyResult; | ||||
|                  | ||||
|                 if (((itemRangeStart-1) + itemChosen) < itemRangeStart) or (itemChosen > itemRangeEnd) then | ||||
|                         player:SendMessage(0x20, "", "[ERROR] Client selected item exceeds the valid range."); | ||||
|                         callClientFunction(player, "finishTalkTurn", player); | ||||
|                         player:EndEvent(); | ||||
|                         return; | ||||
|                 else | ||||
|                     player:SendMessage(0x20, "", "Item chosen: " .. itemChosen .. "  Quantity: ".. quantity); | ||||
|  | ||||
|                     --[[ | ||||
|                         TO-DO:  Request item information from server table and throw result to purchaseItem() | ||||
|  | ||||
|                         requestItem = GetItemShopInfoThing(itemChosen); | ||||
|                         purchaseItem(player, INVENTORY_NORMAL, requestItem.id, quantity, requestItem.quality, requestItem.price, shopCurrency); | ||||
|                     --]] | ||||
|                 end | ||||
|             end | ||||
|              | ||||
|         end   | ||||
|     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:GetItemPackage(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, shopCurrency); | ||||
|             end | ||||
|         end | ||||
|     end | ||||
| end | ||||
							
								
								
									
										55
									
								
								Data/scripts/shop.lua
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										55
									
								
								Data/scripts/shop.lua
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,55 @@ | ||||
| --[[ | ||||
|  | ||||
| Shop Buy/Sell Functions | ||||
|  | ||||
| --]] | ||||
|  | ||||
| function purchaseItem(player, location, itemId, quantity, quality, price, currency) | ||||
|      | ||||
|     local worldMaster = GetWorldMaster();           | ||||
|     local invCheck = -1; | ||||
|  | ||||
|     if (player:GetItemPackage(INVENTORY_CURRENCY):HasItem(currency, price)) then | ||||
|         invCheck = player:GetItemPackage(location):AddItem(itemId, quantity, quality);  | ||||
|      | ||||
|         if (invCheck == INV_ERROR_FULL) then | ||||
|             -- Your inventory is full. | ||||
|             player:SendGameMessage(player, worldMaster, 60022, MESSAGE_TYPE_SYSTEM); | ||||
|         elseif (invCheck == INV_ERROR_ALREADY_HAS_UNIQUE) 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); | ||||
|         elseif (invCheck == INV_ERROR_SYSTEM_ERROR) then | ||||
|             player:SendMessage(0x20, "", "[DEBUG] Server Error on adding item."); | ||||
|         elseif (invCheck == INV_ERROR_SUCCESS) then | ||||
|             player:GetItemPackage(INVENTORY_CURRENCY):removeItem(currency, price); | ||||
|              | ||||
|             if (currency == 1000001) then  -- If Gil | ||||
|                 -- You purchase <quantity> <itemId> <quality> for <price> gil. | ||||
|                 player:SendGameMessage(player, worldMaster, 25061, MESSAGE_TYPE_SYSTEM, itemId, quality, quantity, price);  | ||||
|              | ||||
|             elseif (currency == 1000201 or currency == 1000202 or currency == 1000203) then  -- If Grand Company seal | ||||
|                 -- You exchange <quantity> <GC seals> for <quantity> <itemId> <quality>. | ||||
|                 player:SendGameMessage(player, worldMaster, 25275, MESSAGE_TYPE_SYSTEM, itemId, quality, quantity, price, player.gcCurrent); | ||||
|                  | ||||
|             elseif (currency >= 1000101 and currency <= 1000123) then -- If Guild mark | ||||
|                 -- You trade <quantity> <itemId> <quality> for <quantity> <itemId> <quality>. | ||||
|                 player:SendGameMessage(player, GetWorldMaster(), 25071, MESSAGE_TYPE_SYSTEM, currency, 1, itemId, 1, price, quantity); | ||||
|             end  | ||||
|         end | ||||
|     else | ||||
|         -- You do not have enough gil.  (Should never see this) | ||||
|         player:SendGameMessage(player, worldMaster, 25065, MESSAGE_TYPE_SYSTEM); | ||||
|     end | ||||
|     return | ||||
| end | ||||
|  | ||||
|  | ||||
| function sellItem(player, itemId, quantity, quality, itemPrice, slot, currency) | ||||
|     local worldMaster = GetWorldMaster(); | ||||
|     local cost = quantity * itemPrice; | ||||
|      | ||||
|     player:GetItemPackage(INVENTORY_CURRENCY):AddItem(currency, cost); | ||||
|     player:GetItemPackage(INVENTORY_NORMAL):RemoveItemAtSlot(slot, quantity);    | ||||
|     -- You sell <quantity> <itemId> <quality> for <cost> gil. | ||||
|     player:SendGameMessage(player, worldMaster, 25075, MESSAGE_TYPE_SYSTEM, itemId, quality, quantity, cost); | ||||
| end | ||||
| @@ -0,0 +1,6 @@ | ||||
|  | ||||
| shopInfo = { | ||||
| welcomeText = 5, | ||||
| shopPack = 3008, | ||||
| tutorialId = 35 | ||||
| } | ||||
| @@ -0,0 +1,6 @@ | ||||
|  | ||||
| shopInfo = { | ||||
| welcomeText = 94, | ||||
| shopPack = 0x67, | ||||
| shopCurrancy = nil | ||||
| } | ||||
| @@ -0,0 +1,7 @@ | ||||
| require ("global") | ||||
|  | ||||
| function onEventStarted(player, npc) | ||||
| 	defaultSea = GetStaticActor("DftSea"); | ||||
| 	callClientFunction(player, "delegateEvent", player, defaultSea, "defaultTalkWithMerchant002_001", nil, nil, nil); | ||||
| 	player:endEvent(); | ||||
| end | ||||
| @@ -0,0 +1,5 @@ | ||||
|  | ||||
| shopInfo = { | ||||
| welcomeText = 97, | ||||
| shopPack = 3010 | ||||
| } | ||||
| @@ -0,0 +1,5 @@ | ||||
|  | ||||
| shopInfo = { | ||||
| welcomeText = 100, | ||||
| shopPack = 3013 | ||||
| } | ||||
| @@ -0,0 +1,5 @@ | ||||
|  | ||||
| shopInfo = { | ||||
| welcomeText = 99, | ||||
| shopPack = 3012 | ||||
| } | ||||
| @@ -0,0 +1,5 @@ | ||||
|  | ||||
| shopInfo = { | ||||
| welcomeText = 98, | ||||
| shopPack = 3011 | ||||
| } | ||||
| @@ -0,0 +1,5 @@ | ||||
|  | ||||
| shopInfo = { | ||||
| welcomeText = 106, | ||||
| shopPack = 3007	 | ||||
| } | ||||
| @@ -0,0 +1,7 @@ | ||||
|  | ||||
| shopInfo = { | ||||
| selectMode = 2, | ||||
| welcomeText = 281, | ||||
| shopPack = {5001, 5002, 5007, 5008}, | ||||
| tutorialId = -1 | ||||
| } | ||||
| @@ -0,0 +1,5 @@ | ||||
|  | ||||
| shopInfo = { | ||||
| welcomeText = 84, | ||||
| shopPack = 3018 | ||||
| } | ||||
| @@ -0,0 +1,7 @@ | ||||
|  | ||||
| shopInfo = { | ||||
| selectMode = 3, | ||||
| welcomeText = 281, | ||||
| shopPack = {5004, 5005, 5006, 5003}, | ||||
| tutorialId = -1 | ||||
| } | ||||
| @@ -0,0 +1,5 @@ | ||||
|  | ||||
| shopInfo = { | ||||
| welcomeText = 103, | ||||
| shopPack = 3015 | ||||
| } | ||||
| @@ -0,0 +1,5 @@ | ||||
|  | ||||
| shopInfo = { | ||||
| welcomeText = 102, | ||||
| shopPack = 3016 | ||||
| } | ||||
| @@ -0,0 +1,5 @@ | ||||
|  | ||||
| shopInfo = { | ||||
| welcomeText = 104, | ||||
| shopPack = 3017 | ||||
| } | ||||
| @@ -0,0 +1,5 @@ | ||||
|  | ||||
| shopInfo = { | ||||
| welcomeText = 112, | ||||
| shopPack = 3001	 | ||||
| } | ||||
| @@ -0,0 +1,5 @@ | ||||
|  | ||||
| shopInfo = { | ||||
| welcomeText = 96, | ||||
| shopPack = 3009 | ||||
| } | ||||
| @@ -0,0 +1,5 @@ | ||||
|  | ||||
| shopInfo = { | ||||
| welcomeText = 105, | ||||
| shopPack = 3004 | ||||
| } | ||||
| @@ -0,0 +1,5 @@ | ||||
|  | ||||
| shopInfo = { | ||||
| welcomeText = 108, | ||||
| shopPack = 3006 | ||||
| } | ||||
| @@ -0,0 +1,5 @@ | ||||
|  | ||||
| shopInfo = { | ||||
| welcomeText = 101, | ||||
| shopPack = 3014 | ||||
| } | ||||
| @@ -0,0 +1,5 @@ | ||||
|  | ||||
| shopInfo = { | ||||
| welcomeText = 237, | ||||
| shopPack = 3023 | ||||
| } | ||||
| @@ -0,0 +1,5 @@ | ||||
|  | ||||
| shopInfo = { | ||||
| welcomeText = 109, | ||||
| shopPack = 3005 | ||||
| } | ||||
| @@ -0,0 +1,6 @@ | ||||
|  | ||||
| shopInfo = { | ||||
| welcomeText = 69, | ||||
| shopPack = 3020, | ||||
| tutorialId = 35 | ||||
| } | ||||
| @@ -0,0 +1,6 @@ | ||||
|  | ||||
| shopInfo = { | ||||
| welcomeText = 64, | ||||
| shopPack = 3021, | ||||
| tutorialId = 34 | ||||
| } | ||||
| @@ -0,0 +1,6 @@ | ||||
|  | ||||
| shopInfo = { | ||||
| welcomeText = 76, | ||||
| shopPack = 3022, | ||||
| tutorialId = 39 | ||||
| } | ||||
| @@ -0,0 +1,6 @@ | ||||
|  | ||||
| shopInfo = { | ||||
| welcomeText = 54, | ||||
| shopPack = 3019, | ||||
| tutorialId = 32 | ||||
| } | ||||
| @@ -0,0 +1,5 @@ | ||||
|  | ||||
| shopInfo = { | ||||
| welcomeText = 265, | ||||
| shopPack = 3024	 | ||||
| } | ||||
| @@ -0,0 +1,5 @@ | ||||
|  | ||||
| shopInfo = { | ||||
| welcomeText = 111, | ||||
| shopPack = 3003 | ||||
| } | ||||
| @@ -0,0 +1,5 @@ | ||||
|  | ||||
| shopInfo = { | ||||
| welcomeText = 110, | ||||
| shopPack = 3002	 | ||||
| } | ||||
		Reference in New Issue
	
	Block a user