Beispiel #1
0
//Returns the skill index for the character's native tongue.
int Character::NativeTongue()
{
	if(IS_HUMAN(this) || IS_AIEL(this) || IS_SEANCHAN(this))
		return SKILL_NEW_TONGUE;
	if(IS_TROLLOC(this))
		return SKILL_TROLL_TONGUE;
	return 0;
}
Beispiel #2
0
int invalid_race(struct char_data *ch, struct obj_data *obj)
{
  if (GET_LEVEL(ch) >= LVL_IMMORT)
    return FALSE;

  if (OBJ_FLAGGED(obj, ITEM_ANTI_HUMAN) && IS_HUMAN(ch))
    return (TRUE);

  if (OBJ_FLAGGED(obj, ITEM_ANTI_ELF) && IS_ELF(ch))
    return (TRUE);

  if (OBJ_FLAGGED(obj, ITEM_ANTI_DWARF) && IS_DWARF(ch))
    return (TRUE);

  if (OBJ_FLAGGED(obj, ITEM_ANTI_GNOME) && IS_GNOME(ch))
    return (TRUE);

  return (FALSE);
}
Beispiel #3
0
//Sets a character's default skills, such as languages.
void Character::SetSkillDefaults()
{
	if(	IS_NPC(this) || IS_HUMAN(this) || IS_DREADLORD(this) || IS_DREADGUARD(this) || IS_FADE(this) ||
	IS_GREYMAN(this) || IS_SEANCHAN(this) || IS_AIEL(this))
		SET_SKILL(this, SKILL_NEW_TONGUE, 100);
	if(IS_NPC(this) || IS_TROLLOC(this) || PLR_FLAGGED(this, PLR_DARKFRIEND))
		SET_SKILL(this, SKILL_TROLL_TONGUE, 100);
	SET_SKILL(this, SKILL_BAREHANDS, 100);

	if( !IS_NPC(this) && !this->userClans.empty() )
	{
		Clan *clan;
		for(auto userClanIter = userClans.begin();userClanIter != userClans.end();++userClanIter)
		{
			UserClan *userClan = (*userClanIter);
			clan = ClanUtil::getClan(userClan->getClanId());
			if(userClan->getRank() >= clan->bonus_skill_rank)
				SET_SKILL(this, clan->bonus_skill, clan->bonus_skill_val);
		}
	}
}
Beispiel #4
0
/*
 * invalid_race is used by handler.c to determine if a piece of equipment is
 * usable by a particular race, based on the ITEM_ANTI_{race} bitvectors.
 */
int invalid_race(struct char_data *ch, struct obj_data *obj) {

    if ( IS_OBJ_STAT(obj, ITEM_ANTI_BARBAR) && IS_BARBARIAN(ch) ) {
        return 1;
    }

    if ( IS_OBJ_STAT(obj, ITEM_ANTI_DWARF) &&
            ( IS_HYLAR(ch) || IS_DAEWAR(ch) || IS_NEIDAR(ch) ) ) {
        return 1;
    }

    if ( IS_OBJ_STAT(obj, ITEM_ANTI_ELF) &&
            ( IS_SILVANESTI(ch) || IS_QUALINESTI(ch) || IS_KAGONESTI(ch) ) ) {
        return 1;
    }

    if ( IS_OBJ_STAT(obj, ITEM_ANTI_HALFELF) && IS_HALFELVEN(ch) ) {
        return 1;
    }

    if ( IS_OBJ_STAT(obj, ITEM_ANTI_KENDER) && IS_KENDER(ch) ) {
        return 1;
    }

    if ( IS_OBJ_STAT(obj, ITEM_ANTI_MINOTAUR) && IS_MINOTAUR(ch) ) {
        return 1;
    }

    if ( IS_OBJ_STAT(obj, ITEM_ANTI_GNOME) && IS_GNOME(ch) ) {
        return 1;
    }

    if ( IS_OBJ_STAT(obj, ITEM_ANTI_HUMAN) && IS_HUMAN(ch) ) {
        return 1;
    }


    return 0;
}
Beispiel #5
0
local void playera(Player *p, int action, Arena *arena)
{
	/* ignore fake players */
	if (!IS_HUMAN(p))
		return;

	if (action == PA_CONNECT)
	{
		struct net_client_stats ncs;
		struct chat_client_stats ccs;

		char *name = p->name;
		char *ip = "0";
		unsigned int macid;
		unsigned int permid;

		/* get ip and optionally macid/permid */
		if (IS_STANDARD(p) && net)
		{
			net->GetClientStats(p, &ncs);
			ip = ncs.ipaddr;
		}
		else if (IS_CHAT(p) && chatnet)
		{
			chatnet->GetClientStats(p, &ccs);
			ip = ccs.ipaddr;
		}

		macid = p->macid;
		permid = p->permid;

		/* the ip address will be in dotted decimal form, let mysql do
		 * the conversion to an integer. */
		db->Query(NULL, NULL, 0,
				"replace into " TABLE_NAME " (name, ip, macid, permid) "
				"values (?, inet_aton(?), #, #)",
				name, ip, macid, permid);
	}
}