naivite / game-golem

Automatically exported from code.google.com/p/game-golem
0 stars 0 forks source link

Newer items in Black Smith tab not getting properly classed #166

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Go to http://apps.facebook.com/castle_age/item.php
2. Observe some newer items are not classed.
3. Also affects what is displayed in Town Invade/Duel tab.

What is the expected output? What do you see instead?
  Item name/ Item class
  Deliverance/Weapon
  Punisher/Weapon
  Mythril Fists/Gloves

What version of Golem are you using? Beta or release? On what browser?
R775

Does anything relevant appear in the Console? (ctrl+shift+J)
  Didn't look, as fix was trivial.

Please provide any additional information below.

The following change should fix this:

Town.blacksmith = {
   Weapon:  /avenger|axe|blade|bow|cleaver|cudgel|dagger|halberd|lance|mace|morningstar|rod|saber|spear|staff|stave|sword|talon|trident|wand|Crystal Rod|Daedalus|Dragonbane|Dreadnought Greatsword|Excalibur|Incarnation|Ironhart's Might|Lionheart Blade|Judgement|Justice|Lightbringer|Oathkeeper|Onslaught|Scepter|Punisher|Frost Edge|Deliverance/i,
   Shield:  /buckler|shield|tome|Defender|Dragon Scale|Frost Dagger|Frost Tear Dagger|Harmony|Sword of Redemption|Terra's Guard|The Dreadnought|Purgatory|Zenarean Crest|Aegis/i,
   Helmet:  /cowl|crown|helm|horns|mask|veil|Virtue of Fortitude/i,
   Gloves:  /gauntlet|glove|hand|bracer|fist|Slayer's Embrace|Virtue of Temperance/i,
   Armor:   /armor|chainmail|cloak|pauldrons|plate|raiments|robe|battlegear|garb|epaulet|vestment|Faerie Wings|Swordsmans Plate/i,
   Amulet:  /amulet|bauble|charm|crystal|eye|heart|insignia|jewel|lantern|memento|orb|shard|soul|talisman|trinket|signet|necklace|pendant|Paladin's Oath|Poseidons Horn| Ring|Ring of|Ruby Ore|Thawing Star|Mark of the Empire/i
};

Changed to use generics like "vestment" instead of "Blood Vestment".

Original issue reported on code.google.com by LickThis...@yahoo.com on 27 Aug 2010 at 10:53

GoogleCodeExporter commented 9 years ago
Sorry, first issue, and should have made it low priority.

Original comment by LickThis...@yahoo.com on 27 Aug 2010 at 11:05

GoogleCodeExporter commented 9 years ago
Attaching relevant worker file.

Original comment by LickThis...@yahoo.com on 27 Aug 2010 at 11:39

Attachments:

GoogleCodeExporter commented 9 years ago
committed in r777

Original comment by venjiance on 28 Aug 2010 at 6:01

GoogleCodeExporter commented 9 years ago
Thanks for catching the items I missed (they were not in my inventory).

You need to leave "Swordsmans Plate" in armor, as otherwise it will match on 
"sword" and be classified as a weapon. I also tried to eliminate it, but have 
Swordsmans Plate...

Original comment by LickThis...@yahoo.com on 29 Aug 2010 at 7:12

GoogleCodeExporter commented 9 years ago
I'll add "Swordsmans Plate" in a couple of days, together with some other epics 
and legendaries I've missed.

Original comment by venjiance on 29 Aug 2010 at 7:23

GoogleCodeExporter commented 9 years ago
r778 should fix it

Original comment by venjiance on 29 Aug 2010 at 9:51

GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
Oops, "Cowl of the Avenger" is showing as a weapon.

You could change "avenger" to the specifics "^Avenger$|Holy Avenger", then let 
the generics match cowl, amulet and plate.

It is not an error, but you could also have changed "|sword|" to "|sword 
|sword$|" and omitted the specific checks for "Swordsmans Plate" & "Swordsman 
Helm". Something to consider if they ever add more "Swordsman" stuff.

Original comment by LickThis...@yahoo.com on 30 Aug 2010 at 10:37

GoogleCodeExporter commented 9 years ago
I like your solution. I'll implement it in the next upload.

Original comment by venjiance on 31 Aug 2010 at 6:29

GoogleCodeExporter commented 9 years ago
I don't have these, but tunic & grinder are also missing. 

