Merge branch 'ai-open' into develop

# Conflicts:
#	FFXIVClassic Lobby Server/Database.cs
#	FFXIVClassic Map Server/Database.cs
#	FFXIVClassic Map Server/FFXIVClassic Map Server.csproj
#	FFXIVClassic Map Server/actors/chara/player/Inventory.cs
#	FFXIVClassic Map Server/actors/chara/player/Player.cs
#	FFXIVClassic Map Server/dataobjects/Session.cs
#	FFXIVClassic World Server/Server.cs
This commit is contained in:
Filip Maj 2019-05-04 20:13:29 -04:00
commit 1e4a1cf263
402 changed files with 20078 additions and 1348 deletions

View file

@ -0,0 +1,29 @@
require("global");
properties = {
permissions = 0,
parameters = "sss",
description =
[[
Adds target to party
]]
}
function onTrigger(player, argc)
local sender = "[addtoparty] ";
if player then
if player.target then
print("hi")
local id = player.target.actorId
print("hi")
player.currentParty:AddMember(id);
player.target.currentParty = player.currentParty;
print("hi")
else
print(sender.." no target")
end
else
print(sender.." no player");
end;
end;

View file

@ -0,0 +1,29 @@
require("global");
properties = {
permissions = 0,
parameters = "sssss",
description =
[[
Adds experience <qty> to player or <targetname>.
!giveexp <qty> |
!giveexp <qty> <targetname> |
]],
}
function onTrigger(player, argc, commandId, animationId, textId, effectId, amount)
local sender = "[battleaction] ";
if player then
cid = tonumber(commandId) or 0;
aid = tonumber(animationId) or 0;
tid = tonumber(textId) or 0;
print(effectId)
eid = tonumber(effectId) or 0;
amt = tonumber(amount) or 0;
player:DoBattleActionAnimation(cid, aid, tid, eid, amt);
else
print(sender.."unable to add experience, ensure player name is valid.");
end;
end;

View file

@ -0,0 +1,34 @@
require("global");
properties = {
permissions = 0,
parameters = "s",
description =
[[
Equips <commandid> in the first open slot without checking if you can.
!eaction <commandid>
]],
}
function onTrigger(player, argc, commandid)
local sender = "[eaction] ";
print(commandid);
if name then
if lastName then
player = GetWorldManager():GetPCInWorld(name.." "..lastName) or nil;
else
player = GetWorldManager():GetPCInWorld(name) or nil;
end;
end;
if player then
classid = player:GetCurrentClassOrJob();
commandid = tonumber(commandid) or 0;
local added = player:EquipAbilityInFirstOpenSlot(classid, commandid);
else
print(sender.."unable to add command, ensure player name is valid.");
end;
end;

View file

@ -0,0 +1,31 @@
require("global");
require("bit32");
properties = {
permissions = 0,
parameters = "iiii",
description =
[[
effect
]],
}
function onTrigger(player, argc, effectId, magnitude, tick, duration)
local messageId = MESSAGE_TYPE_SYSTEM_ERROR;
local sender = "effect";
if player then
player.AddHP(100000);
player.DelHP(500);
effectId = tonumber(effectId) or 223180;
magnitude = tonumber(magnitude) or 700;
tick = tonumber(tick) or 3;
duration = tonumber(duration) or 360;
while player.statusEffects.HasStatusEffect(effectId) do
player.statusEffects.RemoveStatusEffect(effectId);
end;
player.statusEffects.AddStatusEffect(effectId, magnitude, tick, duration);
end;
end;

View file

@ -0,0 +1,35 @@
require("global");
properties = {
permissions = 0,
parameters = "sss",
description =
[[
Adds experience <qty> to player or <targetname>.
!giveexp <qty> |
!giveexp <qty> <targetname> |
]],
}
function onTrigger(player, argc, qty, name, lastName)
local sender = "[giveexp] ";
if name then
if lastName then
player = GetWorldManager():GetPCInWorld(name.." "..lastName) or nil;
else
player = GetWorldManager():GetPCInWorld(name) or nil;
end;
end;
if player then
currency = 1000001;
qty = tonumber(qty) or 1;
location = INVENTORY_CURRENCY;
actionList = player:AddExp(qty, player.charaWork.parameterSave.state_mainSkill[0], 0);
player:DoBattleAction(0, 0, actionList);
else
print(sender.."unable to add experience, ensure player name is valid.");
end;
end;

