06-05-2012, 01:03 AM
кому интересно вот отображение урона
писалось быстро так что не обессудте
писалось быстро так что не обессудте
Код:
Index: /trunk/Lineage 2 Goddess of Destruction/gameserver/src/main/java/l2p/gameserver/serverpackets/StatusUpdate.java
===================================================================
--- /trunk/Lineage 2 Goddess of Destruction/gameserver/src/main/java/l2p/gameserver/serverpackets/StatusUpdate.java (revision 3)
+++ /trunk/Lineage 2 Goddess of Destruction/gameserver/src/main/java/l2p/gameserver/serverpackets/StatusUpdate.java (revision 103)
@@ -42,5 +42,11 @@
public final static int MAX_CP = 0x22;
+ /**
+ * GOD отображение демага
+ */
+ public final static int DAMAGE = 0x23;
+
private final int _objectId;
+ private int _playerId;
private final List<Attribute> _attributes = new ArrayList<Attribute>();
@@ -54,7 +60,14 @@
}
}
+ public StatusUpdate(int objectId)
+ {
+ _objectId = objectId;
+ _playerId = 0;
+ }
- public StatusUpdate(int objectId) {
+ public StatusUpdate(int objectId, int playerId)
+ {
_objectId = objectId;
+ _playerId = playerId;
}
@@ -68,6 +81,6 @@
writeC(0x18);
writeD(_objectId);
- writeD(1); //хз че такое Наверно МП
- writeD(1); // при 1 идет рег хп
+ writeD(_playerId);
+ writeD(0x01); //При 1 = рег ХП
writeD(_attributes.size());
Index: /trunk/Lineage 2 Goddess of Destruction/gameserver/src/main/java/l2p/gameserver/serverpackets/SystemMessage.java
===================================================================
--- /trunk/Lineage 2 Goddess of Destruction/gameserver/src/main/java/l2p/gameserver/serverpackets/SystemMessage.java (revision 81)
+++ /trunk/Lineage 2 Goddess of Destruction/gameserver/src/main/java/l2p/gameserver/serverpackets/SystemMessage.java (revision 103)
@@ -15,4 +15,5 @@
// d d (d S/d d/d dd)
// |--------------> 0 - String 1-number 2-textref npcname (1000000-1002655) 3-textref itemname 4-textref skills 5-??
+ private static final int TYPE_DAMAGE = 16;
private static final int TYPE_CLASS_NAME = 15;
private static final int TYPE_SYSTEM_STRING = 13;
@@ -3257,4 +3258,10 @@
}
+ public SystemMessage addDamage(Creature targetid, Creature attakerid, int damage)
+ {
+ args.add(new Arg(TYPE_DAMAGE, new int[] { targetid.getObjectId(), attakerid.getObjectId(), damage }));
+ return this;
+ }
+
@Override
protected final void writeImpl() {
@@ -3311,4 +3318,11 @@
break;
}
+ case TYPE_DAMAGE: {
+ int[] attr = (int[]) e.obj;
+ writeD(attr[0]); // target object id
+ writeD(attr[1]); // attaker object id
+ writeD(attr[2]); // damage
+ break;
+ }
}
}
Index: /trunk/Lineage 2 Goddess of Destruction/gameserver/src/main/java/l2p/gameserver/model/Player.java
===================================================================
--- /trunk/Lineage 2 Goddess of Destruction/gameserver/src/main/java/l2p/gameserver/model/Player.java (revision 101)
+++ /trunk/Lineage 2 Goddess of Destruction/gameserver/src/main/java/l2p/gameserver/model/Player.java (revision 103)
@@ -2170,5 +2170,5 @@
return;
- StatusUpdate su = makeStatusUpdate(StatusUpdate.MAX_HP, StatusUpdate.MAX_MP, StatusUpdate.MAX_CP, StatusUpdate.CUR_HP, StatusUpdate.CUR_MP, StatusUpdate.CUR_CP);
+ StatusUpdate su = makeStatusUpdate(StatusUpdate.MAX_HP, StatusUpdate.MAX_MP, StatusUpdate.MAX_CP, StatusUpdate.CUR_HP, StatusUpdate.CUR_MP, StatusUpdate.CUR_CP, StatusUpdate.DAMAGE);
sendPacket(su);
@@ -8404,12 +8404,12 @@
if (crit)
if (magic)
- sendPacket(new SystemMessage(SystemMessage.MAGIC_CRITICAL_HIT).addName(this));
+ sendPacket(new SystemMessage(SystemMessage.MAGIC_CRITICAL_HIT).addName(this).addDamage(target,target,damage));
else
- sendPacket(new SystemMessage(SystemMessage.C1_HAD_A_CRITICAL_HIT).addName(this));
+ sendPacket(new SystemMessage(SystemMessage.C1_HAD_A_CRITICAL_HIT).addName(this).addDamage(target,target,damage));
if (miss)
- sendPacket(new SystemMessage(SystemMessage.C1S_ATTACK_WENT_ASTRAY).addName(this));
+ sendPacket(new SystemMessage(SystemMessage.C1S_ATTACK_WENT_ASTRAY).addName(this).addDamage(target,target,damage));
else if (!target.isDamageBlocked())
- sendPacket(new SystemMessage(SystemMessage.C1_HAS_GIVEN_C2_DAMAGE_OF_S3).addName(this).addName(target).addNumber(damage));
+ sendPacket(new SystemMessage(SystemMessage.C1_HAS_GIVEN_C2_DAMAGE_OF_S3).addName(this).addName(target).addNumber(damage).addDamage(target,target,damage));
if (target.isPlayer()) {
@@ -8424,5 +8424,5 @@
public void displayReceiveDamageMessage(Creature attacker, int damage) {
if (attacker != this)
- sendPacket(new SystemMessage(SystemMessage.C1_HAS_RECEIVED_DAMAGE_OF_S3_FROM_C2).addName(this).addName(attacker).addNumber((long) damage));
+ sendPacket(new SystemMessage(SystemMessage.C1_HAS_RECEIVED_DAMAGE_OF_S3_FROM_C2).addName(this).addName(attacker).addNumber((long) damage).addDamage(attacker,attacker,damage));
}
Index: /trunk/Lineage 2 Goddess of Destruction/gameserver/src/main/java/l2p/gameserver/model/Creature.java
===================================================================
--- /trunk/Lineage 2 Goddess of Destruction/gameserver/src/main/java/l2p/gameserver/model/Creature.java (revision 101)
+++ /trunk/Lineage 2 Goddess of Destruction/gameserver/src/main/java/l2p/gameserver/model/Creature.java (revision 103)
@@ -78,4 +78,5 @@
public abstract class Creature extends GameObject {
+
public class MoveNextTask extends RunnableImpl {
private double alldist, donedist;
@@ -879,6 +880,13 @@
su.addAttribute(field, getPvpFlag());
break;
+ case StatusUpdate.DAMAGE:
+ su.addAttribute(field, (int) getCurrentHp() );
+ break;
}
return su;
+ }
}