… | |
… | |
1131 | AddIfShort (pl->last_stats.Wis, pl->ob->stats.Wis, CS_STAT_WIS); |
1131 | AddIfShort (pl->last_stats.Wis, pl->ob->stats.Wis, CS_STAT_WIS); |
1132 | AddIfShort (pl->last_stats.Dex, pl->ob->stats.Dex, CS_STAT_DEX); |
1132 | AddIfShort (pl->last_stats.Dex, pl->ob->stats.Dex, CS_STAT_DEX); |
1133 | AddIfShort (pl->last_stats.Con, pl->ob->stats.Con, CS_STAT_CON); |
1133 | AddIfShort (pl->last_stats.Con, pl->ob->stats.Con, CS_STAT_CON); |
1134 | AddIfShort (pl->last_stats.Cha, pl->ob->stats.Cha, CS_STAT_CHA); |
1134 | AddIfShort (pl->last_stats.Cha, pl->ob->stats.Cha, CS_STAT_CHA); |
1135 | } |
1135 | } |
|
|
1136 | |
1136 | if (pl->socket.exp64) |
1137 | if (pl->socket.exp64) |
1137 | { |
1138 | { |
1138 | uint8 s; |
1139 | uint8 s; |
1139 | |
1140 | |
1140 | for (s = 0; s < NUM_SKILLS; s++) |
1141 | for (s = 0; s < NUM_SKILLS; s++) |
… | |
… | |
1150 | SockList_AddInt64 (&sl, pl->last_skill_ob[s]->stats.exp); |
1151 | SockList_AddInt64 (&sl, pl->last_skill_ob[s]->stats.exp); |
1151 | pl->last_skill_exp[s] = pl->last_skill_ob[s]->stats.exp; |
1152 | pl->last_skill_exp[s] = pl->last_skill_ob[s]->stats.exp; |
1152 | } |
1153 | } |
1153 | } |
1154 | } |
1154 | } |
1155 | } |
|
|
1156 | |
1155 | if (pl->socket.exp64) |
1157 | if (pl->socket.exp64) |
1156 | { |
|
|
1157 | AddIfInt64 (pl->last_stats.exp, pl->ob->stats.exp, CS_STAT_EXP64); |
1158 | { AddIfInt64 (pl->last_stats.exp, pl->ob->stats.exp, CS_STAT_EXP64) } |
1158 | } |
|
|
1159 | else |
1159 | else |
1160 | { |
|
|
1161 | AddIfInt (pl->last_stats.exp, (int) pl->ob->stats.exp, CS_STAT_EXP); |
1160 | { AddIfInt (pl->last_stats.exp, (int) pl->ob->stats.exp, CS_STAT_EXP) } |
1162 | } |
1161 | |
1163 | AddIfShort (pl->last_level, (char) pl->ob->level, CS_STAT_LEVEL); |
1162 | AddIfShort (pl->last_level, (char) pl->ob->level, CS_STAT_LEVEL); |
1164 | AddIfShort (pl->last_stats.wc, pl->ob->stats.wc, CS_STAT_WC); |
1163 | AddIfShort (pl->last_stats.wc, pl->ob->stats.wc, CS_STAT_WC); |
1165 | AddIfShort (pl->last_stats.ac, pl->ob->stats.ac, CS_STAT_AC); |
1164 | AddIfShort (pl->last_stats.ac, pl->ob->stats.ac, CS_STAT_AC); |
1166 | AddIfShort (pl->last_stats.dam, pl->ob->stats.dam, CS_STAT_DAM); |
1165 | AddIfShort (pl->last_stats.dam, pl->ob->stats.dam, CS_STAT_DAM); |
1167 | AddIfFloat (pl->last_speed, pl->ob->speed, CS_STAT_SPEED); |
1166 | AddIfFloat (pl->last_speed, pl->ob->speed, CS_STAT_SPEED); |
1168 | AddIfShort (pl->last_stats.food, pl->ob->stats.food, CS_STAT_FOOD); |
1167 | AddIfShort (pl->last_stats.food, pl->ob->stats.food, CS_STAT_FOOD); |
1169 | AddIfFloat (pl->last_weapon_sp, pl->weapon_sp, CS_STAT_WEAP_SP); |
1168 | AddIfFloat (pl->last_weapon_sp, pl->weapon_sp, CS_STAT_WEAP_SP); |
1170 | AddIfInt (pl->last_weight_limit, (sint32) weight_limit[pl->ob->stats.Str], CS_STAT_WEIGHT_LIM); |
1169 | AddIfInt (pl->last_weight_limit, (sint32) weight_limit[pl->ob->stats.Str], CS_STAT_WEIGHT_LIM); |
1171 | flags = 0; |
1170 | flags = 0; |
|
|
1171 | |
1172 | if (pl->fire_on) |
1172 | if (pl->fire_on) |
1173 | flags |= SF_FIREON; |
1173 | flags |= SF_FIREON; |
|
|
1174 | |
1174 | if (pl->run_on) |
1175 | if (pl->run_on) |
1175 | flags |= SF_RUNON; |
1176 | flags |= SF_RUNON; |
1176 | |
1177 | |
1177 | AddIfShort (pl->last_flags, flags, CS_STAT_FLAGS); |
1178 | AddIfShort (pl->last_flags, flags, CS_STAT_FLAGS); |
|
|
1179 | |
1178 | if (pl->socket.sc_version < 1025) |
1180 | if (pl->socket.sc_version < 1025) |
1179 | { |
|
|
1180 | AddIfShort (pl->last_resist[ATNR_PHYSICAL], pl->ob->resist[ATNR_PHYSICAL], CS_STAT_ARMOUR); |
1181 | { AddIfShort (pl->last_resist[ATNR_PHYSICAL], pl->ob->resist[ATNR_PHYSICAL], CS_STAT_ARMOUR) } |
1181 | } |
|
|
1182 | else |
1182 | else |
1183 | { |
1183 | { |
1184 | int i; |
1184 | int i; |
1185 | |
1185 | |
1186 | for (i = 0; i < NROFATTACKS; i++) |
1186 | for (i = 0; i < NROFATTACKS; i++) |
1187 | { |
1187 | { |
1188 | /* Skip ones we won't send */ |
1188 | /* Skip ones we won't send */ |
1189 | if (atnr_cs_stat[i] == -1) |
1189 | if (atnr_cs_stat[i] == -1) |
1190 | continue; |
1190 | continue; |
|
|
1191 | |
1191 | AddIfShort (pl->last_resist[i], pl->ob->resist[i], (char) atnr_cs_stat[i]); |
1192 | AddIfShort (pl->last_resist[i], pl->ob->resist[i], (char) atnr_cs_stat[i]); |
1192 | } |
1193 | } |
1193 | } |
1194 | } |
|
|
1195 | |
1194 | if (pl->socket.monitor_spells) |
1196 | if (pl->socket.monitor_spells) |
1195 | { |
1197 | { |
1196 | AddIfInt (pl->last_path_attuned, pl->ob->path_attuned, CS_STAT_SPELL_ATTUNE); |
1198 | AddIfInt (pl->last_path_attuned, pl->ob->path_attuned, CS_STAT_SPELL_ATTUNE); |
1197 | AddIfInt (pl->last_path_repelled, pl->ob->path_repelled, CS_STAT_SPELL_REPEL); |
1199 | AddIfInt (pl->last_path_repelled, pl->ob->path_repelled, CS_STAT_SPELL_REPEL); |
1198 | AddIfInt (pl->last_path_denied, pl->ob->path_denied, CS_STAT_SPELL_DENY); |
1200 | AddIfInt (pl->last_path_denied, pl->ob->path_denied, CS_STAT_SPELL_DENY); |
1199 | } |
1201 | } |
|
|
1202 | |
1200 | rangetostring (pl->ob, buf); /* we want use the new fire & run system in new client */ |
1203 | rangetostring (pl->ob, buf); /* we want use the new fire & run system in new client */ |
1201 | AddIfString (pl->socket.stats.range, buf, CS_STAT_RANGE); |
1204 | AddIfString (pl->socket.stats.range, buf, CS_STAT_RANGE); |
1202 | set_title (pl->ob, buf); |
1205 | set_title (pl->ob, buf); |
1203 | AddIfString (pl->socket.stats.title, buf, CS_STAT_TITLE); |
1206 | AddIfString (pl->socket.stats.title, buf, CS_STAT_TITLE); |
1204 | |
1207 | |
… | |
… | |
1208 | #ifdef ESRV_DEBUG |
1211 | #ifdef ESRV_DEBUG |
1209 | LOG (llevDebug, "Sending stats command, %d bytes long.\n", sl.len); |
1212 | LOG (llevDebug, "Sending stats command, %d bytes long.\n", sl.len); |
1210 | #endif |
1213 | #endif |
1211 | Send_With_Handling (&pl->socket, &sl); |
1214 | Send_With_Handling (&pl->socket, &sl); |
1212 | } |
1215 | } |
|
|
1216 | |
1213 | free (sl.buf); |
1217 | free (sl.buf); |
1214 | } |
1218 | } |
1215 | |
|
|
1216 | |
1219 | |
1217 | /** |
1220 | /** |
1218 | * Tells the client that here is a player it should start using. |
1221 | * Tells the client that here is a player it should start using. |
1219 | */ |
1222 | */ |
1220 | void |
1223 | void |
… | |
… | |
1238 | |
1241 | |
1239 | Send_With_Handling (&pl->socket, &sl); |
1242 | Send_With_Handling (&pl->socket, &sl); |
1240 | free (sl.buf); |
1243 | free (sl.buf); |
1241 | SET_FLAG (pl->ob, FLAG_CLIENT_SENT); |
1244 | SET_FLAG (pl->ob, FLAG_CLIENT_SENT); |
1242 | } |
1245 | } |
1243 | |
|
|
1244 | |
1246 | |
1245 | /** |
1247 | /** |
1246 | * Need to send an animation sequence to the client. |
1248 | * Need to send an animation sequence to the client. |
1247 | * We will send appropriate face commands to the client if we haven't |
1249 | * We will send appropriate face commands to the client if we haven't |
1248 | * sent them the face yet (this can become quite costly in terms of |
1250 | * sent them the face yet (this can become quite costly in terms of |
… | |
… | |
2086 | |
2088 | |
2087 | if (socket.extmap) |
2089 | if (socket.extmap) |
2088 | { |
2090 | { |
2089 | uint8 stat_hp = 0; |
2091 | uint8 stat_hp = 0; |
2090 | uint8 stat_width = 0; |
2092 | uint8 stat_width = 0; |
|
|
2093 | uint8 flags = 0; |
2091 | tag_t player = 0; |
2094 | tag_t player = 0; |
2092 | |
2095 | |
2093 | // send hp information, if applicable |
2096 | // send hp information, if applicable |
2094 | if (object *op = GET_MAP_FACE_OBJ (m, nx, ny, 0)) |
2097 | if (object *op = GET_MAP_FACE_OBJ (m, nx, ny, 0)) |
2095 | { |
2098 | { |
… | |
… | |
2103 | stat_hp = 255 - (op->stats.hp * 255 + 254) / op->stats.maxhp; |
2106 | stat_hp = 255 - (op->stats.hp * 255 + 254) / op->stats.maxhp; |
2104 | stat_width = op->arch->tail_x; |
2107 | stat_width = op->arch->tail_x; |
2105 | } |
2108 | } |
2106 | } |
2109 | } |
2107 | |
2110 | |
|
|
2111 | if (op->msg && op->msg[0] == '@') |
|
|
2112 | flags |= 1; |
|
|
2113 | |
2108 | if (op->type == PLAYER && op != pl) |
2114 | if (op->type == PLAYER && op != pl) |
2109 | player = op->count; |
2115 | player = op->count; |
2110 | } |
2116 | } |
2111 | |
2117 | |
2112 | if (lastcell.stat_hp != stat_hp) |
2118 | if (lastcell.stat_hp != stat_hp) |
… | |
… | |
2136 | *last_ext |= 0x80; |
2142 | *last_ext |= 0x80; |
2137 | last_ext = sl.buf + sl.len; |
2143 | last_ext = sl.buf + sl.len; |
2138 | SockList_AddChar (&sl, 0x47); |
2144 | SockList_AddChar (&sl, 0x47); |
2139 | SockList_AddChar (&sl, 4); |
2145 | SockList_AddChar (&sl, 4); |
2140 | SockList_AddInt (&sl, player); |
2146 | SockList_AddInt (&sl, player); |
|
|
2147 | } |
|
|
2148 | |
|
|
2149 | if (lastcell.flags != flags) |
|
|
2150 | { |
|
|
2151 | lastcell.flags = flags; |
|
|
2152 | |
|
|
2153 | mask |= 0x8; |
|
|
2154 | *last_ext |= 0x80; |
|
|
2155 | last_ext = sl.buf + sl.len; |
|
|
2156 | SockList_AddChar (&sl, 8); |
|
|
2157 | SockList_AddChar (&sl, flags); |
2141 | } |
2158 | } |
2142 | } |
2159 | } |
2143 | |
2160 | |
2144 | /* Floor face */ |
2161 | /* Floor face */ |
2145 | if (update_space (&sl, &socket, m, nx, ny, ax, ay, 2)) |
2162 | if (update_space (&sl, &socket, m, nx, ny, ax, ay, 2)) |