r8436-8437 (shop_useSkill)

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

Moderator: Moderators

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

r8436-8437 (shop_useSkill)

#1 Post by EternalHarvest »

http://openkore.svn.sourceforge.net/vie ... ision=8436
http://openkore.svn.sourceforge.net/vie ... ision=8437

Nice, but maybe use Task::Chained to cast the skill and then open the shop, and not automatically open the shop on receiving packet shop_skill? Task::UseSkill has special fixes to work correctly with Vending skill. This way, there would be less random stuff in network handlers and no special cases for XKore.

Kaspy
Halfway to Eternity
Halfway to Eternity
Posts: 398
Joined: 08 Jun 2012, 15:42
Noob?: No
Location: Brazil

Re: r8436-8437 (shop_useSkill)

#2 Post by Kaspy »

Right? Put a delay, because the official client, it takes some time to create a store
Index: AI/CoreLogic.pm
===================================================================
--- AI/CoreLogic.pm (revision 8559)
+++ AI/CoreLogic.pm (working copy)
@@ -3099,7 +3099,15 @@
skill => $skill,
priority => Task::USER_PRIORITY
);
- my $task = new Task::ErrorReport(task => $skillTask);
+ my $task = new Task::Chained(
+ tasks => [
+ new Task::ErrorReport(task => $skillTask),
+ Task::Timeout->new(
+ function => sub {main::openShop()},
+ seconds => 3,
+ )
+ ]
+ );
$taskManager->add($task);
} else {
main::openShop();
Index: Commands.pm
===================================================================
--- Commands.pm (revision 8559)
+++ Commands.pm (working copy)
@@ -3225,7 +3225,7 @@

if ($config{'shop_useSkill'}) {
# This method is responsible to NOT uses a bug in which openkore opens the shop,
- # using a vending skill and awaiting the response of the package and then open the shop
+ # using a vending skill and then open the shop
my $skill = new Skill(auto => "MC_VENDING");

require Task::UseSkill;
@@ -3234,7 +3234,15 @@
skill => $skill,
priority => Task::USER_PRIORITY
);
- my $task = new Task::ErrorReport(task => $skillTask);
+ my $task = new Task::Chained(
+ tasks => [
+ new Task::ErrorReport(task => $skillTask),
+ Task::Timeout->new(
+ function => sub {main::openShop()},
+ seconds => 3,
+ )
+ ]
+ );
$taskManager->add($task);
} else {
# This method is responsible to uses a bug in which openkore opens the shop
Index: Network/Receive.pm
===================================================================
--- Network/Receive.pm (revision 8559)
+++ Network/Receive.pm (working copy)
@@ -1478,7 +1478,7 @@
my $number = $args->{number};
message TF("You can sell %s items!\n", $number);

- main::openShop() unless ($config{XKore});
+ #main::openShop() unless ($config{XKore});
}

# 01D0 (spirits), 01E1 (coins), 08CF (amulets)
Image

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

Re: r8436-8437 (shop_useSkill)

#3 Post by EternalHarvest »

Yes, something like this.

iMikeLance
Moderators
Moderators
Posts: 208
Joined: 01 Feb 2010, 17:37
Noob?: No
Location: Brazil - MG
Contact:

Re: r8436-8437 (shop_useSkill)

#4 Post by iMikeLance »

KeplerBR wrote:Put a delay, because the official client, it takes some time to create a store
It would be very nice if this delay could be defined via user settings.

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

Re: r8436-8437 (shop_useSkill)

#5 Post by EternalHarvest »

It's easy to use timeouts.txt in last snippet of code.

Kaspy
Halfway to Eternity
Halfway to Eternity
Posts: 398
Joined: 08 Jun 2012, 15:42
Noob?: No
Location: Brazil

Re: r8436-8437 (shop_useSkill)

#6 Post by Kaspy »

Send to SVN: https://sourceforge.net/p/openkore/code/8561/

I think more practical and organized configuration in config.txt, but if necessary, can be moved to SVN.
In the timeout.txt is normally used only for intervals of AI.
Image

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

Re: r8436-8437 (shop_useSkill)

#7 Post by EternalHarvest »

KeplerBR wrote:I think more practical and organized configuration in config.txt
You may suggest that for the whole timeouts.txt then.
KeplerBR wrote:In the timeout.txt is normally used only for intervals of AI.
It's used for many kind of timeouts, including connection timeouts and shop-related delays. How come automatically opening the shop is not AI in our project?

Kaspy
Halfway to Eternity
Halfway to Eternity
Posts: 398
Joined: 08 Jun 2012, 15:42
Noob?: No
Location: Brazil

Re: r8436-8437 (shop_useSkill)

#8 Post by Kaspy »

Image

Post Reply