Skip to content

Commit

Permalink
Major gameobject refactor, Tile/Nav unloading and others. (#1437)
Browse files Browse the repository at this point in the history
* Closes #1201

Closes #1201

* Closes #571

Closes #571

* Update updates.sql

* Closes #699

Closes #699

* Update updates.sql

* Update UnitManager.py

* Update GameObjectLootManager.py

* Update FearMovement.py

* Update FearMovement.py

* Update FearMovement.py

* Crushing blow.

* Update UnitManager.py

* Update AuraManager.py

* Specialization..

* Update ExtendedSpellData.py

* Update updates.sql

* Update QuestManager.py

* Update updates.sql

* Fix quest status display bug.

- Unavailable quest due race / class requirements / disabled  should no longer wrongfully display available in the future (gray symbol)

* Update QuestManager.py

* Update updates.sql

* Update updates.sql

* Update QuestHelpers.py

err

* Update ReadItemHandler.py

* CMSG_READ_ITEM

* Modify both UnitFlag and UnitState when possible.

- Fix ConfusedMovement not applying unit flag.

* Update UnitManager.py

* Update updates.sql

* Route all flag changes through setters.

* Update LootManager.py

* Update PlayerManager.py

* Remove gold by surrounding units gold mean.

* Remove second pass for loot generation. Left comment.

* Update updates.sql

* Update PlayerManager.py

* Update PlayerManager.py

* Update GameObjectLootManager.py

* Update UnitManager.py

* Update updates.sql

* Major gameobject refactor.

- All gameobject types are now implemented via inheritance.
- Implement Doors/Buttons auto reset.
- Fix mining nodes despawn chance calculation.
- Fishing node activation (Bobber animation) is now notified instantly to clients reducing the missed hook errors.
- Fix despawn bug that did not destroy the object to near players when only the is_spanwed flag changed to False.
- Add GM collision cheat. '.collision'

* Update GameObjectBuilder.py

* Update PlayerManager.py

* Update ItemCodes.py

* Update SpellCodes.py

* Update SpellCodes.py

* Update ChestMananger.py

* Make sure parent GameObjectManager update() is called.

* Update ButtonManager.py

* Update DoorManager.py

* Minor

* Update MapManager.py

* Update AttackSwingHandler.py

* Update AttackSwingHandler.py

* Implement Tile unloading.

- Deactivated cells will now also unload tile data (.map) and namigator data (.nav) when possible.
- Many optimizations in order to also load less data when activating cells. (Only necessary tiles and nav data).
- Fixed a bug in which creatures could also trigger tile/nav loading (This is restricted to players, creatures can activate cells but should not load data)
- Fixes some issues with namigator and wmo based maps which left this kind of maps with no navigation.

* Update MapTile.py

* Update CommandManager.py

* Improve graceful shutdown.

* Update main.py

* Stop inside PyCharm will now also achieve a graceful shutdown.

* Update WorldManager.py

* Update main.py

* Update main.py

* Update CreatureManager.py

* #1438

* Fix bug with respawned objects not displaying to players.

* Update updates.sql

* Update updates.sql

* Update DoorManager.py

* Respawn.

- Restore Gameobject original state each respawn()
- Restore Creature original state each respawn()

* Use creature addon equipment when available.

- Add missing goldshire guard.

* Proper lamp for new guard.

* Update VirtualItemUtils.py

* In the Name of the Light - Min Level 23

* In the Name of the Light

Zone sort set to Southshore (given quest giver location), alpha does not have dungeon quest sort ids. #1438 complete.
  • Loading branch information
devw4r authored Sep 23, 2024
1 parent 2ecb62e commit b7ef71c
Show file tree
Hide file tree
Showing 47 changed files with 1,533 additions and 933 deletions.
3 changes: 2 additions & 1 deletion etc/config/config.yml.dist
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
Version:
current: 17
current: 18

Database:
Connection:
Expand Down Expand Up @@ -31,6 +31,7 @@ Server:
xp_rate: 1.0
load_gameobjects: True
load_creatures: True
load_pools: True # If False, creatures and gameobject spawns will ignore pooling.
supported_client: 3368
realm_saving_interval_seconds: 60
cell_size: 64 # Shouldn't be much bigger than 200
Expand Down
55 changes: 55 additions & 0 deletions etc/databases/world/updates/updates.sql
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,61 @@ begin not atomic
-- Chest placement.
UPDATE `spawns_gameobjects` SET `spawn_positionX` = '10720.001', `spawn_positionY` = '758.654', `spawn_positionZ` = '1322.234' WHERE (`spawn_id` = '49528');

-- Down the Scarlet Path (ID 261) https://github.com/The-Alpha-Project/alpha-core/issues/1438
UPDATE `quest_template` SET `ZoneOrSort` = '10', `MinLevel` = '23', `QuestLevel` = '28', `Details` = 'I will be frank. We are at war with the Scourge. It is an evil that corrupts our people and infects our land. It must be stopped before it washes over our last bastions and drags our world into shadow. We of the Scarlet Crusade have sworn to fight the Scourge with body and soul.$B$BIf you would take this same oath, then gather your courage and prove your allegiance - wage war with the Undead of Duskwood, and return to me with proof of your deeds. $B$BDo this, and the Crusade will embrace you.', `Objectives` = 'Bring 12 Shriveled Eyes to Brother Anton in Stormwind.', `ReqCreatureOrGOId1` = '2477', `ReqCreatureOrGOCount1` = '12', `RewXP` = '2050', `RewOrReqMoney` = '2000' WHERE (`entry` = '261');

-- Down the Scarlet Path (ID 1052) https://github.com/The-Alpha-Project/alpha-core/issues/1438
UPDATE `quest_template` SET `ZoneOrSort` = '10', `MinLevel` = '23', `QuestLevel` = '28', `Details` = 'We of the Scarlet Crusade lay claim to strongholds from Hearthglen to Tirisfal Glades. We are quite proud of our bastions of cleansing throughout Lordaeron.$b$bYou have proven yourself against the undead in southern Azeroth. But the true threat of the plague lies in the northern lands of Lordaeron.$b$bTravel to the town of Southshore, in the Eastern Kingdoms. Seek out a crusader named Raleigh the Devout. Give him this letter of commendation bearing my seal and he will escort you to a place of honor in our Scarlet Monastery.', `RewXP` = '1200' WHERE (`entry` = '1052');

-- In the Name of the Light (ID 1053) https://github.com/The-Alpha-Project/alpha-core/issues/1438
UPDATE `quest_template` SET `ZoneOrSort` = '271', `MinLevel` = '23', `QuestLevel` = '35', `RewItemId1` = '1217', `RewItemCount1` = '1', `RewXP` = '8650' WHERE (`entry` = '1053');

-- Brother Anton, no equipment and level.
UPDATE `creature_template` SET `level_min` = '50', `level_max` = '50', `equipment_id` = '0' WHERE (`entry` = '1182');

-- Fix Raleigh the Devout Hammer, remove offhand non existent book.
UPDATE `creature_equip_template` SET `equipentry1` = '2524', `equipentry2` = '0' WHERE (`entry` = '3980');

-- Ravager's Skull (ID 2477) should be renamed to "Shriveled Eye"
UPDATE `item_template` SET `name` = 'Shriveled Eye' WHERE (`entry` = '2477');

-- Ravager's Skull (ID 2477) drop. Brain Eaters, Plague Spreaders, Bone Chewers, Fetid Corpses and Rotted Ones.
DELETE FROM `creature_loot_template` WHERE (`item` = '2477');
INSERT INTO `creature_loot_template` (`entry`, `item`, `ChanceOrQuestChance`, `groupid`, `mincountOrRef`, `maxcount`, `condition_id`) VALUES ('570', '2477', '-80', '0', '1', '1', '0');
INSERT INTO `creature_loot_template` (`entry`, `item`, `ChanceOrQuestChance`, `groupid`, `mincountOrRef`, `maxcount`, `condition_id`) VALUES ('604', '2477', '-80', '0', '1', '1', '0');
INSERT INTO `creature_loot_template` (`entry`, `item`, `ChanceOrQuestChance`, `groupid`, `mincountOrRef`, `maxcount`, `condition_id`) VALUES ('210', '2477', '-40', '0', '1', '1', '0');
INSERT INTO `creature_loot_template` (`entry`, `item`, `ChanceOrQuestChance`, `groupid`, `mincountOrRef`, `maxcount`, `condition_id`) VALUES ('127', '2477', '-15', '0', '1', '1', '0');
INSERT INTO `creature_loot_template` (`entry`, `item`, `ChanceOrQuestChance`, `groupid`, `mincountOrRef`, `maxcount`, `condition_id`) VALUES ('948', '2477', '-15', '0', '1', '1', '0');

-- Fix Raleigh the Devout timing for Respawn Gobject, should appear right when 'Raleigh the Devout throws Anton's letter down on the table.' happens.
DELETE FROM `quest_end_scripts` WHERE `id`=1052;
INSERT INTO `quest_end_scripts` (`id`, `delay`, `priority`, `command`, `datalong`, `datalong2`, `datalong3`, `datalong4`, `target_param1`, `target_param2`, `target_type`, `data_flags`, `dataint`, `dataint2`, `dataint3`, `dataint4`, `x`, `y`, `z`, `o`, `condition_id`, `comments`) VALUES
(1052, 0, 0, 1, 69, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 'Raleigh the Devout - Emote'),
(1052, 0, 0, 4, 147, 2, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 'Raleigh the Devout - Modify Flags'),
(1052, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1377, 0, 0, 0, 0, 0, 0, 0, 0, 'Raleigh the Devout - Talk'),
(1052, 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1378, 0, 0, 0, 0, 0, 0, 0, 0, 'Raleigh the Devout - Talk'),
(1052, 7, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 'Raleigh the Devout - Emote'),
(1052, 8, 0, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -848.237, -577.427, 18.546, 0, 0, 'Raleigh the Devout - Move'),
(1052, 14, 0, 1, 61, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 'Raleigh the Devout - Emote'),
(1052, 15, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1379, 0, 0, 0, 0, 0, 0, 0, 0, 'Raleigh the Devout - Talk'),
(1052, 15, 0, 9, 133, 18, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 'Raleigh the Devout - Respawn Gobject'),
(1052, 20, 0, 19, 0, 0, 0, 0, 0, 0, 0, 0, 1906, 0, 0, 0, 0, 0, 0, 0, 0, 'Raleigh the Devout - Set Equipment'),
(1052, 23, 0, 1, 25, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 'Raleigh the Devout - Emote'),
(1052, 24, 0, 13, 0, 0, 0, 0, 133, 0, 12, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 'Raleigh the Devout - Activate Gobject'),
(1052, 26, 0, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -844.878, -580.284, 18.5459, 2.391, 0, 'Raleigh the Devout - Move'),
(1052, 28, 0, 19, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 'Raleigh the Devout - Set Equipment'),
(1052, 31, 0, 4, 147, 2, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 'Raleigh the Devout - Modify Flags');

-- Anton's Letter of Commendation
UPDATE `gameobject_template` SET `flags` = '4' WHERE (`entry` = '19534');

-- Missing Goldshire guard.
INSERT INTO `spawns_creatures` (`spawn_id`, `spawn_entry1`, `spawn_entry2`, `spawn_entry3`, `spawn_entry4`, `map`, `position_x`, `position_y`, `position_z`, `orientation`, `spawntimesecsmin`, `spawntimesecsmax`, `wander_distance`, `health_percent`, `mana_percent`, `movement_type`, `spawn_flags`, `visibility_mod`, `ignored`) VALUES ('400464', '1423', '0', '0', '0', '0', '-9497.842', '67.635', '56.367', '6.131', '300', '300', '0', '100', '100', '0', '0', '0', '0');

-- Addon - Equipment id.
INSERT INTO `creature_addon` (`guid`, `display_id`, `mount_display_id`, `equipment_id`, `stand_state`, `sheath_state`, `emote_state`) VALUES ('400464', '0', '0', '400464', '0', '1', '0');
INSERT INTO `creature_equip_template` (`entry`, `equipentry1`, `equipentry2`, `equipentry3`) VALUES ('400464', '2714', '143', '1899');

insert into applied_updates values ('040920242');
end if;
end $
Expand Down
76 changes: 38 additions & 38 deletions game/realm/RealmManager.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,49 +70,49 @@ def redirect_to_world(sck):
sck.sendall(packet)

@staticmethod
def start_realm():
def start_realm(running):
local_realm = REALMLIST[config.Server.Connection.Realm.local_realm_id]
server_socket = RealmManager.build_socket(local_realm.realm_address, local_realm.realm_port)
server_socket.listen()
real_binding = server_socket.getsockname()
# Make sure all characters have online = 0 on realm start.
RealmDatabaseManager.character_set_all_offline()
Logger.success(f'Login server started, listening on {real_binding[0]}:{real_binding[1]}\a')

while True:
try:
client_socket, client_address = server_socket.accept()
RealmManager.serve_realmlist(client_socket)
client_socket.shutdown(socket.SHUT_RDWR)
client_socket.close()
except socket.timeout:
pass # Non blocking.
except OSError:
Logger.warning(traceback.format_exc())
except KeyboardInterrupt:
break
with RealmManager.build_socket(local_realm.realm_address, local_realm.realm_port) as server_socket:
server_socket.listen()
real_binding = server_socket.getsockname()
# Make sure all characters have online = 0 on realm start.
RealmDatabaseManager.character_set_all_offline()
Logger.success(f'Login server started, listening on {real_binding[0]}:{real_binding[1]}\a')

while running.value:
try:
client_socket, client_address = server_socket.accept()
RealmManager.serve_realmlist(client_socket)
client_socket.shutdown(socket.SHUT_RDWR)
client_socket.close()
except socket.timeout:
pass # Non blocking.
except OSError:
Logger.warning(traceback.format_exc())
except KeyboardInterrupt:
break

Logger.info("Login server turned off.")

@staticmethod
def start_proxy():
def start_proxy(running):
local_realm = REALMLIST[config.Server.Connection.Realm.local_realm_id]
server_socket = RealmManager.build_socket(local_realm.proxy_address, local_realm.proxy_port)
server_socket.listen()
real_binding = server_socket.getsockname()
Logger.success(f'Proxy server started, listening on {real_binding[0]}:{real_binding[1]}\a')

while True:
try:
client_socket, client_address = server_socket.accept()
RealmManager.redirect_to_world(client_socket)
client_socket.shutdown(socket.SHUT_RDWR)
client_socket.close()
except socket.timeout:
pass # Non blocking.
except OSError:
Logger.warning(traceback.format_exc())
except KeyboardInterrupt:
break
with RealmManager.build_socket(local_realm.proxy_address, local_realm.proxy_port) as server_socket:
server_socket.listen()
real_binding = server_socket.getsockname()
Logger.success(f'Proxy server started, listening on {real_binding[0]}:{real_binding[1]}\a')

while running.value:
try:
client_socket, client_address = server_socket.accept()
RealmManager.redirect_to_world(client_socket)
client_socket.shutdown(socket.SHUT_RDWR)
client_socket.close()
except socket.timeout:
pass # Non blocking.
except OSError:
Logger.warning(traceback.format_exc())
except KeyboardInterrupt:
break

Logger.info("Proxy server turned off.")
Loading

0 comments on commit b7ef71c

Please sign in to comment.