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

Comparing deliantra/server/server/player.C (file contents):
Revision 1.104 by root, Fri Feb 16 19:43:41 2007 UTC vs.
Revision 1.110 by root, Mon Apr 16 06:23:43 2007 UTC

124 continue; 124 continue;
125 125
126 if (*buf == '%') 126 if (*buf == '%')
127 { /* send one news */ 127 { /* send one news */
128 if (size > 0) 128 if (size > 0)
129 draw_ext_info_format (NDI_UNIQUE | NDI_GREEN, 0, op, MSG_TYPE_ADMIN, MSG_TYPE_ADMIN_NEWS, "INFORMATION: %s\n%s", "%s\n%s", subject, news); /*send previously read news */ 129 draw_ext_info_format (NDI_UNIQUE | NDI_GREEN, 0, op, MSG_TYPE_ADMIN, MSG_TYPE_ADMIN_NEWS, "INFORMATION: %s\n%s", (char *)"%s\n%s", subject, news); /*send previously read news */
130 130
131 strcpy (subject, buf + 1); 131 strcpy (subject, buf + 1);
132 strip_endline (subject); 132 strip_endline (subject);
133 size = 0; 133 size = 0;
134 news[0] = '\0'; 134 news[0] = '\0';
144 size += strlen (buf); 144 size += strlen (buf);
145 } 145 }
146 } 146 }
147 147
148 draw_ext_info_format (NDI_UNIQUE | NDI_GREEN, 0, op, 148 draw_ext_info_format (NDI_UNIQUE | NDI_GREEN, 0, op,
149 MSG_TYPE_ADMIN, MSG_TYPE_ADMIN_NEWS, "INFORMATION: %s\n%s\n", "%s\n%s", subject, news); 149 MSG_TYPE_ADMIN, MSG_TYPE_ADMIN_NEWS, "INFORMATION: %s\n%s\n", (char *)"%s\n%s", subject, news);
150 close_and_delete (fp, comp); 150 close_and_delete (fp, comp);
151} 151}
152 152
153/* This loads the first map an puts the player on it. */ 153/* This loads the first map an puts the player on it. */
154static void 154static void
291 ns->reset_stats (); 291 ns->reset_stats ();
292 ns->pl = 0; 292 ns->pl = 0;
293 this->ns = 0; 293 this->ns = 0;
294 } 294 }
295 295
296 if (ob)
296 ob->close_container (); //TODO: client-specific 297 ob->close_container (); //TODO: client-specific
298
297 deactivate (); 299 deactivate ();
298} 300}
299 301
300// the need for this function can be explained 302// the need for this function can be explained
301// by load_object not returning the object 303// by load_object not returning the object
313player::player () 315player::player ()
314{ 316{
315 /* There are some elements we want initialised to non zero value - 317 /* There are some elements we want initialised to non zero value -
316 * we deal with that below this point. 318 * we deal with that below this point.
317 */ 319 */
318 outputs_sync = 16; /* Every 2 seconds */ 320 outputs_sync = 6; /* Every 2 seconds */
319 outputs_count = 8; /* Keeps present behaviour */ 321 outputs_count = 10; /* Keeps present behaviour */
320 unapply = unapply_nochoice; 322 unapply = unapply_nochoice;
321 323
322 savebed_map = first_map_path; /* Init. respawn position */ 324 savebed_map = first_map_path; /* Init. respawn position */
323 325
324 gen_sp_armour = 10; 326 gen_sp_armour = 10;
875 char buf[MAX_BUF]; 877 char buf[MAX_BUF];
876 878
877 /* this must before then initial items are given */ 879 /* this must before then initial items are given */
878 esrv_new_player (op->contr, op->weight + op->carrying); 880 esrv_new_player (op->contr, op->weight + op->carrying);
879 881
880 treasurelist *tl = find_treasurelist ("starting_wealth"); 882 treasurelist *tl = treasurelist::find ("starting_wealth");
881 if (tl) 883 if (tl)
882 create_treasure (tl, op, 0, 0, 0); 884 create_treasure (tl, op, 0, 0, 0);
883 885
884 INVOKE_PLAYER (BIRTH, op->contr); 886 INVOKE_PLAYER (BIRTH, op->contr);
885 INVOKE_PLAYER (LOGIN, op->contr); 887 INVOKE_PLAYER (LOGIN, op->contr);
1028int 1030int
1029check_pick (object *op) 1031check_pick (object *op)
1030{ 1032{
1031 object *tmp, *next; 1033 object *tmp, *next;
1032 int stop = 0; 1034 int stop = 0;
1033 int j, k, wvratio; 1035 int wvratio;
1034 char putstring[128], tmpstr[16]; 1036 char putstring[128];
1035 1037
1036 /* if you're flying, you cna't pick up anything */ 1038 /* if you're flying, you cna't pick up anything */
1037 if (op->move_type & MOVE_FLYING) 1039 if (op->move_type & MOVE_FLYING)
1038 return 1; 1040 return 1;
1039 1041
2254 * Returns true if there are more actions we can do. 2256 * Returns true if there are more actions we can do.
2255 */ 2257 */
2256int 2258int
2257handle_newcs_player (object *op) 2259handle_newcs_player (object *op)
2258{ 2260{
2259 if (op->contr->hidden)
2260 {
2261 op->invisible = 1000;
2262 /* the socket code flashes the player visible/invisible
2263 * depending on the value of invisible, so we need to
2264 * alternate it here for it to work correctly.
2265 */
2266 if (pticks & 2)
2267 op->invisible--;
2268 }
2269 else if (op->invisible && !(QUERY_FLAG (op, FLAG_MAKE_INVIS)))
2270 {
2271 op->invisible--;
2272 if (!op->invisible)
2273 {
2274 make_visible (op);
2275 new_draw_info (NDI_UNIQUE, 0, op, "Your invisibility spell runs out.");
2276 }
2277 }
2278
2279 if (QUERY_FLAG (op, FLAG_SCARED)) 2261 if (QUERY_FLAG (op, FLAG_SCARED))
2280 { 2262 {
2281 flee_player (op); 2263 flee_player (op);
2282 /* If player is still scared, that is his action for this tick */ 2264 /* If player is still scared, that is his action for this tick */
2283 if (QUERY_FLAG (op, FLAG_SCARED)) 2265 if (QUERY_FLAG (op, FLAG_SCARED))
2437 int rate_grace = 2000; 2419 int rate_grace = 2000;
2438 const int max_hp = 1; 2420 const int max_hp = 1;
2439 const int max_sp = 1; 2421 const int max_sp = 1;
2440 const int max_grace = 1; 2422 const int max_grace = 1;
2441 2423
2424 if (op->contr->hidden)
2425 {
2426 op->invisible = 1000;
2427 /* the socket code flashes the player visible/invisible
2428 * depending on the value of invisible, so we need to
2429 * alternate it here for it to work correctly.
2430 */
2431 if (pticks & 2)
2432 op->invisible--;
2433 }
2434 else if (op->invisible && !(QUERY_FLAG (op, FLAG_MAKE_INVIS)))
2435 {
2436 if (!op->invisible--)
2437 {
2438 make_visible (op);
2439 new_draw_info (NDI_UNIQUE, 0, op, "Your invisibility spell runs out.");
2440 }
2441 }
2442
2442 if (op->contr->outputs_sync) 2443 if (op->contr->outputs_sync)
2443 {
2444 for (i = 0; i < NUM_OUTPUT_BUFS; i++) 2444 for (i = 0; i < NUM_OUTPUT_BUFS; i++)
2445 if (op->contr->outputs[i].buf && (op->contr->outputs[i].first_update + op->contr->outputs_sync) < (uint16) pticks) 2445 if (op->contr->outputs[i].buf && (op->contr->outputs[i].first_update + op->contr->outputs_sync) < (uint16) pticks)
2446 flush_output_element (op, &op->contr->outputs[i]); 2446 flush_output_element (op, &op->contr->outputs[i]);
2447 }
2448 2447
2449 if (op->contr->ns->state == ST_PLAYING) 2448 if (op->contr->ns->state == ST_PLAYING)
2450 { 2449 {
2451 /* these next three if clauses make it possible to SLOW DOWN 2450 /* these next three if clauses make it possible to SLOW DOWN
2452 hp/grace/spellpoint regeneration. */ 2451 hp/grace/spellpoint regeneration. */
2908 op->stats.hp = op->stats.maxhp; 2907 op->stats.hp = op->stats.maxhp;
2909 op->stats.sp = MAX (op->stats.sp, op->stats.maxsp); 2908 op->stats.sp = MAX (op->stats.sp, op->stats.maxsp);
2910 op->stats.grace = MAX (op->stats.grace, op->stats.maxgrace); 2909 op->stats.grace = MAX (op->stats.grace, op->stats.maxgrace);
2911 2910
2912 /* 2911 /*
2913 * Check to see if the player is in a shop. IF so, then check to see if
2914 * the player has any unpaid items. If so, remove them and put them back 2912 * Check to see if the player has any unpaid items. If so, remove them
2915 * in the map. 2913 * and put them back in the map.
2916 */ 2914 */
2917
2918 if (is_in_shop (op))
2919 remove_unpaid_objects (op->inv, op); 2915 remove_unpaid_objects (op->inv, op);
2920 2916
2921 /****************************************/ 2917 /****************************************/
2922 /* */ 2918 /* */
2923 /* Move player to his current respawn- */ 2919 /* Move player to his current respawn- */
2924 /* position (usually last savebed) */ 2920 /* position (usually last savebed) */
3069 if (op->type == PLAYER) 3065 if (op->type == PLAYER)
3070 { 3066 {
3071 op->contr->tmp_invis = 0; 3067 op->contr->tmp_invis = 0;
3072 op->contr->invis_race = 0; 3068 op->contr->invis_race = 0;
3073 } 3069 }
3070
3074 update_object (op, UP_OBJ_FACE); 3071 update_object (op, UP_OBJ_CHANGE);
3075} 3072}
3076 3073
3077int 3074int
3078is_true_undead (object *op) 3075is_true_undead (object *op)
3079{ 3076{
3080 object *tmp = NULL;
3081
3082 if (QUERY_FLAG (&op->arch->clone, FLAG_UNDEAD)) 3077 if (QUERY_FLAG (&op->arch->clone, FLAG_UNDEAD))
3083 return 1; 3078 return 1;
3084 3079
3085 return 0; 3080 return 0;
3086} 3081}
3374 char buf[MAX_BUF]; /* tmp. string buffer */ 3369 char buf[MAX_BUF]; /* tmp. string buffer */
3375 int i = 0, j = 0; 3370 int i = 0, j = 0;
3376 3371
3377 /* get the appropriate treasurelist */ 3372 /* get the appropriate treasurelist */
3378 if (atnr == ATNR_FIRE) 3373 if (atnr == ATNR_FIRE)
3379 trlist = find_treasurelist ("dragon_ability_fire"); 3374 trlist = treasurelist::find ("dragon_ability_fire");
3380 else if (atnr == ATNR_COLD) 3375 else if (atnr == ATNR_COLD)
3381 trlist = find_treasurelist ("dragon_ability_cold"); 3376 trlist = treasurelist::find ("dragon_ability_cold");
3382 else if (atnr == ATNR_ELECTRICITY) 3377 else if (atnr == ATNR_ELECTRICITY)
3383 trlist = find_treasurelist ("dragon_ability_elec"); 3378 trlist = treasurelist::find ("dragon_ability_elec");
3384 else if (atnr == ATNR_POISON) 3379 else if (atnr == ATNR_POISON)
3385 trlist = find_treasurelist ("dragon_ability_poison"); 3380 trlist = treasurelist::find ("dragon_ability_poison");
3386 3381
3387 if (trlist == NULL || who->type != PLAYER) 3382 if (trlist == NULL || who->type != PLAYER)
3388 return; 3383 return;
3389 3384
3390 for (i = 0, tr = trlist->items; tr != NULL && i < level - 1; tr = tr->next, i++); 3385 for (i = 0, tr = trlist->items; tr != NULL && i < level - 1; tr = tr->next, i++);

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines