Advertisement
Guest User

Untitled

a guest
Jul 24th, 2012
101
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Diff 2.26 KB | None | 0 0
  1. Index: src/char/char.c
  2. ===================================================================
  3. --- src/char/char.c (revisão 16496)
  4. +++ src/char/char.c (cópia de trabalho)
  5. @@ -3664,6 +3664,12 @@
  6.                 break;
  7.             }
  8.  
  9. +           // Send party to map
  10. +           if( cd->party_id != 0 && !inter_party_update(cd) )
  11. +           {
  12. +               // TODO something went wrong, auto remove from party?
  13. +           }
  14. +
  15.             //Send player to map
  16.             WFIFOHEAD(fd,28);
  17.             WFIFOW(fd,0) = 0x71;
  18. Index: src/char/int_party.c
  19. ===================================================================
  20. --- src/char/int_party.c    (revisão 16496)
  21. +++ src/char/int_party.c    (cópia de trabalho)
  22. @@ -850,3 +850,32 @@
  23.         idb_remove(party_db_, party_id);
  24.     return 1;
  25.  }
  26. +
  27. +
  28. +/// Updates the party info related to the target character.
  29. +/// Returns true on success.
  30. +bool inter_party_update(struct mmo_charstatus* cd)
  31. +{
  32. +   struct party_data* p;
  33. +   struct party_member* member;
  34. +   int i;
  35. +
  36. +   if( cd == NULL || cd->party_id == 0 )
  37. +       return false; // character not in a party
  38. +   p = inter_party_fromsql(cd->party_id);
  39. +   if( p == NULL )
  40. +       return false; // invalid party
  41. +   for( i = 0; i <= p->party.count; ++i )
  42. +   {
  43. +       member = &p->party.member[i];
  44. +       if( member->account_id != cd->account_id || member->char_id != cd->char_id )
  45. +           continue;
  46. +       safestrncpy(member->name, cd->name, NAME_LENGTH);
  47. +       member->class_ = cd->class_;
  48. +       member->map = cd->last_point.map;
  49. +       member->lv = cd->base_level;
  50. +       mapif_party_info(-1, &p->party, cd->char_id); // send to all map servers
  51. +       return true; // found and updated
  52. +   }
  53. +   return false; // not found
  54. +}
  55. Index: src/char/int_party.h
  56. ===================================================================
  57. --- src/char/int_party.h    (revisão 16496)
  58. +++ src/char/int_party.h    (cópia de trabalho)
  59. @@ -15,6 +15,7 @@
  60.  };
  61.  
  62.  struct party;
  63. +struct mmo_charstatus;
  64.  
  65.  int inter_party_parse_frommap(int fd);
  66.  int inter_party_sql_init(void);
  67. @@ -22,6 +23,8 @@
  68.  int inter_party_leave(int party_id,int account_id, int char_id);
  69.  int inter_party_CharOnline(int char_id, int party_id);
  70.  int inter_party_CharOffline(int char_id, int party_id);
  71. +bool inter_party_update(struct mmo_charstatus* cd);
  72. +
  73.  //Required for the TXT->SQL converter
  74.  int inter_party_tosql(struct party *p, int flag, int index);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement