[2.0.7][r7437] Urgent:Implement missing packets and handlers

Forum closed. All further discussion to be discussed at https://github.com/OpenKore/

Moderators: Moderators, Developers

Message
Author
User avatar
kLabMouse
Administrator
Administrator
Posts: 1301
Joined: 24 Apr 2008, 12:02

[2.0.7][r7437] Urgent:Implement missing packets and handlers

#1 Post by kLabMouse »

As topic says: http://forums.openkore.com/viewtopic.php?f=56&t=8020
there is a few packets that OpenKore does not support yet, and thus found on Official Servers.
Also, Please compare kRO::Sakexe_0 and ServerType0, so all know packet are implemented in ServerType0 too.

Code: Select all

// packet 0xcb
// Not present in ServerType 0
struct PACKET_ZC_PC_SELL_RESULT {
  /* this+0x0 */ short PacketType
  /* this+0x2 */ unsigned char result
}

// packet 0x182
// Not present in ServerType 0
struct PACKET_ZC_MEMBER_ADD {
  /* this+0x0 */ short PacketType
  /* this+0x2 */ struct GUILD_MEMBER_INFO Info {
    /* this+0x0 */ int AID
    /* this+0x4 */ int GID
    /* this+0x8 */ short head
    /* this+0xa */ short headPalette
    /* this+0xc */ short sex
    /* this+0xe */ short job
    /* this+0x10 */ short level
    /* this+0x12 */ int contributionExp
    /* this+0x16 */ int currentState
    /* this+0x1a */ int positionID
    /* this+0x1e */ char intro[50]
    /* this+0x50 */ char charname[24]
  }
}

// packet 0x1ec
// Not present in ServerType 0
struct PACKET_ZC_GUILD_MEMBER_MAP_CHANGE {
  /* this+0x0 */ short PacketType
  /* this+0x2 */ unsigned long GDID
  /* this+0x6 */ unsigned long AID
  /* this+0xa */ char mapName[16]
}

// packet 0x27b
// Not present in ServerType 0
struct PACKET_ZC_PCBANG_EFFECT {
  /* this+0x0 */ short PacketType
  /* this+0x2 */ int ExpFactor
  /* this+0x6 */ int ExpFactor2
  /* this+0xa */ int DropFactor
}

// packet 0x2db
struct PACKET_CZ_BATTLEFIELD_CHAT {
  /* this+0x0 */ short PacketType
  /* this+0x2 */ unsigned short PacketLength
  /* this+0x4 */ char msg[...]
}

// packet 0x2dc
struct PACKET_ZC_BATTLEFIELD_CHAT {
  /* this+0x0 */ short PacketType
  /* this+0x2 */ unsigned short PacketLength
  /* this+0x4 */ unsigned long accountID
  /* this+0x8 */ char name[24]
  /* this+0x20 */ char msg[...]
}

// packet 0x2dd
struct PACKET_ZC_BATTLEFIELD_NOTIFY_CAMPINFO {
  /* this+0x0 */ short PacketType
  /* this+0x2 */ unsigned long accountID
  /* this+0x6 */ char name[24]
  /* this+0x1e */ short camp
}

// packet 0x2de
struct PACKET_ZC_BATTLEFIELD_NOTIFY_POINT {
  /* this+0x0 */ short PacketType
  /* this+0x2 */ short pointCampA
  /* this+0x4 */ short pointCampB
}

// packet 0x2df
struct PACKET_ZC_BATTLEFIELD_NOTIFY_POSITION {
  /* this+0x0 */ short PacketType
  /* this+0x2 */ unsigned long accountID
  /* this+0x6 */ char name[24]
  /* this+0x1e */ unsigned short job
  /* this+0x20 */ short x
  /* this+0x22 */ short y
}

// packet 0x2e0
struct PACKET_ZC_BATTLEFIELD_NOTIFY_HP {
  /* this+0x0 */ short PacketType
  /* this+0x2 */ unsigned long accountID
  /* this+0x6 */ char name[24]
  /* this+0x1e */ short hp
  /* this+0x20 */ short maxHp
}

