Jump to content

j4r0d

Members
  • Posts

    22
  • Joined

  • Last visited

    Never
  • Donations

    0.00 GBP 

Posts posted by j4r0d

  1. you didn't include body of those 4 new files ;-)

    omg sorry :P

    diff --git a/src/game/MapUpdater.cpp b/src/game/MapUpdater.cpp
    new file mode 100644
    index 0000000..1a37d7e
    --- /dev/null
    +++ b/src/game/MapUpdater.cpp
    @@ -0,0 +1,140 @@
    +#include "MapUpdater.h"
    +
    +#include "DelayExecutor.h"
    +#include "Map.h"
    +#include "Database/DatabaseEnv.h"
    +
    +#include <ace/Guard_T.h>
    +#include <ace/Method_Request.h>
    +
    +//the reason this things are here is that i want to make
    +//the netcode patch and the multithreaded maps independant
    +//once they are merged 1 class should be used
    +class  WDBThreadStartReq1 : public ACE_Method_Request
    +{
    +public:
    +  WDBThreadStartReq1 () { }
    +  virtual int
    +  call (void)
    +  {
    +    WorldDatabase.ThreadStart ();
    +    return 0;
    +  }
    +};
    +
    +class  WDBThreadEndReq1 : public ACE_Method_Request
    +{
    +public:
    +  WDBThreadEndReq1 () { }
    +  virtual int
    +  call (void)
    +  {
    +    WorldDatabase.ThreadEnd ();
    +    return 0;
    +  }
    +};
    +
    +class MapUpdateRequest : public ACE_Method_Request
    +{
    +public:
    +  Map& m_map;
    +  MapUpdater& m_updater;
    +  ACE_UINT32 m_diff;
    +  MapUpdateRequest (Map& m,MapUpdater& u,ACE_UINT32 d) : m_map(m),m_updater(u),m_diff(d) { }
    +  virtual int
    +  call (void)
    +  {
    +    m_map.Update (m_diff);
    +    m_updater.update_finished ();
    +    return 0;
    +  }
    +};
    +
    +MapUpdater::MapUpdater () :
    +m_mutex (),
    +m_condition (m_mutex),
    +m_executor (),
    +pedning_requests (0)
    +{
    +  return;
    +}
    +
    +MapUpdater::~MapUpdater ()
    +{
    +  this->deactivate ();
    +}
    +
    +int
    +MapUpdater::activate (size_t num_threads)
    +{
    +  return this->m_executor.activate (static_cast<int> (num_threads),
    +                                    new WDBThreadStartReq1,
    +                                    new WDBThreadEndReq1);
    +}
    +
    +int
    +MapUpdater::Deactivate (void)
    +{
    +  this->wait ();
    +
    +  return this->m_executor.deactivate ();
    +}
    +
    +int
    +MapUpdater::wait ()
    +{
    +  ACE_GUARD_RETURN(ACE_Thread_Mutex,guard,this->m_mutex,-1);
    +
    +  while(this->pedning_requests > 0)
    +    this->m_condition.wait ();
    +
    +  return 0;
    +}
    +
    +int
    +MapUpdater::schedule_update(Map& map, ACE_UINT32 diff)
    +{
    +  ACE_GUARD_RETURN(ACE_Thread_Mutex,guard,this->m_mutex,-1);
    +
    +  ++this->pedning_requests;
    +
    +  if( this->m_executor.execute (new MapUpdateRequest(map,*this,diff)) == -1)
    +    {
    +      ACE_DEBUG ((LM_ERROR,
    +                  ACE_TEXT ("(%t) \\n"),
    +                  ACE_TEXT ("Failed to schedule Map Update")));
    +
    +      --this->pedning_requests;
    +      return -1;
    +    }
    +
    +  return 0;
    +}
    +
    +bool
    +MapUpdater::activated ()
    +{
    +  return m_executor.activated();
    +}
    +
    +void
    +MapUpdater::update_finished ()
    +{
    +  ACE_GUARD (ACE_Thread_Mutex, guard, this->m_mutex);
    +
    +  if (this->pedning_requests == 0)
    +    {
    +      ACE_ERROR ((LM_ERROR,
    +                  ACE_TEXT ("(%t)\\n"),
    +                  ACE_TEXT ("MapUpdater::update_finished BUG, report to devs")));
    +
    +      return;
    +    }
    +
    +  --this->pedning_requests;
    +
    +  //TODO can more than one thread call wait (), it shouldnt happen
    +  //however I ensure if in future more than 1 thread call it by
    +  //using broadcast instead of signal ()
    +  this->m_condition.broadcast ();
    +}
    diff --git a/src/game/MapUpdater.h b/src/game/MapUpdater.h
    new file mode 100644
    index 0000000..d4d4be5
    --- /dev/null
    +++ b/src/game/MapUpdater.h
    @@ -0,0 +1,46 @@
    +#ifndef _MAP_UPDATER_H_INCLUDED
    +#define _MAP_UPDATER_H_INCLUDED
    +
    +
    +#include <ace/Thread_Mutex.h>
    +#include <ace/Condition_Thread_Mutex.h>
    +
    +#include "DelayExecutor.h"
    +
    +class Map;
    +
    +class MapUpdater
    +{
    +public:
    +  MapUpdater ();
    +  virtual ~MapUpdater ();
    +
    +  friend class MapUpdateRequest;
    +
    +  /// schedule update on a map, the update will start
    +  /// as soon as possible ,
    +  /// it may even start before the call returns
    +  int schedule_update(Map& map, ACE_UINT32 diff);
    +
    +  /// Wait untill all pending updates finish
    +  int wait ();
    +
    +  /// Start the worker threads
    +  int activate (size_t num_threads);
    +
    +  /// Stop the worker threads
    +  int deactivate (void);
    +
    +  bool activated ();
    +
    +private:
    +  /// hook called by worker threads
    +  void update_finished ();
    +
    +  DelayExecutor m_executor;
    +  ACE_Condition_Thread_Mutex m_condition;
    +  ACE_Thread_Mutex m_mutex;
    +  size_t pedning_requests;
    +};
    +
    +#endif //_MAP_UPDATER_H_INCLUDED
    diff --git a/src/shared/DelayExecutor.cpp b/src/shared/DelayExecutor.cpp
    new file mode 100644
    index 0000000..d567ceb
    --- /dev/null
    +++ b/src/shared/DelayExecutor.cpp
    @@ -0,0 +1,130 @@
    +#include <ace/Singleton.h>
    +#include <ace/Thread_Mutex.h>
    +
    +#include "DelayExecutor.h"
    +
    +#include <ace/Log_Msg.h>
    +
    +DelayExecutor*
    +DelayExecutor::instance ()
    +{
    +  return ACE_Singleton<DelayExecutor, ACE_Thread_Mutex>::instance ();
    +}
    +
    +DelayExecutor::DelayExecutor () :
    +activated_ (false),
    +pre_svc_hook_ (0),
    +post_svc_hook_ (0) { }
    +
    +DelayExecutor::~DelayExecutor ()
    +{
    +  if (pre_svc_hook_)
    +    delete pre_svc_hook_;
    +
    +  if (post_svc_hook_)
    +    delete post_svc_hook_;
    +
    +  this->deactivate ();
    +
    +  //todo probably free the queue ??
    +}
    +
    +int
    +DelayExecutor::Deactivate ()
    +{
    +  if (!this->activated ())
    +    return -1;
    +
    +  this->activated (false);
    +
    +  this->queue_.queue ()->deactivate ();
    +
    +  this->wait ();
    +
    +  return 0;
    +}
    +
    +int
    +DelayExecutor::svc (void)
    +{
    +  if (pre_svc_hook_)
    +    pre_svc_hook_->call ();
    +
    +  for (;
    +    {
    +      ACE_Method_Request* rq = this->queue_.dequeue ();
    +
    +      if (!rq)
    +        break;
    +
    +      rq->call ();
    +
    +      delete rq;
    +    }
    +
    +  if (post_svc_hook_)
    +    post_svc_hook_->call ();
    +
    +  return 0;
    +}
    +
    +int
    +DelayExecutor::activate (int num_threads,
    +                         ACE_Method_Request* pre_svc_hook,
    +                         ACE_Method_Request* post_svc_hook)
    +{
    +  if (this->activated ())
    +    return -1;
    +
    +  if (num_threads < 1)
    +    return -1;
    +
    +  if (pre_svc_hook_)
    +    delete pre_svc_hook_;
    +
    +  if (post_svc_hook_)
    +    delete post_svc_hook_;
    +
    +  this->pre_svc_hook_ = pre_svc_hook;
    +  this->post_svc_hook_ = post_svc_hook;
    +
    +  this->queue_.queue ()->activate ();
    +
    +  if( ACE_Task_Base::activate (THR_NEW_LWP | THR_JOINABLE | THR_INHERIT_SCHED,
    +                                  num_threads) == -1)
    +    return -1;
    +
    +  this->activated(true);
    +
    +  return true;
    +}
    +
    +int
    +DelayExecutor::execute (ACE_Method_Request* new_req)
    +{
    +  if(new_req == NULL)
    +    return -1;
    +
    +  if(this->queue_.enqueue (new_req,
    +                           (ACE_Time_Value*)&ACE_Time_Value::zero) == -1)
    +    {
    +      delete new_req;
    +      ACE_ERROR_RETURN ((LM_ERROR,
    +                         ACE_TEXT ("(%t) %p\\n"),
    +                         ACE_TEXT ("DelayExecutor::execute enqueue")),
    +                        -1);
    +    }
    +  return 0;
    +}
    +
    +bool
    +DelayExecutor::activated ()
    +{
    +  return this->activated_;
    +}
    +
    +void
    +DelayExecutor::activated (bool s)
    +{
    +  this->activated_ = s;
    +}
    diff --git a/src/shared/DelayExecutor.h b/src/shared/DelayExecutor.h
    new file mode 100644
    index 0000000..18c6a1b
    --- /dev/null
    +++ b/src/shared/DelayExecutor.h
    @@ -0,0 +1,39 @@
    +#ifndef _M_DELAY_EXECUTOR_H
    +#define    _M_DELAY_EXECUTOR_H
    +
    +#include <ace/Task.h>
    +#include <ace/Activation_Queue.h>
    +#include <ace/Method_Request.h>
    +
    +class DelayExecutor : protected ACE_Task_Base
    +{
    +public:
    +  DelayExecutor ();
    +  virtual ~DelayExecutor ();
    +
    +  static DelayExecutor* instance ();
    +
    +  /// example
    +  /// DelayExecutor::instance ()->execute(new MyRequest(myarg));
    +  /// returns -1 on failures
    +  int execute (ACE_Method_Request* new_req);
    +
    +  int activate (int num_threads = 1,
    +                ACE_Method_Request* pre_svc_hook = 0,
    +                ACE_Method_Request* post_svc_hook = 0);
    +
    +  int deactivate ();
    +
    +  bool activated ();
    +
    +  virtual int svc (void);
    +private:
    +  ACE_Activation_Queue queue_;
    +  ACE_Method_Request* pre_svc_hook_;
    +  ACE_Method_Request* post_svc_hook_;
    +
    +  void activated (bool s);
    +  bool activated_;
    +};
    +
    +#endif // _M_DELAY_EXECUTOR_H
    

  2. Can you update with the vehicle patch because there are a conflict with TARGET_AREAEFFECT_CUSTOM_2.

    In vehicle patch TARGET_AREAEFFECT_CUSTOM_2 is similar that TARGET_AREAEFFECT_CUSTOM.

    With the Strand of the Ancients patch provided by Rage Hunter i have a crash when i destroyed a gate with a vehicle.

    Mathman, i don't have the patch for Strand of the Ancients, so i can't try by self if Destructible Buildings patch is still stable with this battleground....

    please link me SoTA patch, and i will make a test :)

  3. Ok there is the final release of Destructible Buildings, tested and seems to works fine and stable.

    http://paste2.org/p/841160

    Also fixed gameobject crash encountered in lastest Destructible Buildings revision.

    Please test and give ur feedbacks thanks :)

    EDIT : This patch works but is still unstable when we are in range of gameobjects with quests, atm i don't know how to fix this problem, if someone know how to fix this, post it :)

  4.     class GameObjectInRangeCheck
       {
       public:
           GameObjectInRangeCheck(float _x, float _y, float _z, float _range) : x(_x), y(_y), z(_z), range(_range) {}
           bool operator() (GameObject* go)
           {
               return go->IsInRange(x, y, z, range);
           }
       private:
           float x, y, z, range;
       };

    this function cause the crash....we need to do more research on it, server crash when you are in range of some normal gameobjects

  5. Ok all done and works great :D

    diff --git a/src/game/GameObject.cpp b/src/game/GameObject.cpp
    index a03e866..ef7543c 100644
    --- a/src/game/GameObject.cpp
    +++ b/src/game/GameObject.cpp
    @@ -147,7 +147,10 @@ bool GameObject::Create(uint32 guidlow, uint32 name_id, Map *map, uint32 phaseMa
        SetGoAnimProgress(animprogress);
    
        if(goinfo->type == GAMEOBJECT_TYPE_DESTRUCTIBLE_BUILDING)
    -        m_health = goinfo->destructibleBuilding.damagedHealth;
    +    {
    +        m_health = goinfo->destructibleBuilding.damagedHealth + goinfo->destructibleBuilding.damagedDisplayId;
    +        SetGoAnimProgress(255);
    +    }
    
        //Notify the map's instance data.
        //Only works if you create the object in it, not if it is moves to that map.
    @@ -208,7 +211,7 @@ void GameObject::Update(uint32 /*p_time*/)
                                udata.BuildPacket(&packet);
                                ((Player*)caster)->GetSession()->SendPacket(&packet);
    
    -                            SendGameObjectCustomAnim(GetGUID());
    +                            SendGameObjectCustomAnim(GetGUID(), GetGoAnimProgress());
                            }
    
                            m_lootState = GO_READY;                 // can be successfully open with some chance
    @@ -1075,7 +1078,7 @@ void GameObject::Use(Unit* user)
    
                // this appear to be ok, however others exist in addition to this that should have custom (ex: 190510, 188692, 187389)
                if (time_to_restore && info->goober.customAnim)
    -                SendGameObjectCustomAnim(GetGUID());
    +                SendGameObjectCustomAnim(GetGUID(), GetGoAnimProgress());
                else
                    SetGoState(GO_STATE_ACTIVE);
    
    @@ -1462,6 +1465,8 @@ void GameObject::TakenDamage(uint32 damage, Unit* pKiller)
            else
                m_health = 0;
        }
    +
    +    SetGoAnimProgress(m_health*255/(m_goInfo->destructibleBuilding.damagedHealth + m_goInfo->destructibleBuilding.destroyedHealth));
    }
    
    void GameObject::Rebuild(Unit* pKiller)
    diff --git a/src/game/Object.cpp b/src/game/Object.cpp
    index 55cc856..07ba552 100644
    --- a/src/game/Object.cpp
    +++ b/src/game/Object.cpp
    @@ -1618,11 +1618,11 @@ void WorldObject::SendObjectDeSpawnAnim(uint64 guid)
        SendMessageToSet(&data, true);
    }
    
    -void WorldObject::SendGameObjectCustomAnim(uint64 guid)
    +void WorldObject::SendGameObjectCustomAnim(uint64 guid, uint8 animprogress)
    {
        WorldPacket data(SMSG_GAMEOBJECT_CUSTOM_ANIM, 8+4);
        data << uint64(guid);
    -    data << uint32(0);                                      // not known what this is
    +    data << uint32(animprogress);
        SendMessageToSet(&data, true);
    }
    
    diff --git a/src/game/Object.h b/src/game/Object.h
    index 074fc94..527bec5 100644
    --- a/src/game/Object.h
    +++ b/src/game/Object.h
    @@ -447,7 +447,7 @@ class MANGOS_DLL_SPEC WorldObject : public Object
            void PlayDirectSound(uint32 sound_id, Player* target = NULL);
    
            void SendObjectDeSpawnAnim(uint64 guid);
    -        void SendGameObjectCustomAnim(uint64 guid);
    +        void SendGameObjectCustomAnim(uint64 guid, uint8 animprogress);
    
            virtual bool IsHostileTo(Unit const* unit) const =0;
            virtual bool IsFriendlyTo(Unit const* unit) const =0;

    That's the last update enjoy it and thanks to all :)

    EDIT : typo fix, thanks to Spp_

  6. I'm trying with this

    diff --git a/src/game/GameObject.cpp b/src/game/GameObject.cpp
    index a03e866..4905f3f 100644
    --- a/src/game/GameObject.cpp
    +++ b/src/game/GameObject.cpp
    @@ -208,7 +208,7 @@ void GameObject::Update(uint32 /*p_time*/)
                                udata.BuildPacket(&packet);
                                ((Player*)caster)->GetSession()->SendPacket(&packet);
    
    -                            SendGameObjectCustomAnim(GetGUID());
    +                            SendGameObjectCustomAnim(GetGUID(), GetGoAnimProgress());
                            }
    
                            m_lootState = GO_READY;                 // can be successfully open with some chance
    @@ -1075,7 +1075,7 @@ void GameObject::Use(Unit* user)
    
                // this appear to be ok, however others exist in addition to this that should have custom (ex: 190510, 188692, 187389)
                if (time_to_restore && info->goober.customAnim)
    -                SendGameObjectCustomAnim(GetGUID());
    +                SendGameObjectCustomAnim(GetGUID(), GetGoAnimProgress());
                else
                    SetGoState(GO_STATE_ACTIVE);
    
    diff --git a/src/game/Object.cpp b/src/game/Object.cpp
    index 55cc856..b995cab 100644
    --- a/src/game/Object.cpp
    +++ b/src/game/Object.cpp
    @@ -1618,11 +1618,11 @@ void WorldObject::SendObjectDeSpawnAnim(uint64 guid)
        SendMessageToSet(&data, true);
    }
    
    -void WorldObject::SendGameObjectCustomAnim(uint64 guid)
    +void WorldObject::SendGameObjectCustomAnim(uint64 guid, uint8 animprogress)
    {
        WorldPacket data(SMSG_GAMEOBJECT_CUSTOM_ANIM, 8+4);
        data << uint64(guid);
    -    data << uint32(0);                                      // not known what this is
    +    data << uint8(animprogress);
        SendMessageToSet(&data, true);
    }
    
    diff --git a/src/game/Object.h b/src/game/Object.h
    index 074fc94..527bec5 100644
    --- a/src/game/Object.h
    +++ b/src/game/Object.h
    @@ -447,7 +447,7 @@ class MANGOS_DLL_SPEC WorldObject : public Object
            void PlayDirectSound(uint32 sound_id, Player* target = NULL);
    
            void SendObjectDeSpawnAnim(uint64 guid);
    -        void SendGameObjectCustomAnim(uint64 guid);
    +        void SendGameObjectCustomAnim(uint64 guid, uint8 animprogress);
    
            virtual bool IsHostileTo(Unit const* unit) const =0;
            virtual bool IsFriendlyTo(Unit const* unit) const =0;

    but still can't see healthbar, what's wrong?

    EDIT : Sorry, my bad... i see correctly the health bar in upper right under the gobject name, but gobject when take dmg is still at 100% of hp...

  7. IMO all code related to ZoneScript should be removed:

    - That is not Destructible Object dependant (ie: adding 2 functionalities in one patch).

    - Adding stuff from trinity AS IS is without removing the unused data (ZoneScript only using 1 function)

    - Why Rebuild event depends on the killer? those events are supposed to be notified always, not depending on the player.

    Note: Remember to give credits to the original authors.

    Ok i've cleaned up last patch, and updated with Spp_ suggested modifies...

    ZoneScript.h and it's references was been removed (useless)

    http://paste2.org/p/840330

    I noticed that now vehicles deal damage to buildings correctly, tested on "Wintergrasp Fortress Wall" in wintergrasp, but building is still whole... what missing?

    Ofc credits to everyone who have worked on this function, and credits to trinity too for some parts :D

  8. Where is "ZoneScript.h"? Does it exists? The core doesn't compile with this patch because of that #include :/

    Also, it give me this error:

    yep sorry for missing ZoneScript.h... :P it's the same of trinity

    #ifndef ZONE_SCRIPT_H_
    #define ZONE_SCRIPT_H_
    
    #include "Common.h"
    #include "Creature.h"
    
    //struct CreatureData;
    class Creature;
    class GameObject;
    
    class ZoneScript
    {
       public:
           explicit ZoneScript() {}
    
           virtual uint32 GetCreatureEntry(uint32 /*guidlow*/, const CreatureData *data) { return data->id; }
           virtual uint32 GetGameObjectEntry(uint32 /*guidlow*/, uint32 entry) { return entry; }
    
           virtual void OnCreatureCreate(Creature *, bool /*add*/) {}
           virtual void OnGameObjectCreate(GameObject * /*go*/, bool /*add*/) {}
    
           //All-purpose data storage 64 bit
           virtual uint64 GetData64(uint32 /*DataId*/) { return 0; }
           virtual void SetData64(uint32 /*DataId*/, uint64 /*Value*/) {}
    
           //All-purpose data storage 32 bit
           virtual uint32 GetData(uint32 /*DataId*/) { return 0; }
           virtual void SetData(uint32 /*DataId*/, uint32 /*Value*/) {}
    
           virtual void ProcessEvent(GameObject * /*obj*/, uint32 /*eventId*/) {}
    };
    
    #endif

    if there are changes for DB, can someone make a patch?if someone can update the patch with newest modifies i think will be better :)

    Thanks

  9. Hi all,

    I've noticed that there are some problems in spell_bonus_data table, i maked some tests with spell Devouring Plague http://www.wowhead.com/?spell=2944

    This spell have a dot that provide to damage the target and so heal the caster for 15% of damage dealt... now if we try to forcing damage from spell_bonus_data in dot_bonus, the spell damage work fine, but not correctly, because this also gives bonus to heal, so casters can receive an high amount of healing instead of only 15% of damage dealt.

    So i was thinking that this problem can be fixed adding a new one column to spell_bonus_data, like "hot_bonus", in this way hot and dot can work clean and separately and spells like Devouring Plague can finally works perfectly :)

    Any suggestions?

    Thanks

    John

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. Privacy Policy Terms of Use