Anti
-
Posts
81 -
Joined
-
Last visited
Never -
Donations
0.00 GBP
Content Type
Profiles
Bug Tracker
Wiki
Release Notes
Forums
Downloads
Blogs
Events
Posts posted by Anti
-
-
I have remastered the regen system for vehicles. And now there are works a vehicles like Salvaged Chopper.
Added new data for vahicle_* tables. Thanks to gen1us2k
There was posted only base part of my fix.
diff --git a/src/game/Vehicle.cpp b/src/game/Vehicle.cpp index 04c7e99..24d6da9 100644 --- a/src/game/Vehicle.cpp +++ b/src/game/Vehicle.cpp @@ -81,14 +81,14 @@ void Vehicle::Update(uint32 diff) if(m_regenTimer <= diff) { - Regenerate(getPowerType()); + RegeneratePower(getPowerType()); m_regenTimer = 4000; } else m_regenTimer -= diff; } -void Vehicle::Regenerate(Powers power) +void Vehicle::RegeneratePower(Powers power) { uint32 curValue = GetPower(power); uint32 maxValue = GetMaxPower(power); @@ -98,11 +98,12 @@ void Vehicle::Regenerate(Powers power) float addvalue = 0.0f; - if(m_vehicleInfo->m_powerType == POWER_STEAM) - addvalue = 20.0; - else - if(m_vehicleInfo->m_powerType == POWER_PYRITE) - return; + // hack: needs more research of power type from the dbc. + // It must contains some info about vehicles like Salvaged Chopper. + if(m_vehicleInfo->m_powerType == POWER_TYPE_PYRITE) + return; + + addvalue = 20.0f; ModifyPower(power, (int32)addvalue); } @@ -149,43 +150,42 @@ bool Vehicle::Create(uint32 guidlow, Map *map, uint32 phaseMask, uint32 Entry, u { ((InstanceMap*)map)->GetInstanceData()->OnCreatureCreate(this); } - if(Creature *cre = dynamic_cast<Creature*>(this)) + + if(m_vehicleInfo->m_powerType == POWER_TYPE_STEAM) { - if(m_vehicleInfo->m_powerType == POWER_STEAM) - { - this->setPowerType(POWER_ENERGY); - this->SetMaxPower(POWER_ENERGY, 100); - this->SetPower(POWER_ENERGY, 100); - } - else if(m_vehicleInfo->m_powerType == POWER_PYRITE) - { - this->setPowerType(POWER_ENERGY); - this->SetMaxPower(POWER_ENERGY, 50); - this->SetPower(POWER_ENERGY, 50); - } - else + setPowerType(POWER_ENERGY); + SetMaxPower(POWER_ENERGY, 100); + SetPower(POWER_ENERGY, 100); + } + else if(m_vehicleInfo->m_powerType == POWER_TYPE_PYRITE) + { + setPowerType(POWER_ENERGY); + SetMaxPower(POWER_ENERGY, 50); + SetPower(POWER_ENERGY, 50); + } + else + { + for (uint32 i = 0; i < MAX_VEHICLE_SPELLS; ++i) { - for (uint32 i = 0; i < MAX_VEHICLE_SPELLS; ++i) - { - if(!cre->m_spells[i]) - continue; - SpellEntry const *spellInfo = sSpellStore.LookupEntry(cre->m_spells[i]); - if(!spellInfo) - continue; + if(!GetVehicleData()->v_spells[i]) + continue; + SpellEntry const *spellInfo = sSpellStore.LookupEntry(GetVehicleData()->v_spells[i]); + if(!spellInfo) + continue; - if(spellInfo->powerType == POWER_MANA) - break; + if(spellInfo->powerType == POWER_MANA) + break; - if(spellInfo->powerType == POWER_ENERGY) - { - this->setPowerType(POWER_ENERGY); - this->SetMaxPower(POWER_ENERGY, 100); - this->SetPower(POWER_ENERGY, 100); - break; - } + if(spellInfo->powerType == POWER_ENERGY) + { + setPowerType(POWER_ENERGY); + SetMaxPower(POWER_ENERGY, 100); + SetPower(POWER_ENERGY, 100); + break; } } } + InstallAllAccessories(); return true; diff --git a/src/game/Vehicle.h b/src/game/Vehicle.h index 7c17edc..b164172 100644 --- a/src/game/Vehicle.h +++ b/src/game/Vehicle.h @@ -43,8 +43,8 @@ enum VehicleSeatFlags enum PowerType { - POWER_STEAM = 61, - POWER_PYRITE = 41, + POWER_TYPE_PYRITE = 41, + POWER_TYPE_STEAM = 61 }; #define MAX_SEAT 8 @@ -66,7 +66,7 @@ class Vehicle : public Creature void setDeathState(DeathState s); // overwrite virtual Creature::setDeathState and Unit::setDeathState void Update(uint32 diff); // overwrite virtual Creature::Update and Unit::Update - void Regenerate(Powers power); + void RegeneratePower(Powers power); uint32 GetVehicleId() { return m_vehicleId; } bool SetVehicleId(uint32 vehicleid);
PS to Wojta. When you'll apply the patch add my "signed-off".
Signed-off-by: AntiDiavol <[email protected]> -
I could be totally off base but it looks like when the function changes abruptly from eather a user command or system command it puts out this error due to the data not getting processed in time and there is some data that is and or will be lost because of it. :eek:
I think that from the packets obtains not only seatId, but something else. Or... This is crazy idea, but...
May be we have to defined seatID as uint32...
-
Looks good. The only problem is:
+ uint32 tmp_gmlevel = 0; + + switch(m_session->GetSecurity()) // Maybe check this later with the direct GMLevelID from Account table + { + case SEC_PLAYER: + tmp_gmlevel = 0; + break; + case SEC_MODERATOR: + tmp_gmlevel = 1; + break; + case SEC_GAMEMASTER: + tmp_gmlevel = 2; + break; + case SEC_ADMINISTRATOR: + tmp_gmlevel = 3; + break; + default: + return false; + } + + uint32 a_gmlevel = tmp_gmlevel; // GM-SecurityLevel from GetSecurity(), maybe pull that directly from AccountData for better Custom Settings
Like they said, can be reduced to just:
+ uint32 a_gmlevel = m_session->GetSecurity();
Does exactly the same thing. If that doesn't work (I haven't tried it) try:
+ uint32 a_gmlevel = ((uint32)m_session->GetSecurity());
It works for int variables. But there are types of variables defined in special way and we have to use static_cast or something else.
I had use static_cast because it'll work as I want it.
-
Small code style fix.
+ uint32 ItemID = fields[5].GetUInt32(); + uint32 ItemCount = fields[6].GetUInt32(); + + if(Player *receiver = sObjectMgr.GetPlayer( receiver_guid )) + { + sLog.outString("EXTERNAL MAIL> Sending mail to %u, Item:%u", receiver_guid, ItemID); +
-
Look at Spell::EffectCharge. There are uses 3.(6) instead of 5.
-
We need smbd to implement all vehicle's spell. I don't know how it can be done.
-
Anti, over the last 2 days I keep getting this error on compile and don't know how to fix maybe you do,
Creating library .\\mangosd__Win32_Release\\mangosd.lib and object .\\mangosd__Win32_Release\\mangosd.exp
game.lib(SpellEffects.obj) : error LNK2019: unresolved external symbol "public: void __thiscall GameObject::DealSiegeDamage(unsigned int)" (?DealSiegeDamage@GameObject@@QAEXI@Z) referenced in function "public: void __thiscall Spell::EffectDamageBuilding(unsigned int)" (?EffectDamageBuilding@Spell@@QAEXI@Z)
..\\..\\bin\\Win32_Release\\mangosd.exe : fatal error LNK1120: 1 unresolved externals
Build log was saved at "file://c:\\MangosSRC\\win\\VC90\\mangosd__Win32_Release\\BuildLog.htm"
mangosd - 2 error(s), 0 warning(s)
------ Build started: Project: script, Configuration: Release Win32 ------
Compiling...
sc_default.cpp
system.cpp
ScriptMgr.cpp
Generating Code...
Linking...
Creating library .\\script__Win32_Release/mangosscript.lib and object .\\script__Win32_Release/mangosscript.exp
Embedding manifest...
Build log was saved at "file://c:\\MangosSRC\\win\\VC90\\script__Win32_Release\\BuildLog.htm"
script - 0 error(s), 0 warning(s)
========== Build: 12 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
Thank you for the news in advance
oh... Read 1st part of my prev post. I has already written fix.
-
I have problems to compile the emulator after applying the command:
git pull git: //github.com/Tasssadar/Valhalla-roject.git vehicle
my mangos rev. 8993 sql
Error:
"12> Creating library .\\mangosd__Win32_Release\\mangosd.lib and object .\\mangosd__Win32_Release\\mangosd.exp
12>game.lib(SpellEffects.obj) : error LNK2019: unresolved external symbol "public: void __thiscall GameObject::DealSiegeDamage(unsigned int)" (?DealSiegeDamage@GameObject@@QAEXI@Z) referenced in function "public: void __thiscall Spell::EffectDamageBuilding(unsigned int)" (?EffectDamageBuilding@Spell@@QAEXI@Z)
12>..\\..\\bin\\Win32_Release\\mangosd.exe : fatal error LNK1120: 1 unresolved externals"
The function has missed.
diff --git a/src/game/GameObject.cpp b/src/game/GameObject.cpp index eada9cb..dc5402e 100644 --- a/src/game/GameObject.cpp +++ b/src/game/GameObject.cpp @@ -1332,3 +1332,15 @@ void GameObject::UpdateRotationFields(float rotation2 /*=0.0f*/, float rotation3 SetFloatValue(GAMEOBJECT_PARENTROTATION+2, rotation2); SetFloatValue(GAMEOBJECT_PARENTROTATION+3, rotation3); } + +void GameObject::DealSiegeDamage(uint32 damage) +{ + m_actualHealth -= damage; + + // TODO : there are a lot of thinghts to do here + if(m_actualHealth < 0) + { + m_actualHealth = GetGOInfo()->destructibleBuilding.intactNumHits; + SetLootState(GO_JUST_DEACTIVATED); + } +} \\ No newline at end of file
added
I'd implemented regen system for vehicles.
There is patch for the Wojta's vehicles branch.
diff --git a/src/game/Vehicle.cpp b/src/game/Vehicle.cpp index d3fa42a..04c7e99 100644 --- a/src/game/Vehicle.cpp +++ b/src/game/Vehicle.cpp @@ -70,6 +70,7 @@ void Vehicle::Update(uint32 diff) { Creature::Update(diff); InstallAllAccessories(); + if(despawn) { m_spawnduration -= diff; @@ -77,6 +78,33 @@ void Vehicle::Update(uint32 diff) Dismiss(); despawn = false; } + + if(m_regenTimer <= diff) + { + Regenerate(getPowerType()); + m_regenTimer = 4000; + } + else + m_regenTimer -= diff; +} + +void Vehicle::Regenerate(Powers power) +{ + uint32 curValue = GetPower(power); + uint32 maxValue = GetMaxPower(power); + + if (curValue >= maxValue) + return; + + float addvalue = 0.0f; + + if(m_vehicleInfo->m_powerType == POWER_STEAM) + addvalue = 20.0; + else + if(m_vehicleInfo->m_powerType == POWER_PYRITE) + return; + + ModifyPower(power, (int32)addvalue); } bool Vehicle::Create(uint32 guidlow, Map *map, uint32 phaseMask, uint32 Entry, uint32 vehicleId, uint32 team, const CreatureData *data) @@ -127,14 +155,12 @@ bool Vehicle::Create(uint32 guidlow, Map *map, uint32 phaseMask, uint32 Entry, u { this->setPowerType(POWER_ENERGY); this->SetMaxPower(POWER_ENERGY, 100); - this->SetPower(POWER_ENERGY, 0); this->SetPower(POWER_ENERGY, 100); } else if(m_vehicleInfo->m_powerType == POWER_PYRITE) { this->setPowerType(POWER_ENERGY); this->SetMaxPower(POWER_ENERGY, 50); - this->SetPower(POWER_ENERGY, 0); this->SetPower(POWER_ENERGY, 50); } else @@ -154,7 +180,6 @@ bool Vehicle::Create(uint32 guidlow, Map *map, uint32 phaseMask, uint32 Entry, u { this->setPowerType(POWER_ENERGY); this->SetMaxPower(POWER_ENERGY, 100); - this->SetPower(POWER_ENERGY, 0); this->SetPower(POWER_ENERGY, 100); break; } diff --git a/src/game/Vehicle.h b/src/game/Vehicle.h index c2e883e..7c17edc 100644 --- a/src/game/Vehicle.h +++ b/src/game/Vehicle.h @@ -66,6 +66,8 @@ class Vehicle : public Creature void setDeathState(DeathState s); // overwrite virtual Creature::setDeathState and Unit::setDeathState void Update(uint32 diff); // overwrite virtual Creature::Update and Unit::Update + void Regenerate(Powers power); + uint32 GetVehicleId() { return m_vehicleId; } bool SetVehicleId(uint32 vehicleid);
Has the pyrite regen? Or it gets from some sources?
-
Thanks to x.e.x but your fix is hack.
But thanks to it i had found bug in the vehicle system. There is no a power regen system.
I'm work on it now.
-
Ok! i like the patch! but where is the sql?
damn. Forgot about it.
ALTER TABLE game_tele ADD COLUMN `gmlevel` tinyint(3) unsigned NOT NULL DEFAULT '0' AFTER `name`;
-
Perfect would be a normal Loglevel 1 log and a "limited "loglevel 3 log.
Damn, there was an offtop.
-
Works patch. Based on the Licked's patch but i have rewrited many things and it looks fine now.
And sql.
ALTER TABLE game_tele ADD COLUMN `gmlevel` tinyint(3) unsigned NOT NULL DEFAULT '0' AFTER `name`;
-
There was an offtop.
sry.
-
anti sry for asking but you have a patch/git?
I'll post a patch file when it'll be good to work. Now it just couple of ideas which has been expressed in the code.
Important fix to my prev post.
@@ -98,11 +98,11 @@ const char TalentEntryfmt[]="niiiiiiiixxxxixxixxxxxx"; const char TalentTabEntryfmt[]="nxxxxxxxxxxxxxxxxxxxiiix"; const char TaxiNodesEntryfmt[]="nifffssssssssssssssssxii"; const char TaxiPathEntryfmt[]="niii"; const char TaxiPathNodeEntryfmt[]="diiifffiixx"; const char TotemCategoryEntryfmt[]="nxxxxxxxxxxxxxxxxxii"; -const char VehicleEntryfmt[]="niffffiiiiiiiifffffffffffffffssssfifixxx"; +const char VehicleEntryfmt[]="niffffiiiiiiiifffffffffffffffssssfifiixx"; const char VehicleSeatEntryfmt[]="niiffffffffffiiiiiifffffffiiifffiiiiiiiffiiiiixxxxxxxxxxxx"; const char WorldMapAreaEntryfmt[]="xinxffffixx"; const char WorldMapOverlayEntryfmt[]="nxiiiixxxxxxxxxxx"; const char WorldSafeLocsEntryfmt[]="nifffxxxxxxxxxxxxxxxxx";
Another bug in the movement handler
-
U can seat on tanks but its works nemnogo koryavo
in Ulduar vehicles operate so.
you can ride on them
you can shoot
but they have not filled with energy
I have implemented the power but I don't know how send info about energy to the client. May be with a SMSG_* or some thing else...
The Commit from my local repo:
--------------------------- src/game/DBCStructure.h --------------------------- index 2e0ce90..a27acb4 100644 @@ -1663,7 +1663,7 @@ struct VehicleEntry uint32 m_uiLocomotionType; // 34 float m_msslTrgtImpactTexRadius; // 35 uint32 m_uiSeatIndicatorType; // 36 - // 37, new in 3.1 + uint32 m_powerType; // 37, new in 3.1 // 38, new in 3.1 // 39, new in 3.1 }; ----------------------------- src/game/ObjectMgr.h ----------------------------- index d21bdd6..6dba638 100644 @@ -342,7 +342,7 @@ MANGOS_DLL_SPEC LanguageDesc const* GetLanguageDescByID(uint32 lang); class PlayerDumpReader; // vehicle system -#define MAX_VEHICLE_SPELLS 10 +#define MAX_VEHICLE_SPELLS 6 struct VehicleDataStructure { ----------------------------- src/game/Vehicle.cpp ----------------------------- index f80d26b..39fff88 100644 @@ -120,9 +121,41 @@ bool Vehicle::Create(uint32 guidlow, Map *map, uint32 phaseMask, uint32 Entry, u { ((InstanceMap*)map)->GetInstanceData()->OnCreatureCreate(this); } + if(Creature *cre = dynamic_cast<Creature*>(this)) + { + if(m_vehicleInfo->m_powerType == POWER_STEAM) + { + this->setPowerType(POWER_ENERGY); + this->SetMaxPower(POWER_ENERGY, 100); + } + else if(m_vehicleInfo->m_powerType == POWER_PYRITE) + { + this->setPowerType(POWER_ENERGY); + this->SetMaxPower(POWER_ENERGY, 50); + } + else + { + for (uint32 i = 0; i < MAX_VEHICLE_SPELLS; ++i) + { + if(!cre->m_spells[i]) + continue; - InstallAllAccessories(); + SpellEntry const *spellInfo = sSpellStore.LookupEntry(cre->m_spells[i]); + if(!spellInfo) + continue; + if(spellInfo->powerType == POWER_MANA) + break; + + if(spellInfo->powerType == POWER_ENERGY) + { + this->setPowerType(POWER_ENERGY); + this->SetMaxPower(POWER_ENERGY, 100); + break; + } + } + } + } return true; } ------------------------------ src/game/Vehicle.h ------------------------------ index fadb9ea..dc81125 100644 @@ -41,6 +41,11 @@ enum VehicleSeatFlags SEAT_VEHICLE_FULL = 0x08 // seat occupied by vehicle and that vehicle is full too }; +enum PowerType +{ + POWER_STEAM = 61, + POWER_PYRITE = 41, +}; #define MAX_SEAT 8 typedef std::map<int8, VehicleSeat> SeatMap;
And about 2nd problem:
We need smbd to implement changing of seats between base vehicle and the accessories.
Added
Whence we receives the information for CustomVehicleFLags?
-
Wojta i don't know have you repaired loading of accessories but in update() must be InstallAllAccessories()
void Vehicle::Update(uint32 diff) { Creature::Update(diff); [b] InstallAllAccessories();[/b] if(despawn) { m_spawnduration -= diff; if(m_spawnduration < 0) Dismiss(); despawn = false; } }
-
Yes..but there are many Q in NR which uses vehicles, and there are pre-spawned here, for example: http://www.wowhead.com/?quest=12326#. or http://www.wowhead.com/?quest=12856#. and theres many more of them but maybe when you click on them, new vehicle spawns and the old one despawns(not die, despawn), so it does not look so horrible but if its not vehicle, you cant see accessories, and in ulduar there are many vehicles near flame levithian(they are flying, http://www.wowhead.com/?npc=33214). Script for spawns like that would be really big )
ArtUrlWWW: never, because I using this GIT for my server
Qs can be realized by using quest_start_script table or by another ways.
-
i have a error...
error: no changes?
wat?
ty guys
I don't understand what you want to say... Use a translater or somthing else...
Wojta there is no way to spawn a vehicle instead a creature. And I has come to a conclusion that is right and blizzlike.
In the wintergrasp and the ulduar a vehicles must be spawned by a script.
I think there is no problem as we thought earlier.
-
The wintergrasp and the ulduar need to be scripted before it will work.
All what we can implement now is the silver tournament. I think it possible.
-
but... I understood one thing.
I got a clean source... Then
git pull git://github.com/Tasssadar/Valhalla-Project.git vehicle
then
patch -p1 -l <dua.patch
now compiling... then testing...
and I notices 3-4 SQL errors,,,
but a made vehicle.pacth as diff master vehicle....
Well ... see how It Will work
sorry for my bad English
when you pulled the sources you obtained all updates.
If the dua.patch is dual spec, you done ererything right.
If you show the errors i'll help to fix it.
-
-
Ill test it tommorow because I'm so tired now.
-
It is better to use the new table than to change the old, which can vary in the future.
We can drop useless columns in any time.
Where you will place the new data? It will not be simple to make a copy well. We have to use data which exists in a dbase.
-
I have the qustions for a devs or a knowledge peolpes.
How to make strongly connection between spawn and npc? I'd try to implement it by including the new condition in respawn()
if (isVehicle() && isAlive()) return;
in respawn() but it failed.
Oh god, a minute passed After I posted my question and I obtained the answer.
When we click on a vehicle it constructing a new one. And we obtain the vehicle.
But spawn became free. And it call to respawn.
I wish to connect a vehicle and it's spawn.
May be we can overwrite isAlive func for the vehicle's class or do smth else in this way.
[Help] Implementing Vehicles
in OldCore modifications
Posted
There are all updates which was posted by gen1us2k. I just applyed it in the commit.
I want vehicle class work with dbc data but I can't implement it now.