mirror of
				https://bitbucket.org/Ioncannon/project-meteor-server.git
				synced 2025-05-20 08:26:59 -04:00 
			
		
		
		
	Merge branch 'Jorge/quest_system' into ioncannon/quest_system
This commit is contained in:
		| @@ -2,29 +2,94 @@ require("global"); | ||||
|  | ||||
| properties = { | ||||
|     permissions = 0, | ||||
|     parameters = "ddd", | ||||
|     parameters = "dddd", | ||||
|     description = | ||||
| [[ | ||||
| Sets anim id for current target | ||||
| !anim <animID> | | ||||
| !anim <category> <effect> <motion> | ||||
| ]], | ||||
|  | ||||
| } | ||||
|  | ||||
| function onTrigger(player, argc, aType, a1, a2) | ||||
| 	npc = player;--GetWorldManager():GetActorInWorldByUniqueId("test"); | ||||
| 	 | ||||
| 	aType = tonumber(aType); | ||||
| 	a1 = tonumber(a1); | ||||
| 	a2 = tonumber(a2); | ||||
| 	 | ||||
| 	a1 = bit32.band(a1, 0xFFF); | ||||
| 	a2 = bit32.band(a2, 0xFFF); | ||||
| 	aType = bit32.band(aType, 0xFF); | ||||
| 	 | ||||
| 	animId = bit32.bor(bit32.lshift(a2, 12), a1); | ||||
| 	animId = bit32.bor(bit32.lshift(aType, 24), animId); | ||||
| 		 | ||||
| 	print("AHHH"); | ||||
| 	player:PlayAnimation(0x10005000); | ||||
| end; | ||||
|  | ||||
|     local actor = player.CurrentArea.FindActorInArea(player.currentTarget) or nil; | ||||
|      | ||||
|     if (player and actor) then | ||||
|         a1 = bit32.band(a1, 0xFFF); | ||||
|         a2 = bit32.band(a2, 0xFFF); | ||||
|         aType = bit32.band(aType, 0xFF); | ||||
|              | ||||
|         animId = bit32.bor(bit32.lshift(a2, 12), a1); | ||||
|         animId = bit32.bor(bit32.lshift(aType, 24), animId); | ||||
|         -- player:SendMessage(0x20, "[anim] ", tostring(animId)); | ||||
|         actor:PlayAnimation(animId); | ||||
|         local output = string.format("%x", animId)  | ||||
|         player:SendMessage(0x20, "[anim] ", "0x"..tostring(output).. " Target:"..tostring(actor)); | ||||
|     end | ||||
| end | ||||
|  | ||||
|  | ||||
| --[[ Categories: | ||||
| 1 MGK: 01         - Magic | ||||
| 2 SYS: 02         - System noises | ||||
| 3 ETC: 03         - ??  - Item sound? | ||||
| 4 LIB: 04         - Posing animations | ||||
| 5-9 ITM: 05-09      - Items | ||||
| 10 KAO: 0A         - KAO = Face emotes? | ||||
| 11-12 GLI1/2/3: 0B/0C - Leve card things | ||||
| 13 CBI: 0D      - Two small effects | ||||
| 14 ABL: 0E      - Cooldown buffs | ||||
| 15 POP: 0F      - Warp effects | ||||
| 16 CFT: 10      - Crafting? | ||||
| 17 BTL: 11      - More Crafting? | ||||
| 18 WSC: 12      - Weapon Skills   Arg1 - Weapon Skill  Arg2 - Player Animation | ||||
| 19 WSS: 13      - Mob animations | ||||
| 20 PIC: 14      - Gathering weapons? | ||||
| 21 LIU: 15      - Player Hand Emotes | ||||
| 22 LIN: 16      - Doesn't exist? | ||||
| 23 LIF: 17      - Doesn't exist? | ||||
| 24 LIL: 18      - Mouth | ||||
| 25 ATK: 19      - Autoattacks | ||||
|  | ||||
| 33 = ? | ||||
| 34 = Crash | ||||
| 120 = ??? | ||||
|  | ||||
|  | ||||
| Notes: | ||||
| ------ | ||||
| CATEGORY | ||||
| Shift 18 bits right | ||||
| CMP 0xB | ||||
|  | ||||
| ANIMATION?????? | ||||
| Shift 0xC bits right | ||||
| AND 0x0FFF | ||||
|  | ||||
| PARTICLE EFFECT | ||||
| AND 0x0FFF | ||||
| This number is in the subfolder (wsc, abi, etc) | ||||
|  | ||||
|  | ||||
| That 12 is: | ||||
|  | ||||
| CMP 7C | ||||
| CMP 6f | ||||
| CMP 70 | ||||
| CMP 71 | ||||
|  | ||||
| 7C000062 | ||||
| ec000000 | ||||
| 00FFFFFF | ||||
|  | ||||
| 19: Auto Attack?     | ||||
| 6F: Casting | ||||
| 71: Seems to deal with signaling monster parts | ||||
| 7C: Sheath/Unsheath | ||||
| 7F: Cast failed | ||||
|  | ||||
| --]] | ||||
|  | ||||
|  | ||||
|   | ||||
| @@ -3,15 +3,15 @@ properties = { | ||||
|     parameters = "ss", | ||||
|     description = | ||||
| [[ | ||||
| Plays music <id> to player. | ||||
| Plays music <id> to player, otherwise resets to the zone's music. | ||||
| !music | ||||
| !music <id> | ||||
| !music <id> <transition_type> | ||||
| ]], | ||||
| } | ||||
|  | ||||
| function onTrigger(player, argc, music, transition) | ||||
|     music = tonumber(music) or 0; | ||||
|     music = tonumber(music) or player.currentArea.bgmDay or 0; | ||||
|     transition = tonumber(transition) or nil; | ||||
|     player:SendMessage(0x20, "", tostring(argc).." "..tostring(music).." "..tostring(transition)); | ||||
|     player:ChangeMusic(music, transition); | ||||
| end; | ||||
| @@ -38,7 +38,8 @@ horizontal = { | ||||
| rotation = { | ||||
| ["ROTATE"] = 3, | ||||
| ["ORIENTATION"] = 3, | ||||
| ["O"] = 3 | ||||
| ["O"] = 3, | ||||
| ["ROT"] = 3 | ||||
| } | ||||
|  | ||||
| function onTrigger(player, argc, arg1, arg2) | ||||
|   | ||||
| @@ -5,166 +5,207 @@ properties = { | ||||
|     parameters = "ssss", | ||||
|     description = | ||||
| [[ | ||||
| Add/Remove Quests, modify <phase> and <flag 0-32>. | ||||
| !quest add/remove <quest> | | ||||
| !quest phase <quest> <phase> | | ||||
| !quest flag <quest> <flag> true/false | | ||||
| Add/Remove/Complete Quests, modify <sequence> and <flag 0-32>. | ||||
| !quest <quest> <add/remove> <#> | | ||||
| !quest <quest> <sequence> <#> | | ||||
| !quest <quest> <flag> <#> true/false | | ||||
| ]], | ||||
| } | ||||
|  | ||||
| function onTrigger(player, argc, command, var1, var2, var3) | ||||
| function onTrigger(player, argc, quest, command, var1, var2) | ||||
|  | ||||
|     local messageID = MESSAGE_TYPE_SYSTEM_ERROR; | ||||
|     local sender = "[quest] "; | ||||
|     local message = "Error"; | ||||
|     local questId = tonumber(quest); | ||||
|      | ||||
| 			print(tostring(argc)); | ||||
|     if player then | ||||
|         if argc == 2 then | ||||
|             if command == "add" or command == "give" or command == "+" then | ||||
|                 if tonumber(var1) then	 | ||||
|                     if player:HasQuest(tonumber(var1)) == false then | ||||
|                         player:AddQuest(tonumber(var1)); | ||||
|                         message = ("adding quest "..var1); | ||||
|                     else | ||||
|                         message = ("already have quest "..var1); | ||||
|                     end | ||||
|                 else | ||||
|                     if player:HasQuest(var1) == false then | ||||
|                         player:AddQuest(var1); | ||||
|                         message = ("adding quest "..var1); | ||||
|                     else  | ||||
|                         message = ("already have quest "..var1); | ||||
|                     end | ||||
|                 end | ||||
|                  | ||||
|             elseif command == "remove" or command == "delete" or command == "-" then | ||||
|                 if tonumber(var1) and player:HasQuest(tonumber(var1)) == true then | ||||
|                     player:RemoveQuest(tonumber(var1)); | ||||
|                     message = ("removing quest "..var1); | ||||
|                 else | ||||
|                     if player:HasQuest(var1) == true then   | ||||
|                        q2 = GetStaticActor(var1); | ||||
|                         | ||||
|                         if q2 ~= nil then  | ||||
|                         q3 = q2.Id; | ||||
|                             message = ("removing quest "..var1); | ||||
|                             printf(q3); | ||||
|                             q4 = bit32.band(q3, 0xA0F00000); | ||||
|                             printf(q4); | ||||
|                              | ||||
|                             player:RemoveQuest(quest.Name); | ||||
|                         end | ||||
|                     else | ||||
|                         message = ("remove error: either incorrect ID or quest "..var1.." isn't active on character"); | ||||
|                     end | ||||
|                 end | ||||
| 			elseif command == "info" then | ||||
| 				if tonumber(var1) then	 | ||||
|                     if player:HasQuest(tonumber(var1)) then | ||||
|                         quest = player:GetQuest(tonumber(var1));										 | ||||
|  | ||||
| 						local flagStr = ""; | ||||
| 						for i=0,31,1 do  | ||||
| 							if (quest:GetData():GetFlag(i)) then | ||||
| 								flagStr = flagStr .. "O"; | ||||
| 							else | ||||
| 								flagStr = flagStr .. "X"; | ||||
| 							end | ||||
| 							if (i == 15) then | ||||
| 								flagStr = flagStr .. "\n"; | ||||
| 							end | ||||
| 						end | ||||
| 						 | ||||
| 						local data = quest:GetData(); | ||||
| 						 | ||||
| 						message = string.format("\nInfo for quest %s [%d]\n", quest.Name, quest:GetQuestId()); | ||||
| 						message = message .. string.format("Current Sequence: %d\n", quest:getSequence()); | ||||
| 						message = message .. string.format("Flags: \n%s\n", flagStr) | ||||
| 						message = message .. string.format("Counters: %d,%d,%d,%d", data:getCounter(0), data:getCounter(1), data:getCounter(2), data:getCounter(3)); | ||||
|                     else | ||||
|                         message = ("Quest not active: "..var1); | ||||
|                     end | ||||
|                 else					 | ||||
|                     message = ("error: invalid parameters used"); | ||||
|                 end | ||||
|     if (type(questId) == "number") then | ||||
|         if (questId < 110001 or questId > 110001 + 2048) and player then | ||||
|             player:SendMessage(messageID, sender, "Invalid questId entered"); | ||||
|             player:SendMessage(messageID, sender, argc); | ||||
|             return; | ||||
|         else | ||||
|             if (command == "add" or command == "give" or command == "+") then | ||||
|                 message = addQuest(player, questId); | ||||
|             elseif (command == "remove" or command == "delete" or command == "-") then | ||||
|                 message = removeQuest(player, questId); | ||||
|             elseif (command == "complete" or command == "completed" or command == "finish") then | ||||
|                 message = setQuestCompletion(player, argc, questId, var1); | ||||
|             elseif (command == "info") then | ||||
|                 message = getQuestInfo(player, questId); | ||||
|             elseif (command == "seq" or command == "sequence") then | ||||
|                 message = setQuestSequence(player, questId, tonumber(var1)); | ||||
|             elseif (command == "flag") then | ||||
|                 message = setQuestFlag(player, questId, var1, var2); | ||||
|             elseif (command == "counter" or command == "count") then | ||||
|                 message = setQuestCounter(player, questId, var1, var2); | ||||
|             else | ||||
|                 message = ("error: command "..command.." not recognized"); | ||||
|             end                 | ||||
|         elseif argc == 3 then | ||||
|             if command == "seq" or command == "sequence" then | ||||
|                 if (tonumber(var1) and tonumber(var2)) ~= nil then | ||||
|                     if player:HasQuest(tonumber(var1)) == true then | ||||
|                         player:GetQuest(tonumber(var1)):StartSequence(tonumber(var2)); | ||||
|                         message = ("changing sequence of quest "..var1.." to "..var2); | ||||
|                     else | ||||
|                         message = ("sequence error: either incorrect ID or quest "..var1.." isn't active on character"); | ||||
|                     end | ||||
|                 else | ||||
|                     message = ("error: invalid parameters used"); | ||||
|                 end | ||||
|             else | ||||
|                 message = ("error: command "..command.." not recognized"); | ||||
|             end; | ||||
|          | ||||
|         elseif argc == 4 then | ||||
|             if command == "flag" then | ||||
|                 if tonumber(var1) and (tonumber(var2) >= 0 and tonumber(var2) <= 32) then | ||||
|                     questvar = tonumber(var1); | ||||
|                     flagvar = (tonumber(var2)); | ||||
|                     boolvar = 0;               | ||||
|                      | ||||
|                     if var3 == "true" or var3 == "1" or var3 == "on" or var3 == "O" then | ||||
|                         boolvar = true;                        | ||||
|                     elseif var3 == "false" or var3 == "0" or var3 == "off" or var3 == "X" then | ||||
|                         boolvar = false; | ||||
|                     elseif var3 == "flip" or var3 == "toggle" then | ||||
|                         if player:HasQuest(questvar) == true then | ||||
|                             boolvar = not player:GetQuest(questvar):GetData():GetFlag(flagvar); | ||||
|                         end | ||||
|                     else | ||||
|                         message = ("error: flag: boolean not recognized"); | ||||
|                         print(sender..message); | ||||
|                         return; | ||||
|                     end | ||||
|                      | ||||
|                     var4 =  player:GetQuest(questvar):GetData():GetFlag(flagvar); | ||||
|                      | ||||
|                     if var4 ~= boolvar then | ||||
| 						if (boolvar == true) then | ||||
| 							player:GetQuest(questvar):GetData():SetFlag(flagvar); | ||||
| 						else | ||||
| 							player:GetQuest(questvar):GetData():ClearFlag(flagvar); | ||||
| 						end | ||||
|                         player:GetQuest(questvar):UpdateENPCs(); | ||||
|                         player:GetQuest(questvar):GetData():Save();	 | ||||
|                         if boolvar == true then | ||||
|                             message = ("changing flag "..tonumber(var2).." to true on quest "..questvar); | ||||
|                         else | ||||
|                             message = ("changing flag "..tonumber(var2).." to false on quest "..questvar); | ||||
|                         end | ||||
|                     else | ||||
|                         message = ("error: flag "..flagvar.." is already set to that state on quest "..questvar); | ||||
|                     end     | ||||
|                 else | ||||
|                     message = ("error: command "..command.." not recognized"); | ||||
|                 end | ||||
| 			elseif command == "counter" then | ||||
|                 if tonumber(var1) and (tonumber(var2) >= 0 and tonumber(var2) <= 4) then | ||||
|                     questvar = tonumber(var1); | ||||
|                     index = (tonumber(var2)); | ||||
|                      | ||||
| 					player:GetQuest(questvar):GetData():SetCounter(index, tonumber(var3)); | ||||
| 					player:GetQuest(questvar):UpdateENPCs(); | ||||
| 					player:GetQuest(questvar):GetData():Save();	 | ||||
| 					message = ("changing counter "..tonumber(var2).." to "..var3); | ||||
|                 else | ||||
|                     message = ("error: command "..command.." not recognized"); | ||||
|                 end | ||||
|             end	 | ||||
|                 message = ("Error: Command "..command.." not recognized"); | ||||
|             end  | ||||
|         end | ||||
|     else | ||||
|         message = ("Error: Quest id must be a valid number.") | ||||
|     end | ||||
|      | ||||
|     player:SendMessage(messageID, sender, message); | ||||
|     print(sender..message); | ||||
| end | ||||
| end | ||||
|  | ||||
|  | ||||
|  | ||||
| function addQuest(player, questId) | ||||
|     if (not (player:HasQuest(questId))) then | ||||
|         player:AddQuest(questId); | ||||
|         return string.format("Adding quest "..player:GetQuest(questId).name.." ["..questId.."]"); | ||||
|     else | ||||
|         return string.format("Already have quest "..player:GetQuest(questId).name.." ["..questId.."]"); | ||||
|     end | ||||
| end | ||||
|  | ||||
| function removeQuest(player, questId) | ||||
|     if (player:HasQuest(questId)) then | ||||
|         local questName = player:GetQuest(questId).name; | ||||
|         player:RemoveQuest(questId); | ||||
|         return string.format("Removing quest "..questName.." ["..questId.."]"); | ||||
|     else | ||||
|         return string.format("Error: Either incorrect ID or quest "..questId.." isn't active on character."); | ||||
|     end | ||||
| end | ||||
|  | ||||
| function setQuestCompletion(player, argc, questId, flag) | ||||
|      | ||||
|     if (argc == 2) then -- No flag entered -> Return state of the quest's completion. | ||||
|         return string.format("Quest %d completion is set to: %s", questId, tostring(player:IsQuestCompleted(questId))); | ||||
|     else  | ||||
|         local boolFlag = false; | ||||
|          | ||||
|         if (flag == "true" or flag == "1" or flag == "on" or flag == "O") then | ||||
|             boolFlag = true; | ||||
|         elseif (flag == "false" or flag == "0" or flag == "off" or flag == "X") then | ||||
|             boolFlag = false; | ||||
|         elseif flag == "flip" or flag == "toggle" then | ||||
|             boolFlag = not player:IsQuestCompleted(questId); | ||||
|         else -- A catch for bad inputs | ||||
|             return string.format("Error: Invalid flag entered"); | ||||
|         end | ||||
|          | ||||
|         player:SetQuestComplete(questId, boolFlag);		 | ||||
|         return string.format("Quest %d completion set to: %s", questId, tostring(player:IsQuestCompleted(questId))); | ||||
|  | ||||
|     end | ||||
| end | ||||
|  | ||||
| function setQuestSequence(player, questId, sequence) | ||||
|     if (type(sequence) == "number") then | ||||
|         if (player:HasQuest(questId)) then | ||||
|             local seq = math.floor(tonumber(sequence)); | ||||
|             if (seq >= 0 and seq <= 65535) then | ||||
|                 player:GetQuest(questId):StartSequence(seq); | ||||
|                 return string.format("Changing sequence of quest "..player:GetQuest(questId).name.." ["..questId.."] to "..seq); | ||||
|             else | ||||
|                 return string.format("Error: Sequence value must be within 0-65535.");  | ||||
|             end | ||||
|         else | ||||
|             return string.format("Sequence error: either incorrect ID or quest "..questId.." isn't active on character"); | ||||
|         end | ||||
|     else | ||||
|         return string.format("Error: Sequence value must be a valid number."); | ||||
|     end | ||||
| end | ||||
|  | ||||
| function setQuestFlag(player, questId, flagNum, flagCmd) | ||||
|     local questvar = questId; | ||||
|     local flagvar = tonumber(flagNum); | ||||
|     local boolvar = 0; | ||||
|  | ||||
|     if (player:HasQuest(questvar)) then | ||||
|         if (flagvar >= 0 and flagvar <= 31) then | ||||
|               | ||||
|             if flagCmd == "true" or flagCmd == "1" or flagCmd == "on" or flagCmd == "O" then | ||||
|                 boolvar = true;                        | ||||
|             elseif flagCmd == "false" or flagCmd == "0" or flagCmd == "off" or flagCmd == "X" then | ||||
|                 boolvar = false; | ||||
|             elseif flagCmd == "flip" or flagCmd == "toggle" then | ||||
|                 boolvar = not player:GetQuest(questvar):GetData():GetFlag(flagvar); | ||||
|             else | ||||
|                 return "Error: Flag: Boolean not recognized." | ||||
|             end | ||||
|  | ||||
|             currentFlagState =  player:GetQuest(questvar):GetData():GetFlag(flagvar); | ||||
|              | ||||
|             if (currentFlagState ~= boolvar) then | ||||
|                  | ||||
|                 if (boolvar == true) then | ||||
|                     player:GetQuest(questvar):GetData():SetFlag(flagvar); | ||||
|                 else | ||||
|                     player:GetQuest(questvar):GetData():ClearFlag(flagvar); | ||||
|                 end | ||||
|                 player:GetQuest(questvar):UpdateENPCs(); | ||||
|                 player:GetQuest(questvar):GetData():Save();	 | ||||
|                 if boolvar == true then | ||||
|                     return string.format("Changing flag "..tonumber(flagNum).." to true on quest "..questvar); | ||||
|                 else | ||||
|                     return string.format("Changing flag "..tonumber(flagNum).." to false on quest "..questvar); | ||||
|                 end | ||||
|             else | ||||
|                 return string.format("Error: Flag "..flagvar.." is already set to that state on quest "..questvar); | ||||
|             end   | ||||
|         else | ||||
|             return string.format("Error: Flag "..flagNum.." is not within the valid range of 0-31."); | ||||
|         end | ||||
|     else | ||||
|         return string.format("Error: Either incorrect ID or quest "..tostring(questId).." isn't active on character.");  | ||||
|     end         | ||||
|      | ||||
| end | ||||
|  | ||||
| function setQuestCounter(player, questId, counterSlot, counterValue) | ||||
|     local cSlot = tonumber(counterSlot) or nil; | ||||
|     local cVal = tonumber(counterValue) or nil; | ||||
|      | ||||
|     if (cSlot ~= nil and cSlot >= 0 and cSlot <= 3) then | ||||
|         if (cVal ~= nil and cVal >= 0 and cVal <= 255) then | ||||
|             player:GetQuest(questId):GetData():SetCounter(cSlot, cVal); | ||||
|             player:GetQuest(questId):UpdateENPCs(); | ||||
|             player:GetQuest(questId):GetData():Save();	 | ||||
|  | ||||
|             return string.format("Changing counter "..cSlot.." to "..cVal); | ||||
|         else | ||||
|             return string.format("Error: Invalid counter value.  Must be between 0-255."); | ||||
|         end | ||||
|     else | ||||
|         return string.format("Error: Invalid counter index.  Must be between 0-3."); | ||||
|     end | ||||
| end | ||||
|  | ||||
|  | ||||
| function getQuestInfo(player, questId) | ||||
|     if player:HasQuest(questId) then | ||||
|         quest = player:GetQuest(questId);										 | ||||
|  | ||||
|         local msg = ""; | ||||
|         local flagStr = ""; | ||||
|          | ||||
|         for i=0,31,1 do  | ||||
|             if (quest:GetData():GetFlag(i)) then | ||||
|                 flagStr = flagStr .. "O"; | ||||
|             else | ||||
|                 flagStr = flagStr .. "X"; | ||||
|             end | ||||
|             if (i == 15) then | ||||
|                 flagStr = flagStr .. "\n"; | ||||
|             end | ||||
|         end | ||||
|          | ||||
|         local data = quest:GetData(); | ||||
|          | ||||
|         msg = string.format("Info for quest %s [%d]\n", quest.Name, quest:GetQuestId()); | ||||
|         msg = msg .. string.format("Flags \\\\ Current Sequence: %d\n", quest:getSequence()); | ||||
|         msg = msg .. string.format("%s\n", flagStr) | ||||
|         msg = msg .. string.format("Counters: %d,%d,%d,%d", data:getCounter(0), data:getCounter(1), data:getCounter(2), data:getCounter(3)); | ||||
|         return msg; | ||||
|     else | ||||
|         return string.format("Quest not active: "..questId); | ||||
|     end | ||||
| end | ||||
|  | ||||
|  | ||||
|   | ||||
| @@ -15,10 +15,12 @@ function onTrigger(player, argc, state) | ||||
|     local sender = "[setstate] "; | ||||
|      | ||||
|     local s = tonumber(state); | ||||
|     local actor = GetWorldManager():GetActorInWorld(player.currentTarget) or nil; | ||||
|     local actor = player.CurrentArea:FindActorInArea(player.currentTarget) or nil; | ||||
|     if player and actor then | ||||
|         actor:ChangeState(s); | ||||
| 		wait(0.8); | ||||
| 		player:SendMessage(0x20, "", "state: "..s); | ||||
|         wait(0.8); | ||||
|         player:SendMessage(0x20, "", "state: "..s); | ||||
|     else | ||||
|         player:SendMessage(0x20, "", "Error: No target selected.");    | ||||
|     end; | ||||
| end; | ||||
| @@ -3,7 +3,12 @@ require("global"); | ||||
| properties = { | ||||
|     permissions = 0, | ||||
|     parameters = "sssss", | ||||
|     description = "" | ||||
|     description = | ||||
| [[ | ||||
|  | ||||
| Tests a layout/region id w/ an animation string | ||||
| !testmapobj <anim> <region> <layout> <maxlayout> | ||||
| ]], | ||||
| } | ||||
|  | ||||
| function onTrigger(player, argc, animation, layoutId, instanceId, maxInstanceId) | ||||
|   | ||||
| @@ -62,6 +62,27 @@ function onTrigger(player, argc, p1, p2, p3, p4, privateArea, privateAreaType, n | ||||
|             worldManager:DoZoneChange(player, zone, privateArea, tonumber(privateAreaType), 0x02, x, y, z, 0.00); | ||||
|         end | ||||
|    | ||||
|     elseif (argc == 1) then -- Switch city zone | ||||
|              | ||||
|         local commands = { ["SWITCH"] = 1, ["S"] = 1, ["FLIP"] = 1, ["F"] = 1, ["TOWN"] = 1}; | ||||
|      | ||||
|         if (commands[string.upper(p1)]) then | ||||
|             local zones = { | ||||
|                         [133] = {133, 230}, | ||||
|                         [155] = {155, 206}, | ||||
|                         [175] = {175, 209}, | ||||
|                         [206] = {206, 155}, | ||||
|                         [209] = {209, 175}, | ||||
|                         [230] = {230, 133} | ||||
|                         } | ||||
|                   | ||||
|             if (player_zone == zones[player_zone][1]) then  | ||||
|                 worldManager:DoZoneChange(player, zones[player_zone][2], "", 0, 0x16, player_x, player_y, player_z, player_rot); | ||||
|                 player:SendMessage(messageID, sender, string.format("setting coordinates X:%d Y:%d Z:%d to new zone (%d) private area:%s", player_x, player_y, player_z, zones[player_zone][2], privateArea or "unspecified")); | ||||
|             end | ||||
|         else | ||||
|             player:SendMessage(messageID, sender, "Unknown parameters! Usage: "..properties.description); | ||||
|         end | ||||
|     else | ||||
|         player:SendMessage(messageID, sender, "Unknown parameters! Usage: "..properties.description); | ||||
|     end; | ||||
|   | ||||
| @@ -38,7 +38,7 @@ function onTrigger(player, argc, name, lastName, name2, lastName2) | ||||
|             return;     | ||||
|         else | ||||
|             local pos = p1:GetPos(); | ||||
|             worldManager:DoZoneChange(player, pos[4], nil, 0, 0x02, pos[0], pos[1], pos[2], pos[3]); | ||||
|             worldManager:DoZoneChange(player, pos[5], nil, 0, 0x02, pos[1], pos[2], pos[3], pos[4]); | ||||
|             player:SendMessage(messageID, sender, string.format("Moving to %s %s 's coordinates.", name, lastName)); | ||||
|         end; | ||||
|     elseif argc == 4 then; | ||||
| @@ -50,7 +50,7 @@ function onTrigger(player, argc, name, lastName, name2, lastName2) | ||||
|             local pos = p1:GetPos(); | ||||
|             local pos2 = p2:GetPos(); | ||||
|              | ||||
|             worldManager:DoZoneChange(p1, pos2[4], nil, 0, 0x02, pos2[0], pos2[1], pos2[2], pos2[3]); | ||||
|             worldManager:DoZoneChange(p1, pos2[5], nil, 0, 0x02, pos2[1], pos2[2], pos2[3], pos2[4]); | ||||
|             player:SendMessage(messageID, sender, string.format("Moving %s %s to %s %s 's coordinates.", name, lastName, name2, lastName2));     | ||||
|             p1:SendMessage(messageID, sender, string.format("You are being moved to %s %s 's coordinates.", name2, lastName2));               | ||||
|         end; | ||||
|   | ||||
| @@ -21,6 +21,12 @@ function onTrigger(player, argc, weather, updateTime, zonewide) | ||||
|         weather = tonumber(weather) or 0; | ||||
|         updateTime = tonumber(updateTime) or 0; | ||||
|         zonewide = tonumber(zonewide) or 0; | ||||
|          | ||||
|         if (weather > 0 and weather < 82) then | ||||
|             weather = weather + 8000; | ||||
|         end | ||||
|          | ||||
|          | ||||
|         message = string.format("changed weather to %u ", weather); | ||||
|          | ||||
|         if zonewide ~= 0 then | ||||
|   | ||||
| @@ -144,11 +144,11 @@ function onTrigger(player, argc, width, height, blockCount) | ||||
|         end; | ||||
|          | ||||
|         local pos = player:GetPos(); | ||||
|         local x = tonumber(pos[0]); | ||||
|         local y = tonumber(pos[1]); | ||||
|         local z = tonumber(pos[2]); | ||||
|         local rot = tonumber(pos[3]); | ||||
|         local zone = pos[4]; | ||||
|         local x = tonumber(pos[1]); | ||||
|         local y = tonumber(pos[2]); | ||||
|         local z = tonumber(pos[3]); | ||||
|         local rot = tonumber(pos[4]); | ||||
|         local zone = pos[5]; | ||||
|         local w = tonumber(width) or 0; | ||||
|  | ||||
|         local h = tonumber(height) or 0; | ||||
| @@ -160,7 +160,7 @@ function onTrigger(player, argc, width, height, blockCount) | ||||
|             for i = 0, w do | ||||
|                 for j = 0, h do | ||||
|                     local actor = player.CurrentArea.SpawnActor(2104001, 'ass', x + (i * 1), y, z + (j * 1), rot, 0, 0, true); | ||||
|                     --actor.ChangeNpcAppearance(2200905); | ||||
|                     actor.ChangeNpcAppearance(2200905); | ||||
|                     actor.SetMaxHP(500); | ||||
|                     actor.SetHP(500); | ||||
|                     actor.SetMod(modifiersGlobal.CanBlock, 1); | ||||
|   | ||||
		Reference in New Issue
	
	Block a user