mirror of
				https://bitbucket.org/Ioncannon/project-meteor-server.git
				synced 2025-05-20 08:26:59 -04:00 
			
		
		
		
	start of work moving commands to lua
This commit is contained in:
		
							
								
								
									
										9
									
								
								data/scripts/commands/gm/command - Copy (2).lua
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										9
									
								
								data/scripts/commands/gm/command - Copy (2).lua
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,9 @@ | ||||
| properties = { | ||||
| 	permissions = 0, | ||||
| 	parameters = "", | ||||
| 	description = "", | ||||
| } | ||||
|  | ||||
| function onTrigger(player) | ||||
|  | ||||
| end; | ||||
							
								
								
									
										9
									
								
								data/scripts/commands/gm/command - Copy (3).lua
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										9
									
								
								data/scripts/commands/gm/command - Copy (3).lua
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,9 @@ | ||||
| properties = { | ||||
| 	permissions = 0, | ||||
| 	parameters = "", | ||||
| 	description = "", | ||||
| } | ||||
|  | ||||
| function onTrigger(player) | ||||
|  | ||||
| end; | ||||
							
								
								
									
										9
									
								
								data/scripts/commands/gm/command - Copy (4).lua
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										9
									
								
								data/scripts/commands/gm/command - Copy (4).lua
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,9 @@ | ||||
| properties = { | ||||
| 	permissions = 0, | ||||
| 	parameters = "", | ||||
| 	description = "", | ||||
| } | ||||
|  | ||||
| function onTrigger(player) | ||||
|  | ||||
| end; | ||||
							
								
								
									
										9
									
								
								data/scripts/commands/gm/command - Copy (5).lua
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										9
									
								
								data/scripts/commands/gm/command - Copy (5).lua
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,9 @@ | ||||
| properties = { | ||||
| 	permissions = 0, | ||||
| 	parameters = "", | ||||
| 	description = "", | ||||
| } | ||||
|  | ||||
| function onTrigger(player) | ||||
|  | ||||
| end; | ||||
							
								
								
									
										9
									
								
								data/scripts/commands/gm/command - Copy (6).lua
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										9
									
								
								data/scripts/commands/gm/command - Copy (6).lua
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,9 @@ | ||||
| properties = { | ||||
| 	permissions = 0, | ||||
| 	parameters = "", | ||||
| 	description = "", | ||||
| } | ||||
|  | ||||
| function onTrigger(player) | ||||
|  | ||||
| end; | ||||
							
								
								
									
										9
									
								
								data/scripts/commands/gm/command - Copy (7).lua
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										9
									
								
								data/scripts/commands/gm/command - Copy (7).lua
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,9 @@ | ||||
| properties = { | ||||
| 	permissions = 0, | ||||
| 	parameters = "", | ||||
| 	description = "", | ||||
| } | ||||
|  | ||||
| function onTrigger(player) | ||||
|  | ||||
| end; | ||||
							
								
								
									
										22
									
								
								data/scripts/commands/gm/giveitem.lua
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										22
									
								
								data/scripts/commands/gm/giveitem.lua
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,22 @@ | ||||
| require("global"); | ||||
|  | ||||
| properties = { | ||||
|     permissions = 0, | ||||
|     parameters = "ssss", | ||||
|     description = "adds <item> <qty> to <location> for <target>. <qty> and <location> are optional, item is added to user if <target> is nil", | ||||
| } | ||||
|  | ||||
| function onTrigger(player, argc, item, qty, location, target) | ||||
|     local sender = "[giveitem] "; | ||||
|     player = GetWorldManager():GetPCInWorld(target) or player; | ||||
|     if player then | ||||
|         item = tonumber(item) or nil; | ||||
|         qty = tonumber(qty) or 1; | ||||
|         location = tonumber(itemtype) or INVENTORY_NORMAL; | ||||
|          | ||||
|         if item then | ||||
|             player:GetInventory(location):AddItem(item, qty); | ||||
|             player:SendMessage(MSG_TYPE_SYSTEM_ERROR, "[giveitem] ", string.format("Added item %u to %s", item, player:GetName()); | ||||
|         end | ||||
|     end; | ||||
| end; | ||||
							
								
								
									
										19
									
								
								data/scripts/commands/gm/graphic.lua
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										19
									
								
								data/scripts/commands/gm/graphic.lua
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,19 @@ | ||||
| properties = { | ||||
|     permissions = 0, | ||||
|     parameters = "sssss", | ||||
|     description = [[changes appearance for equipment in <slot>. Parameters: <slot> <wId> <eId> <vId> <cId>, | ||||
|                             idk what any of those mean either]], | ||||
| } | ||||
|  | ||||
| function onTrigger(player, argc, slot, wId, eId, vId, cId) | ||||
|     slot = tonumber(slot) or 0; | ||||
|     wId = tonumber(wId) or 0; | ||||
|     eId = tonumber(eId) or 0; | ||||
|     vId = tonumber(vId) or 0; | ||||
|     cId = tonumber(cId) or 0; | ||||
|      | ||||
|     if player then | ||||
|         player:GraphicChange(slot, wId, eId, vId, cId); | ||||
|         player:SendAppearance(); | ||||
|     end; | ||||
| end; | ||||
							
								
								
									
										10
									
								
								data/scripts/commands/gm/music.lua
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										10
									
								
								data/scripts/commands/gm/music.lua
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,10 @@ | ||||
| properties = { | ||||
|     permissions = 0, | ||||
|     parameters = "s", | ||||
|     description = "plays music <id> to player", | ||||
| } | ||||
|  | ||||
| function onTrigger(player, argc, music) | ||||
|     music = tonumber(music) or 0; | ||||
|     player:ChangeMusic(music); | ||||
| end; | ||||
							
								
								
									
										22
									
								
								data/scripts/commands/gm/mypos.lua
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										22
									
								
								data/scripts/commands/gm/mypos.lua
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,22 @@ | ||||
| require("global"); | ||||
|  | ||||
| properties = { | ||||
|     permissions = 0, | ||||
|     parameters = "", | ||||
|     description = "prints your current in-game position (different to map coords)", | ||||
| } | ||||
|  | ||||
| function onTrigger(player) | ||||
|     local pos = player:GetPos(); | ||||
|     local x = pos[0]; | ||||
|     local y = pos[1]; | ||||
|     local z = pos[2]; | ||||
|     local rot = pos[3]; | ||||
|     local zone = pos[4]; | ||||
|        | ||||
|     local messageID = MESSAGE_TYPE_SYSTEM_ERROR; | ||||
|     local sender = "[mypos] "; | ||||
|     local message = string.format("current position X:%d Y:%d Z:%d (Rotation: %d) Zone:%d", x, y, z, rot, zone); | ||||
|  | ||||
|     player:SendMessage(messageID, sender, message); | ||||
| end; | ||||
							
								
								
									
										23
									
								
								data/scripts/commands/gm/reloadzone.lua
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										23
									
								
								data/scripts/commands/gm/reloadzone.lua
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,23 @@ | ||||
| require("global"); | ||||
|  | ||||
| properties = { | ||||
|     permissions = 0, | ||||
|     parameters = "s", | ||||
|     description = "reloads <zone>", | ||||
| } | ||||
|  | ||||
| function onTrigger(player, argc, zone) | ||||
|     if not zone or tonumber(zone) == 0 then | ||||
|         printf("%s is not a valid zone!", zone); | ||||
|         return; | ||||
|     end; | ||||
|      | ||||
|     zone = tonumber(zone); | ||||
|      | ||||
|     if player then | ||||
|         local messageID = MSG_TYPE_SYSTEM_ERROR; | ||||
|         player:SendMessage(messageID, "[reloadzones] ", string.format("Reloading zone: %u", zone)); | ||||
|     end; | ||||
|      | ||||
|     GetWorldManager():ReloadZone(zone); | ||||
| end; | ||||
							
								
								
									
										9
									
								
								data/scripts/commands/gm/test.lua
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										9
									
								
								data/scripts/commands/gm/test.lua
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,9 @@ | ||||
| properties = { | ||||
|     permissions = 0, | ||||
|     parameters = "sss", | ||||
|     description = "", | ||||
| } | ||||
|  | ||||
| function onTrigger(player, argc) | ||||
| 	-- todo: change weather | ||||
| end; | ||||
							
								
								
									
										78
									
								
								data/scripts/commands/gm/warp.lua
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										78
									
								
								data/scripts/commands/gm/warp.lua
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,78 @@ | ||||
| require("global"); | ||||
|  | ||||
| properties = { | ||||
|     permissions = 0, | ||||
|     parameters = "sssssss", | ||||
|     description = [[ | ||||
| <zone> | | ||||
| <zone> <x> <y> <z> | | ||||
| <x> <y> <z> <zone> <privateArea> <target name>. | ||||
| ]], | ||||
| } | ||||
|  | ||||
| function onTrigger(player, argc, p1, p2, p3, p4, privateArea, firstName, lastName) | ||||
|  | ||||
|     if firstName then | ||||
|         if lastName then | ||||
|             player = GetWorldManager():GetPCInWorld(firstName.." "..lastName) or nil; | ||||
|         else | ||||
|             player = GetWorldManager():GetPCInWorld(firstName) or nil; | ||||
|         end; | ||||
|     end; | ||||
|      | ||||
|     if not player then | ||||
|         printf("[Command] [warp] error! No target or player specified!"); | ||||
|         return; | ||||
|     end; | ||||
|      | ||||
|     local messageID = MESSAGE_TYPE_SYSTEM_ERROR; | ||||
|     local sender = "[warp] "; | ||||
|      | ||||
|     -- we're getting a list/array from c# so 0 index | ||||
|     local pos = player:GetPos(); | ||||
|     local player_x = pos[0]; | ||||
|     local player_y = pos[1]; | ||||
|     local player_z = pos[2]; | ||||
|     local player_rot = pos[3]; | ||||
|     local player_zone = pos[4]; | ||||
|      | ||||
|     local worldManager = GetWorldManager(); | ||||
|      | ||||
|     -- treat this as a predefined warp list | ||||
|     if argc == 1 then | ||||
|         zone = tonumber(p1) or player_zone; | ||||
|         player:SendMessage(messageID, sender,  string.format("warping to zone:%u", zone)); | ||||
|         worldManager:DoZoneChange(player, zone); | ||||
|      | ||||
|     elseif argc >= 3 then | ||||
|          | ||||
|         if argc == 3 then | ||||
|             local x = tonumber(applyPositionOffset(p1, player_x)) or player_x; | ||||
|             local y = tonumber(applyPositionOffset(p2, player_y)) or player_y; | ||||
|             local z = tonumber(applyPositionOffset(p3, player_z)) or player_z; | ||||
|              | ||||
|             player:SendMessage(messageID, sender, string.format("setting coordinates X:%d Y:%d Z:%d within current zone (%d)", x, y, z, player_zone)); | ||||
|             worldManager:DoPlayerMoveInZone(player, x, y, z, 0x0F); | ||||
|         else | ||||
|             local zone = tonumber(applyPositionOffset(p1, player_zone)) or player_zone; | ||||
|             local x = tonumber(applyPositionOffset(p2, player_x)) or player_x; | ||||
|             local y = tonumber(applyPositionOffset(p3, player_y)) or player_y; | ||||
|             local z = tonumber(applyPositionOffset(p4, player_z)) or player_z; | ||||
|             if privateArea == "" then privateArea = nil end; | ||||
|             player:SendMessage(messageID, sender, string.format("setting coordinates X:%d Y:%d Z:%d to new zone (%d) private area:%s", x, y, z, zone, privateArea or "unspecified")); | ||||
|             worldManager:DoZoneChange(player, zone, privateArea, 0x0F, x, y, z, 0.00); | ||||
|         end | ||||
|    | ||||
|     else | ||||
|         player:SendMessage(messageID, sender, "Unknown parameters! Usage: "..properties.description); | ||||
|     end; | ||||
| end; | ||||
|  | ||||
| function applyPositionOffset(str, offset) | ||||
|     local s = str; | ||||
|     print(s); | ||||
|     if s:find("@") then | ||||
|         s = tonumber(s:sub(s:find("@") + 1, s:len())) + offset; | ||||
|     end | ||||
|     return s; | ||||
| end; | ||||
		Reference in New Issue
	
	Block a user