… | |
… | |
719 | if (!(ns->faces_sent[smoothface] & NS_FACESENT_FACE)) |
719 | if (!(ns->faces_sent[smoothface] & NS_FACESENT_FACE)) |
720 | esrv_send_face (ns, smoothface, 0); |
720 | esrv_send_face (ns, smoothface, 0); |
721 | |
721 | |
722 | ns->faces_sent[face] |= NS_FACESENT_SMOOTH; |
722 | ns->faces_sent[face] |= NS_FACESENT_SMOOTH; |
723 | |
723 | |
724 | packet sl; |
724 | packet sl ("smooth"); |
725 | |
725 | |
726 | sl << "smooth " |
|
|
727 | << uint16 (face) |
726 | sl << uint16 (face) |
728 | << uint16 (smoothface); |
727 | << uint16 (smoothface); |
729 | |
728 | |
730 | ns->send_packet (sl); |
729 | ns->send_packet (sl); |
731 | } |
730 | } |
732 | |
731 | |
… | |
… | |
809 | int time = FABS (pl->ob->speed) < 0.001 |
808 | int time = FABS (pl->ob->speed) < 0.001 |
810 | ? time = MAX_TIME * 100 |
809 | ? time = MAX_TIME * 100 |
811 | : time = (int) (MAX_TIME / FABS (pl->ob->speed)); |
810 | : time = (int) (MAX_TIME / FABS (pl->ob->speed)); |
812 | |
811 | |
813 | /* Send confirmation of command execution now */ |
812 | /* Send confirmation of command execution now */ |
814 | packet sl; |
813 | packet sl ("comc"); |
815 | sl << "comc " << uint16 (cmdid) << uint32 (time); |
814 | sl << uint16 (cmdid) << uint32 (time); |
816 | pl->socket->send_packet (sl); |
815 | pl->socket->send_packet (sl); |
817 | } |
816 | } |
818 | |
817 | |
819 | |
818 | |
820 | /** This is a reply to a previous query. */ |
819 | /** This is a reply to a previous query. */ |
… | |
… | |
1033 | esrv_update_stats (player *pl) |
1032 | esrv_update_stats (player *pl) |
1034 | { |
1033 | { |
1035 | char buf[MAX_BUF]; |
1034 | char buf[MAX_BUF]; |
1036 | uint16 flags; |
1035 | uint16 flags; |
1037 | |
1036 | |
1038 | packet sl; |
1037 | packet sl ("stats"); |
1039 | sl << "stats "; |
|
|
1040 | |
1038 | |
1041 | if (pl->ob) |
1039 | if (pl->ob) |
1042 | { |
1040 | { |
1043 | AddIfShort (pl->last_stats.hp, pl->ob->stats.hp, CS_STAT_HP); |
1041 | AddIfShort (pl->last_stats.hp, pl->ob->stats.hp, CS_STAT_HP); |
1044 | AddIfShort (pl->last_stats.maxhp, pl->ob->stats.maxhp, CS_STAT_MAXHP); |
1042 | AddIfShort (pl->last_stats.maxhp, pl->ob->stats.maxhp, CS_STAT_MAXHP); |
… | |
… | |
1127 | void |
1125 | void |
1128 | esrv_new_player (player *pl, uint32 weight) |
1126 | esrv_new_player (player *pl, uint32 weight) |
1129 | { |
1127 | { |
1130 | pl->last_weight = weight; |
1128 | pl->last_weight = weight; |
1131 | |
1129 | |
1132 | packet sl; |
1130 | packet sl ("player"); |
1133 | sl << "player "; |
|
|
1134 | |
1131 | |
1135 | sl << uint32 (pl->ob->count) |
1132 | sl << uint32 (pl->ob->count) |
1136 | << uint32 (weight) |
1133 | << uint32 (weight) |
1137 | << uint32 (pl->ob->face->number) |
1134 | << uint32 (pl->ob->face->number) |
1138 | << data8 (pl->ob->name); |
1135 | << data8 (pl->ob->name); |
… | |
… | |
1159 | { |
1156 | { |
1160 | LOG (llevError, "esrv_send_anim (%d) out of bounds??\n", anim_num); |
1157 | LOG (llevError, "esrv_send_anim (%d) out of bounds??\n", anim_num); |
1161 | return; |
1158 | return; |
1162 | } |
1159 | } |
1163 | |
1160 | |
1164 | packet sl; |
1161 | packet sl ("anim"); |
1165 | |
1162 | |
1166 | sl << "anim " |
|
|
1167 | << uint16 (anim_num) |
1163 | sl << uint16 (anim_num) |
1168 | << uint16 (0); /* flags - not used right now */ |
1164 | << uint16 (0); /* flags - not used right now */ |
1169 | |
1165 | |
1170 | /* Build up the list of faces. Also, send any information (ie, the |
1166 | /* Build up the list of faces. Also, send any information (ie, the |
1171 | * the face itself) down to the client. |
1167 | * the face itself) down to the client. |
1172 | */ |
1168 | */ |
… | |
… | |
1618 | |
1614 | |
1619 | client &socket = *pl->contr->socket; |
1615 | client &socket = *pl->contr->socket; |
1620 | |
1616 | |
1621 | check_map_change (pl->contr); |
1617 | check_map_change (pl->contr); |
1622 | |
1618 | |
1623 | packet sl; |
1619 | packet sl (socket.mapmode == Map1Cmd ? "map1" : "map1a"); |
1624 | packet esl; |
1620 | packet esl; |
1625 | |
1621 | |
1626 | sl << (socket.mapmode == Map1Cmd ? "map1 " : "map1a "); |
|
|
1627 | startlen = sl.length (); |
1622 | startlen = sl.length (); |
1628 | |
1623 | |
1629 | /*Extendedmapinfo structure initialisation */ |
1624 | /*Extendedmapinfo structure initialisation */ |
1630 | if (socket.ext_mapinfos) |
1625 | if (socket.ext_mapinfos) |
1631 | { |
1626 | { |
… | |
… | |
2175 | { |
2170 | { |
2176 | LOG (llevError, "Invalid call to esrv_remove_spell"); |
2171 | LOG (llevError, "Invalid call to esrv_remove_spell"); |
2177 | return; |
2172 | return; |
2178 | } |
2173 | } |
2179 | |
2174 | |
2180 | packet sl; |
2175 | packet sl ("delspell"); |
2181 | |
2176 | |
2182 | sl << "delspell " |
|
|
2183 | << uint32 (spell->count); |
2177 | sl << uint32 (spell->count); |
2184 | |
2178 | |
2185 | pl->socket->send_packet (sl); |
2179 | pl->socket->send_packet (sl); |
2186 | } |
2180 | } |
2187 | |
2181 | |
2188 | /* appends the spell *spell to the Socklist we will send the data to. */ |
2182 | /* appends the spell *spell to the Socklist we will send the data to. */ |
… | |
… | |
2241 | } |
2235 | } |
2242 | |
2236 | |
2243 | if (!pl->socket->monitor_spells) |
2237 | if (!pl->socket->monitor_spells) |
2244 | return; |
2238 | return; |
2245 | |
2239 | |
2246 | packet sl; |
2240 | packet sl ("addspell"); |
2247 | sl << "addspell "; |
|
|
2248 | |
2241 | |
2249 | if (!spell) |
2242 | if (!spell) |
2250 | { |
2243 | { |
2251 | for (spell = pl->ob->inv; spell != NULL; spell = spell->below) |
2244 | for (spell = pl->ob->inv; spell != NULL; spell = spell->below) |
2252 | { |
2245 | { |