Code Monkey home page Code Monkey logo

tibiawikibot's Introduction

Build Status Quality Gate Coverage

TibiaWikiBot

Purpose

TibiaWikiBot acts as a MediaWiki bot which can be run manually from your local machine. It has these main jobs:

  • Creatures Service: check all creature pages for new loot information and add to item's droppedBy lists;
  • Items Service: check all item pages for new loot information and add to creature's loot lists;
  • Loot Statistics Service: check all loot statistics pages for new loot information and add to creature's loot lists.

The result of these services is used to add missing links to creatures on item pages and missing links to items on creature pages on TibiaWiki, a wiki about the game Tibia.

See also

tibiawikibot's People

Contributors

benjaminkomen avatar dependabot-preview[bot] avatar dependabot[bot] avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Forkers

sixish

tibiawikibot's Issues

Fix incorrectly adding e.g. Skull instead of Skull (Item)

For example, take an Amazon. In its loot stats page it has a loot item named Skull. The page of this item is actually named Skull (Item).

The 'FixLootStatistics' usecase incorrectly adds an item 'Skull' to the loot list of the creature.

One way to fix this would be to keep the usecase as dumb as it is and fix the item naming in the loot parser on the wiki.

Another option would be to add a list of exceptions to the usecase (i.e. if you find the name 'Skull' on a loot statistics page, translate this to 'Skull (Item)').

Reduce number of edits needed

The problem with the bot overwriting its own edits is solvable by only editing each page once.

  1. obtain data from creatures, store in a Set
  2. obtain data from items, store in a Set
  3. filter out the intersecting pairs in the two sets
  4. output results as two sets: a set of items missing from creature pages, and a set of creatures missing from item pages

This should reduce the current algorithm from O(n x m) performance to O(n + m) where n, m are creatures and items.

Fix class responsibilities

TibiaWikiBot doesn't seem to be responsible for anything. It seems TibiaWikiBot should be responsible for wrapping MediaWikiBot and WikiRepository so that FixCreatures shouldn't have to interact with those classes.

FixCreatures and FixItems should be connected in some way. They are fundamentally tasks for TibiaWikiBot. It's more appropriate to have TibiaWikiBot acting upon the task, than the task creating its own bot. Alternatively, FixCreatures could extend TibiaWikiBot and be a bot in itself.

Fix jackson parsing

After the update to Kotlin the jackson parsing is broken. Notably the Percentage class is weirdly constructed.

Fill creature's behaviour depending on runsat

When setting default values for creatures the following rules must be applied:

  • it is ok to fill behaviour with a question mark when the runsat parameter is empty;
  • the behaviour parameter should not be filled with a question mark when the runsat value is non-null.

Original report by Hunter of Dragoes:

Hey Bennie,
on April 28, your bot added missing creature parameters and even assigned default values to some of them. This was the case of blank behaviour parameters which were filled with Unknown. This caused an undesired situation when the Behaviour field was not blank (although the parameter was), but filled with a string which depends on the runsat value. Now, those pages have the word Unknown followed by the runsat's string. For example, you can check the Stalker page. Having said this, can you set your bot to remove the content from behaviour when runsat has a non-null value?

Loot exception on The Percht Queen

Message by Hunter:

Yesterday I removed The Crown of the Percht Queen and Giant Shimmering Pearl from The Percht Queen.
I believe your bot added those two items because they are listed on the loot stats page. Well, the bot can't read this, but we have a warning box which explains the Percht Queen drops 2 items named The Crown of the Percht Queen and 2 items named Giant Shimmering Pearl, since they can't be distinguished on the loot message, those disambiguation links are used on the loot stats page. This, obviously, doesn't apply to the creature page, on which we link to the 4 item pages (and don't link to those disambiguation pages).
https://tibia.fandom.com/wiki/The_Percht_Queen?diff=896552

Acceptance criteria:

  • When adding loot from the loot statistics pages, never add items The Crown of the Percht Queen and Giant Shimmering Pearl to creature The Percht Queen

Do not add empty list of sounds anymore

[at]Bennie, I noticed your bot was adding | sounds = {{Sound List|}} to all item pages it edited, can you change it so it won't add this parameter anymore (and won't remove it from items that emit sounds when used)?

Usecases FixLootStatistics and FixLootItems modify same creature

In one run, these two usecases can modify the same creature, essentially overwriting each other's commits. Possible ways to fix:

  • Have a cache of items/creatures on a higher level, outside of the separate usecases. Only save after all usecases are done.
  • Fix getting the latest state from MediaWiki API. There must be a way to not get a cached version but a live view.

Clean up code

It is bad practise to have all code in one main file, it is better to have several classes with their own methods.

Do not add item 'Old Rag' to loot list of Cyclops

XarkostToday at 2:36 PM
A few months ago I removed "Old Rag" from cyclops drop loot. I just realized the bot added it back. It also exists in the loot on Troll and Wolf pages. I assume this is because it appears in the "Dropped By" section on the item page https://tibia.fandom.com/wiki/Old_Rag. I removed this because the drop is related to a special event, similar to the Envelopes from the Wizards and these don't appear. Is there a solution for this? Does the Old Rag page have to be marked as related to an event?

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.