ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/deliantra/server/socket/request.C
(Generate patch)

Comparing deliantra/server/socket/request.C (file contents):
Revision 1.170 by root, Thu Apr 8 20:05:36 2010 UTC vs.
Revision 1.173 by root, Thu Apr 15 00:37:24 2010 UTC

65 * This table translates the attack numbers as used within the 65 * This table translates the attack numbers as used within the
66 * program to the value we use when sending STATS command to the 66 * program to the value we use when sending STATS command to the
67 * client. If a value is -1, then we don't send that to the 67 * client. If a value is -1, then we don't send that to the
68 * client. 68 * client.
69 */ 69 */
70static short atnr_cs_stat[NROFATTACKS] = { CS_STAT_RES_PHYS, 70static short atnr_cs_stat[NROFATTACKS] =
71 CS_STAT_RES_MAG, CS_STAT_RES_FIRE, CS_STAT_RES_ELEC, 71{
72 CS_STAT_RES_COLD, CS_STAT_RES_CONF, CS_STAT_RES_ACID, 72 CS_STAT_RES_PHYS,
73 CS_STAT_RES_DRAIN, -1 /* weaponmagic */ , 73 CS_STAT_RES_MAG,
74 CS_STAT_RES_GHOSTHIT, CS_STAT_RES_POISON, 74 CS_STAT_RES_FIRE,
75 CS_STAT_RES_SLOW, CS_STAT_RES_PARA, CS_STAT_TURN_UNDEAD, 75 CS_STAT_RES_ELEC,
76 CS_STAT_RES_FEAR, -1 /* Cancellation */ , 76 CS_STAT_RES_COLD,
77 CS_STAT_RES_DEPLETE, CS_STAT_RES_DEATH, 77 CS_STAT_RES_CONF,
78 -1 /* Chaos */ , -1 /* Counterspell */ , 78 CS_STAT_RES_ACID,
79 -1 /* Godpower */ , CS_STAT_RES_HOLYWORD, 79 CS_STAT_RES_DRAIN,
80 -1 /* weaponmagic */,
81 CS_STAT_RES_GHOSTHIT,
82 CS_STAT_RES_POISON,
83 CS_STAT_RES_SLOW,
84 CS_STAT_RES_PARA,
85 CS_STAT_TURN_UNDEAD,
86 CS_STAT_RES_FEAR,
87 -1 /* Cancellation */,
88 CS_STAT_RES_DEPLETE,
89 CS_STAT_RES_DEATH,
90 -1 /* Chaos */,
91 -1 /* Counterspell */,
92 -1 /* Godpower */,
93 CS_STAT_RES_HOLYWORD,
80 CS_STAT_RES_BLIND, 94 CS_STAT_RES_BLIND,
81 -1, /* Internal */ 95 -1, /* Internal */
82 -1, /* life stealing */ 96 -1, /* life stealing */
83 -1 /* Disease - not fully done yet */ 97 -1 /* Disease - not fully done yet */
84}; 98};
228send_skill_info (client *ns, char *params) 242send_skill_info (client *ns, char *params)
229{ 243{
230 packet sl; 244 packet sl;
231 sl << "replyinfo skill_info\n"; 245 sl << "replyinfo skill_info\n";
232 246
233 for (int i = 1; i < NUM_SKILLS; i++) 247 for (int i = 0; i < skillvec.size (); ++i)
234 sl.printf ("%d:%s\n", i + CS_STAT_SKILLINFO, &skill_names [i]); 248 sl.printf ("%d:%s\n", CS_STAT_SKILLINFO + i, &skillvec [i]->name);
235 249
236 if (sl.length () > MAXSOCKBUF) 250 if (sl.length () > MAXSOCKBUF)
237 { 251 {
238 LOG (llevError, "Buffer overflow in send_skill_info!\n"); 252 LOG (llevError, "Buffer overflow in send_skill_info!\n");
239 fatal (0); 253 fatal (0);
726 AddIfShort (ns->last_stats.Int, ob->stats.Int, CS_STAT_INT); 740 AddIfShort (ns->last_stats.Int, ob->stats.Int, CS_STAT_INT);
727 AddIfShort (ns->last_stats.Wis, ob->stats.Wis, CS_STAT_WIS); 741 AddIfShort (ns->last_stats.Wis, ob->stats.Wis, CS_STAT_WIS);
728 AddIfShort (ns->last_stats.Pow, ob->stats.Pow, CS_STAT_POW); 742 AddIfShort (ns->last_stats.Pow, ob->stats.Pow, CS_STAT_POW);
729 AddIfShort (ns->last_stats.Cha, ob->stats.Cha, CS_STAT_CHA); 743 AddIfShort (ns->last_stats.Cha, ob->stats.Cha, CS_STAT_CHA);
730 744
731 for (int s = 0; s < NUM_SKILLS; s++) 745 for (int s = 0; s < CS_NUM_SKILLS; s++)
732 if (object *skill = opl->last_skill_ob [s]) 746 if (object *skill = opl->last_skill_ob [s])
733 if (skill->stats.exp != ns->last_skill_exp [s]) 747 if (skill->stats.exp != ns->last_skill_exp [s])
734 { 748 {
735 ns->last_skill_exp [s] = skill->stats.exp; 749 ns->last_skill_exp [s] = skill->stats.exp;
736 750
737 /* Always send along the level if exp changes. This is only 751 /* Always send along the level if exp changes. This is only
738 * 1 extra byte, but keeps processing simpler. 752 * 1 extra byte, but keeps processing simpler.
739 */ 753 */
740 sl << uint8 (s + CS_STAT_SKILLINFO) 754 sl << uint8 (CS_STAT_SKILLINFO + s)
741 << uint8 (skill->level) 755 << uint8 (skill->level)
742 << uint64 (skill->stats.exp); 756 << uint64 (skill->stats.exp);
743 } 757 }
744 758
745 AddIfInt64 (ns->last_stats.exp, ob->stats.exp, CS_STAT_EXP64); 759 AddIfInt64 (ns->last_stats.exp, ob->stats.exp, CS_STAT_EXP64);
750 AddIfFloat (ns->last_speed, ob->speed, CS_STAT_SPEED, 1.f / TICK); 764 AddIfFloat (ns->last_speed, ob->speed, CS_STAT_SPEED, 1.f / TICK);
751 AddIfShort (ns->last_stats.food, ob->stats.food, CS_STAT_FOOD); 765 AddIfShort (ns->last_stats.food, ob->stats.food, CS_STAT_FOOD);
752 AddIfFloat (ns->last_weapon_sp, pl->weapon_sp, CS_STAT_WEAP_SP, 1.f / TICK); 766 AddIfFloat (ns->last_weapon_sp, pl->weapon_sp, CS_STAT_WEAP_SP, 1.f / TICK);
753 AddIfInt (ns->last_weight_limit, weight_limit[ob->stats.Str], CS_STAT_WEIGHT_LIM); 767 AddIfInt (ns->last_weight_limit, weight_limit[ob->stats.Str], CS_STAT_WEIGHT_LIM);
754 768
755 flags = 0; 769 flags = (opl->fire_on ? SF_FIREON : 0)
756 770 | (opl->run_on ? SF_RUNON : 0);
757 if (opl->fire_on)
758 flags |= SF_FIREON;
759
760 if (opl->run_on)
761 flags |= SF_RUNON;
762 771
763 AddIfShort (ns->last_flags, flags, CS_STAT_FLAGS); 772 AddIfShort (ns->last_flags, flags, CS_STAT_FLAGS);
764 773
765 for (int i = 0; i < NROFATTACKS; i++) 774 for (int i = 0; i < NROFATTACKS; i++)
766 {
767 /* Skip ones we won't send */ 775 /* Skip ones we won't send */
768 if (atnr_cs_stat[i] == -1) 776 if (atnr_cs_stat[i] >= 0)
769 continue;
770
771 AddIfShort (ns->last_resist[i], ob->resist[i], atnr_cs_stat[i]); 777 AddIfShort (ns->last_resist[i], ob->resist[i], atnr_cs_stat[i]);
772 }
773 778
774 if (pl->ns->monitor_spells) 779 if (pl->ns->monitor_spells)
775 { 780 {
776 AddIfInt (ns->last_path_attuned, ob->path_attuned, CS_STAT_SPELL_ATTUNE); 781 AddIfInt (ns->last_path_attuned, ob->path_attuned, CS_STAT_SPELL_ATTUNE);
777 AddIfInt (ns->last_path_repelled, ob->path_repelled, CS_STAT_SPELL_REPEL); 782 AddIfInt (ns->last_path_repelled, ob->path_repelled, CS_STAT_SPELL_REPEL);
1062 { 1067 {
1063 if (op->stats.maxhp > op->stats.hp 1068 if (op->stats.maxhp > op->stats.hp
1064 && op->stats.maxhp > 0 1069 && op->stats.maxhp > 0
1065 && (op->type == PLAYER 1070 && (op->type == PLAYER
1066 || op->type == DOOR // does not work, have maxhp 0 1071 || op->type == DOOR // does not work, have maxhp 0
1067 || QUERY_FLAG (op, FLAG_MONSTER) 1072 || op->flag [FLAG_MONSTER]
1068 || QUERY_FLAG (op, FLAG_ALIVE) 1073 || op->flag [FLAG_ALIVE]
1069 || QUERY_FLAG (op, FLAG_GENERATOR))) 1074 || op->flag [FLAG_GENERATOR]))
1070 { 1075 {
1071 stat_hp = 255 - (op->stats.hp * 255 + 254) / op->stats.maxhp; 1076 stat_hp = 255 - (op->stats.hp * 255 + 254) / op->stats.maxhp;
1072 stat_width = op->arch->max_x - op->arch->x; //TODO: should be upper-left edge 1077 stat_width = op->arch->max_x - op->arch->x; //TODO: should be upper-left edge
1073 } 1078 }
1074 1079
1269 spell->cached_eat = casting_level (pl->ob, spell); 1274 spell->cached_eat = casting_level (pl->ob, spell);
1270 1275
1271 /* figure out which skill it uses, if it uses one */ 1276 /* figure out which skill it uses, if it uses one */
1272 if (spell->skill) 1277 if (spell->skill)
1273 if (object *tmp = pl->find_skill (spell->skill)) 1278 if (object *tmp = pl->find_skill (spell->skill))
1274 skill = tmp->subtype + CS_STAT_SKILLINFO; 1279 skill = CS_STAT_SKILLINFO + SKILL_INDEX (tmp);
1275 1280
1276 // spells better have a face 1281 // spells better have a face
1277 if (!spell->face) 1282 if (!spell->face)
1278 { 1283 {
1279 LOG (llevError, "%s: spell has no face, but face is mandatory.\n", &spell->name); 1284 LOG (llevError, "%s: spell has no face, but face is mandatory.\n", &spell->name);

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines