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.
r8436-8437 (shop_useSkill)
Moderator: Moderators
-
- Developers
- Posts: 1798
- Joined: 05 Dec 2008, 05:42
- Noob?: Yes
Re: r8436-8437 (shop_useSkill)
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)
-
- Developers
- Posts: 1798
- Joined: 05 Dec 2008, 05:42
- Noob?: Yes
Re: r8436-8437 (shop_useSkill)
Yes, something like this.
-
- Moderators
- Posts: 208
- Joined: 01 Feb 2010, 17:37
- Noob?: No
- Location: Brazil - MG
- Contact:
Re: r8436-8437 (shop_useSkill)
It would be very nice if this delay could be defined via user settings.KeplerBR wrote:Put a delay, because the official client, it takes some time to create a store
-
- Developers
- Posts: 1798
- Joined: 05 Dec 2008, 05:42
- Noob?: Yes
Re: r8436-8437 (shop_useSkill)
It's easy to use timeouts.txt in last snippet of code.
Re: r8436-8437 (shop_useSkill)
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.
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.
-
- Developers
- Posts: 1798
- Joined: 05 Dec 2008, 05:42
- Noob?: Yes
Re: r8436-8437 (shop_useSkill)
You may suggest that for the whole timeouts.txt then.KeplerBR wrote:I think more practical and organized configuration in config.txt
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?KeplerBR wrote:In the timeout.txt is normally used only for intervals of AI.