-
Notifications
You must be signed in to change notification settings - Fork 102
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
New InventoryItem subclasses to create catapult, ballista and trebuch…
…et on battlegrounds (#395) This PR will be linked to another PR on the db-public repo to have the corresponding 3 new ItemTemplates to complete this enhancement Co-authored-by: DigitalBox98 <[email protected]>
- Loading branch information
1 parent
888aa8b
commit 6002416
Showing
3 changed files
with
270 additions
and
0 deletions.
There are no files selected for viewing
90 changes: 90 additions & 0 deletions
90
GameServer/gameobjects/InventoryItem/GameInventorySiegeBallista.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,90 @@ | ||
/* | ||
* DAWN OF LIGHT - The first free open source DAoC server emulator | ||
* | ||
* This program is free software; you can redistribute it and/or | ||
* modify it under the terms of the GNU General Public License | ||
* as published by the Free Software Foundation; either version 2 | ||
* of the License, or (at your option) any later version. | ||
* | ||
* This program is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU General Public License | ||
* along with this program; if not, write to the Free Software | ||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | ||
* | ||
*/ | ||
using System; | ||
using System.Reflection; | ||
using System.Collections.Generic; | ||
|
||
using DOL.Language; | ||
using DOL.GS.PacketHandler; | ||
using DOL.Database; | ||
using DOL.GS.Spells; | ||
|
||
using log4net; | ||
|
||
namespace DOL.GS | ||
{ | ||
/// <summary> | ||
/// This class represents a Siege Ballista inventory item | ||
/// </summary> | ||
public class GameInventorySiegeBallista : GameInventoryItem, IGameInventoryItem, ITranslatableObject | ||
{ | ||
|
||
public GameInventorySiegeBallista() | ||
: base() | ||
{ | ||
} | ||
|
||
public GameInventorySiegeBallista(ItemTemplate template) | ||
: base(template) | ||
{ | ||
} | ||
|
||
public GameInventorySiegeBallista(ItemUnique template) | ||
: base(template) | ||
{ | ||
} | ||
|
||
public GameInventorySiegeBallista(InventoryItem item) | ||
: base(item) | ||
{ | ||
OwnerID = item.OwnerID; | ||
ObjectId = item.ObjectId; | ||
} | ||
|
||
|
||
/// <summary> | ||
/// Try and use this item | ||
/// </summary> | ||
/// <param name="player"></param> | ||
/// <returns>true if item use is handled here</returns> | ||
public bool Use(GamePlayer player) | ||
{ | ||
// Create the siege ballista | ||
GameSiegeBallista bal = new GameSiegeBallista(); | ||
|
||
// Level, name and model of the siege ballista are retrieved from the inventory item | ||
bal.Level = Convert.ToByte(Level); | ||
bal.Name = Name; | ||
bal.Model = (ushort) Model; | ||
bal.X = player.X; | ||
bal.Y = player.Y; | ||
bal.Z = player.Z; | ||
bal.CurrentRegion = player.CurrentRegion; | ||
bal.Realm = player.Realm; | ||
bal.AddToWorld(); | ||
|
||
// Remove current item from player's inventory | ||
InventoryItem item = player.Inventory.GetItem((eInventorySlot)SlotPosition); | ||
player.Inventory.RemoveItem(item); | ||
|
||
return true; | ||
} | ||
} | ||
|
||
} |
90 changes: 90 additions & 0 deletions
90
GameServer/gameobjects/InventoryItem/GameInventorySiegeCatapult.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,90 @@ | ||
/* | ||
* DAWN OF LIGHT - The first free open source DAoC server emulator | ||
* | ||
* This program is free software; you can redistribute it and/or | ||
* modify it under the terms of the GNU General Public License | ||
* as published by the Free Software Foundation; either version 2 | ||
* of the License, or (at your option) any later version. | ||
* | ||
* This program is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU General Public License | ||
* along with this program; if not, write to the Free Software | ||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | ||
* | ||
*/ | ||
using System; | ||
using System.Reflection; | ||
using System.Collections.Generic; | ||
|
||
using DOL.Language; | ||
using DOL.GS.PacketHandler; | ||
using DOL.Database; | ||
using DOL.GS.Spells; | ||
|
||
using log4net; | ||
|
||
namespace DOL.GS | ||
{ | ||
/// <summary> | ||
/// This class represents a Siege Catapult inventory item | ||
/// </summary> | ||
public class GameInventorySiegeCatapult : GameInventoryItem, IGameInventoryItem, ITranslatableObject | ||
{ | ||
|
||
public GameInventorySiegeCatapult() | ||
: base() | ||
{ | ||
} | ||
|
||
public GameInventorySiegeCatapult(ItemTemplate template) | ||
: base(template) | ||
{ | ||
} | ||
|
||
public GameInventorySiegeCatapult(ItemUnique template) | ||
: base(template) | ||
{ | ||
} | ||
|
||
public GameInventorySiegeCatapult(InventoryItem item) | ||
: base(item) | ||
{ | ||
OwnerID = item.OwnerID; | ||
ObjectId = item.ObjectId; | ||
} | ||
|
||
|
||
/// <summary> | ||
/// Try and use this item | ||
/// </summary> | ||
/// <param name="player"></param> | ||
/// <returns>true if item use is handled here</returns> | ||
public bool Use(GamePlayer player) | ||
{ | ||
// Create the siege catapult | ||
GameSiegeCatapult cat = new GameSiegeCatapult(); | ||
|
||
// Level, name and model of the siege catapult are retrieved from the inventory item | ||
cat.Level = Convert.ToByte(Level); | ||
cat.Name = Name; | ||
cat.Model = (ushort) Model; | ||
cat.X = player.X; | ||
cat.Y = player.Y; | ||
cat.Z = player.Z; | ||
cat.CurrentRegion = player.CurrentRegion; | ||
cat.Realm = player.Realm; | ||
cat.AddToWorld(); | ||
|
||
// Remove current item from player's inventory | ||
InventoryItem item = player.Inventory.GetItem((eInventorySlot)SlotPosition); | ||
player.Inventory.RemoveItem(item); | ||
|
||
return true; | ||
} | ||
} | ||
|
||
} |
90 changes: 90 additions & 0 deletions
90
GameServer/gameobjects/InventoryItem/GameInventorySiegeTrebuchet.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,90 @@ | ||
/* | ||
* DAWN OF LIGHT - The first free open source DAoC server emulator | ||
* | ||
* This program is free software; you can redistribute it and/or | ||
* modify it under the terms of the GNU General Public License | ||
* as published by the Free Software Foundation; either version 2 | ||
* of the License, or (at your option) any later version. | ||
* | ||
* This program is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU General Public License | ||
* along with this program; if not, write to the Free Software | ||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | ||
* | ||
*/ | ||
using System; | ||
using System.Reflection; | ||
using System.Collections.Generic; | ||
|
||
using DOL.Language; | ||
using DOL.GS.PacketHandler; | ||
using DOL.Database; | ||
using DOL.GS.Spells; | ||
|
||
using log4net; | ||
|
||
namespace DOL.GS | ||
{ | ||
/// <summary> | ||
/// This class represents a Siege Trebuchet inventory item | ||
/// </summary> | ||
public class GameInventorySiegeTrebuchet : GameInventoryItem, IGameInventoryItem, ITranslatableObject | ||
{ | ||
|
||
public GameInventorySiegeTrebuchet() | ||
: base() | ||
{ | ||
} | ||
|
||
public GameInventorySiegeTrebuchet(ItemTemplate template) | ||
: base(template) | ||
{ | ||
} | ||
|
||
public GameInventorySiegeTrebuchet(ItemUnique template) | ||
: base(template) | ||
{ | ||
} | ||
|
||
public GameInventorySiegeTrebuchet(InventoryItem item) | ||
: base(item) | ||
{ | ||
OwnerID = item.OwnerID; | ||
ObjectId = item.ObjectId; | ||
} | ||
|
||
|
||
/// <summary> | ||
/// Try and use this item | ||
/// </summary> | ||
/// <param name="player"></param> | ||
/// <returns>true if item use is handled here</returns> | ||
public bool Use(GamePlayer player) | ||
{ | ||
// Create the siege trebuchet | ||
GameSiegeBallista bal = new GameSiegeBallista(); | ||
|
||
// Level, name and model of the siege trebuchet are retrieved from the inventory item | ||
bal.Level = Convert.ToByte(Level); | ||
bal.Name = Name; | ||
bal.Model = (ushort) Model; | ||
bal.X = player.X; | ||
bal.Y = player.Y; | ||
bal.Z = player.Z; | ||
bal.CurrentRegion = player.CurrentRegion; | ||
bal.Realm = player.Realm; | ||
bal.AddToWorld(); | ||
|
||
// Remove current item from player's inventory | ||
InventoryItem item = player.Inventory.GetItem((eInventorySlot)SlotPosition); | ||
player.Inventory.RemoveItem(item); | ||
|
||
return true; | ||
} | ||
} | ||
|
||
} |