// packet 0x2e7
// NOTE:
// mapInfoTable one will be written to: g_session.m_mapInfoTable[packet->type][i]
// and resset to 0 on PACKET_ZC_NOTIFY_MAPPROPERTY and PACKET_ZC_NOTIFY_MAPPROPERTY2 as thus only implement "type" param
// This packet Implement Additional Zone Characteristics.
// This packet is resend to client on entering Piece/Battle zones on map.
struct PACKET_ZC_MAPPROPERTY {
  /* this+0x0 */ short PacketType
  /* this+0x2 */ unsigned short PacketLength
  /* this+0x4 */ short type
  /* this+0x6 */ int mapInfoTable[...]
}
// param "type": 
enum {
    MAPPROPERTY_NOTHING =  0x0,
    MAPPROPERTY_FREEPVPZONE =  0x1,
    MAPPROPERTY_EVENTPVPZONE =  0x2,
    MAPPROPERTY_AGITZONE =  0x3,
    MAPPROPERTY_PKSERVERZONE =  0x4,
    MAPPROPERTY_PVPSERVERZONE =  0x5,
    MAPPROPERTY_DENYSKILLZONE =  0x6
}
// param "mapInfoTable": 
enum {
    MAPPROPERTY_PK =  0x0,
    MAPPROPERTY_TELEPORT =  0x1,
    MAPPROPERTY_NOTREMEMBER =  0x2,
    MAPPROPERTY_ITEMDROP =  0x3,
    MAPPROPERTY_EXP =  0x4,
    MAPPROPERTY_DISCONNECT_NOTREMEMBER =  0x5,
    MAPPROPERTY_CALLMONSTER =  0x6,
    MAPPROPERTY_PARTY =  0x7,
    MAPPROPERTY_GUILD =  0x8,
    MAPPROPERTY_SIEGE =  0x9,
    MAPPROPERTY_PKSERVER =  0xa,
    MAPPROPERTY_PVPSERVER =  0xb,
    MAPPROPERTY_DENYSKILL =  0xc,
    MAPPROPERTY_TURBOTRACK =  0xd,
    MAPPROPERTY_DENY_BUTTERFLY =  0xe,
    MAPPROPERTY_USE_SIMPLE_EFFECT =  0xf,
    MAPPROPERTY_DISABLE_LOCKON =  0x10,
    MAPPROPERTY_COUNT_PK =  0x11,
    MAPPROPERTY_NO_PARTY_FORMATION =  0x12,
    MAPPROPERTY_BATTLEFIELD =  0x13,
    MAPPROPERTY_LAST =  0x14,
    MAPPROPERTY_HIDING_DAMAGE =  0x15,
    MAPPROPERTY_DISABLE_KNOCKBACK =  0x16,
    MAPPROPERTY_LONG_INSUPERABLE_TIME =  0x17,
    MAPPROPERTY_NAMED_BOOTY =  0x18,
    MAPPROPERTY_SIEGETIME_VERSION =  0x19,
    MAPPROPERTY_GOTOTOWN =  0x1a,
    MAPPROPERTY_NORMAL_DAMAGE =  0x1b,
    MAPPROPERTY_RANGE_DAMAGE =  0x1c,
    MAPPROPERTY_BLOCK_EQUIPITEM =  0x1d,
    MAPPROPERTY_BLOCK_BUFF =  0x1e,
    MAPPROPERTY_NO_CHATTING =  0x1f
}

// packet 0x2f0
struct PACKET_ZC_PROGRESS {
  /* this+0x0 */ short PacketType
  /* this+0x2 */ unsigned long color
  /* this+0x6 */ unsigned long time
}

// packet 0x2f1
struct PACKET_CZ_PROGRESS {
  /* this+0x0 */ short PacketType
}

// packet 0x2f2
struct PACKET_ZC_PROGRESS_CANCEL {
  /* this+0x0 */ short PacketType
}

// packet 0x7d9
struct PACKET_ZC_SHORTCUT_KEY_LIST_V2 {
  /* this+0x0 */ short PacketType
  /* this+0x2 */ struct ShortCutKey ShortCutKey[38] {
    /* this+0x0 */ char isSkill
    /* this+0x1 */ unsigned long ID
    /* this+0x5 */ short count
  }
}
// packet: 0x7f6
// NOTE:
// Looks like packet 00B1 PACKET_ZC_LONGPAR_CHANGE, but with additional "AID" (Must be yours or 0)
// and "expType" that switches type of Experience gained.
struct PACKET_ZC_NOTIFY_EXP {
  /* this+0x0 */ short PacketType
  /* this+0x2 */ unsigned long AID
  /* this+0x6 */ int amount
  /* this+0xa */ unsigned short varID
  /* this+0xc */ short expType {
    EXP_FROM_BATTLE =  0x0,
    EXP_FROM_QUEST =  0x1,
  }
}

