Fixed bug when received 00C6 without NPC Information

Wrote new code? Fixed a bug? Want to discuss technical stuff? Feel free to post it here.

Moderator: Moderators

Message
Author
UltimaWeapon
Human
Human
Posts: 37
Joined: 04 Apr 2008, 22:55
Noob?: Yes
Location: Thailand
Contact:

Fixed bug when received 00C6 without NPC Information

#1 Post by UltimaWeapon »

Below is a topic that report this bug.

http://forums.openkore.com/viewtopic.php?f=56&t=6821

The bug in that topic is because kore received 00C6 (NPC Buy List) after received 00B6 (NPC Cancel). When kore received 00B6. %talk will be undefined and cause this bug appeared.

This is a patch for fixed this bug.

Code: Select all

Index: src/Network/Receive.pm
===================================================================
--- src/Network/Receive.pm	(revision 6825)
+++ src/Network/Receive.pm	(working copy)
@@ -4265,8 +4265,10 @@
 		debug "Item added to Store: $store->{name} - $price z\n", "parseMsg", 2;
 		$storeList++;
 	}
-
-	my $name = getNPCName($talk{ID});
+	
+	# Real RO client can be receive this message without NPC Information. We should mimic this behavior.
+	my $name = (defined $talk{ID}) ? getNPCName($talk{ID}) : 'Unknown';
+	
 	$ai_v{npc_talk}{talk} = 'store';
 	# continue talk sequence now
 	$ai_v{'npc_talk'}{'time'} = time;
Please commit it.

Thank you. :mrgreen:
I may make you misunderstand. Because my English isn't good enough. So Sorry.
Image

windows98SE
Human
Human
Posts: 22
Joined: 31 May 2008, 21:40
Noob?: No

Re: Fixed bug when received 00C6 without NPC Information

#2 Post by windows98SE »

UltimaWeapon, i love you :P
Free !!, All about BOT SETTING, Plz. Read Openkore Manual

fChopin
Noob
Noob
Posts: 3
Joined: 02 Aug 2009, 12:56
Noob?: No

Re: Fixed bug when received 00C6 without NPC Information

#3 Post by fChopin »

in this subrutine
$name is the NPCID right ?
i've found that $name use only once when OpenKore
want to show the NPCID on it's console.

with my little idea

#my $name = getNPCName($talk{ID});
message TF("---------- Store List-----------\n" ."# Name Type Price\n"), "list";

i've used this way to bypass this bug for 2-3 days

and thx Ultima Weapon
for the better way

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

Re: Fixed bug when received 00C6 without NPC Information

#4 Post by kLabMouse »

Developers, Please Commit it.
Thanks.

h4rry84
Moderators
Moderators
Posts: 234
Joined: 04 Apr 2008, 09:30
Noob?: Yes
Location: My House
Contact:

Re: Fixed bug when received 00C6 without NPC Information

#5 Post by h4rry84 »

Committed , :mrgreen:

Locked