… | |
… | |
833 | AddIfShort (ns->last_stats.Wis, ob->stats.Wis, CS_STAT_WIS); |
833 | AddIfShort (ns->last_stats.Wis, ob->stats.Wis, CS_STAT_WIS); |
834 | AddIfShort (ns->last_stats.Pow, ob->stats.Pow, CS_STAT_POW); |
834 | AddIfShort (ns->last_stats.Pow, ob->stats.Pow, CS_STAT_POW); |
835 | AddIfShort (ns->last_stats.Cha, ob->stats.Cha, CS_STAT_CHA); |
835 | AddIfShort (ns->last_stats.Cha, ob->stats.Cha, CS_STAT_CHA); |
836 | |
836 | |
837 | for (int s = 0; s < NUM_SKILLS; s++) |
837 | for (int s = 0; s < NUM_SKILLS; s++) |
838 | if (object *skill = opl->last_skill_ob[s]) |
838 | if (object *skill = opl->last_skill_ob [s]) |
839 | if (skill->stats.exp != ns->last_skill_exp [s]) |
839 | if (skill->stats.exp != ns->last_skill_exp [s]) |
840 | { |
840 | { |
841 | ns->last_skill_exp [s] = skill->stats.exp; |
841 | ns->last_skill_exp [s] = skill->stats.exp; |
842 | |
842 | |
843 | /* Always send along the level if exp changes. This is only |
843 | /* Always send along the level if exp changes. This is only |
… | |
… | |
912 | << uint32 (pl->ob->face) |
912 | << uint32 (pl->ob->face) |
913 | << data8 (pl->ob->name); |
913 | << data8 (pl->ob->name); |
914 | |
914 | |
915 | pl->ns->last_weight = weight; |
915 | pl->ns->last_weight = weight; |
916 | pl->ns->send_packet (sl); |
916 | pl->ns->send_packet (sl); |
917 | SET_FLAG (pl->ob, FLAG_CLIENT_SENT); |
|
|
918 | } |
917 | } |
919 | |
918 | |
920 | /****************************************************************************** |
919 | /****************************************************************************** |
921 | * |
920 | * |
922 | * Start of map related commands. |
921 | * Start of map related commands. |
… | |
… | |
1262 | { |
1261 | { |
1263 | if (op->stats.maxhp > op->stats.hp |
1262 | if (op->stats.maxhp > op->stats.hp |
1264 | && op->stats.maxhp > 0 |
1263 | && op->stats.maxhp > 0 |
1265 | && (op->type == PLAYER |
1264 | && (op->type == PLAYER |
1266 | || op->type == DOOR // does not work, have maxhp 0 |
1265 | || op->type == DOOR // does not work, have maxhp 0 |
1267 | || QUERY_FLAG (op, FLAG_MONSTER) || QUERY_FLAG (op, FLAG_ALIVE) || QUERY_FLAG (op, FLAG_GENERATOR))) |
1266 | || QUERY_FLAG (op, FLAG_MONSTER) |
|
|
1267 | || QUERY_FLAG (op, FLAG_ALIVE) |
|
|
1268 | || QUERY_FLAG (op, FLAG_GENERATOR))) |
1268 | { |
1269 | { |
1269 | stat_hp = 255 - (op->stats.hp * 255 + 254) / op->stats.maxhp; |
1270 | stat_hp = 255 - (op->stats.hp * 255 + 254) / op->stats.maxhp; |
1270 | stat_width = op->arch->max_x - op->arch->x; //TODO: should be upper-left edge |
1271 | stat_width = op->arch->max_x - op->arch->x; //TODO: should be upper-left edge |
1271 | } |
1272 | } |
1272 | |
1273 | |
1273 | if (op->has_dialogue ()) |
1274 | if (op->has_dialogue ()) |
1274 | flags |= 1; |
1275 | flags |= 1; |
1275 | |
1276 | |
1276 | if (op->type == PLAYER) |
1277 | if (op->type == PLAYER) |
1277 | player = op->count; |
1278 | player = op == ob ? pl->ob->count |
|
|
1279 | : op == pl->ob ? ob->count |
|
|
1280 | : op->count; |
1278 | } |
1281 | } |
1279 | |
1282 | |
1280 | if (lastcell.stat_hp != stat_hp) |
1283 | if (lastcell.stat_hp != stat_hp) |
1281 | { |
1284 | { |
1282 | lastcell.stat_hp = stat_hp; |
1285 | lastcell.stat_hp = stat_hp; |
… | |
… | |
1432 | { |
1435 | { |
1433 | packet sl; |
1436 | packet sl; |
1434 | sl << "replyinfo skill_info\n"; |
1437 | sl << "replyinfo skill_info\n"; |
1435 | |
1438 | |
1436 | for (int i = 1; i < NUM_SKILLS; i++) |
1439 | for (int i = 1; i < NUM_SKILLS; i++) |
1437 | sl.printf ("%d:%s\n", i + CS_STAT_SKILLINFO, &skill_names[i]); |
1440 | sl.printf ("%d:%s\n", i + CS_STAT_SKILLINFO, &skill_names [i]); |
1438 | |
1441 | |
1439 | if (sl.length () > MAXSOCKBUF) |
1442 | if (sl.length () > MAXSOCKBUF) |
1440 | { |
1443 | { |
1441 | LOG (llevError, "Buffer overflow in send_skill_info!\n"); |
1444 | LOG (llevError, "Buffer overflow in send_skill_info!\n"); |
1442 | fatal (0); |
1445 | fatal (0); |
… | |
… | |
1560 | spell->cached_grace = SP_level_spellpoint_cost (pl->ob, spell, SPELL_GRACE); |
1563 | spell->cached_grace = SP_level_spellpoint_cost (pl->ob, spell, SPELL_GRACE); |
1561 | spell->cached_eat = spell->stats.dam + SP_level_dam_adjust (pl->ob, spell); |
1564 | spell->cached_eat = spell->stats.dam + SP_level_dam_adjust (pl->ob, spell); |
1562 | |
1565 | |
1563 | /* figure out which skill it uses, if it uses one */ |
1566 | /* figure out which skill it uses, if it uses one */ |
1564 | if (spell->skill) |
1567 | if (spell->skill) |
1565 | { |
1568 | if (object *tmp = pl->find_skill (spell->skill)) |
1566 | for (i = 1; i < NUM_SKILLS; i++) |
|
|
1567 | if (!strcmp (spell->skill, skill_names[i])) |
|
|
1568 | { |
|
|
1569 | skill = i + CS_STAT_SKILLINFO; |
1569 | skill = tmp->subtype + CS_STAT_SKILLINFO; |
1570 | break; |
|
|
1571 | } |
|
|
1572 | } |
|
|
1573 | |
1570 | |
1574 | // spells better have a face |
1571 | // spells better have a face |
1575 | if (!spell->face) |
1572 | if (!spell->face) |
1576 | { |
1573 | { |
1577 | LOG (llevError, "%s: spell has no face, but face is mandatory.\n", &spell->name); |
1574 | LOG (llevError, "%s: spell has no face, but face is mandatory.\n", &spell->name); |