// packet: 0x7fa
struct PACKET_ZC_DELETE_ITEM_FROM_BODY {
  /* this+0x0 */ short PacketType
  /* this+0x2 */ short DeleteType {
    DELETE_TYPE_NORMAL =  0x0,
    DELETE_TYPE_USE_SKILL =  0x1,
    DELETE_TYPE_FAIL_REFINING =  0x2,
    DELETE_TYPE_CHANGE_MATERIAL =  0x3,
    DELETE_TYPE_MOVETO_STORE =  0x4,
    DELETE_TYPE_MOVETO_CART =  0x5,
    DELETE_TYPE_SELL_ITEM =  0x6,
  }
  /* this+0x4 */ unsigned short Index
  /* this+0x6 */ short Count
}

// packet 0x7ff
// NOTE:
// I did not seen this packet in wild, with "PacketLength" more then 8.
struct PACKET_ZC_DEFINE_CHECK {
  /* this+0x0 */ short PacketType
  /* this+0x2 */ short PacketLength
  /* this+0x4 */ int Result {
    DEFINE__BROADCASTING_SPECIAL_ITEM_OBTAIN =  0x1,
    DEFINE__RENEWAL_ADD_2 =  0x2,
    DEFINE__CHANNELING_SERVICE =  0x4,
  }
}

// packet: 0x80f
struct PACKET_ZC_ADD_EXCHANGE_ITEM2 {
  /* this+0x0 */ short PacketType
  /* this+0x2 */ unsigned short ITID
  /* this+0x4 */ unsigned char type
  /* this+0x5 */ int count
  /* this+0x9 */ bool IsIdentified
  /* this+0xa */ bool IsDamaged
  /* this+0xb */ unsigned char refiningLevel
  /* this+0xc */ struct EQUIPSLOTINFO slot {
    /* this+0x0 */ unsigned short info[4]
  }
}

EternalHarvest
Developers
Developers
Posts: 1798
Joined: 05 Dec 2008, 05:42
Noob?: Yes

Re: [2.0.7][r7437] Urgent:Implement missing packets and handlers

#2 Post by EternalHarvest »

kLabMouse wrote:

Code: Select all

// packet 0x2e7
// NOTE:
// mapInfoTable one will be written to: g_session.m_mapInfoTable[packet->type][i]
// and resset to 0 on PACKET_ZC_NOTIFY_MAPPROPERTY and PACKET_ZC_NOTIFY_MAPPROPERTY2 as thus only implement "type" param

  /* this+0x6 */ int mapInfoTable[...]
It looks more like an array of byte flags indicating if Nth property is turned on with Nth byte, not like an array of int.

User avatar
kLabMouse
Administrator
Administrator
Posts: 1301
Joined: 24 Apr 2008, 12:02

Re: [2.0.7][r7437] Urgent:Implement missing packets and handlers

#3 Post by kLabMouse »

EternalHarvest wrote:
kLabMouse wrote:

Code: Select all

// packet 0x2e7
// NOTE:
// mapInfoTable one will be written to: g_session.m_mapInfoTable[packet->type][i]
// and resset to 0 on PACKET_ZC_NOTIFY_MAPPROPERTY and PACKET_ZC_NOTIFY_MAPPROPERTY2 as thus only implement "type" param

  /* this+0x6 */ int mapInfoTable[...]
It looks more like an array of byte flags indicating if Nth property is turned on with Nth byte, not like an array of int.
But "enum" is not an a bit mask.

EternalHarvest
Developers
Developers
Posts: 1798
Joined: 05 Dec 2008, 05:42
Noob?: Yes

Re: [2.0.7][r7437] Urgent:Implement missing packets and handlers

#4 Post by EternalHarvest »

kLabMouse wrote:
array of byte flags
But "enum" is not an a bit mask.

Code: Select all

info_table: 00 01 01 00 01 00 01 00 00 00 00 00 00 00 00 00 00 00 00 00
Byte count mathes MAPPROPERTY_LAST (non-renewal).

EternalHarvest
Developers
Developers
Posts: 1798
Joined: 05 Dec 2008, 05:42
Noob?: Yes

Re: [2.0.7][r7437] Urgent:Implement missing packets and handlers

#5 Post by EternalHarvest »

Let's put it all into one line and add descriptions or ignoring where it's known what it means.

