feat: Added DamageDescription class

+ Added onPlayerDamage event
This commit is contained in:
AURUMVORXX
2024-11-05 23:44:22 +03:00
parent 7a1d11543b
commit 4efda3e2e0
12 changed files with 193 additions and 8 deletions

View File

@@ -0,0 +1,33 @@
#ifndef _PYDAMAGEDESCRIPTION_H
#define _PYDAMAGEDESCRIPTION_H
#include <classes/sq/DamageDescription.h>
class PyDamageDescription
{
private:
nonut::DamageDescription *sqobj;
public:
PyDamageDescription() { sqobj = new nonut::DamageDescription(); };
PyDamageDescription(SQObject obj) { sqobj = new nonut::DamageDescription(obj); }
nonut::Int getFlags() { return sqobj->flags; }
nonut::Int getDamage() { return sqobj->damage; }
nonut::String getItemInstance() { return sqobj->item_instance; }
nonut::Int getDistance() { return sqobj->distance; }
nonut::Int getSpellId() { return sqobj->spell_id; }
nonut::Int getSpellLevel() { return sqobj->spell_level; }
nonut::String getNode() { return sqobj->node; }
void setFlags(nonut::Int value) { sqobj->flags = value; }
void setDamage(nonut::Int value) { sqobj->damage = value; }
void setDistance(nonut::Int value) { sqobj->distance = value; }
void setSpellId(nonut::Int value) { sqobj->spell_id = value; }
void setSpellLevel(nonut::Int value) { sqobj->spell_level = value; }
void setNode(nonut::String value) { sqobj->node = value; }
void del() { delete sqobj; }
};
#endif

View File

@@ -1,5 +1,5 @@
#ifndef _PYPACKET_H_
#define _PYPACKET_
#define _PYPACKET_H_
#include <classes/sq/Packet.h>

View File

@@ -0,0 +1,32 @@
#include <NoNut/core/CommonHeader.h>
#include "DamageDescription.h"
namespace nonut
{
DamageDescription::DamageDescription() :
Class("DamageDescription"),
PROPERTY_CTOR(flags),
PROPERTY_CTOR(damage),
PROPERTY_CTOR(item_instance),
PROPERTY_CTOR(distance),
PROPERTY_CTOR(spell_id),
PROPERTY_CTOR(spell_level),
PROPERTY_CTOR(node)
{
classCtor();
}
DamageDescription::DamageDescription(SQObject object) :
Class("DamageDescription", object),
PROPERTY_CTOR(flags),
PROPERTY_CTOR(damage),
PROPERTY_CTOR(item_instance),
PROPERTY_CTOR(distance),
PROPERTY_CTOR(spell_id),
PROPERTY_CTOR(spell_level),
PROPERTY_CTOR(node)
{
}
}

View File

@@ -0,0 +1,27 @@
#ifndef _DAMAGEDESCRIPTION_H_
#define _DAMAGEDESCRIPTION_H_
#include <string>
#include <NoNut/core/Class.h>
#include <NoNut/core/CustomTypes.h>
namespace nonut
{
class DamageDescription : public Class
{
public:
DamageDescription();
explicit DamageDescription(SQObject object);
// Properties
Property<Int> flags;
Property<Int> damage;
Property<String> item_instance;
Property<Int> distance;
Property<Int> spell_id;
Property<Int> spell_level;
Property<String> node;
};
}
#endif

View File

@@ -1,5 +1,5 @@
#ifndef NONUT_G2O_SERVER_CLASS_PACKET
#define NONUT_G2O_SERVER_CLASS_PACKET
#ifndef _PACKET_H_
#define _PACKET_H_
#include <string>
#include <NoNut/core/Class.h>
@@ -13,7 +13,6 @@ namespace nonut
Packet();
explicit Packet(SQObject object);
// Methods
Function<void> reset;
Function<void, Int, Int> send;
Function<void, Int> sendToAll;
@@ -36,10 +35,9 @@ namespace nonut
Function<Float> readFloat;
Function<String> readString;
// Properties
Property<Int> bitsUsed;
Property<Int> bytesUsed;
};
}
#endif // NONUT_G2O_SERVER_CLASS_PACKET
#endif