View file

@ -21,9 +21,13 @@ function onTrigger(player, argc, slot, wId, eId, vId, cId)
cId = tonumber(cId) or 0;
if player and argc > 0 then
player:GraphicChange(slot, wId, eId, vId, cId);
if argc > 2 then
player:GraphicChange(slot, wId, eId, vId, cId);
player:SendMessage(messageID, sender, string.format("Changing appearance on slot %u", slot));
else
player:GraphicChange(slot, wId);
end
player:SendAppearance();
player:SendMessage(messageID, sender, string.format("Changing appearance on slot %u", slot));
else
player:SendMessage(messageID, sender, "No parameters sent! Usage: "..properties.description);
end;

View file

@ -0,0 +1,25 @@
require("global");
properties = {
permissions = 0,
parameters = "s",
description =
[[
Changes appearance for equipment with given parameters.
!graphic <slot> <wID> <eID> <vID> <vID>
]],
}
function onTrigger(player, argc, appearanceId)
local messageID = MESSAGE_TYPE_SYSTEM_ERROR;
local sender = "[setappearance] ";
app = tonumber(appearanceId) or 0;
player:SendMessage(messageID, sender, string.format("appearance %u", app));
if player and player.target then
player.target.ChangeNpcAppearance(app);
player:SendMessage(messageID, sender, string.format("appearance %u", app));
end;
end;

View file

@ -0,0 +1,21 @@
require("global");
properties = {
permissions = 0,
parameters = "sss",
description =
[[
Adds experience <qty> to player or <targetname>.
!giveexp <qty> |
!giveexp <qty> <targetname> |
]],
}
function onTrigger(player, argc, jobId)
local sender = "[setjob] ";
jobId = tonumber(jobId)
if player then
player:SetCurrentJob(jobId);
end;
end;

View file

@ -0,0 +1,33 @@
require("global");
properties = {
permissions = 0,
parameters = "sss",
description =
[[
Sets player or <targetname>'s maximum hp to <hp> and heals them to full.
!setmaxhp <hp> |
!setmaxhp <hp> <targetname>
]],
}
function onTrigger(player, argc, hp, name, lastName)
local sender = "[setmaxhp] ";
if name then
if lastName then
player = GetWorldManager():GetPCInWorld(name.." "..lastName) or nil;
else
player = GetWorldManager():GetPCInWorld(name) or nil;
end;
end;
if player then
hp = tonumber(hp) or 1;
location = INVENTORY_CURRENCY;
player:hpstuff(hp);
else
print(sender.."unable to add experience, ensure player name is valid.");
end;
end;

View file

@ -0,0 +1,33 @@
require("global");
properties = {
permissions = 0,
parameters = "sss",
description =
[[
Sets player or <targetname>'s maximum hp to <hp> and heals them to full.
!setmaxhp <hp> |
!setmaxhp <hp> <targetname>
]],
}
function onTrigger(player, argc, hp, name, lastName)
local sender = "[setmaxhp] ";
if name then
if lastName then
player = GetWorldManager():GetPCInWorld(name.." "..lastName) or nil;
else
player = GetWorldManager():GetPCInWorld(name) or nil;
end;
end;
if player then
hp = tonumber(hp) or 1;
location = INVENTORY_CURRENCY;
player:hpstuff(hp);
else
print(sender.."unable to add experience, ensure player name is valid.");
end;
end;

View file

@ -0,0 +1,18 @@
require("global");
properties = {
permissions = 0,
parameters = "ss",
description =
[[
Sets a modifier of player
!setmod <modId> <modVal> |
]],
}
function onTrigger(player, argc, modId, modVal)
local sender = "[setmod] ";
local mod = tonumber(modId)
local val = tonumber(modVal)
player:SetMod(mod, val);
end;

View file

@ -0,0 +1,18 @@
require("global");
properties = {
permissions = 0,
parameters = "sss",
description =
[[
Adds experience <qty> to player or <targetname>.
!giveexp <qty> |
!giveexp <qty> <targetname> |
]],
}
function onTrigger(player, argc, procid)
local sender = "[giveexp] ";
local pid = tonumber(procid)
player:SetProc(pid, true);
end;

View file

