mirror of
				https://bitbucket.org/Ioncannon/project-meteor-server.git
				synced 2025-05-20 08:26:59 -04:00 
			
		
		
		
	Cleaned up the new scripting code. Added a helper function to do the yielding automatically. Modified all the scripts to use the new system and added a few new ones.
This commit is contained in:
		| @@ -1,9 +1,3 @@ | ||||
| function init(npc) | ||||
| 	return false, false, 0, 0;	 | ||||
| end | ||||
|  | ||||
| function onEventStarted(player, npc, triggerName) | ||||
| end | ||||
|  | ||||
| function onEventUpdate(player, npc) | ||||
| end | ||||
| @@ -16,23 +16,80 @@ eventTalkChangeOne(skipQuestion) | ||||
| talkOfferMaxOver() | ||||
| askRetryRegionalleve(guildLeveId, leveAllowances); | ||||
|  | ||||
| Menu Ids: | ||||
|  | ||||
| --]] | ||||
|  | ||||
| require ("global") | ||||
|  | ||||
| function init(npc) | ||||
| 	return false, false, 0, 0;	 | ||||
| end | ||||
|  | ||||
| function onEventStarted(player, npc) | ||||
| 	player:RunEventFunction("eventTalkType", 0x30, true, 0x02CE, 0x356, 0x367, true, 0, nil, 0x29, 0,0,0); | ||||
|  | ||||
| 	::MENU_LOOP:: | ||||
| 	menuChoice = callClientFunction(player, "eventTalkType", 0x30, true, 0x02CE, 0x356, 0x367, true, 0, nil, 0x29, 0,0,0);	 | ||||
| 	--Battlecraft | ||||
| 	if (menuChoice == 1) then | ||||
| 		resultGLPack = callClientFunction(player, "eventTalkPack", 201, 207); | ||||
| 		 | ||||
| 		if (resultGLPack == nil) then | ||||
| 			goto MENU_LOOP; | ||||
| 		else | ||||
| 		 | ||||
| 			::CARDS_LOOP:: | ||||
| 			cards = {0x30C3, 0x30C4, 0x30C1, 0x30C5, 0x30C6, 0x30C7, 0x30C8, 0x30C9}; | ||||
| 		 | ||||
| 			chosenGLCard = callClientFunction(player, "eventTalkCard", cards[1], cards[2], cards[3], cards[4], cards[5], cards[6], cards[7], cards[8]); | ||||
| 			 | ||||
| 			if (chosenGLCard == -1) then | ||||
| 				goto MENU_LOOP; | ||||
| 			else | ||||
| 				wasAccepted = callClientFunction(player, "eventTalkDetail", cards[chosenGLCard], 0, 0xF4242, 0xD, 0xF4242, 0, 0, true, 0); | ||||
| 				 | ||||
| 				if (wasAccepted == true) then | ||||
| 				 | ||||
| 				end | ||||
| 				 | ||||
| 				goto CARDS_LOOP; | ||||
| 				 | ||||
| 			end | ||||
| 		end | ||||
| 		 | ||||
| 	--FieldCraft Miner | ||||
| 	elseif (menuChoice == 0x15) then | ||||
| 	--FieldCraft Botanist | ||||
| 	elseif (menuChoice == 0x16) then | ||||
| 	--FieldCraft Fisher | ||||
| 	elseif (menuChoice == 0x17) then | ||||
| 	--FieldCraft Quit | ||||
| 	elseif (menuChoice == 0x18) then | ||||
| 	--Faction Broken Blade | ||||
| 	elseif (menuChoice == 0x29) then | ||||
| 	--Faction Shields | ||||
| 	elseif (menuChoice == 0x2A) then | ||||
| 	--Faction Horn and Hand | ||||
| 	elseif (menuChoice == 0x2B) then | ||||
| 	--Leve Evaluation | ||||
| 	elseif (menuChoice == 5) then | ||||
| 	--Tutorial | ||||
| 	elseif (menuChoice == 6) then | ||||
| 	--End of Info | ||||
| 	elseif (menuChoice == 7) then	 | ||||
| 	--Quit | ||||
| 	elseif (menuChoice == 8) then	 | ||||
| 	end | ||||
| 	 | ||||
| 	-- | ||||
| 	-- | ||||
| 	-- | ||||
| 	player:EndEvent(); | ||||
| end | ||||
|  | ||||
| function onEventUpdate(player, npc, step, menuOptionSelected) | ||||
| 	--player:RunEventFunction("eventTalkType", 0x32, true, 0x02CE, 0x356, 0x367, false, 2, nil, 0x29, 0,0,0); | ||||
| 	player:RunEventFunction("eventTalkPack", 201, 207); | ||||
| 	--player:RunEventFunction("eventTalkCard", 0x30C3, 0x30C4, 0x30C1, 0x30C5, 0x30C6, 0x30C7, 0x30C8, 0x30C9); | ||||
| 	--player:RunEventFunction("eventTalkDetail", 0x30C4, 2, 0xF4242, 0xD, 0xF4242, 0, 0xFF, true, 11); | ||||
| 	-- | ||||
| 	--player:RunEventFunction("eventGLChangeDetail", 0xDEAD, 0x30C4, 0xFF, 0xF4242, 0xD, 0xF4242, 0, 2, true); | ||||
| 	player:EndEvent();	 | ||||
| 	 | ||||
| end | ||||
| @@ -1,28 +1,56 @@ | ||||
| --[[ | ||||
|  | ||||
| PopulaceLinkshellManager Script | ||||
|  | ||||
| Functions: | ||||
|  | ||||
| eventTalkStep1(noLinkshellActive) - Says intro. If noLinkshellActive = true, say newbie stuff. | ||||
| eventTalkStep2(noLinkshellActive) - Shows menu, if noLinkshellActive = true, only give ability to make linkshell. | ||||
| eventTalkStepMakeupDone() - Confirm when creating LS | ||||
| eventTalkStepModifyDone() - Confirm when modding LS | ||||
| eventTalkStepBreakDone() - Confirm when deleting LS | ||||
|  | ||||
| --]] | ||||
|  | ||||
| require ("global") | ||||
|  | ||||
| function init(npc) | ||||
| 	return false, false, 0, 0; | ||||
| end | ||||
|  | ||||
| function onEventStarted(player, npc) | ||||
| 	isNew = false; | ||||
| 	player:RunEventFunction("eventTalkStep1", isNew); | ||||
| function createLinkshell(name, crest) | ||||
| 	 | ||||
| end | ||||
|  | ||||
| function onEventUpdate(player, npc, step, menuOptionSelected, lsName, lsCrest) | ||||
|  | ||||
| 	if (menuOptionSelected == nil) then | ||||
| 		player:EndEvent(); | ||||
| 		return; | ||||
| 	end | ||||
|  | ||||
| 	isNew = false; | ||||
| 	if (menuOptionSelected == 1) then | ||||
| 		player:RunEventFunction("eventTalkStep2", isNew); | ||||
| 	elseif (menuOptionSelected == 10) then | ||||
| 		player:EndEvent(); | ||||
| 		return; | ||||
| 	elseif (menuOptionSelected == 3) then | ||||
| 		--createLinkshell | ||||
| 		player:RunEventFunction("eventTalkStepMakeupDone", isNew); | ||||
| 	end	 | ||||
| function modifyLinkshell(name, crest) | ||||
| 	 | ||||
| end | ||||
|  | ||||
| function disbandLinkshell(name, crest) | ||||
| 	 | ||||
| end | ||||
|  | ||||
| function onEventStarted(player, npc, triggerName) | ||||
|  | ||||
| 	hasNoActiveLS = false; | ||||
| 	 | ||||
| 	callClientFunction(player, "eventTalkStep1", hasNoActiveLS); | ||||
| 	command, lsName, crestId = callClientFunction(player, "eventTalkStep2", hasNoActiveLS); | ||||
| 	 | ||||
| 	--Create | ||||
| 	if (result == 3) then | ||||
| 		createLinkshell(lsName, crestId); | ||||
| 		callClientFunction(player, "eventTalkStepMakeupDone");		 | ||||
| 	--Modify | ||||
| 	elseif (result == 1) then | ||||
| 		modifyLinkshell(lsName, crestId); | ||||
| 		callClientFunction(player, "eventTalkStepModifyDone");		 | ||||
| 	--Disband | ||||
| 	elseif (result == 5) then | ||||
| 		disbandLinkshell(lsName, crestId); | ||||
| 		callClientFunction(player, "eventTalkStepBreakDone");	 | ||||
| 	end | ||||
| 	 | ||||
| 	player:endEvent(); | ||||
| 		 | ||||
| end | ||||
| @@ -0,0 +1,77 @@ | ||||
| --[[ | ||||
|  | ||||
| PopulaceRetainerManager Script | ||||
|  | ||||
| Functions: | ||||
|  | ||||
| eventTalkStep1(true) - Intro tutorial if no retainer | ||||
| newEventTalkStep1(sayIntro) - Seems to be a post-Tanaka version of the intro???? | ||||
| eventTalkStep2() - Choose retainer yourself (go to race select) or let npc do it | ||||
| eventTaklSelectCutSeane(cutsceneName, actorClassId1, actorClassId2, actorClassId3, actorClassId4, actorClassId5) - Starts the advance cutscene to choose a retainer. 5 retainer actorClassId's are given. | ||||
| eventTalkStep4(actorClassId) - Opens up the retainer naming dialog | ||||
| eventTalkStepFinalAnswer(actorClassId) - Confirm Dialog | ||||
| eventTalkStepError(errorCode) - Error dialog, 1: No Extra Retainers, 2: Server Busy. | ||||
| eventTalkStepFinish() | ||||
|  | ||||
| --]] | ||||
|  | ||||
| require ("global") | ||||
|  | ||||
| function init(npc) | ||||
| 	return false, false, 0, 0;	 | ||||
| end | ||||
|  | ||||
| function onEventStarted(player, npc, triggerName) | ||||
| 	 | ||||
| 	introChoice = callClientFunction(player, "newEventTalkStep1", false); | ||||
| 	 | ||||
| 	if (introChoice == 1) then			 | ||||
| 					 | ||||
| 		raceChoice = callClientFunction(player, "eventTalkStep2"); | ||||
| 		 | ||||
| 		while (true) do	 | ||||
| 		 | ||||
| 			if (retainerChoice == 0) then			 | ||||
| 				raceChoice = callClientFunction(player, "eventTalkStep22");	 | ||||
| 			end | ||||
| 			 | ||||
| 			if (raceChoice == 0) then | ||||
| 				--Choose random actorId | ||||
| 			elseif (raceChoice > 0) then						 | ||||
| 				--Choose 5 random but correct actor ids			 | ||||
| 				retainerChoice = callClientFunction(player, "eventTaklSelectCutSeane", "rtn0g010", 0x2DCB1A, 0x2DCB1A, 0x2DCB1A, 0x2DCB1A, 0x2DCB1A); | ||||
| 				 | ||||
| 				if (retainerChoice == -1) then | ||||
| 					player:EndEvent(); | ||||
| 					return;				 | ||||
| 				elseif (retainerChoice > 0) then				 | ||||
| 					--Retainer chosen, choose name				 | ||||
| 					retainerName = callClientFunction(player, "eventTalkStep4", 0x2DCB1A); | ||||
| 					 | ||||
| 					if (retainerName ~= "") then | ||||
| 						confirmChoice = callClientFunction(player, "eventTalkStepFinalAnswer", 0x2DCB1A); | ||||
| 						 | ||||
| 						if (confirmChoice == 1) then | ||||
| 							callClientFunction(player, "eventTalkStepFinish"); | ||||
| 							player:EndEvent(); | ||||
| 							return; | ||||
| 						elseif (confirmChoice == 3) then | ||||
| 							raceChoice = 0; | ||||
| 						else | ||||
| 							player:EndEvent(); | ||||
| 							return; | ||||
| 						end | ||||
| 						 | ||||
| 					end | ||||
| 					 | ||||
| 				end	 | ||||
| 			else | ||||
| 				break; | ||||
| 			end		 | ||||
| 				 | ||||
| 		end | ||||
| 		 | ||||
| 	end | ||||
| 	 | ||||
| 	player:EndEvent(); | ||||
| end | ||||
| @@ -1,3 +1,5 @@ | ||||
| require ("global") | ||||
|  | ||||
| function init(npc) | ||||
| 	return false, false, 0, 0;	 | ||||
| end | ||||
| @@ -44,12 +46,10 @@ function onEventStarted(player, npc) | ||||
| 		saySheetId = 19; | ||||
| 	end | ||||
|  | ||||
| 	player:RunEventFunction("welcomeTalk", nil, saySheetId, player); | ||||
| 	coroutine.yield(); | ||||
| 	callClientFunction(player, "welcomeTalk", nil, saySheetId, player); | ||||
| 	 | ||||
| 	while (true) do	 | ||||
| 		player:RunEventFunction("selectMode", nil, npc:GetActorClassId(), false, 1000001); --Step 2, state your business | ||||
| 		choice = coroutine.yield(); | ||||
| 		choice = callClientFunction(player, "selectMode", nil, npc:GetActorClassId(), false, 1000001); --Step 2, state your business | ||||
| 		 | ||||
| 		if (choice == 3) then | ||||
| 			 | ||||
| @@ -60,17 +60,4 @@ function onEventStarted(player, npc) | ||||
| 		 | ||||
| 	end | ||||
| 	 | ||||
| end | ||||
|  | ||||
| function onEventUpdate(player, npc, step, menuOptionSelected) | ||||
| 	 | ||||
| 	--player:RunEventFunction("cashbackTalkCommand", 22004, 22004, 22004, 22004, 22004, 22004, 22004, 22004, 22004, 22004, 22004); --Refund Abilities??? | ||||
| 	--player:RunEventFunction("cashbackTalk", 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1); --Refund items??? | ||||
| 	 | ||||
| 	if (menuOptionSelected == 4) then | ||||
| 		player:EndEvent(); | ||||
| 	else | ||||
| 		player:RunEventFunction("selectMode", nil, npc:GetActorClassId(), false, 1000001); --Step 2, state your business | ||||
| 	end | ||||
| 	 | ||||
| end | ||||
| @@ -29,11 +29,7 @@ finishTalkTurn() - Done at the end. | ||||
|  | ||||
| --]] | ||||
|  | ||||
| function callClientFunction(player, functionName, ...) | ||||
| 	player:RunEventFunction(functionName, ...); | ||||
| 	result = coroutine.yield(); | ||||
| 	return result; | ||||
| end | ||||
| require ("global") | ||||
|  | ||||
| function init(npc) | ||||
| 	return false, false, 0, 0;	 | ||||
|   | ||||
		Reference in New Issue
	
	Block a user