Code: Select all

Index: src/Network/Receive/ServerType0.pm
===================================================================
--- src/Network/Receive/ServerType0.pm	(revision 7441)
+++ src/Network/Receive/ServerType0.pm	(working copy)
@@ -253,7 +253,7 @@
 		'0194' => ['character_name', 'a4 Z24', [qw(ID name)]],
 		'0195' => ['actor_name_received', 'a4 Z24 Z24 Z24 Z24', [qw(ID name partyName guildName guildTitle)]],
 		'0196' => ['actor_status_active', 'v a4 C', [qw(type ID flag)]],
-		'0199' => ['pvp_mode1', 'v', [qw(type)]],
+		'0199' => ['map_property', 'v', [qw(type)]],
 		'019A' => ['pvp_rank', 'V3', [qw(ID rank num)]],
 		'019B' => ['unit_levelup', 'a4 V', [qw(ID type)]],
 		'019E' => ['pet_capture_process'],
@@ -427,6 +427,7 @@
 		'02DE' => ['battleground_score', 'v2', [qw(score_lion score_eagle)]],
 		# 02E1 packet unsure of dual_wield_damage needs more testing
 		'02E1' => ['actor_action', 'a4 a4 a4 V2 v x2 v x2 C v', [qw(sourceID targetID tick src_speed dst_speed damage div type dual_wield_damage)]],
+		'02E7' => ['map_property', 'v2 a*', [qw(len type info_table)]],
 		'02E8' => ['inventory_items_stackable'],
 		'02E9' => ['cart_items_stackable'],
 		'02EA' => ['storage_items_stackable'],
@@ -5209,28 +5210,86 @@
 	}
 }
 
