All pastes #485932 Raw Edit

Miscellany

public text v1 · immutable
·published 2007-05-13 10:23 UTC
rendered paste body
        std::ostringstream ss;
        ss<<"select `minhealth`, `maxhealth`, `minmana`, `maxmana`,`mindmg`, `maxdmg`, `spell1`, `spell2`, `spell3`, `spell4`, from `creature_template` where entry='"<<petentry<<"'";
        QueryResult *result = sDatabase.Query( ss.str().c_str() );
        if( !result )
	    return true;
        Field *fields = result->Fetch();
	  // can have 0
	  NewSummon->SetHealth(fields[0].GetUInt32());
	  NewSummon->SetMaxHealth(fields[1].GetUInt32());
	  NewSummon->SetPower(POWER_MANA, fields[2].GetUInt32());
	  NewSummon->SetMaxPower(POWER_MANA, fields[3].GetUInt32());
	  NewSummon->SetFloatValue(UNIT_FIELD_MINDAMAGE, fields[4].GetUInt32());
	  NewSummon->SetFloatValue(UNIT_FIELD_MAXDAMAGE, fields[5].GetUInt32());
	  // can't have 0
	  if(!fields[6].GetUInt32() || fields[6].GetUInt32() != 0)
		NewSummon->learnSpell(fields[6].GetUInt32());
          if(!fields[7].GetUInt32() || fields[7].GetUInt32() != 0)
                NewSummon->learnSpell(fields[7].GetUInt32());
          if(!fields[8].GetUInt32() || fields[8].GetUInt32() != 0)
                NewSummon->learnSpell(fields[8].GetUInt32());
          if(!fields[9].GetUInt32() || fields[9].GetUInt32() != 0)
                NewSummon->learnSpell(fields[9].GetUInt32());