@ -0,0 +1,24 @@
require("global");
properties = {
permissions = 0,
parameters = "s",
description =
[[
Changes appearance for equipment with given parameters.
!graphic <slot> <wID> <eID> <vID> <vID>
]],
}
function onTrigger(player, argc, size)
local messageID = MESSAGE_TYPE_SYSTEM_ERROR;
local sender = "[setappearance] ";
s = tonumber(size) or 0;
if player and player.target then
player.target.appearanceIds[0] = s;
player.target.zone.BroadcastPacketAroundActor(player.target, player.target.CreateAppearancePacket());
end;
end;

View file

@ -0,0 +1,24 @@
require("global");
properties = {
permissions = 0,
parameters = "s",
description =
[[
Changes appearance for equipment with given parameters.
!graphic <slot> <wID> <eID> <vID> <vID>
]],
}
function onTrigger(player, argc, state)
local messageID = MESSAGE_TYPE_SYSTEM_ERROR;
local sender = "[setstate] ";
local s = tonumber(state);
local actor = GetWorldManager():GetActorInWorld(player.currentTarget) or nil;
if player and actor then
actor:ChangeState(s);
wait(0.8);
player:SendMessage(0x20, "", "state: "..s);
end;
end;

View file

@ -0,0 +1,27 @@
require("global");
properties = {
permissions = 0,
parameters = "sss",
description =
[[
Sets player or <targetname>'s maximum tp to <tp> and heals them to full.
!setmaxtp <tp> |
!setmaxtp <tp> <targetname>
]],
}
function onTrigger(player, argc, tp)
local sender = "[setmaxtp] ";
if player then
tp = tonumber(tp) or 0;
location = INVENTORY_CURRENCY;
player:SetTP(tp);
else
print(sender.."unable to add experience, ensure player name is valid.");
end;
end;

View file

@ -6,7 +6,7 @@ properties = {
description = "Spawns a actor",
}
function onTrigger(player, argc, actorClassId)
function onTrigger(player, argc, actorClassId, width, height)
if (actorClassId == nil) then
player:SendMessage(0x20, "", "No actor class id provided.");
@ -24,7 +24,16 @@ function onTrigger(player, argc, actorClassId)
if (actorClassId ~= nil) then
zone = player:GetZone();
actor = zone:SpawnActor(actorClassId, "test", pos[0], pos[1], pos[2], pos[3]);
local w = tonumber(width) or 0;
local h = tonumber(height) or 0;
printf("%f %f %f", x, y, z);
--local x, y, z = player.GetPos();
for i = 0, w do
for j = 0, h do
actor = zone:SpawnActor(actorClassId, "test", pos[0] + (i - (w / 2) * 3), pos[1], pos[2] + (j - (h / 2) * 3), pos[3]);
actor.SetAppearance(1001149)
end
end
end
if (actor == nil) then

View file

