mirror of
https://bitbucket.org/Ioncannon/project-meteor-server.git
synced 2025-06-08 05:24:34 +02:00
Bunch of bugfixes and final tweaking to get inventory working.
This commit is contained in:
parent
47be08fbf7
commit
cb4171f1fd
12 changed files with 215 additions and 42 deletions
|
@ -412,14 +412,14 @@ namespace FFXIVClassic_Lobby_Server
|
|||
if (client != null)
|
||||
{
|
||||
Player p = client.getActor();
|
||||
p.inventories[Inventory.NORMAL].addItem(itemId, 0, quantity, 1);
|
||||
p.inventories[Inventory.NORMAL].addItem(itemId, quantity, 1);
|
||||
}
|
||||
else
|
||||
{
|
||||
foreach (KeyValuePair<uint, ConnectedPlayer> entry in mConnectedPlayerList)
|
||||
{
|
||||
Player p = entry.Value.getActor();
|
||||
p.inventories[Inventory.NORMAL].addItem(itemId, 0, quantity, 1);
|
||||
p.inventories[Inventory.NORMAL].addItem(itemId, quantity, 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -441,6 +441,74 @@ namespace FFXIVClassic_Lobby_Server
|
|||
}
|
||||
}
|
||||
|
||||
private void giveCurrancy(ConnectedPlayer client, uint itemId, int quantity)
|
||||
{
|
||||
if (client != null)
|
||||
{
|
||||
Player p = client.getActor();
|
||||
p.inventories[Inventory.CURRANCY].addItem(itemId, quantity, 1);
|
||||
}
|
||||
else
|
||||
{
|
||||
foreach (KeyValuePair<uint, ConnectedPlayer> entry in mConnectedPlayerList)
|
||||
{
|
||||
Player p = entry.Value.getActor();
|
||||
p.inventories[Inventory.CURRANCY].addItem(itemId, quantity, 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void removeCurrancy(ConnectedPlayer client, uint itemId, int quantity)
|
||||
{
|
||||
if (client != null)
|
||||
{
|
||||
Player p = client.getActor();
|
||||
p.inventories[Inventory.CURRANCY].removeItem(itemId, quantity);
|
||||
}
|
||||
else
|
||||
{
|
||||
foreach (KeyValuePair<uint, ConnectedPlayer> entry in mConnectedPlayerList)
|
||||
{
|
||||
Player p = entry.Value.getActor();
|
||||
p.inventories[Inventory.CURRANCY].removeItem(itemId, quantity);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void giveKeyItem(ConnectedPlayer client, uint itemId)
|
||||
{
|
||||
if (client != null)
|
||||
{
|
||||
Player p = client.getActor();
|
||||
p.inventories[Inventory.KEYITEMS].addItem(itemId, 1, 1);
|
||||
}
|
||||
else
|
||||
{
|
||||
foreach (KeyValuePair<uint, ConnectedPlayer> entry in mConnectedPlayerList)
|
||||
{
|
||||
Player p = entry.Value.getActor();
|
||||
p.inventories[Inventory.KEYITEMS].addItem(itemId, 1, 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void removeKeyItem(ConnectedPlayer client, uint itemId)
|
||||
{
|
||||
if (client != null)
|
||||
{
|
||||
Player p = client.getActor();
|
||||
p.inventories[Inventory.KEYITEMS].removeItem(itemId, 1);
|
||||
}
|
||||
else
|
||||
{
|
||||
foreach (KeyValuePair<uint, ConnectedPlayer> entry in mConnectedPlayerList)
|
||||
{
|
||||
Player p = entry.Value.getActor();
|
||||
p.inventories[Inventory.KEYITEMS].removeItem(itemId, 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
internal void doCommand(string input, ConnectedPlayer client)
|
||||
{
|
||||
input.Trim();
|
||||
|
@ -514,7 +582,65 @@ namespace FFXIVClassic_Lobby_Server
|
|||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Log.error("Could not give item.");
|
||||
Log.error("Could not remove item.");
|
||||
}
|
||||
}
|
||||
else if (split[0].Equals("givekeyitem"))
|
||||
{
|
||||
try
|
||||
{
|
||||
if (split.Length == 2)
|
||||
giveKeyItem(client, UInt32.Parse(split[1]));
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Log.error("Could not give keyitem.");
|
||||
}
|
||||
}
|
||||
else if (split[0].Equals("removekeyitem"))
|
||||
{
|
||||
if (split.Length < 2)
|
||||
return;
|
||||
|
||||
try
|
||||
{
|
||||
if (split.Length == 2)
|
||||
removeKeyItem(client, UInt32.Parse(split[1]));
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Log.error("Could not remove keyitem.");
|
||||
}
|
||||
}
|
||||
else if (split[0].Equals("givecurrancy"))
|
||||
{
|
||||
try
|
||||
{
|
||||
if (split.Length == 2)
|
||||
giveCurrancy(client, UInt32.Parse(split[1]), 1);
|
||||
else if (split.Length == 3)
|
||||
giveCurrancy(client, UInt32.Parse(split[1]), Int32.Parse(split[2]));
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Log.error("Could not give currancy.");
|
||||
}
|
||||
}
|
||||
else if (split[0].Equals("removecurrancy"))
|
||||
{
|
||||
if (split.Length < 2)
|
||||
return;
|
||||
|
||||
try
|
||||
{
|
||||
if (split.Length == 2)
|
||||
removeCurrancy(client, UInt32.Parse(split[1]), 1);
|
||||
else if (split.Length == 3)
|
||||
removeCurrancy(client, UInt32.Parse(split[1]), Int32.Parse(split[2]));
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Log.error("Could not remove currancy.");
|
||||
}
|
||||
}
|
||||
else if (split[0].Equals("music"))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue