GithubHelp home page GithubHelp logo

lok_bot's Introduction

Disclaimer

#include <std_disclaimer.h>
/*
 *
 * We are not responsible for banned account or any other punishment by this game's GM. 
 * Please do some research if you have any concerns about features included in this repo
 * before using it! YOU are choosing to use these scripts, and if
 * you point the finger at us for messing up your account, we will laugh at you.
 *
 */

lok_bot

lok_crystal_miner

GitHub issues GitHub forks GitHub stars GitHub license

Yet another League of Kingdoms farming bot

Features

Feature Supported?
claim mail ✔YES️
buy caravan items ✔YES️
use resource items ✔YES️
claim chests(vip/silver/gold) ✔YES️
harvest resources ✔YES️
alliance help ✔YES️
alliance research ✔YES️
alliance shop auto buy ✔YES️
quest reward auto claim ✔YES️
building upgrade ✔YES️
academy research ✔YES️
train troops ✔YES️
field farming 🚧WIP

Usage

Run with local Python interpreter

Prerequisites

Clone or download the repo

git clone https://github.com/hldh214/lok_bot.git
# or click "Download Zip" button

Install requirements

cd lok_bot
pipenv sync

Run

# Use the UTF-8 mode on Windows
export PYTHONUTF8=1

# activate a new shell with pipenv
pipenv shell
python -m lokbot YOUR_X_ACCESS_TOKEN

# or run directly inside pipenv
pipenv run python -m lokbot YOUR_X_ACCESS_TOKEN

Run with Docker

Build image yourself

docker buildx build -t lok_bot_local --build-arg PYPI_MIRROR=https://pypi.tuna.tsinghua.edu.cn/simple .
docker run -e TOKEN=YOUR_X_ACCESS_TOKEN lok_bot_local

Or use prebuilt image

GitHub Workflow Status

docker run -e TOKEN=YOUR_X_ACCESS_TOKEN ghcr.io/hldh214/lok_bot

# or use your own config
docker run -v $PWD/config.json:/app/config.json -e TOKEN=YOUR_X_ACCESS_TOKEN ghcr.io/hldh214/lok_bot

Configuration

{
  "main": {
    "jobs": [
      {
        // name, DO NOT change
        "name": "alliance_farmer",
        // or false to disable this job
        "enabled": true,
        "kwargs": {
          // or false to disable gift claiming
          "gift_claim": true,
          "help_all": true,
          "research_donate": true,
          // or null if you don't want to auto buy items in alliance shop
          "shop_auto_buy_item_code_list": [
            // ITEM_CODE_VIP_100
            10101008
          ]
        },
        // Run every 120 to 200 minutes.
        "interval": {
          "start": 120,
          "end": 200
        }
      },
      {
        // experimental
        "name": "socf_thread",
        "enabled": true,
        "kwargs": {
          "object_code_list": [
            // OBJECT_CODE_CRYSTAL_MINE
            20100105,
            // OBJECT_CODE_GOBLIN
            20200104
          ],
          // radius of the zone to search, center: your castle, unit: zone
          // P.S. one zone contains 4x4 lands, please refer to: https://github.com/hldh214/lok_bot/blob/master/docs/land.md
          "radius": 8
        },
        // Run every 1 minutes.
        "interval": {
          "start": 1,
          "end": 1
        }
      }
    ],
    "threads": [
      {
        // name, DO NOT change
        "name": "building_farmer_thread",
        "enabled": true,
        "kwargs": {
          // if you want to use speedup items
          "speedup": true
        }
      },
      {
        "name": "academy_farmer_thread",
        "enabled": true,
        "kwargs": {
          // true if you want to research max level, else it will only level up to the minimum required level
          "to_max_level": false
        }
      }
    ]
  }
}

X_ACCESS_TOKEN

There are currently no plans to support login functionality. So we need this X_ACCESS_TOKEN trick to made it works.

x-access-token.webp

You need to log in on the web, then press F12 to open DevTools. Then click Network tab(1)(2), scroll down to the latest request and click it(3). On the right side(4) scroll down to the bottom, and you can see x-access-token field(5). Copy that value and pass it as X_ACCESS_TOKEN mentioned above.

Buy Me a Coffee

ETH/Matic: 0x27C7993CC3349DDE839B4F921733CFc523385864

References

https://github.com/miguelgrinberg/python-socketio/blob/v4.6.1/docs/client.rst https://github.com/bambusbjoerni/bambusbjoerni.github.io

lok_bot's People

Contributors

hldh214 avatar mohoseinhabibi avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

lok_bot's Issues

crystal mine

The bot only sends units to mines that are far away. Therefore it is always too late. The ones that appear close do not even try to take.

Api

can you please tell which api do you call or use

installation

Please can someone help me with the installation?
Please write a simple instruction for installation and how to start

No auth exception

Hi, after start all looks good
But after time I got error no_auth, check pls

2022-04-11 11:03:09.063 | INFO | lokbot.farmer:socf_thread:604 - a loop is finished
2022-04-11 11:47:48.145 | DEBUG | lokbot.client:post:73 - {"url": "quest/list", "data": {}, "elapsed": 0.691461, "res": {"result": false, "err": {"code": "no_auth"}}}

upd. When game is open in browser and window active I dont get error.

Can I close a browser and still successfully using a bot?

Tnx

Feature request

Hi all.

I don't see it, so i ask.

Does this bot send out troops for farming mines and nodes on the map?

Thanks and Best regards

???

Can you post a detailed description? what does this bot do and how does it reproduce? And throw in your donation wallet for your work!