@ -0,0 +1,192 @@
require("global");
require("modifiers");
properties = {
permissions = 0,
parameters = "ssss",
description =
[[
yolo
]],
}
local quests =
{
[111807] = { level = 25, weight = 4, rewardexp = 1080 },
[110868] = { level = 50, weight = 4, rewardexp = 4400 },
[111603] = { level = 22, weight = 5, rewardexp = 1100 },
[111602] = { level = 22, weight = 5, rewardexp = 1100 },
[111420] = { level = 45, weight = 5, rewardexp = 4450 },
[110811] = { level = 18, weight = 6, rewardexp = 780 },
[110814] = { level = 18, weight = 6, rewardexp = 780 },
[110707] = { level = 25, weight = 6, rewardexp = 1620 },
[110682] = { level = 34, weight = 6, rewardexp = 3180 },
[111202] = { level = 35, weight = 6, rewardexp = 3360 },
[111222] = { level = 35, weight = 6, rewardexp = 3360 },
[111302] = { level = 35, weight = 6, rewardexp = 3360 },
[111223] = { level = 40, weight = 6, rewardexp = 4260 },
[110819] = { level = 45, weight = 6, rewardexp = 5340 },
[111224] = { level = 45, weight = 6, rewardexp = 5340 },
[111225] = { level = 45, weight = 6, rewardexp = 5340 },
[110867] = { level = 45, weight = 6, rewardexp = 5340 },
[110869] = { level = 45, weight = 6, rewardexp = 5340 },
[110708] = { level = 45, weight = 6, rewardexp = 5340 },
[110627] = { level = 45, weight = 6, rewardexp = 5340 },
[111434] = { level = 50, weight = 6, rewardexp = 6600 },
[110850] = { level = 1, weight = 7, rewardexp = 40 },
[110851] = { level = 1, weight = 7, rewardexp = 40 },
[110841] = { level = 20, weight = 7, rewardexp = 1120 },
[110642] = { level = 20, weight = 7, rewardexp = 1120 },
[110840] = { level = 20, weight = 7, rewardexp = 1120 },
[110727] = { level = 21, weight = 7, rewardexp = 1401 },
[111221] = { level = 30, weight = 7, rewardexp = 2661 },
[111241] = { level = 30, weight = 7, rewardexp = 2661 },
[110687] = { level = 28, weight = 9, rewardexp = 2970 },
[110016] = { level = 34, weight = 50, rewardexp = 26500 },
[110017] = { level = 38, weight = 50, rewardexp = 32500 },
[110019] = { level = 46, weight = 50, rewardexp = 46000 }
};
local expTable = {
570, -- 1
700,
880,
1100,
1500,
1800,
2300,
3200,
4300,
5000, -- 10
5900,
6800,
7700,
8700,
9700,
11000,
12000,
13000,
15000,
16000, -- 20
20000,
22000,
23000,
25000,
27000,
29000,
31000,
33000,
35000,
38000, -- 30
45000,
47000,
50000,
53000,
56000,
59000,
62000,
65000,
68000,
71000, -- 40
74000,
78000,
81000,
85000,
89000,
92000,
96000,
100000,
100000,
110000 -- 50
};
local commandCost = {
["raise"] = 150,
["cure"] = 40,
["cura"] = 100,
["curaga"] = 150,
};
-- stone: (1, 9) (5, 12) (10, )
-- cure: (1, 5) (5, 6) (10, )
-- aero: (1, 9) (5, 12) (10, )
-- protect: (1, 9) (5, 12) (10, )
--[[
function onTrigger(player, argc, id, level, weight)
id = tonumber(id) or 111807;
level = tonumber(level) or quests[id].level;
weight = tonumber(weight) or quests[id].weight;
local messageId = MESSAGE_TYPE_SYSTEM_ERROR;
local sender = "yolo";
if id == 1 then
return
end
local message = calcSkillPoint(player, level, weight);
if player then
player.SendMessage(messageId, sender, string.format("calculated %s | expected %s", message, quests[id].rewardexp));
end;
printf("calculated %s | expected %s", message, quests[id].rewardexp);
end;
]]
function onTrigger(player, argc, width, height, blockCount)
local messageId = MESSAGE_TYPE_SYSTEM_ERROR;
local sender = "yolo";
if player then
if false then
local effectId = 223004;
player.statusEffects.RemoveStatusEffect(effectId);
player.statusEffects.AddStatusEffect(effectId, 1, 0, 5);
return;
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 w = tonumber(width) or 0;
local h = tonumber(height) or 0;
local blocks = tonumber(blockCount) or 0;
printf("%f %f %f", x, y, z);
--local x, y, z = player.GetPos();
for b = 0, blocks do
for i = 0, w do
for j = 0, h do
local actor = player.GetZone().SpawnActor(2104001, 'ass', x + (i * 1), y, z + (j * 1), rot, 0, 0, true);
actor.ChangeNpcAppearance(2200905);
actor.SetMaxHP(5000);
actor.SetHP(5000);
actor.SetMod(modifiersGlobal.HasShield, 1);
actor.SetMod(modifiersGlobal.AttackRange, 3);
actor.SetMod(modifiersGlobal.Speed, 5);
actor.SetMobMod(mobModifiersGlobal.Roams, 1);
actor.SetMobMod(mobModifiersGlobal.RoamDelay, 3);
actor.moveState = 3;
end
end
x = x + 500
end
return;
end
end;
function calculateCommandCost(player, skillName, level)
if skillName and level and commandCost[skillName] then
return math.ceil((8000 + (level - 70) * 500) * (commandCost[skillName] * 0.001));
end;
return 1;
end
function calcSkillPoint(player, lvl, weight)
weight = weight / 100
return math.ceil(expTable[lvl] * weight)
end

View file

@ -0,0 +1,19 @@
require("global");
properties = {
permissions = 0,
parameters = "",
description =
[[
Get the amount of actors in this zone.
!zonecount
]]
}
function onTrigger(player, argc)
local message = tostring(player.zone.GetAllActors().Count);
player.SendMessage(0x20, "", message);
end