mirror of
https://bitbucket.org/Ioncannon/project-meteor-server.git
synced 2025-08-02 07:41:58 +02:00
Events are now pushed onto a stack and popped off. Turns out multiple events *CAN* happen. Fixed quantity bugs when saving to DB. Fixed buying stacks.
This commit is contained in:
parent
08c5980b22
commit
a9d4e621e3
7 changed files with 38 additions and 58 deletions
|
@ -151,18 +151,7 @@ namespace FFXIVClassic_Map_Server.Actors
|
|||
ushort itemPackage = GetPackageForItem(catalogID);
|
||||
if (itemPackages.ContainsKey(itemPackage))
|
||||
{
|
||||
InventoryItem item = Server.GetWorldManager().CreateItem(catalogID, quantity, quality);
|
||||
itemPackages[itemPackage].AddItem(item);
|
||||
}
|
||||
}
|
||||
|
||||
public void AddItemStack(uint catalogID, int quantity, byte quality)
|
||||
{
|
||||
ItemData itemData = Server.GetItemGamedata(catalogID);
|
||||
if (itemData != null)
|
||||
{
|
||||
int totalQuantity = itemData.maxStack * quantity;
|
||||
AddItem(catalogID, totalQuantity, quality);
|
||||
itemPackages[itemPackage].AddItem(catalogID, quantity, quality);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -88,10 +88,7 @@ namespace FFXIVClassic_Map_Server.Actors
|
|||
74000, 78000, 81000, 85000, 89000, 92000, 96000, 100000, 100000, 110000}; //Level <= 50
|
||||
|
||||
//Event Related
|
||||
public uint currentEventOwner = 0;
|
||||
public string currentEventName = "";
|
||||
|
||||
public Coroutine currentEventRunning;
|
||||
private Stack<GameEvent> runningEvents = new Stack<GameEvent>();
|
||||
|
||||
//Player Info
|
||||
public uint destinationZone;
|
||||
|
@ -1645,12 +1642,15 @@ namespace FFXIVClassic_Map_Server.Actors
|
|||
|
||||
public void StartEvent(Actor owner, EventStartPacket start)
|
||||
{
|
||||
LuaEngine.GetInstance().EventStarted(this, owner, start);
|
||||
GameEvent startedEvent = new GameEvent(start.triggerName, this, owner);
|
||||
runningEvents.Push(startedEvent);
|
||||
LuaEngine.GetInstance().EventStarted(startedEvent, start);
|
||||
}
|
||||
|
||||
public void UpdateEvent(EventUpdatePacket update)
|
||||
{
|
||||
LuaEngine.GetInstance().OnEventUpdate(this, update.luaParams);
|
||||
GameEvent updateEvent = runningEvents.Peek();
|
||||
LuaEngine.GetInstance().OnEventUpdate(updateEvent, update.luaParams);
|
||||
}
|
||||
|
||||
public void KickEvent(Actor actor, string conditionName, params object[] parameters)
|
||||
|
@ -1683,20 +1683,17 @@ namespace FFXIVClassic_Map_Server.Actors
|
|||
public void RunEventFunction(string functionName, params object[] parameters)
|
||||
{
|
||||
List<LuaParam> lParams = LuaUtils.CreateLuaParamList(parameters);
|
||||
SubPacket spacket = RunEventFunctionPacket.BuildPacket(actorId, currentEventOwner, currentEventName, functionName, lParams);
|
||||
SubPacket spacket = RunEventFunctionPacket.BuildPacket(actorId, runningEvents.Peek().GetOwnerActorId(), runningEvents.Peek().GetEventName(), functionName, lParams);
|
||||
spacket.DebugPrintSubPacket();
|
||||
QueuePacket(spacket);
|
||||
}
|
||||
|
||||
public void EndEvent()
|
||||
{
|
||||
SubPacket p = EndEventPacket.BuildPacket(actorId, currentEventOwner, currentEventName);
|
||||
GameEvent endingEvent = runningEvents.Pop();
|
||||
SubPacket p = EndEventPacket.BuildPacket(actorId, endingEvent.GetOwnerActorId(), endingEvent.GetEventName());
|
||||
p.DebugPrintSubPacket();
|
||||
QueuePacket(p);
|
||||
|
||||
currentEventOwner = 0;
|
||||
currentEventName = "";
|
||||
currentEventRunning = null;
|
||||
}
|
||||
|
||||
public void SendInstanceUpdate()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue