version 1.58 | | version 1.59 |
---|
| | |
/* | | /* |
* static char *rcsid_plugins_c = | | * static char *rcsid_plugins_c = |
* "$Id: plugins.c,v 1.58 2005/12/05 23:34:04 akirschbaum Exp $"; | | * "$Id: plugins.c,v 1.59 2005/12/17 18:21:44 ryo_saeba Exp $"; |
*/ | | */ |
| | |
/*****************************************************************************/ | | /*****************************************************************************/ |
| | |
{cfapi_object_apply_below, 69, "cfapi_object_apply_below"}, | | {cfapi_object_apply_below, 69, "cfapi_object_apply_below"}, |
{cfapi_archetype_get_first, 70, "cfapi_archetype_get_first"}, | | {cfapi_archetype_get_first, 70, "cfapi_archetype_get_first"}, |
{cfapi_archetype_get_property, 71, "cfapi_archetype_get_property"}, | | {cfapi_archetype_get_property, 71, "cfapi_archetype_get_property"}, |
| | {cfapi_party_get_property, 72, "cfapi_party_get_property"}, |
}; | | }; |
int plugin_number = 0; | | int plugin_number = 0; |
crossfire_plugin* plugins_list = NULL; | | crossfire_plugin* plugins_list = NULL; |
| | |
rv = (char*)op->arch->name; | | rv = (char*)op->arch->name; |
*type = CFAPI_STRING; | | *type = CFAPI_STRING; |
break; | | break; |
case CFAPI_PLAYER_PROP_IP : | | |
rv = op->contr->socket.host; | | |
*type = CFAPI_STRING; | | |
break; | | |
case CFAPI_PLAYER_PROP_MARKED_ITEM: | | |
rv = find_marked_object(op); | | |
*type = CFAPI_POBJECT; | | |
break; | | |
case CFAPI_OBJECT_PROP_INVISIBLE: | | case CFAPI_OBJECT_PROP_INVISIBLE: |
ri = op->invisible; | | ri = op->invisible; |
rv = &ri; | | rv = &ri; |
| | |
rv = &ri; | | rv = &ri; |
*type = CFAPI_INT; | | *type = CFAPI_INT; |
break; | | break; |
| | case CFAPI_PLAYER_PROP_IP : |
| | rv = op->contr->socket.host; |
| | *type = CFAPI_STRING; |
| | break; |
| | case CFAPI_PLAYER_PROP_MARKED_ITEM: |
| | rv = find_marked_object(op); |
| | *type = CFAPI_POBJECT; |
| | break; |
| | case CFAPI_PLAYER_PROP_PARTY: |
| | rv = (op->contr ? op->contr->party : NULL); |
| | *type = CFAPI_PPARTY; |
| | break; |
default: | | default: |
*type = CFAPI_NONE; | | *type = CFAPI_NONE; |
break; | | break; |
| | |
object* op; | | object* op; |
int property; | | int property; |
void* rv; | | void* rv; |
| | partylist* partyarg; |
va_start(args,type); | | va_start(args,type); |
| | |
op = va_arg(args, object*); | | op = va_arg(args, object*); |
| | |
} | | } |
update_object(op, UP_OBJ_FACE); | | update_object(op, UP_OBJ_FACE); |
break; | | break; |
| | case CFAPI_PLAYER_PROP_MARKED_ITEM: |
| | if (op->contr) |
| | { |
| | oparg = va_arg(args, object*); |
| | op->contr->mark = oparg; |
| | if (oparg) |
| | op->contr->mark_count = oparg->count; |
| | } |
| | break; |
| | case CFAPI_PLAYER_PROP_PARTY: |
| | if (op->contr) |
| | { |
| | partyarg = va_arg(args, partylist*); |
| | op->contr->party = partyarg; |
| | } |
| | break; |
default: | | default: |
*type = CFAPI_NONE; | | *type = CFAPI_NONE; |
break; | | break; |
| | |
return rv; | | return rv; |
} | | } |
| | |
| | /* Party-related functions */ |
| | void* cfapi_party_get_property(int* type, ...) |
| | { |
| | partylist* party; |
| | int prop; |
| | va_list args; |
| | void* rv; |
| | object* obarg; |
| | player* pl; |
| | |
| | va_start(args, type); |
| | party = va_arg(args, partylist*); |
| | prop = va_arg(args, int); |
| | switch (prop) |
| | { |
| | case CFAPI_PARTY_PROP_NAME: |
| | *type = CFAPI_STRING; |
| | rv = (void*)party->partyname; |
| | break; |
| | case CFAPI_PARTY_PROP_NEXT: |
| | *type = CFAPI_PPARTY; |
| | rv = (party?party->next:get_firstparty()); |
| | break; |
| | case CFAPI_PARTY_PROP_PASSWORD: |
| | *type = CFAPI_STRING; |
| | rv = (void*)party->passwd; |
| | case CFAPI_PARTY_PROP_PLAYER: |
| | *type = CFAPI_PPLAYER; |
| | obarg = va_arg(args, object*); |
| | pl = ( obarg ? obarg->contr : first_player ); |
| | rv = NULL; |
| | for (; pl != NULL; pl = pl->next) |
| | if (pl->ob->contr->party == party) |
| | { |
| | rv = (void*)pl; |
| | break; |
| | } |
| | break; |
| | default: |
| | *type = CFAPI_NONE; |
| | rv = NULL; |
| | break; |
| | } |
| | va_end(args); |
| | return rv; |
| | } |
| | |
/*****************************************************************************/ | | /*****************************************************************************/ |
/* NEW PLUGIN STUFF ENDS HERE */ | | /* NEW PLUGIN STUFF ENDS HERE */ |
/*****************************************************************************/ | | /*****************************************************************************/ |