コード例 #1
0
ファイル: spells.cpp プロジェクト: Lolkauo/polserver
    bool knows_spell( Mobile::Character* chr, u16 spellid )
	{
	  //copied code from Character::spellbook to support multiple spellbooks in the pack
	  Items::Item* item = chr->wornitem( LAYER_HAND1 );
	  if ( item != NULL && item->script_isa( POLCLASS_SPELLBOOK ) )
	  {
		Spellbook* book = static_cast<Spellbook*>( item );
		if ( book->has_spellid( spellid ) )
		  return true;
	  }

	  UContainer* cont = chr->backpack();
	  if ( cont != NULL )
	  {
		for ( UContainer::const_iterator itr = cont->begin(), end = cont->end(); itr != end; ++itr )
		{
		  const Items::Item* _item = GET_ITEM_PTR( itr );

		  if ( _item != NULL && _item->script_isa( POLCLASS_SPELLBOOK ) )
		  {
			const Spellbook* book = static_cast<const Spellbook*>( _item );
			if ( book->has_spellid( spellid ) )
			  return true;
		  }
		}
	  }

	  return false;
	}
コード例 #2
0
ファイル: corpse.cpp プロジェクト: AlessandroMamusa/polserver
    void UCorpse::remove(iterator itr)
    {
        Item *item = GET_ITEM_PTR(itr);

        if (Items::valid_equip_layer(item))
        {
            Item* item_on_layer = GetItemOnLayer(item->tile_layer);
            
            if (item_on_layer != EMPTY_ELEM && item_on_layer->serial == item->serial)
            {
                RemoveItemFromLayer(item);
            }
        }
        base::remove(itr);
    }
コード例 #3
0
ファイル: corpse.cpp プロジェクト: vitorfdl/polserver
	void UCorpse::spill_contents( Multi::UMulti* multi )
	{
	  bool any;
	  do
	  {
		any = false;
		for ( iterator itr = begin(); itr != end(); ++itr )
		{
		  Item *item = GET_ITEM_PTR( itr );
		  if ( item->tile_layer == LAYER_HAIR || item->tile_layer == LAYER_BEARD || item->tile_layer == LAYER_FACE || item->movable() == false )
		  {
			Core::destroy_item( item );
			any = true;
			break; // our iterators are now useless, so start over
		  }
		}
	  } while ( any );

	  if ( !take_contents_to_grave )
		base::spill_contents( multi );
	}