c mine

its not farming c mine just atcking goblins
and showning login error

Not farming

Is it only for me or does the bot have not farming feature?

Tried to reinstall everything but the bot neither those build troops or sends them to farms.

is there a telegram group i can join to perhaps find even other bots?

Vps exe

Hy.
I use vps and cant install python. Can you convert to exe?

which line?

Discussed in #61

Originally posted by muratgulerergit May 23, 2022
Hi all,

Which line in the config file collects my lumber, quarry, farm and gold mine?
,

Inactive after a period of time

I use bot and leave it for some time the game doesn't let me take actions so bot can't execute commands, is there any solution?

Error when trying to send troops

Hello, anybody can help me why I get this error when the bot tries to send troops on gathering?

2022-05-08 22:11:33.202 | DEBUG | lokbot.client:post:72 - {"url": "field/march/info", "data": {"fromId": "6240b7e32599fd70c8ef33d3", "toLoc": [13, 859, 1439]}, "elapsed": 0.319399, "res": {"result": false, "err": {"code": "cannot_gathering"}}}
Exception in thread Thread-6116 (_handle_eio_message):
Traceback (most recent call last):
File "C:\Users\Andrej\AppData\Local\Programs\Python\Python310\lib\threading.py", line 1009, in _bootstrap_inner
self.run()
File "C:\Users\Andrej\AppData\Local\Programs\Python\Python310\lib\threading.py", line 946, in run
self._target(*self._args, **self._kwargs)
File "C:\Users\Andrej.virtualenvs\lokC-qA3jnGWS\lib\site-packages\socketio\client.py", line 621, in _handle_eio_message
self._handle_event(pkt.namespace, pkt.id, pkt.data)
File "C:\Users\Andrej.virtualenvs\lokC-qA3jnGWS\lib\site-packages\socketio\client.py", line 505, in _handle_event
r = self._trigger_event(data[0], namespace, *data[1:])
File "C:\Users\Andrej.virtualenvs\lokC-qA3jnGWS\lib\site-packages\socketio\client.py", line 555, in _trigger_event
return self.handlers[namespace]event
File "C:\lokC\lokbot\farmer.py", line 568, in on_field_objects
self._on_field_objects_gather(each_obj)
File "C:\lokC\lokbot\farmer.py", line 462, in on_field_objects_gather
march_troops = self.prepare_march_troops(each_obj, MARCH_TYPE_GATHER)
File "C:\lokC\lokbot\farmer.py", line 396, in prepare_march_troops
march_info = self.api.field_march_info({
File "C:\lokC\lokbot\client.py", line 511, in field_march_info
return self.post('field/march/info', data)
File "C:\Users\Andrej.virtualenvs\lokC-qA3jnGWS\lib\site-packages\tenacity_init
.py", line 324, in wrapped_f
return self(f, *args, **kw)
File "C:\Users\Andrej.virtualenvs\lokC-qA3jnGWS\lib\site-packages\tenacity_init
.py", line 404, in call
do = self.iter(retry_state=retry_state)
File "C:\Users\Andrej.virtualenvs\lokC-qA3jnGWS\lib\site-packages\tenacity_init
.py", line 349, in iter
return fut.result()
File "C:\Users\Andrej\AppData\Local\Programs\Python\Python310\lib\concurrent\futures_base.py", line 439, in result
return self._get_result()
File "C:\Users\Andrej\AppData\Local\Programs\Python\Python310\lib\concurrent\futures_base.py", line 391, in get_result
raise self.exception
File "C:\Users\Andrej.virtualenvs\lokC-qA3jnGWS\lib\site-packages\tenacity_init
.py", line 407, in call
result = fn(*args, **kwargs)
File "C:\Users\Andrej.virtualenvs\lokC-qA3jnGWS\lib\site-packages\tenacity_init
.py", line 324, in wrapped_f
return self(f, *args, **kw)
File "C:\Users\Andrej.virtualenvs\lokC-qA3jnGWS\lib\site-packages\tenacity_init
.py", line 404, in call
do = self.iter(retry_state=retry_state)
File "C:\Users\Andrej.virtualenvs\lokC-qA3jnGWS\lib\site-packages\tenacity_init
.py", line 349, in iter
return fut.result()
File "C:\Users\Andrej\AppData\Local\Programs\Python\Python310\lib\concurrent\futures_base.py", line 439, in result
return self._get_result()
File "C:\Users\Andrej\AppData\Local\Programs\Python\Python310\lib\concurrent\futures_base.py", line 391, in get_result
raise self.exception
File "C:\Users\Andrej.virtualenvs\lokC-qA3jnGWS\lib\site-packages\tenacity_init
.py", line 407, in call
result = fn(*args, **kwargs)
File "C:\Users\Andrej.virtualenvs\lokC-qA3jnGWS\lib\site-packages\tenacity_init
.py", line 324, in wrapped_f
return self(f, *args, **kw)
File "C:\Users\Andrej.virtualenvs\lokC-qA3jnGWS\lib\site-packages\tenacity_init
.py", line 404, in call
do = self.iter(retry_state=retry_state)
File "C:\Users\Andrej.virtualenvs\lokC-qA3jnGWS\lib\site-packages\tenacity_init
.py", line 349, in iter
return fut.result()
File "C:\Users\Andrej\AppData\Local\Programs\Python\Python310\lib\concurrent\futures_base.py", line 439, in result
return self._get_result()
File "C:\Users\Andrej\AppData\Local\Programs\Python\Python310\lib\concurrent\futures_base.py", line 391, in get_result
raise self.exception
File "C:\Users\Andrej.virtualenvs\lokC-qA3jnGWS\lib\site-packages\tenacity_init
.py", line 407, in call
result = fn(*args, **kwargs)
File "C:\Users\Andrej.virtualenvs\lokC-qA3jnGWS\lib\site-packages\tenacity_init
.py", line 324, in wrapped_f
return self(f, *args, **kw)
File "C:\Users\Andrej.virtualenvs\lokC-qA3jnGWS\lib\site-packages\tenacity_init
.py", line 404, in call
do = self.iter(retry_state=retry_state)
File "C:\Users\Andrej.virtualenvs\lokC-qA3jnGWS\lib\site-packages\tenacity_init
.py", line 349, in iter
return fut.result()
File "C:\Users\Andrej\AppData\Local\Programs\Python\Python310\lib\concurrent\futures_base.py", line 439, in result
return self.__get_result()
File "C:\Users\Andrej\AppData\Local\Programs\Python\Python310\lib\concurrent\futures_base.py", line 391, in __get_result
raise self.exception
File "C:\Users\Andrej.virtualenvs\lokC-qA3jnGWS\lib\site-packages\tenacity_init
.py", line 407, in call
result = fn(*args, **kwargs)
File "C:\Users\Andrej.virtualenvs\lokC-qA3jnGWS\lib\site-packages\ratelimit\decorators.py", line 80, in wrapper
return func(*args, **kargs)
File "C:\lokC\lokbot\client.py", line 100, in post
raise OtherException(code)
lokbot.exceptions.OtherException: cannot_gathering
2022-05-08 22:11:40.019 | DEBUG | lokbot.client:post:72 - {"url": "field/march/info", "data": {"fromId": "6240b7e32599fd70c8ef33d3", "toLoc": [13, 492, 1453]}, "elapsed": 0.719931, "res": {"result": true, "distance": 270, "troops": [{"_id": "612581328656947eb9ca811d", "code": 50100301, "amount": 21632}, {"_id": "6128c0567df0747d6c33d608", "code": 50100102, "amount": 19634}, {"_id": "612926aeab2fc921269a006f", "code": 50100302, "amount": 96161}, {"_id": "614775be7b8306022f48d6de", "code": 50100303, "amount": 146}, {"_id": "618db20305537e45f7a2accf", "code": 50100304, "amount": 62471}, {"_id": "619d43c46cd806772afa4209", "code": 50100104, "amount": 5019}, {"_id": "61e2df7faedd4218627c87b6", "code": 50100305, "amount": 302612}, {"_id": "623b99a1c75ce70bd4ec8afb", "code": 50100105, "amount": 56782}], "saveTroops": [[{"_id": "622ab1f4a0e8d97605053d71", "code": 50100305, "select": 0, "amount": 12121}], [{"_id": "6237ec1b5b83132b41df1789", "code": 50100305, "select": 0, "amount": 100000}], [], []], "marchType": 1, "fo": {"_id": "627823b7531289617c2ba435", "loc": [13, 492, 1453], "level": 1, "code": 20100105, "param": {"value": 50}, "state": 1, "expired": "2022-05-10T15:54:42.209Z"}, "numMarch": 4, "numMaxTroops": -1, "currentTroops": -1, "maxTroops": -1}}

Persistancy against errors

Hi all.
thank you dev-team of this app. it is a good base and well written code.

i want you to know that i implemented on local

  1. a nodes/mines gathering feature. that start a watch tower search, wait the report mail and then go the field for gathering
  2. a troops training feature. that try to train highest(tier) available infantry troop. with a limit.

i will make a pull request after tests. if you want.

////////////////////////

i want also to know if the base code, your code is persistent to errors like the "network errors", "not online error" and any OtherException?

Thanks again.

Using Ressources for... nothing

When we launch the bot, he will start by using the ressources in the inventory, i have already 50 millions on all ressources but the bot still using ressources that i want to keep in my inventory... big problem

mines

Can guide me to use the bot to exploit the gold, food mines

errrrroooorrr

In general, I did a check, the bot, apart from using chests with supplies, does nothing, well, it also pumps the academy.
The bot does not build a building, the level of buildings does not rise.

contact you

I wanted to send you a bot for you to try to have access to the code and implement this one will be very good if you can

Crystal Mines

The bot was working very good before the Last week update. it was Discovering Cmine very fast but now the bot look slow and dosent send troops out that fast to gather

Join rally

How to set config bot to join rally dragon or deathkar?

probability of blocking

checked the bot. first I launched 1 account, everything seemed to start working, I went to sleep, I woke up, and the account was blocked (deleted) Then I decided to use 1 more account and watched it in the docker and also got a ban after 1 hour. The question is, what is your bot for then? Or how to avoid blocking?

Radius

Hello,

Even tho i set the radius to 32, the bot sends troops to 1000+ km away. How can I fix that issue?

],
// radius of the land to search, center: your castle, unit: land
"radius": 32

I get this error

PS D:\LoK\lok_bot-master> py -m lokbot eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJfaWQiOiI2MWY3OTZhNWNkMWU4YTExNWY4ZjA2NWQiLCJraW5nZG9tSWQiOiI2MWY3OTZhNWNkMWU4YTExNWY4ZjA2NWUiLCJ2ZXJzaW9uIjoxNDQxLCJ0aW1lIjoxNjUxNzIyNjM4ODA2LCJpYXQiOjE2NTE3MjI2MzgsImV4cCI6MTY1MjMyNzQzOCwiaXNzIjoibm9kZ2FtZXMuY29tIiwic3ViIjoidXNlckluZm8ifQ.McX20q_ZjdMAm3nF7-SDbi-FnWLFBtuHptC1JQkPNzo
Traceback (most recent call last):
File "C:\Program Files\Python310\lib\runpy.py", line 187, in _run_module_as_main
mod_name, mod_spec, code = _get_module_details(mod_name, _Error)
File "C:\Program Files\Python310\lib\runpy.py", line 146, in _get_module_details
return _get_module_details(pkg_main_name, error)
File "C:\Program Files\Python310\lib\runpy.py", line 110, in get_module_details
import(pkg_name)
File "D:\LoK\lok_bot-master\lokbot_init
.py", line 5, in
from loguru import logger
ModuleNotFoundError: No module named 'loguru'

Getting Error "UnicodeEncodeError: 'charmap' codec can't encode characters"

Hello,

I am getting below error, the code is not stopping..

--- Logging error ---
Traceback (most recent call last):
File "C:\Users\Administrator\AppData\Local\Programs\Python\Python310\lib\logging_init_.py", line 1103, in emit
stream.write(msg + self.terminator)
File "C:\Users\Administrator\AppData\Local\Programs\Python\Python310\lib\encodings\cp1252.py", line 19, in encode
return codecs.charmap_encode(input,self.errors,encoding_table)[0]
UnicodeEncodeError: 'charmap' codec can't encode characters in position 283-287: character maps to
Call stack:
File "C:\Users\Administrator\AppData\Local\Programs\Python\Python310\lib\threading.py", line 966, in _bootstrap
self._bootstrap_inner()
File "C:\Users\Administrator\AppData\Local\Programs\Python\Python310\lib\threading.py", line 1009, in _bootstrap_inner
self.run()
File "C:\Users\Administrator\AppData\Local\Programs\Python\Python310\lib\threading.py", line 946, in run
self._target(*self._args, **self._kwargs)
File "C:\Users\Administrator\AppData\Local\Programs\Python\Python310\lib\site-packages\engineio\client.py", line 669, in _read_loop_websocket

Error: Not online

The bot is no longer working.Using the last prebuilt image. What could be the problem? Tried to build images myself and other precompiled - the situation is the same everywhere.

docker run -e TOKEN=MY_X_ACCESS_TOKEN ghcr.io/hldh214/lok_bot:latest
2022-02-19 11:08:56.492 | DEBUG    | lokbot.client:post:67 - {"url": "kingdom/enter", "data": {}, "res": {"result": true, "kingdom": {"wall": {"fireType": 0, "maxDurability": 5000, "durability": 5000}, "bf": {"status": 0}, "boost": {"total": [[11, 4, 2], [12, 1, 3000], [13, 1, 18000], [21, 1, 100000], [22, 1, 100000], [23, 1, 100000], [24, 1, 100000], [16, 4, 1], [202, 4, 100], [25, 4, 2], [118, 1, 5], [14, 2, 0.01], [29, 1, 7200], [30, 2, 0.1], [31, 2, 0.1], [32, 1, 10], [19, 1, 50000], [20, 1, 100000], [26, 1, 5000], [27, 2, 0.05], [28, 2, 0.05], [87, 2, 0.3], [42, 1, 5], [111, 1, 1], [109, 2, 0.03]]}, "stats": {"battle": {"victory": 0, "defeated": 0, "kill": 0, "death": 0}, "monster": {"attack": 0, "kill": 0}, "economy": {"gathering": 0}, "troops": {"heal": 0, "train": 0}, "alliance": {"donate": 0, "help": 0}, "total": {"crystal": 0, "purchase": 0, "max_purchase": 0, "mint": [], "unmint": [], "medals": 0}}, "vip": {"level": 1, "point": 20, "lastClaimTime": "2022-02-19T02:19:01.597Z"}, "actionPoint": {"value": 150, "lastUpdated": "2022-02-19T02:00:57.106Z"}, "freeChest": {"silver": {"num": 0, "next": "2022-02-19T02:00:56.907Z"}, "gold": {"next": "2022-02-19T02:10:56.907Z"}}, "engage": {"comback": false, "nopay": false}, "option": {"push": 1, "push_war": 1, "alarm": 1, "gift": 1}, "ban": {"face": false, "chat": false}, "klaytn": {"invite": {"card": 3, "total": 0, "res": 0}, "klay": {"claimed": 0, "unclaimed": 0}}, "hospital": {"checking": false, "lastUpdated": "2022-02-19T02:01:16.390Z"}, "deletedInfo": {"loc": []}, "level": 1, "resources": [100000, 100000, 100000, 100000], "crystal": 0, "power": 5510, "worldId": 30, "alliancePoint": 0, "numDonation": 0, "todayHP": 0, "todayRP": 0, "todayDonation": 0, "faceCode": -1, "selectedTreasure": 0, "saveTreasures": [[{"_id": "62104f6c1904db61a5180832", "slot": 0}, {"_id": "62104f6c1904db61a5180833", "slot": 1}], [{"_id": "62104f6dda84c7115b062e28", "slot": 0}, {"_id": "62104f6dda84c7115b062e29", "slot": 1}], [{"_id": "62104f6dda84c7115b062e2a", "slot": 0}, {"_id": "62104f6dda84c7115b062e2b", "slot": 1}], [{"_id": "62104f6dda84c7115b062e2c", "slot": 0}, {"_id": "62104f6dda84c7115b062e2d", "slot": 1}]], "saveTroops": [], "tutorialType": 1, "tutorials": [], "todayLogin": true, "yesterdayLogin": false, "medal": 0, "current_medal": 0, "congressTitle": 0, "mainLandId": 0, "blockIds": [], "_id": "62104f5829f5e74a24c7a42b", "researches": [], "buildings": [{"_id": "62104f6b1904db61a5180819", "position": 1, "code": 40100101, "state": 1, "level": 1, "builded": "2022-02-19T02:01:15.152Z", "lastUpgraded": "2022-02-19T02:01:15.152Z", "lastHarvested": null}, {"_id": "62104f6b1904db61a518081a", "position": 2, "code": 40100102, "state": 1, "level": 1, "builded": "2022-02-19T02:01:15.304Z", "lastUpgraded": "2022-02-19T02:01:15.304Z", "lastHarvested": null}, {"_id": "62104f6b1904db61a518081b", "position": 3, "code": 40100103, "state": 1, "level": 1, "builded": "2022-02-19T02:01:15.367Z", "lastUpgraded": "2022-02-19T02:01:15.367Z", "lastHarvested": null}, {"_id": "62104f6b1904db61a518081c", "position": 4, "code": 40100104, "state": 1, "level": 1, "builded": "2022-02-19T02:01:15.498Z", "lastUpgraded": "2022-02-19T02:01:15.498Z", "lastHarvested": null}, {"_id": "62104f6b1904db61a518081d", "position": 5, "code": 40100105, "state": 1, "level": 1, "builded": "2022-02-19T02:01:15.619Z", "lastUpgraded": "2022-02-19T02:01:15.619Z", "lastHarvested": null}, {"_id": "62104f6b1904db61a518081e", "position": 6, "code": 40100106, "state": 1, "level": 1, "builded": "2022-02-19T02:01:15.783Z", "lastUpgraded": "2022-02-19T02:01:15.783Z", "lastHarvested": "2022-02-19T02:01:16.390Z", "param": {"wounded": [], "cured": []}}, {"_id": "62104f6b1904db61a518081f", "position": 7, "code": 40100107, "state": 1, "level": 1, "builded": "2022-02-19T02:01:15.947Z", "lastUpgraded": "2022-02-19T02:01:15.947Z", "lastHarvested": null}, {"_id": "62104f6c1904db61a5180820", "position": 8, "code": 40100108, "state": 1, "level": 1, "builded": "2022-02-19T02:01:16.077Z", "lastUpgraded": "2022-02-19T02:01:16.077Z", "lastHarvested": null}, {"_id": "62104f6c1904db61a5180821", "position": 9, "code": 40100109, "state": 1, "level": 1, "builded": "2022-02-19T02:01:16.198Z", "lastUpgraded": "2022-02-19T02:01:16.198Z", "lastHarvested": null}], "troops": [], "supports": [], "lastDonationCheckTime": "2022-02-19T02:00:56.887Z", "treasure": [{"_id": "62104f6c1904db61a5180832", "slot": 0}, {"_id": "62104f6c1904db61a5180833", "slot": 1}], "bookmarks": [], "registered": "2022-02-19T02:00:56.887Z", "skills": [], "userId": "62104f5829f5e74a24c7a42a", "name": "ponomarev6y991", "__v": 0, "fieldObjectId": "62104f5929f5e74a24c7a42d", "lastLogined": "2022-02-19T02:30:03.428Z", "numSeriesLogin": 1, "lordId": "62104f6c1904db61a5180822", "connectedSocketId": "", "logined": false, "loc": [30, 441, 1861], "lord": {"level": 1, "xp": 0, "point": 1}, "logging": false}, "dbTime": "2022-02-19T03:08:56.421Z", "blockIds": [], "captcha": null, "networks": {"api": "https://api-lok-live.leagueofkingdoms.com/api", "kingdoms": ["https://sock-lok-live.leagueofkingdoms.com/socket.io/"], "fields": ["https://socf-lok-live.leagueofkingdoms.com/socket.io/"], "chats": ["https://socc-lok-live.leagueofkingdoms.com/socket.io/"]}}, "elapsed": 0.807076}
2022-02-19 11:08:58.803 | DEBUG    | lokbot.client:post:67 - {"url": "alliance/help/all", "data": {}, "res": {"result": false, "err": {"code": "no_alliance"}}, "elapsed": 0.306764}
2022-02-19 11:09:01.127 | DEBUG    | lokbot.client:post:67 - {"url": "kingdom/vip/info", "data": {}, "res": {"result": true, "vip": {"level": 1, "point": 20, "nextRewardDate": "2022-02-20T00:00:00.000Z", "isClaimed": true}}, "elapsed": 0.319511}
2022-02-19 11:09:03.433 | DEBUG    | lokbot.client:post:67 - {"url": "item/list", "data": {}, "res": {"result": true, "items": [{"code": 10101015, "amount": 1, "level": 0, "_id": "62105395b4d88c7e5d949f5b"}, {"code": 10101024, "amount": 1, "level": 0, "_id": "62105395b4d88c7e5d94a3eb"}, {"code": 10101033, "amount": 1, "level": 0, "_id": "62105395b4d88c7e5d94a853"}, {"code": 10101050, "amount": 1, "level": 0, "_id": "62105395b4d88c7e5d94ad93"}, {"code": 10104002, "amount": 1, "level": 0, "_id": "62104f58b4d88c7e5dbab071"}, {"code": 10104030, "amount": 1, "level": 0, "_id": "62104f58b4d88c7e5dbab05f"}, {"code": 10104091, "amount": 1, "level": 0, "_id": "62104f58b4d88c7e5dbab07a"}, {"code": 10104129, "amount": 1, "level": 0, "_id": "62104f58b4d88c7e5dbab081"}]}, "elapsed": 0.303155}
2022-02-19 11:09:05.755 | DEBUG    | lokbot.client:post:67 - {"url": "item/use", "data": {"code": 10101015, "amount": 1}, "res": {"result": false, "err": {"code": "not_online"}}, "elapsed": 0.317423}
Traceback (most recent call last):
  File "/usr/local/lib/python3.10/runpy.py", line 196, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "/usr/local/lib/python3.10/runpy.py", line 86, in _run_code
    exec(code, run_globals)
  File "/app/lokbot/__main__.py", line 5, in <module>
    fire.Fire(main)
  File "/app/.venv/lib/python3.10/site-packages/fire/core.py", line 141, in Fire
    component_trace = _Fire(component, args, parsed_flag_args, context, name)
  File "/app/.venv/lib/python3.10/site-packages/fire/core.py", line 466, in _Fire
    component, remaining_args = _CallAndUpdateTrace(
  File "/app/.venv/lib/python3.10/site-packages/fire/core.py", line 681, in _CallAndUpdateTrace
    component = fn(*varargs, **kwargs)
  File "/app/lokbot/app.py", line 31, in main
    schedule.run_all()
  File "/app/.venv/lib/python3.10/site-packages/schedule/__init__.py", line 787, in run_all
    default_scheduler.run_all(delay_seconds=delay_seconds)
  File "/app/.venv/lib/python3.10/site-packages/schedule/__init__.py", line 118, in run_all
    self._run_job(job)
  File "/app/.venv/lib/python3.10/site-packages/schedule/__init__.py", line 172, in _run_job
    ret = job.run()
  File "/app/.venv/lib/python3.10/site-packages/schedule/__init__.py", line 661, in run
    ret = self.job_func()
  File "/app/lokbot/farmer.py", line 774, in use_resource_in_item_list
    self.api.item_use(each_item.get('code'), each_item.get('amount'))
  File "/app/lokbot/client.py", line 312, in item_use
    return self.post('item/use', {'code': code, 'amount': amount})
  File "/app/.venv/lib/python3.10/site-packages/tenacity/__init__.py", line 324, in wrapped_f
    return self(f, *args, **kw)
  File "/app/.venv/lib/python3.10/site-packages/tenacity/__init__.py", line 404, in __call__
    do = self.iter(retry_state=retry_state)
  File "/app/.venv/lib/python3.10/site-packages/tenacity/__init__.py", line 349, in iter
    return fut.result()
  File "/usr/local/lib/python3.10/concurrent/futures/_base.py", line 439, in result
    return self.__get_result()
  File "/usr/local/lib/python3.10/concurrent/futures/_base.py", line 391, in __get_result
    raise self._exception
  File "/app/.venv/lib/python3.10/site-packages/tenacity/__init__.py", line 407, in __call__
    result = fn(*args, **kwargs)
  File "/app/.venv/lib/python3.10/site-packages/tenacity/__init__.py", line 324, in wrapped_f
    return self(f, *args, **kw)
  File "/app/.venv/lib/python3.10/site-packages/tenacity/__init__.py", line 404, in __call__
    do = self.iter(retry_state=retry_state)
  File "/app/.venv/lib/python3.10/site-packages/tenacity/__init__.py", line 349, in iter
    return fut.result()
  File "/usr/local/lib/python3.10/concurrent/futures/_base.py", line 439, in result
    return self.__get_result()
  File "/usr/local/lib/python3.10/concurrent/futures/_base.py", line 391, in __get_result
    raise self._exception
  File "/app/.venv/lib/python3.10/site-packages/tenacity/__init__.py", line 407, in __call__
    result = fn(*args, **kwargs)
  File "/app/.venv/lib/python3.10/site-packages/tenacity/__init__.py", line 324, in wrapped_f
    return self(f, *args, **kw)
  File "/app/.venv/lib/python3.10/site-packages/tenacity/__init__.py", line 404, in __call__
    do = self.iter(retry_state=retry_state)
  File "/app/.venv/lib/python3.10/site-packages/tenacity/__init__.py", line 349, in iter
    return fut.result()
  File "/usr/local/lib/python3.10/concurrent/futures/_base.py", line 439, in result
    return self.__get_result()
  File "/usr/local/lib/python3.10/concurrent/futures/_base.py", line 391, in __get_result
    raise self._exception
  File "/app/.venv/lib/python3.10/site-packages/tenacity/__init__.py", line 407, in __call__
    result = fn(*args, **kwargs)
  File "/app/.venv/lib/python3.10/site-packages/tenacity/__init__.py", line 324, in wrapped_f
    return self(f, *args, **kw)
  File "/app/.venv/lib/python3.10/site-packages/tenacity/__init__.py", line 404, in __call__
    do = self.iter(retry_state=retry_state)
  File "/app/.venv/lib/python3.10/site-packages/tenacity/__init__.py", line 349, in iter
    return fut.result()
  File "/usr/local/lib/python3.10/concurrent/futures/_base.py", line 439, in result
    return self.__get_result()
  File "/usr/local/lib/python3.10/concurrent/futures/_base.py", line 391, in __get_result
    raise self._exception
  File "/app/.venv/lib/python3.10/site-packages/tenacity/__init__.py", line 407, in __call__
    result = fn(*args, **kwargs)
  File "/app/.venv/lib/python3.10/site-packages/ratelimit/decorators.py", line 80, in wrapper
    return func(*args, **kargs)
  File "/app/lokbot/client.py", line 100, in post
    raise OtherException(code)
lokbot.exceptions.OtherException: not_online

Can you help me about error: not_online?

Hi,

The project is great. I referenced it a lot to write my own bot. I have problem about API: api/field/march/start alway response error: not_online.

Do you have suggestion about it? This is flow I use to farming:

  1. Get kingdom info: api/kingdom/enter
  2. Call api/chat/logs and api/auth/setDeviceInfo
  3. Using socket API to query field object
  4. Get field info: api/field/march/info
  5. Start farm: api/field/march/start

bot improving!

the codes are perfect like artwork!
jim liu well done
i think bot need growth in speed and ability.
please centralize to this bot.
you Are angel for some gamers

Error

Hy.
I have this error. Can u help me?

Account getting banned

Can you put some delay to the bot when sending troops or doing task. will look more inhuman

not sending to gather

hello the bot is not sending army for gathering do i need to do something , i just pulled the prebuild docker thanks in advance

code

what?
2022-02-25 10:02:12.010 | WARNING | lokbot.farmer:building_farmer_thread:294 - building_farmer: full_task, quit

image

can't farm

when i set this config to farm

"name": "socf_thread", "enabled": true, "kwargs": { "object_code_list": [ 20100105, 20100101, 20200104 ], "radius": 3 }, "interval": { "start": 1, "end": 1 } }

this config made a exception

collecting

Hello
Is it possible to add a function collection charm? Two would be good:

  • action point regeneration
  • troops speed

Not Mining

Hello,

The code is working fine for upgrades, harvest collection, resource collections.

However it is only attacking "Treasure Goblin" not going to any crystal Mine.

Am I missing any setting.

I encountered this error. Please help me

(lok_bot-KUZYcncA) C:\Users\anhnongdan\Downloads\Compressed\lok_bot>python -m lokbot eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJfaWQiOiI2MWFhMTdmYTk5YTBjMzBjYjgwN2VmN2IiLCJraW5nZG9tSWQiOiI2MWFhMTdmYTk5YTBjMzBjYjgwN2VmN2MiLCJ2ZXJzaW9uIjoxNDI2LCJ0aW1lIjoxNjUxOTQ1NzgzODU2LCJpYXQiOjE2NTE5NDU3ODMsImV4cCI6MTY1MjU1MDU4MywiaXNzIjoibm9kZ2FtZXMuY29tIiwic3ViIjoidXNlckluZm8ifQ.Y1TFpsVOflIjop6pr2aJWU1AzzHv6pHqx9YibfUoSd0
2022-05-08 00:59:28.312 | DEBUG | lokbot.client:post:72 - {"url": "kingdom/enter", "data": {}, "elapsed": 1.386117, "res": {"result": false, "err": {"code": "no_auth"}}}
Traceback (most recent call last):
File "C:\Users\anhnongdan\AppData\Local\Programs\Python\Python310\lib\runpy.py", line 196, in _run_module_as_main
return _run_code(code, main_globals, None,
File "C:\Users\anhnongdan\AppData\Local\Programs\Python\Python310\lib\runpy.py", line 86, in run_code
exec(code, run_globals)
File "C:\Users\anhnongdan\Downloads\Compressed\lok_bot\lokbot_main
.py", line 5, in
fire.Fire(main)
File "C:\Users\anhnongdan.virtualenvs\lok_bot-KUZYcncA\lib\site-packages\fire\core.py", line 141, in Fire
component_trace = _Fire(component, args, parsed_flag_args, context, name)
File "C:\Users\anhnongdan.virtualenvs\lok_bot-KUZYcncA\lib\site-packages\fire\core.py", line 466, in Fire
component, remaining_args = CallAndUpdateTrace(
File "C:\Users\anhnongdan.virtualenvs\lok_bot-KUZYcncA\lib\site-packages\fire\core.py", line 681, in CallAndUpdateTrace
component = fn(*varargs, **kwargs)
File "C:\Users\anhnongdan\Downloads\Compressed\lok_bot\lokbot\app.py", line 65, in main
farmer = LokFarmer(token, captcha_solver_config)
File "C:\Users\anhnongdan\Downloads\Compressed\lok_bot\lokbot\farmer.py", line 73, in init
self.kingdom_enter = self.api.kingdom_enter()
File "C:\Users\anhnongdan\Downloads\Compressed\lok_bot\lokbot\client.py", line 270, in kingdom_enter
res = self.post('kingdom/enter')
File "C:\Users\anhnongdan.virtualenvs\lok_bot-KUZYcncA\lib\site-packages\tenacity_init
.py", line 324, in wrapped_f
return self(f, *args, **kw)
File "C:\Users\anhnongdan.virtualenvs\lok_bot-KUZYcncA\lib\site-packages\tenacity_init
.py", line 404, in call
do = self.iter(retry_state=retry_state)
File "C:\Users\anhnongdan.virtualenvs\lok_bot-KUZYcncA\lib\site-packages\tenacity_init
.py", line 349, in iter
return fut.result()
File "C:\Users\anhnongdan\AppData\Local\Programs\Python\Python310\lib\concurrent\futures_base.py", line 439, in result
return self._get_result()
File "C:\Users\anhnongdan\AppData\Local\Programs\Python\Python310\lib\concurrent\futures_base.py", line 391, in get_result
raise self.exception
File "C:\Users\anhnongdan.virtualenvs\lok_bot-KUZYcncA\lib\site-packages\tenacity_init
.py", line 407, in call
result = fn(*args, **kwargs)
File "C:\Users\anhnongdan.virtualenvs\lok_bot-KUZYcncA\lib\site-packages\tenacity_init
.py", line 324, in wrapped_f
return self(f, *args, **kw)
File "C:\Users\anhnongdan.virtualenvs\lok_bot-KUZYcncA\lib\site-packages\tenacity_init
.py", line 404, in call
do = self.iter(retry_state=retry_state)
File "C:\Users\anhnongdan.virtualenvs\lok_bot-KUZYcncA\lib\site-packages\tenacity_init
.py", line 349, in iter
return fut.result()
File "C:\Users\anhnongdan\AppData\Local\Programs\Python\Python310\lib\concurrent\futures_base.py", line 439, in result
return self._get_result()
File "C:\Users\anhnongdan\AppData\Local\Programs\Python\Python310\lib\concurrent\futures_base.py", line 391, in get_result
raise self.exception
File "C:\Users\anhnongdan.virtualenvs\lok_bot-KUZYcncA\lib\site-packages\tenacity_init
.py", line 407, in call
result = fn(*args, **kwargs)
File "C:\Users\anhnongdan.virtualenvs\lok_bot-KUZYcncA\lib\site-packages\tenacity_init
.py", line 324, in wrapped_f
return self(f, *args, **kw)
File "C:\Users\anhnongdan.virtualenvs\lok_bot-KUZYcncA\lib\site-packages\tenacity_init
.py", line 404, in call
do = self.iter(retry_state=retry_state)
File "C:\Users\anhnongdan.virtualenvs\lok_bot-KUZYcncA\lib\site-packages\tenacity_init
.py", line 349, in iter
return fut.result()
File "C:\Users\anhnongdan\AppData\Local\Programs\Python\Python310\lib\concurrent\futures_base.py", line 439, in result
return self._get_result()
File "C:\Users\anhnongdan\AppData\Local\Programs\Python\Python310\lib\concurrent\futures_base.py", line 391, in get_result
raise self.exception
File "C:\Users\anhnongdan.virtualenvs\lok_bot-KUZYcncA\lib\site-packages\tenacity_init
.py", line 407, in call
result = fn(*args, **kwargs)
File "C:\Users\anhnongdan.virtualenvs\lok_bot-KUZYcncA\lib\site-packages\tenacity_init
.py", line 324, in wrapped_f
return self(f, *args, **kw)
File "C:\Users\anhnongdan.virtualenvs\lok_bot-KUZYcncA\lib\site-packages\tenacity_init
.py", line 404, in call
do = self.iter(retry_state=retry_state)
File "C:\Users\anhnongdan.virtualenvs\lok_bot-KUZYcncA\lib\site-packages\tenacity_init
.py", line 349, in iter
return fut.result()
File "C:\Users\anhnongdan\AppData\Local\Programs\Python\Python310\lib\concurrent\futures_base.py", line 439, in result
return self.__get_result()
File "C:\Users\anhnongdan\AppData\Local\Programs\Python\Python310\lib\concurrent\futures_base.py", line 391, in __get_result
raise self.exception
File "C:\Users\anhnongdan.virtualenvs\lok_bot-KUZYcncA\lib\site-packages\tenacity_init
.py", line 407, in call
result = fn(*args, **kwargs)
File "C:\Users\anhnongdan.virtualenvs\lok_bot-KUZYcncA\lib\site-packages\ratelimit\decorators.py", line 80, in wrapper
return func(*args, **kargs)
File "C:\Users\anhnongdan\Downloads\Compressed\lok_bot\lokbot\client.py", line 84, in post
raise NoAuthException()
lokbot.exceptions.NoAuthException

Dear

Dear, can you make a separate bot that will periodically kill mobs at a given time, which ones will I indicate? And it would also be great to make a bot that will look for mobs and mines at what levels I indicate.

Bot stops working after 1 min

I am getting the following errors after 1 minute of running the bot? How can I resolve this?

--- Logging error ---
Traceback (most recent call last):
File "C:\Users\Andrej\AppData\Local\Programs\Python\Python310\lib\logging_init_.py", line 1103, in emit
stream.write(msg + self.terminator)
File "C:\Users\Andrej\AppData\Local\Programs\Python\Python310\lib\encodings\cp1252.py", line 19, in encode
return codecs.charmap_encode(input,self.errors,encoding_table)[0]
UnicodeEncodeError: 'charmap' codec can't encode character '\u2606' in position 1384: character maps to
Call stack:
File "C:\Users\Andrej\AppData\Local\Programs\Python\Python310\lib\threading.py", line 966, in _bootstrap
self._bootstrap_inner()
File "C:\Users\Andrej\AppData\Local\Programs\Python\Python310\lib\threading.py", line 1009, in _bootstrap_inner
self.run()
File "C:\Users\Andrej\AppData\Local\Programs\Python\Python310\lib\threading.py", line 946, in run
self._target(*self._args, **self._kwargs)
File "C:\Users\Andrej.virtualenvs\lok-LPLZ91B9\lib\site-packages\engineio\client.py", line 669, in _read_loop_websocket
self._receive_packet(pkt)
File "C:\Users\Andrej.virtualenvs\lok-LPLZ91B9\lib\site-packages\engineio\client.py", line 504, in _receive_packet
self.logger.info(
Message: 'Received packet %s data %s'

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.