示例#1
0
CMonster* CMap::AddAdrenaMonster( UINT montype, fPoint position, int team)
{
    // check if is a valid monster
    CNPCData* thisnpc = GServer->GetNPCDataByID( montype );
    if(thisnpc==NULL)
    {
        Log( MSG_WARNING, "Add Monster:: Invalid montype %u", montype );
        return NULL;
    }
    CMonster* monster = new (nothrow) CMonster( position, montype, this->id, 0, 0  );
    if(monster==NULL)
    {
        Log( MSG_WARNING, "Add Monster %u:: Error allocing memory",montype);
        return NULL;
    }
    monster->thisnpc = thisnpc;
    monster->life_time=0;
    monster->SetStats( );
    monster->Stats->HP = monster->Stats->MaxHP;
    monster->Stats->MP = monster->Stats->MaxMP;
    monster->is_tactical=true;
    monster->suicide=false;
    monster->team = team;
    monster->owner = 0;

    //LMA: test for quest hack (stackable).
    #ifdef QHACK
    monster->die_quest=thisnpc->die_quest;
    #endif
    //LMA END

    for(int i=0;i<20;i++)
    {
        monster->AIVar[i] = 0;
    }

    //broken by some monsters (Turak boss)
    if(monster->Stats->HP>MAXHPMOB)
    {
        monster->Stats->HP=(long long) MAXHPMOB;
    }

    MonsterList.push_back( monster );

    //LMA: daynight
    monster->daynight=0;
    monster->sp_aip=0;

    //LMA: team:
    monster->team=team;
    monster->SpawnTime = clock( );
    monster->lastDegenTime=clock();
    monster->OnSpawn( false );
    monster->lastAiUpdate = clock();
    monster->nextAi_attacked=clock();
    monster->hitcount = 0xFF;
    monster->owner = 0;
    monster->hitcount=0;
    monster->maxhitcount=0;
    if(thisnpc->wspeed == 0)
    {
        monster->stay_still=true;
    }
    else
    {
        monster->stay_still=false;
    }


    monster->bonushp=0;
    monster->bonusmp=0;
    monster->maxvalue=0;
    monster->minvalue=0;
    monster->skillid=0;
    monster->range=0;
    monster->buffid=0;
    monster->char_montype=montype;

    //Log(MSG_INFO,"XCID, Addmonster %i in map %i",montype,monster->Position->Map);

    return monster;
}
示例#2
0
// add a new monster to this map
CMonster* CMap::AddMonster( UINT montype, fPoint position, UINT owner, CMDrops* MonsterDrop, CMDrops* MapDrop, UINT spawnid , bool GetDropData )
{
    // check if is a valid monster
    CNPCData* thisnpc = GServer->GetNPCDataByID( montype );
    if(thisnpc==NULL)
    {
        Log( MSG_WARNING, "Invalid montype %i", montype );
        return NULL;
    }
    CMonster* monster = new (nothrow) CMonster( position, montype, this->id, owner, spawnid  );
    if(monster==NULL)
    {
        Log( MSG_WARNING, "Error allocing memory" );
        return NULL;
    }
    monster->thisnpc = thisnpc;
    monster->SetStats( );
    monster->Stats->HP = monster->Stats->MaxHP;
    if(GetDropData && owner==0)
    {
        monster->MonsterDrop->mobdrop = GServer->GetDropData( monster->thisnpc->dropid );
        monster->MonsterDrop->mapdrop = GServer->GetDropData( id );
    }
    else
    {
        monster->MonsterDrop->mobdrop = MonsterDrop;
        monster->MonsterDrop->mapdrop = MapDrop;
    }
    MonsterList.push_back( monster );
    if(spawnid!=0)
    {
        CSpawnArea* thisspawn = GServer->GetSpawnArea( spawnid, this->id );
        if(thisspawn!=NULL)
            thisspawn->amon++;
    }
    monster->SpawnTime = clock( );
    monster->OnSpawn( false );

    //LMA BEGIN
    //20070621-211100/test
    //The bug still exists, I activate it...
    //solves 99.99% this problem.
    //We search if a player is nearby and we force the refresh
    /*
      CPlayer* player = monster->GetNearPlayer( );
      if(player!=NULL)
      {
          player->ForceRefreshMonster(false,monster->clientid);
      }
    */
    //LMA END

    monster->hitcount=0;
    monster->maxhitcount=0;
    monster->stay_still=false;

    if(monster->thisnpc->id==659)
    {
        monster->maxhitcount=3;   //LMA: MoonChild
        monster->stay_still=true;
    }

    if(monster->thisnpc->id==201)
    {
        monster->maxhitcount=1;   //LMA: Worm dragon
    }

    //Sunrise, Sunset and Dusk Crystal in Junon Cartel
    if (monster->thisnpc->id>=431&&monster->thisnpc->id<=433)
        monster->stay_still=true;

    //LMA: bonfire (and salamender...) don't move and don't attack ;)
    if (monster->IsBonfire())
    {
        monster->stay_still=true;
        monster->Battle->target=owner;
    }

    monster->bonushp=0;
    monster->bonusmp=0;
    monster->maxvalue=0;
    monster->minvalue=0;
    monster->skillid=0;
    monster->range=0;
    monster->buffid=0;


    return monster;
}
示例#3
0
// add a new monster to this map
CMonster* CMap::AddMonster( UINT montype, fPoint position, UINT owner, CMDrops* MonsterDrop, CMDrops* MapDrop, UINT spawnid , bool GetDropData, bool is_tactic)
{
    // check if is a valid monster
    CNPCData* thisnpc = GServer->GetNPCDataByID( montype );
    if(thisnpc==NULL)
    {
        Log( MSG_WARNING, "Add Monster:: Invalid montype %u", montype );
        return NULL;
    }

    CMonster* monster = new (nothrow) CMonster( position, montype, this->id, owner, spawnid  );
    if(monster==NULL)
    {
        Log( MSG_WARNING, "Add Monster %u:: Error allocing memory",montype);
        return NULL;
    }
    monster->thisnpc = thisnpc;
    monster->life_time=0;
    monster->SetStats( );
    monster->Stats->HP = monster->Stats->MaxHP;
    monster->Stats->MP = monster->Stats->MaxMP;
    monster->is_tactical=is_tactic;
    monster->suicide=false;

    //LMA: test for quest hack (stackable).
    #ifdef QHACK
    monster->die_quest=thisnpc->die_quest;
    #endif
    //LMA END

    for(int i=0;i<20;i++)
    {
        monster->AIVar[i] = 0;
    }

    //LMA: no agressivity in Santa's planetoid ;)
    if(monster->Position->Map==38)
    {
        monster->thisnpc->aggresive=0;
        monster->thisnpc->helpless=1;
        //Log( MSG_WARNING, "Add Monster %u:: to Santa's planetoid",montype); // PY code added to read out monsters spawning on Santa's planetoid
    }

    //LMA: Little check, for now we "only" have a DWORD for monster's HP so there is a limit
    //broken by some monsters (Turak boss)
    if(monster->Stats->HP>MAXHPMOB)
    {
        monster->Stats->HP=(long long) MAXHPMOB;
    }

    monster->Status->spawnid = spawnid; //this way we can easily find which spawn a mob belongs to
    if(GetDropData && owner==0)
    {
        monster->MonsterDrop->mobdrop = GServer->GetDropData( monster->thisnpc->dropid );
        monster->MonsterDrop->mapdrop = GServer->GetDropData( id );
    }
    else
    {
        monster->MonsterDrop->mobdrop = MonsterDrop;
        monster->MonsterDrop->mapdrop = MapDrop;
    }
    MonsterList.push_back( monster );

    //LMA: daynight
    monster->daynight=0;
    monster->sp_aip=0;

    //LMA: team:
    monster->team=0;

    if(monster->IsSummon()&&owner!=0)
    {
        //Trying to get the owner.
        CPlayer* tempplayer=GServer->GetClientByID(owner,monster->Position->Map);
        if (tempplayer!=NULL)
        {
            monster->team=tempplayer->pvp_id;
            Log(MSG_INFO,"ADDMONSTER, overwriting team with owner's pvp_id %i",tempplayer->pvp_id);

            //Tomiz : Get Owner lvl For Summon (the one from job, setup to fix normal atk formula because summon got lvl <= 100 in STB)
            UINT ownerlevel = 0;
            ownerlevel += tempplayer->Stats->Level;
            monster->Stats->Level = ownerlevel;
             Log(MSG_INFO,"Summon %i, got lvl %i by this owner",thisnpc->id,ownerlevel);
         }

        //LMA: adding a summon :)
        if (monster->IsSummon())
        {
            nb_summons++;
            Log(MSG_INFO,"Adding a summon in map %i (now %u)",id,nb_summons);
        }

     }
    //Log( MSG_WARNING, "AddMonster:: about to do some crap with groups" );
    /* if(spawnid!=0)  //PY: commenting out this bit cuz it crashes with my new IFO spawns
    {
        CMobGroup* thisgroup = GServer->GetMobGroup( spawnid, this->id );
        if(thisgroup!=NULL)
        {
            //LMA: only if not a tactical.
            if(!monster->is_tactical)
            {
                thisgroup->active++;
            }

        }

        //LMA: daynight
        monster->daynight=thisgroup->daynight;
    }
    */
    monster->SpawnTime = clock( );
    monster->lastDegenTime=clock();
    monster->OnSpawn( false );
    monster->lastAiUpdate = clock();
    monster->nextAi_attacked=clock();
    monster->hitcount = 0xFF;

    monster->hitcount=0;
    monster->maxhitcount=0;
    monster->stay_still=false;

    if(monster->thisnpc->id==659)
    {
       monster->maxhitcount=3;   //LMA: MoonChild
       monster->stay_still=true;
    }

    if(monster->thisnpc->id==201)
    {
       monster->maxhitcount=1;   //LMA: Worm dragon
    }

    if(monster->thisnpc->id==1572)
    {
       monster->maxhitcount=1;   //rl2171: Cursed Ant Vagabond
    }

    if(monster->thisnpc->id==662 || monster->thisnpc->id==667 || monster->thisnpc->id==673 || monster->thisnpc->id==678)
    {
       monster->maxhitcount=3;   //rl2171: Dragon Egg for Clan Wars  - 662, 667, 673, 678
       monster->stay_still=true;
    }

     if(monster->thisnpc->id==558)
    {
       monster->maxhitcount=1;   //rl2171: 1st Turak
    }

     if(monster->thisnpc->id==559)
    {
       monster->maxhitcount=1;   //rl2171: 2nd Turak
    }

    /*if(monster->thisnpc->id==560)
    {
       monster->maxhitcount=1;   //rl2171: 3rd Turak
    }
    */
    //Sunrise, Sunset and Dusk Crystal in Junon Cartel
    if (monster->thisnpc->id>=431&&monster->thisnpc->id<=433)
       monster->stay_still=true;

    //Rune Stone, Green, Blue, Red, White Crystal in Luna
    //    if (monster->thisnpc->id>=325&&monster->thisnpc->id<=329)
    //       monster->stay_still=true;

        //Seal Stone
    //    if (monster->thisnpc->id>=451&&monster->thisnpc->id<=457)
    //       monster->stay_still=true;

        //Clan Wars gate - wall
    //    if (monster->thisnpc->id>=1022&&monster->thisnpc->id<=1023)
    //       monster->stay_still=true;

    //LMA: bonfire (and salamender...) don't move and don't attack ;)
    if (monster->IsBonfire())
    {
       monster->stay_still=true;
       monster->Battle->target=owner;
    }

    monster->bonushp=0;
    monster->bonusmp=0;
    monster->maxvalue=0;
    monster->minvalue=0;
    monster->skillid=0;
    monster->range=0;
    monster->buffid=0;
    monster->char_montype=montype;

    //Log(MSG_INFO,"XCID, Addmonster %i in map %i",montype,monster->Position->Map);


    return monster;
}
示例#4
0
// add a new monster to this map
CMonster* CMap::AddMonster( UINT montype, fPoint position, UINT owner, CMDrops* MonsterDrop, CMDrops* MapDrop, UINT spawnid , bool GetDropData, bool is_tactic)
{
    // check if is a valid monster
    CNPCData* thisnpc = GServer->GetNPCDataByID( montype );
    if(thisnpc==NULL)
    {
        Log( MSG_WARNING, "Invalid montype %i", montype );
        return NULL;
    }

    CMonster* monster = new (nothrow) CMonster( position, montype, this->id, owner, spawnid  );
    if(monster==NULL)
    {
        Log( MSG_WARNING, "Error allocing memory" );
        return NULL;
    }

    monster->thisnpc = thisnpc;
    monster->life_time=0;
    monster->SetStats( );
    monster->Stats->HP = monster->Stats->MaxHP;
    monster->Stats->MP = monster->Stats->MaxMP;
    monster->is_tactical=is_tactic;
    monster->suicide=false;

    //LMA: no agressivity in Santa's planetoid ;)
    if(monster->Position->Map==38)
    {
        monster->thisnpc->aggresive=0;
        monster->thisnpc->helpless=1;
    }

    //LMA: Little check, for now we "only" have a DWORD for monster's HP so there is a limit
    //broken by some monsters (Turak boss)
    if(monster->Stats->HP>MAXHPMOB)
    {
        monster->Stats->HP=(long long) MAXHPMOB;
    }

    monster->Status->spawnid = spawnid; //this way we can easily find which spawn a mob belongs to
    if(GetDropData && owner==0)
    {
        monster->MonsterDrop->mobdrop = GServer->GetDropData( monster->thisnpc->dropid );
        monster->MonsterDrop->mapdrop = GServer->GetDropData( id );
    }
    else
    {
        monster->MonsterDrop->mobdrop = MonsterDrop;
        monster->MonsterDrop->mapdrop = MapDrop;
    }
    MonsterList.push_back( monster );

    //LMA: daynight
    monster->daynight=0;
    monster->sp_aip=0;

    //LMA: team:
    monster->team=0;

    if(monster->IsSummon()&&owner!=0)
    {
        //Trying to get the owner.
        CPlayer* tempplayer=GServer->GetClientByID(owner,monster->Position->Map);
        if (tempplayer!=NULL)
        {
            monster->team=tempplayer->pvp_id;
            Log(MSG_INFO,"ADDMONSTER, overwriting team with owner's pvp_id",tempplayer->pvp_id);
        }

    }

    if(spawnid!=0)
    {
        CMobGroup* thisgroup = GServer->GetMobGroup( spawnid, this->id );
        if(thisgroup!=NULL)
        {
            //LMA: only if not a tactical.
            if(!monster->is_tactical)
            {
                thisgroup->active++;
            }

        }

        //LMA: daynight
        monster->daynight=thisgroup->daynight;
    }

    monster->SpawnTime = clock( );
    monster->lastDegenTime=clock();
    monster->OnSpawn( false );
    monster->lastAiUpdate = clock();
    monster->hitcount = 0xFF;

    monster->hitcount=0;
    monster->maxhitcount=0;
    monster->stay_still=false;

    if(monster->thisnpc->id==659)
    {
       monster->maxhitcount=3;   //LMA: MoonChild
       monster->stay_still=true;
    }

    if(monster->thisnpc->id==201)
    {
       monster->maxhitcount=1;   //LMA: Worm dragon
    }

    if(monster->thisnpc->id==1572)
    {
       monster->maxhitcount=1;   //rl2171: Cursed Ant Vagabond
    }

    if(monster->thisnpc->id==662)
    {
       monster->maxhitcount=3;   //rl2171: Dragon Egg for Clan Wars  - 662, 667, 673, 678
       monster->stay_still=true;
    }

     if(monster->thisnpc->id==558)
    {
       monster->maxhitcount=1;   //rl2171: 1st Turak
    }

     if(monster->thisnpc->id==559)
    {
       monster->maxhitcount=1;   //rl2171: 2nd Turak
    }

    /*if(monster->thisnpc->id==560)
    {
       monster->maxhitcount=1;   //rl2171: 3rd Turak
    }
    */
    //Sunrise, Sunset and Dusk Crystal in Junon Cartel
    if (monster->thisnpc->id>=431&&monster->thisnpc->id<=433)
       monster->stay_still=true;

    //Rune Stone, Green, Blue, Red, White Crystal in Luna
    //    if (monster->thisnpc->id>=325&&monster->thisnpc->id<=329)
    //       monster->stay_still=true;

        //Seal Stone
    //    if (monster->thisnpc->id>=451&&monster->thisnpc->id<=457)
    //       monster->stay_still=true;

        //Clan Wars gate - wall
    //    if (monster->thisnpc->id>=1022&&monster->thisnpc->id<=1023)
    //       monster->stay_still=true;

    //LMA: bonfire (and salamender...) don't move and don't attack ;)
    if (monster->IsBonfire())
    {
       monster->stay_still=true;
       monster->Battle->target=owner;
    }

    monster->bonushp=0;
    monster->bonusmp=0;
    monster->maxvalue=0;
    monster->minvalue=0;
    monster->skillid=0;
    monster->range=0;
    monster->buffid=0;
    monster->char_montype=montype;

    //Log(MSG_INFO,"XCID, Addmonster %i in map %i",montype,monster->Position->Map);


    return monster;
}