Since only 2 of the 8 items with "heart" in their name are amulets, maybe check 
for them specifically (all the others match generic patterns).

   Weapon: /axe|blade|bow|cleaver|cudgel|dagger|edge|grinder|halberd|lance|mace|morningstar|rod|saber|scepter|spear|staff|stave|sword |sword$|talon|trident|wand|^Avenger$|Celestas Devotion|Crystal Rod|Daedalus|Deliverance|Dragonbane|Dreadnought Greatsword|Excalibur|Holy Avenger|Incarnation|Ironhart's Might|Judgement|Justice|Lightbringer|Oathkeeper|Onslaught|Punisher|Soulforge/i,
   Shield: /aegis|buckler|shield|tome|Defender|Dragon Scale|Frost Tear Dagger|Harmony|Sword of Redemption|Terra's Guard|The Dreadnought|Purgatory|Zenarean Crest/i,
   Helmet: /cowl|crown|helm|horns|mask|veil|Virtue of Fortitude/i,
   Gloves: /gauntlet|glove|hand|bracer|fist|Slayer's Embrace|Soul Crusher|Soul Eater|Virtue of Temperance/i,
   Armor:  /armor|belt|chainmail|cloak|gear|garb|pauldrons|plate|raiments|robe|tunic|vestment|Faerie Wings|Epaulets of Might/i,
   Amulet: /amulet|bauble|charm|crystal|eye|flask|insignia|jewel|lantern|memento|necklace|orb|pendant|shard|signet|soul|talisman|trinket|Paladin's Oath|Poseidons Horn| Ring|Ring of|Ruby Ore|Thawing Star|Mark of the Empire|Transcendence|Heart of Elos|Terra's Heart/i

Original comment by LickThis...@yahoo.com on 31 Aug 2010 at 5:54

GoogleCodeExporter commented 9 years ago
r782 just committed

Original comment by venjiance on 1 Sep 2010 at 10:33

GoogleCodeExporter commented 9 years ago
Several issues remain here.

Sword of Redemption is a shield, matched by weapon pattern /sword /.
Ice Dagger and Frost Tear Dagger are shields, matched by weapon pattern 
/dagger/.
The Sword of Redemption and Frost Tear Dagger manage to be classed correctly 
due to being matched again by Shield after Weapon in the type loop, but Ice 
Dagger still looks like a weapon. It might be safer to correct this so that 
Town.blacksmith.Weapon could be used independently without relying on the order.

Many of the word segments stand the potential of mismatching in future because 
they aren't word bounded. To be safe it might be best to bracket most with 
/\bPATTERN\b/ to ensure the amulet pattern /crystal/ doesn't match things like 
weapon Crystalline Rod. Note that even /\bcrystal\b/ or /^crystal\b/ isn't 
safe, as it misclassifies weapon Crystal Rod as an amulet.

Weapon Fury Maul Axe could be matched by /\bmaul\b/.

The attached file snippet should match the current items in game, as 
represented in the Wiki.

Original comment by lur...@hotmail.com on 1 Sep 2010 at 7:06

Attachments:

GoogleCodeExporter commented 9 years ago
Oops, minor correction to the file:

'|\\bfists\\b' +    // 1+1

should read:

'|\\bfists?\\b' +   // 1+1

Original comment by lur...@hotmail.com on 1 Sep 2010 at 7:09

GoogleCodeExporter commented 9 years ago
The match isn't based on the order of regexps, but it's based instead on the 
length of matching part.

In the following code the name variable contains the name of the item.

for (i in Town.blacksmith) {
        if ((match = name.match(Town.blacksmith[i]))) {
                for (j=0; j<match.length; j++) {
                        if (match[j].length > maxlen) {
                                unit[name].type = i;
                                maxlen = match[j].length;
                        }
                }
        }
}

Original comment by venjiance on 1 Sep 2010 at 7:25

GoogleCodeExporter commented 9 years ago
Given the current matching loop, these likely need adding in:

Weapons:
Crystalline Rod (currently matches Amulet)
Death Dealer
Deathbellow
Lifebane
Moonclaw
Righteousness

Shields:
Feral Staff (currently matches Weapon)
Ice Dagger (currently matches Weapon)
Illusia's Bauble (currently matches Amulet)
Illvasan Crest
Serenes Arrow

Armor:
Death Ward
Lycan Armguard

Helmet:
Gilded Tiara

Gloves:
Tempered Steel

Amulet:
Shadowmoon
Silverlight Seal
Skullstone Relic
Sunstone Crest
Tribal Crest

Original comment by lur...@hotmail.com on 1 Sep 2010 at 9:20

GoogleCodeExporter commented 9 years ago
Lurgid has added / improved the matches. As of this date I think every item is 
recognised.

Original comment by RycochetTM on 8 Jan 2011 at 7:33