-# TODO: add unknown modes
-sub pvp_mode1 {
+use constant MAPPROPERTY_TYPE => qw(
+	MAPPROPERTY_NOTHING
+	MAPPROPERTY_FREEPVPZONE
+	MAPPROPERTY_EVENTPVPZONE
+	MAPPROPERTY_AGITZONE
+	MAPPROPERTY_PKSERVERZONE
+	MAPPROPERTY_PVPSERVERZONE
+	MAPPROPERTY_DENYSKILLZONE
+);
+
+use constant MAPPROPERTY_INFO => qw(
+	MAPPROPERTY_PK
+	MAPPROPERTY_TELEPORT
+	MAPPROPERTY_NOTREMEMBER
+	MAPPROPERTY_ITEMDROP
+	MAPPROPERTY_EXP
+	MAPPROPERTY_DISCONNECT_NOTREMEMBER
+	MAPPROPERTY_CALLMONSTER
+	MAPPROPERTY_PARTY
+	MAPPROPERTY_GUILD
+	MAPPROPERTY_SIEGE
+	MAPPROPERTY_PKSERVER
+	MAPPROPERTY_PVPSERVER
+	MAPPROPERTY_DENYSKILL
+	MAPPROPERTY_TURBOTRACK
+	MAPPROPERTY_DENY_BUTTERFLY
+	MAPPROPERTY_USE_SIMPLE_EFFECT
+	MAPPROPERTY_DISABLE_LOCKON
+	MAPPROPERTY_COUNT_PK
+	MAPPROPERTY_NO_PARTY_FORMATION
+	MAPPROPERTY_BATTLEFIELD
+	MAPPROPERTY_LAST
+	MAPPROPERTY_HIDING_DAMAGE
+	MAPPROPERTY_DISABLE_KNOCKBACK
+	MAPPROPERTY_LONG_INSUPERABLE_TIME
+	MAPPROPERTY_NAMED_BOOTY
+	MAPPROPERTY_SIEGETIME_VERSION
+	MAPPROPERTY_GOTOTOWN
+	MAPPROPERTY_NORMAL_DAMAGE
+	MAPPROPERTY_RANGE_DAMAGE
+	MAPPROPERTY_BLOCK_EQUIPITEM
+	MAPPROPERTY_BLOCK_BUFF
+	MAPPROPERTY_NO_CHATTING
+);
+
+use constant MAPPROPERTY_MSG => {
+	MAPPROPERTY_TELEPORT => T('Allow Teleport'),
+	MAPPROPERTY_DISCONNECT_NOTREMEMBER => T('Respawn on Disconnect'),
+	MAPPROPERTY_USE_SIMPLE_EFFECT => undef,
+	MAPPROPERTY_DISABLE_LOCKON => undef,
+};
+
+sub map_property {
 	my ($self, $args) = @_;
-	my $type = $args->{type};
-
-	if ($type == 0) {
-		$pvp = 0;
-	} elsif ($type == 1) {
-		message T("PvP Display Mode\n"), "map_event";
-		$pvp = 1;
-	} elsif ($type == 3) {
-		message T("GvG Display Mode\n"), "map_event";
-		$pvp = 2;
-	} else {
-		debug "pvp_mode1: Unknown mode: $type\n";
-	}
 	
+	my @msg;
+	push @msg, (MAPPROPERTY_TYPE)[$args->{type}] if $args->{type};
+	
+	# compatibility only
+	$pvp = {1 => 1, 3 => 2}->{$args->{type}};
 	if ($pvp) {
 		Plugins::callHook('pvp_mode', {
 			pvp => $pvp # 1 PvP, 2 GvG
 		});
 	}
+	
+	# TODO: if implementing storage of properties, clear map info here (also in pvp_mode2)
+	
+	if ($args->{info_table}) {
+		# TODO: if implementing storage of properties, save map info
+		
+		my @info_table = unpack 'C*', $args->{info_table};
+		for (grep { $info_table[$_] } 0 .. @info_table-1) {
+			push @msg, (MAPPROPERTY_INFO)[$_];
+		}
+	}
+	
+	message TF("Map is currently: %s\n", join ', ', grep defined, map {
+		exists MAPPROPERTY_MSG->{$_} ? MAPPROPERTY_MSG->{$_} : s/^\w+_// && $_
+	} @msg), "map_event";
 }
 
 sub pvp_mode2 {

Code: Select all

MAP Name: prt_gld.gat
Map is currently: Allow Teleport, NOTREMEMBER

Map Change: prtg_cas04.gat
Map is currently: PK, Respawn on Disconnect, GUILD, SIEGE
GvG Display Mode
Also pvp_mode2 is sent by server right after map_properties (last line in log).

Technology
Super Moderators
Super Moderators
Posts: 801
Joined: 06 May 2008, 12:47
Noob?: No

Re: [2.0.7][r7437] Urgent:Implement missing packets and handlers

#6 Post by Technology »

One ST0 to rule them all? One PE viewer to find them!
One ST_kRO to bring them all and in the darkness bind them...

Mount Doom awaits us, fellowship of OpenKore!

EternalHarvest
Developers
Developers
Posts: 1798
Joined: 05 Dec 2008, 05:42
Noob?: Yes

Re: [2.0.7][r7437] Urgent:Implement missing packets and handlers

#7 Post by EternalHarvest »

for 1D6 pvp_mode2 type

Code: Select all

typedef enum <unnamed-tag> {
  MAPTYPE_VILLAGE =  0x0,
  MAPTYPE_VILLAGE_IN =  0x1,
  MAPTYPE_FIELD =  0x2,
  MAPTYPE_DUNGEON =  0x3,
  MAPTYPE_ARENA =  0x4,
  MAPTYPE_PENALTY_FREEPKZONE =  0x5,
  MAPTYPE_NOPENALTY_FREEPKZONE =  0x6,
  MAPTYPE_EVENT_GUILDWAR =  0x7,
  MAPTYPE_AGIT =  0x8,
  MAPTYPE_DUNGEON2 =  0x9,
  MAPTYPE_DUNGEON3 =  0xa,
  MAPTYPE_PKSERVER =  0xb,
  MAPTYPE_PVPSERVER =  0xc,
  MAPTYPE_DENYSKILL =  0xd,
  MAPTYPE_TURBOTRACK =  0xe,
  MAPTYPE_JAIL =  0xf,
  MAPTYPE_MONSTERTRACK =  0x10,
  MAPTYPE_PORINGBATTLE =  0x11,
  MAPTYPE_AGIT_SIEGEV15 =  0x12,
  MAPTYPE_BATTLEFIELD =  0x13,
  MAPTYPE_PVP_TOURNAMENT =  0x14,
  MAPTYPE_UNUSED =  0x1d,
  MAPTYPE_LAST =  0x1e,
} <unnamed-tag>;

EternalHarvest
Developers
Developers
Posts: 1798
Joined: 05 Dec 2008, 05:42
Noob?: Yes

Re: [2.0.7][r7437] Urgent:Implement missing packets and handlers

#8 Post by EternalHarvest »

Map properties are now character statuses.

Locked