|
|
|
@ -33,9 +33,11 @@ require 'common'
@@ -33,9 +33,11 @@ require 'common'
|
|
|
|
|
---------------------------------------------------------------------------------------------------- |
|
|
|
|
-- Variables |
|
|
|
|
---------------------------------------------------------------------------------------------------- |
|
|
|
|
local singlerace = { }; |
|
|
|
|
singlerace.race = 5; |
|
|
|
|
singlerace.hair = 2; |
|
|
|
|
local singlerace = { }; |
|
|
|
|
singlerace.race = 5; |
|
|
|
|
singlerace.hair = 2; |
|
|
|
|
singlerace.pcon = true; |
|
|
|
|
singlerace.npcon = true; |
|
|
|
|
|
|
|
|
|
---------------------------------------------------------------------------------------------------- |
|
|
|
|
-- func: print_help |
|
|
|
@ -76,10 +78,42 @@ ashita.register_event('command', function(command, ntype)
@@ -76,10 +78,42 @@ ashita.register_event('command', function(command, ntype)
|
|
|
|
|
return true; |
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
-- Set the pc mode on or off.. |
|
|
|
|
if (#args >= 2 and args[2] == 'pc') then |
|
|
|
|
local enabled = false; |
|
|
|
|
if (#args >= 3) then |
|
|
|
|
enabled = args[3] == 'on' or args[3] == 'enabled' or args[3] == '1'; |
|
|
|
|
else |
|
|
|
|
enabled = not singlerace.pcon; |
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
singlerace.pcon = enabled; |
|
|
|
|
print(string.format('\31\200[\31\05singlerace\31\200] \31\130Set PC enabled to to: \30\02%s', tostring(singlerace.pcon))); |
|
|
|
|
return true; |
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
-- Set the npc mode on or off.. |
|
|
|
|
if (#args >= 2 and args[2] == 'npc') then |
|
|
|
|
local enabled = false; |
|
|
|
|
if (#args >= 3) then |
|
|
|
|
enabled = args[3] == 'on' or args[3] == 'enabled' or args[3] == '1'; |
|
|
|
|
else |
|
|
|
|
enabled = not singlerace.npcon; |
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
singlerace.npcon = enabled; |
|
|
|
|
print(string.format('\31\200[\31\05singlerace\31\200] \31\130Set NPC enabled to to: \30\02%s', tostring(singlerace.pcon))); |
|
|
|
|
return true; |
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
-- Prints the addon help.. |
|
|
|
|
print_help('/singlerace', { |
|
|
|
|
{ '/singlerace race [raceid]', '- Sets the enforced race type to apply to other players.' }, |
|
|
|
|
{ '/singlerace hair [hairid]', '- Sets the enforced hair type to apply to other players.' }, |
|
|
|
|
{ '/singlerace race [raceid]', '- Sets the enforced race type to apply to other players.' }, |
|
|
|
|
{ '/singlerace hair [hairid]', '- Sets the enforced hair type to apply to other players.' }, |
|
|
|
|
{ '/singlerace npc', '- Toggles if the NPC mode is enabled or disabled.' }, |
|
|
|
|
{ '/singlerace npc [on|1|enabled]', '- Toggles if the NPC mode is enabled or disabled.' }, |
|
|
|
|
{ '/singlerace pc', '- Toggles if the PC mode is enabled or disabled.' }, |
|
|
|
|
{ '/singlerace pc [on|1|enabled]', '- Toggles if the PC mode is enabled or disabled.' }, |
|
|
|
|
}); |
|
|
|
|
return true; |
|
|
|
|
end); |
|
|
|
@ -93,7 +127,7 @@ ashita.register_event('incoming_packet', function(id, size, data, modified, bloc
@@ -93,7 +127,7 @@ ashita.register_event('incoming_packet', function(id, size, data, modified, bloc
|
|
|
|
|
if (blocked == true) then return false; end |
|
|
|
|
|
|
|
|
|
-- Look for player update packets.. |
|
|
|
|
if (id == 0x000D) then |
|
|
|
|
if (id == 0x000D and singlerace.pcon) then |
|
|
|
|
local packet = data:totable(); |
|
|
|
|
if (packet[0x0A + 1] == 0x1F) then |
|
|
|
|
packet[0x48 + 1] = singlerace.hair; |
|
|
|
@ -103,7 +137,7 @@ ashita.register_event('incoming_packet', function(id, size, data, modified, bloc
@@ -103,7 +137,7 @@ ashita.register_event('incoming_packet', function(id, size, data, modified, bloc
|
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
-- Look for entity update packets.. |
|
|
|
|
if (id == 0x000E) then |
|
|
|
|
if (id == 0x000E and singlerace.npcon) then |
|
|
|
|
local packet = data:totable(); |
|
|
|
|
if (packet[0x0A + 1] == 0x57) then |
|
|
|
|
-- This does not work on all NPCs due to how some of them are handled. |
|
|
|
|