Commit Graph

350 Commits

Author SHA1 Message Date
jackpoz
1c0903e286 Core/Misc: Fix some static analysis issues
Fix some static analysis issues about uninitialized values. Most of them are false positives, always initialized before being accessed, while some of them are real issues spotted by valgrind too.
2013-12-14 18:41:26 +01:00
Vincent_Michael
6e13263c7a Core/AI: Good bye, Good bye my beloved EventAI system :( 2013-12-01 01:27:08 +01:00
jackpoz
ff20596933 Core/World: Remove unused code
Remove unused code added in f20b25d1c9
2013-11-29 22:37:31 +01:00
Spp
94e2b9332a Core/Logging: Remove LOG_FILTER_XXX defines with it's value (remember logger names are case-sensitive) 2013-11-08 10:50:51 +01:00
Ascathor
2607738990 Core/Code: Unify codestyle for brackets: {} to { }.
Also added missing copyright to some files.
2013-10-27 23:46:02 +01:00
Shauren
ce55647c41 Core/Transports
* Rewritten path generation, now uses splines - timers are a lot more accurate now
* Implemented stopping transports
* Implemented spawning transports in instances
* Implemented spawning gameobjects as transport passengers
* Transport passengers are now stored in creature/gameobject table using gameobject_template.data6 from transport's template as map id
2013-10-16 18:37:29 +02:00
Spp
cfaea769bc Core/RBAC: Move RBAC code to namespace rbac 2013-09-27 13:35:45 +02:00
Aokromes
783e28e874 Core/Groups: Allow to configure the way in which instance reset message is sent, to the whole party (not blizzlike) or not.
Signed-off-by: Machiavelli <machiavelli.trinity@gmail.com>
2013-09-12 10:19:05 +01:00
Nay
baa159dbd4 Merge pull request #10736 from jackpoz/localtime_race_condition
Core/Thread: Fix race condition converting time values to local time
2013-09-11 11:50:18 -07:00
jackpoz
9578b5f87a Core/Thread: Fix race condition converting time values to local time
Replace thread-unsafe localtime() http://www.cplusplus.com/reference/ctime/localtime/ with thread-safe portable ACE_OS::localtime_r() .

Helgrind log:
 Possible data race during read of size 4 at 0x6F183C0 by thread #1
 Locks held: none
  at 0x14E72E3: World::InitDailyQuestResetTime() (World.cpp:2772)
  by 0x14E3A01: World::SetInitialWorldSettings() (World.cpp:1790)
  by 0x101122A: Master::Run() (Master.cpp:164)
  by 0x101740C: main (Main.cpp:142)

 This conflicts with a previous write of size 4 by thread #2
 Locks held: none
  at 0x6C2D3BA: __tzfile_compute (tzfile.c:797)
  by 0x6C2D036: __tz_convert (tzset.c:627)
  by 0x164146C: LogMessage::getTimeStr(long) (Appender.cpp:23)
  by 0x1641550: LogMessage::getTimeStr() (Appender.cpp:31)
  by 0x1641722: Appender::write(LogMessage&) (Appender.cpp:80)
  by 0x1633FCE: Logger::write(LogMessage&) (Logger.cpp:83)
  by 0x16433D8: LogOperation::call() (LogOperation.cpp:29)
  by 0x16428A4: LogWorker::svc() (LogWorker.cpp:45)
2013-09-07 14:37:54 +02:00
Aokromes
80516db48c Core/Battlegrounds: Allow random BG winner/loser rewards to be configurable
Signed-off-by: Machiavelli <machiavelli.trinity@gmail.com>
2013-09-07 13:32:04 +01:00
Ascathor
722a6c143a Core/Account: Make account password change security variable and various changes
Settings within worldserver.conf:

Three settings for secruity level:
0 - None - No change to current system
1 - Email - Always requires the email entered on registration for confirming.
2 - RBAC - Groups applied with the RBAC role always require the email entered on registration for confirming.

RBAC default to every group. Changed some logs to make it more clear what is going on at all.

Emails may now no longer exceed 64 chars. Current email is used as regmail.

On account creation, two emails are saved. Registration email and normal email. Normal email is relevant afterwards. Registration email can be changed by console ONLY.

Includes new commands and changes to existing ones:
.account fulfills several new functions:
* Still prints GM Level.
* If account has permission, it displays the current email. This is not defaulted to any group.
* Security level is displayed. Also displays if user has RBAC perm if RBAC security mode is selected
.account email allows user to change email with sufficient confirmation
.account set sec email allows higher sec with higher sec than account to change the normal email. Registrationemail remains untouched here.
.account set sec regmail allows console to change registration email.
.pinfo now displays the registration and normal mail.

Also fixes .learn all crafts.
Closes #10558
2013-09-01 21:21:16 +02:00
jackpoz
e1e1067d17 Core/Thread: Fix race condition in FreezeDetectorRunnable
Fix race condition by replacing a static volatile uint32 with proper atomic thread-safe ACE_Atomic_Op<ACE_Thread_Mutex, uint32>, incremented in WorldRunnable::run() at each world loop and read in FreezeDetectorRunnable::run().

Helgrind log:
 Possible data race during read of size 4 at 0x2400D54 by thread #12
 Locks held: none
    at 0x100FEA6: FreezeDetectorRunnable::run() (Master.cpp:106)
    by 0x1637892: ACE_Based::Thread::ThreadTask(void*) (Threading.cpp:186)
    by 0x518F555: ACE_OS_Thread_Adapter::invoke() (OS_Thread_Adapter.cpp:103)
    by 0x4C2B5AD: mythread_wrapper (hg_intercepts.c:219)
    by 0x61DAB4F: start_thread (pthread_create.c:304)
    by 0x6C69A7C: clone (clone.S:112)

 This conflicts with a previous write of size 4 by thread #9
 Locks held: none
    at 0x100C23E: WorldRunnable::run() (WorldRunnable.cpp:55)
    by 0x1637892: ACE_Based::Thread::ThreadTask(void*) (Threading.cpp:186)
    by 0x518F555: ACE_OS_Thread_Adapter::invoke() (OS_Thread_Adapter.cpp:103)
    by 0x4C2B5AD: mythread_wrapper (hg_intercepts.c:219)
    by 0x61DAB4F: start_thread (pthread_create.c:304)
    by 0x6C69A7C: clone (clone.S:112)
2013-09-01 18:49:49 +02:00
Machiavelli
9346695129 Core: Few fixes for previous commit. 2013-08-29 21:55:29 +01:00
Machiavelli
59b4c34924 Core/NetworkIO: Generic packet spam solution
Currently regulates the usage of CMSG_CHAR_ENUM only, but can be easily
extended to detect inappropriate network behaviour by using
AntiDOS.AllowOpcode in WorldSession's handlers.
2013-08-29 16:46:28 +01:00
Nay
58e6503eef Core/Settings: Fix build in non cpp11 compilers
std::string back() was only introduced in C++11, a pity..
2013-08-24 15:45:19 +01:00
Nay
cc3055f344 Core/Settings: Fix a crash if worldserver.conf DataDir setting is empty 2013-08-24 14:30:17 +01:00
Nay
a71fcee27d DB/Schema: Rename _questrelation tables to _queststarter and _involvedrelation to _questender, for creature and gameobject 2013-08-06 00:04:29 +01:00
joschiwald
00f3b01ea7 Core/Spells: operate spell correction on SpellInfo store instead of dbc (picked from 77b85b2ea0) 2013-07-24 00:06:21 +02:00
Shauren
779a59e7e2 Core/Config: Refactored ConfigMgr
* Loading initial configuration files is now separate from loading any additional custom configs
2013-07-15 17:31:44 +02:00
corbi
e185713464 Stats Limits 2013-06-05 10:34:05 +03:00
joschiwald
3e108f0680 DB/Autobroadcast: Update correct db struktur and auth base 2013-06-02 19:41:27 +02:00
Shauren
7da33b6bce Core/Misc: Another batch of fixes for issues found by static analysis 2013-05-19 11:15:54 +02:00
Spp
d1677b2db0 Core/Logging: Performance-related tweaks to logging system
All sLog->out* functions (except outCommand atm) are replaced with TC_LOG_* macros.
    Memleak fix
2013-05-13 15:07:36 +02:00
Ascathor
1c2d617c18 Core/Player: CharDelete.Heroic.MinLevel as seperated unlink requirement for Heroic classes
Also added documentation for GetCharacterNameData
2013-04-28 00:04:55 +02:00
xjose93
d7e9d1bafb Core/World: Improvements in Autobroadcast system (dropped from world database and moved to auth database, added realmid and weight columns) 2013-04-25 22:54:20 +02:00
Ascathor
100a632a62 Clearify the guild limitation message on world server initation (3.3.5a withdrawal cap; 4.3.4 withdrawal and guild rep cap) 2013-04-09 21:27:27 +02:00
Nefarion
49fd11ab5a First step of comment style refactoring to doxygen-style. 2013-03-08 21:55:37 +01:00
Spp
377cfdb560 Core/RBAC: Fix multiple permissions and remove multiple config options that are currently implementes by RBAC
- Remove config options: CONFIG_ALLOW_TWO_SIDE_INTERACTION_CHAT, CONFIG_ALLOW_TWO_SIDE_INTERACTION_MAIL, CONFIG_GM_LOG_TRADE, CONFIG_ALLOW_TWO_SIDE_ACCOUNTS, CONFIG_ALLOW_TWO_SIDE_WHO_LIST, CONFIG_ALLOW_GM_FRIEND, CONFIG_ALLOW_TWO_SIDE_ADD_FRIEND, CONFIG_SILENTLY_GM_JOIN_TO_CHANNEL
- Fix RBAC_PERM_SKIP_CHECK_CHAT_SPAM (Was checking spam for those that had the permission)
- Only check RBAC_PERM_TWO_SIDE_INTERACTION_CHAT for sender of whispers (Restores GM being able to whisper players)
- Only check RBAC_PERM_TWO_SIDE_INTERACTION_MAIL for sender
- Fix .ticket assign <Player>, with last RBAC change it was changed by mistake from Player to Account
2013-03-08 13:15:25 +01:00
Shauren
6be5bc71eb Core/GameObjects
* Removed long deprecated code for mining nodes (multiple uses, artifact of TBC)
* Made fishing pools generate use count only on spawn (and respawn) instead of randomizing use count on every fishing attempt - prevents early despawning in some cases
2013-03-02 23:59:42 +01:00
Spp
480c6cf4dd Core/RBAC: Add .reload rbac command and prevent possible crash if rbac_permissions has wrong data 2013-02-27 03:30:53 +01:00
Spp
54f7cc326f Core/RBAC: Create new permission 'Receive global GM messages/texts' 2013-02-25 15:48:18 +01:00
Nay
cf58f5a075 Core: Fix a comment in LoadConfigSettings
Closes #9292
2013-02-24 16:54:02 +00:00
horn
ba549ddc30 Core/Summons: Implement summon groups system to be able to summon multiple NPCs at once without need of hardcoding the positions. Almost all hardcoded positions can now be moved to DB.
Thx to @Shauren for his help.
2013-02-24 17:10:02 +01:00
Nay
028c72a9f2 Core/NPCs: Refactor equipments
- creature_template.equipment_id deleted
- creature_equip_template.entry == creature_template.entry
- id field added to creature_equip_template -> PK(entry, id)
- id field in creature_equip_template starts at 1
- creature.equipment_id references id of creature_equip_template
- creature.equipment_id = 0 means no equipment at all (default 1)
- creature.equipment_id = -1 means pick a random equipment from creature_equip_template
- add equipment info to .npc info command

While table creature_equip_template got bigger in size, this system is easier to mantain and allows creatures to have a random template from a group of equipments
2013-02-18 12:24:18 +00:00
Nay
87d4e8c067 Core/Config: Change CONFIG_EVENT_ANNOUNCE from int to bool
Also correct the description of BeepAtStart, it works in Windows as well
2013-02-18 12:20:00 +00:00
Vincent_Michael
6cfb5e13dc Core/Character: Rename engrish function 2013-02-16 18:53:44 +01:00
Machiavelli
877a7e9968 Core/Handlers: Fix a crash in HandleCharFactionOrRaceChange
Ensure there's always valid character name data present, even for
characters that were manually inserted into the database, by adding
character name data on char enum if needed.
2013-02-14 15:43:26 +01:00
Spp
b980aff83e Core: Implement Role based Access Control
- This system will give more control of actions an account can perform.

System defines:
- Permissions to perform some action
- Roles: a set of permissions that have some relation
- Groups: a set of roles that have some relation

Operations:
- Grant: Assign and allow
- Deny: Assign and do not allow
- Revoke: Remove

Precedence to know if something can be done: Grant, Deny. That means, if you are granted some action by a role but you have denied the permission, the action can not be done.

Some Rules:
- Groups can only have roles
- Roles can only have permissions
- An account can be assigned granted and denied roles. Permissions inherited from roles are granted if roles is granted and denied if roles is denied
- An account can be assigned granted and denied permissions
- An account can have multiple groups, roles and permissions
- An account can not have same role granted and denied at same time
- An acconnt can not have same permission granted and denied at same time
- Id 0 can not be used to define a group, role or permission

Added some permissions as a sample of use (Instant Logout, Skip Queue, Join BGs, Join DF) and some permissions as a workaround to commands till command system is modified to use RBAC
2013-02-04 09:04:33 +01:00
Shauren
f410bf9755 Core/World: Fixed a warning 2013-02-02 16:46:14 +01:00
Shauren
957375c7ff Core/Misc: Fixed a few warning found by static analysis tools. 2013-02-01 11:40:39 +01:00
MrSmite
a45f7fd878 Adds CONF option to show quest levels in dialogs.
Example: [13] Westfall Stew

Default = 0 (off). Make sure to set UI.ShowQuestLevelsInDialogs to 1 to turn it on

NOTES:

* DO NOT supply the quest level when using commands such as .lookup quest, it
is not actually part of the title (even though it will be printed in the result)

* Also adds the level in the quest tracker and quest log

* If locale is used, the level is added after the proper title is looked up

* LUA Mods that offer this feature do not work properly with TC, most will not put the level in all dialogs. Users who have such mods should disable the mod's feature or they may see the quest level listed twice.

Example: [13][13] Westfall Stew
2013-01-25 21:47:07 -05:00
Spp
cc605e0605 Core/Misc: Minor cosmetic changes here and there 2013-01-24 16:57:35 +01:00
click
907cd17342 Merge pull request #9020 from krofna/krafixes
Core/ConfigReader: Expand ~ as the HOME envvar on UNIX-based platforms (requries that the HOME envvar has been set, it normally is)
2013-01-22 12:59:18 -08:00
Mislav Blažević
0cdadcdd78 Expand ~ to home directory on unix 2013-01-22 09:36:54 +01:00
Nay
3cb80f206e Core/Config: Set mmaps disabled by default 2013-01-21 20:45:09 +00:00
Vincent_Michael
224b4480a7 Merge branch 'master' of github.com:TrinityCore/TrinityCore into mmaps 2013-01-16 23:43:07 +01:00
Spp
be3826825e Core/Logging: Use correct realmId when logging to DB 2013-01-16 08:59:56 +01:00
Nay
e6a07076c3 Merge remote-tracking branch 'origin/master' into mmaps
Conflicts:
	src/server/game/Entities/Unit/Unit.cpp
	src/server/game/Movement/MotionMaster.cpp
	src/server/game/Movement/MovementGenerators/FleeingMovementGenerator.cpp
	src/server/game/Movement/MovementGenerators/HomeMovementGenerator.cpp
	src/server/game/Movement/MovementGenerators/PointMovementGenerator.cpp
	src/server/game/Movement/MovementGenerators/RandomMovementGenerator.cpp
	src/server/game/Movement/MovementGenerators/TargetedMovementGenerator.cpp
	src/server/game/Movement/Spline/MoveSplineInit.cpp
2013-01-14 13:58:34 +00:00
Spp
802657250c Core/Misc: Apply codestyle to multiple files 2013-01-14 09:50:59 +01:00