Language: 
To browser these website, it's necessary to store cookies on your computer.
The cookies contain no personal information, they are required for program control.
  the storage of cookies while browsing this website, on Login and Register.

Author Topic:  65000 WC stat  (Read 11985 times)

0 Members and 0 Guests are viewing this topic.

Joe

« on: 19, July 2014, 23:11:28 »
Main server:
For some reason having negative wc added to some items, drops it below 0 instead of stopping.  The -wc was added to the new killrin agility gear in this months event.
Whoever said "Out of sight, out of mind" never had a spider disappear in their bedroom.

smacky

« Reply #1 on: 20, July 2014, 13:22:26 »
It looks like this is a problem common to all primary (Str, etc) and secondary (WC, etc) stats and health indicators (hp, etc). Hard limits were not made server-side (for the most part -- hp 0 causes death at which point it is reset to max). Later, various ways to get boni/mali to these numbers were added, such as wc_add, etc object attributes and guild memberships, allowing them to have a wide range. Most crucially to drop below zero. While the server stores these as signed numbers (so negative is fine), the client interprets them as unsigned (so negative wraps around to a high positive).

The plugin contains some old TODO comments suggesting possible ranges. Some don't make sense (negative ac/wc/primaries?) and some are/will be outdated (primaries will be 0-200 or 0-250 not -30-30):

Code: [Select]
    /* TODO: Limit to +- 16000 ? */
    {"hitpoints",             FIELDTYPE_SINT32,    offsetof(object, stats.hp),                  0,                  0},
    {"max_hitpoints",         FIELDTYPE_SINT32,    offsetof(object, stats.maxhp),               FIELDFLAG_PLAYER_READONLY, 0},
    {"spellpoints",           FIELDTYPE_SINT16,    offsetof(object, stats.sp),                  0,                  0},
    {"max_spellpoints",       FIELDTYPE_SINT16,    offsetof(object, stats.maxsp),               FIELDFLAG_PLAYER_READONLY, 0},
    {"grace",                 FIELDTYPE_SINT16,    offsetof(object, stats.grace),               0,                  0},
    {"max_grace",             FIELDTYPE_SINT16,    offsetof(object, stats.maxgrace),            FIELDFLAG_PLAYER_READONLY, 0},
    /* TODO: Limit to max 999 (at least for players) ? */
    {"food",                  FIELDTYPE_SINT16,    offsetof(object, stats.food),                0,                  0},
    /* TODO: Limit to 0 <= dam <= 120 ? */
    {"damage",                FIELDTYPE_SINT16,    offsetof(object, stats.dam),                 FIELDFLAG_PLAYER_READONLY, 0},
    /* TODO: Limit to +-120 */
    {"weapon_class",          FIELDTYPE_SINT16,    offsetof(object, stats.wc),                  FIELDFLAG_PLAYER_READONLY, 0},
    /* TODO: Limit to +-120 */
    {"armour_class",          FIELDTYPE_SINT16,    offsetof(object, stats.ac),                  FIELDFLAG_PLAYER_READONLY, 0},
    /* TODO: Limit to +-30 (all  */
    {"strength",              FIELDTYPE_SINT8,     offsetof(object, stats.Str),                 FIELDFLAG_PLAYER_FIX, 0},
    {"dexterity",             FIELDTYPE_SINT8,     offsetof(object, stats.Dex),                 FIELDFLAG_PLAYER_FIX, 0},
    {"constitution",          FIELDTYPE_SINT8,     offsetof(object, stats.Con),                 FIELDFLAG_PLAYER_FIX, 0},
    {"wisdom",                FIELDTYPE_SINT8,     offsetof(object, stats.Wis),                 FIELDFLAG_PLAYER_FIX, 0},
    {"charisma",              FIELDTYPE_SINT8,     offsetof(object, stats.Cha),                 FIELDFLAG_PLAYER_FIX, 0},
    {"intelligence",          FIELDTYPE_SINT8,     offsetof(object, stats.Int),                 FIELDFLAG_PLAYER_FIX, 0},
    {"power",                 FIELDTYPE_SINT8,     offsetof(object, stats.Pow),                 FIELDFLAG_PLAYER_FIX, 0},
    {"thac0",                 FIELDTYPE_SINT8,     offsetof(object, stats.thac0),               FIELDFLAG_PLAYER_READONLY, 0},
    {"thacm",                 FIELDTYPE_SINT8,     offsetof(object, stats.thacm),               FIELDFLAG_PLAYER_READONLY, 0},

Shroud

« Reply #2 on: 20, July 2014, 20:26:46 »
That was quite informative. If anything it was a nice practical example of importance of using interfaces :)

It seems that bug is mostly cosmetic but I'll also note that I was quite surprised how often I managed to hit them so perhaps WC (and AC) aren't that important in determining if a mob is hit
Doesn't matter, you'd die anyway. ;D Shroud's a hacker. After many hours of deep thought I have came to that conclusion.

Tags:
 

Related Topics

  Subject / Started by Replies Last post
1 Replies
20641 Views
Last post 09, February 2005, 09:25:29
by michtoen
10 Replies
1428 Views
Last post 21, February 2008, 10:57:24
by Talwoasc
2 Replies
2849 Views
Last post 29, June 2009, 18:30:39
by fiendstar
23 Replies
5402 Views
Last post 02, August 2010, 21:32:49
by longir
4 Replies
2205 Views
Last post 27, February 2011, 19:20:34
by fatal