52 Commits

Author SHA1 Message Date
Emagi
f1c4a91b01 Enforce regen refresh after combat, avoid loot method being out of range 2025-08-27 07:42:20 -04:00
Emagi
3045b15f88 ZoneServer::KillSpawnByDistance deadlock fixed by calling outside of grid mutex lock. Killing spawn resulted in dropping loot chest, then Entity::DropChest calls SetLocation which calls AddSpawnToGrid causing deadlock. 2025-08-26 09:00:59 -04:00
Emagi
05f5061c19 don't allow zone to shutdown while spawn process takes place, check by using MMasterSpawnLock first 2025-08-17 18:18:29 -04:00
Emagi
24f5a566ae Assure HearDispell is not accidentally sent to old clients causing a crash 2025-08-15 21:06:36 -04:00
Emagi
a7260e9f72 Keep player at same Y position and grid_id (added new column to characters table) to address falling through objects after logging out
DB Update:
alter table characters add column grid_id int(10) unsigned not null default 0;
2025-08-13 09:57:27 -04:00
Emagi
4d0ef974ae On zone shutdown purge all spells pending to be deleted so we do not reference dead spell->zone ptr 2025-08-08 14:40:30 -04:00
Emagi
baf74d0bdd Added LUA Function to adjust hate position up or down: AdjustHatePosition(Caster, NPC, Increase) increase is boolean, true to increase, false to decrease 2025-08-02 06:35:03 -04:00
Emagi
6a6573e339 Addressing a number of coincidental lock conditions with removing a dead spawn (out of order), clearing hate (deadlock due to early dead spawn removal), saving a player to database (before player loaded) 2025-07-31 18:38:39 -04:00
Emagi
b7f56e3b73 Prevent accessing spawn list outside of read lock, removal of pending spawn removals (redundant) 2025-07-31 13:23:42 -04:00
Emagi
9ef48d3bab limiting spawn list write lock further 2025-07-30 19:15:47 -04:00
Emagi
e1a759a1a2 this seems to be better behavior with ASAN due to not constant locking/unlocking the spawn list.. 2025-07-29 19:25:26 -04:00
Emagi
9e255408ce misc cleanup 2025-07-29 18:44:34 -04:00
Emagi
f60d261f00 Vault, Broker support for DoF, KoS, AoM. Shop support for DoF, KoS.
Broker/Vault (Fix #10):
- Traditional broker integrated (/frombroker), GM itemsearch is still available via /itemsearch.  AoM client cannot sell/use shop, can only buy from broker.
- DoF and KoS client now support House Shop (sell inventory, vault to broker).
- House containers now function like actual containers and can be stored in the vault which will allow placement in the home (to serve as a merchant).
- Sales crate merchant windows in player houses implemented for broker.
- Peering URI's added for broker/shop support: /addseller, /removeseller, /additemsale, /removeitemsale
- House vault and vault slots implemented for DoF, KoS and AoM clients.

Stability and Functionality:
- World Database now has seq_character_items (Sequence) to sync self and peers instantiating new unique IDs for character items.  This is to avoid conflict/overriding another unique id.
- spawn and spawn_houses tables have a lua_script that can now be defined outside the existing spawn_scripts table for a singular spawn.
- Fixed a watchdog/hangup when clearing hate lists inside a spawn list lock.
- Item unique id is being transitioned to int64 (although older clients still only support int32, clients later on are int64).
- Fixed so that spells that have no duration will no longer be added to maintained effects.
- Fixed spell cleanup, maintained effect does not remain on the Player causing a crash.
- Fixed spell conflicts to that check all targets are applicable for the spell.
- Fixed issues with maintained effects or spell effects stacking repeatedly.
- Fixed assigning items to non inventory slots when 'adding' an item to the Player.
- Fixed locking orders between maintained effects and spell effects to avoid deadlocks.
- Fixed entering house and visiting houses, targetting of the house door is now enforced server side.
- Item locking is now enforced by the type of locking (eg. house placement, crafting, shop list for sale).  Locks no longer override/interfere with each other.
- Additional logging around spell casting and targets.
- Spawns/Objects/Widgets so on related to houses now have their own sub tables _houses, eg. spawn_houses, spawn_npc_houses, spawn_object_houses, so on to avoid conflicting with existing tables non-house.

- new LUA Functions:
	ShowShopWindow(Player, FromSpawn) - opens shop window for player (if in their house) for listing, pricing items, retrieving sales log and coin, etc.
	SetSpawnHouseScript(Target, LuaScript) - Utilized in the item script 'placed' function to set the spawned house item's lua script.
	SendBook(Target, ItemID) - Sends the book to the target player based on the item id.
	GetPickupItemID(Spawn) - Gets the item id that the house spawn would represent
	SetHouseCharacterID(Spawn, CharID) - Sets the house spawn character id (should be used on Spawn).  Set CharID to 0 to set to the current houses character id.

- Updated LUA Functions:
	StartHeroicOpportunity(Caster, ClassID, OverrideTarget)  - OverrideTarget now available to change the heroic opportunity target
	HasItem(Player, ItemID, IncludeBank) - No parameter change, include bank, which serves as 'all' should now work correctly (previously did not check bank/other negative slots),  default is false.

- Slash Commands Added:
	/sle - Fix #41, Set Location Entry (DB command for setting spawn location entry values such as offsets and overrides)
	/store_list_item - used to list an item for broker shop
	/store_set_price - used for setting items price for shop
	/store_set_price_local - used for inventory items price for shop
	/store_start_selling - Begin selling from inventory for shop
	/store_stop_selling - Stop selling from inventory
	/store_unlist_item - used to unlist an item from broker shop
	/close_store_keep_selling - Closes store shop window, but keep selling from inventory while in house
	/cancel_store - cancel selling from inventory
2025-07-26 07:10:07 -04:00
Emagi
b0f24aea5d small comments + gnu cleanup 2025-07-04 07:48:40 -04:00
Emagi
cb5371793e reduce MSpawnList writelock from outside the for loop 2025-07-02 14:50:01 -04:00
Emagi
93b7620364 Need to also track the not deleted to re-add after attempting a DeleteSpawns loop, need to also release the read lock if we continue 2025-07-01 07:54:58 -04:00
Emagi
40e83f5e2d Redesign of ZoneServer::DeleteSpawns to avoid deadlocks 2025-07-01 07:39:51 -04:00
Emagi
1ba65aba78 DB async query synching to peers, code/logging cleanup 2025-06-29 14:03:23 -04:00
Emagi
2a133292b0 Deadlock fix for adding pending spawns, zoneserver.cpp cleanup 2025-06-29 06:48:30 -04:00
Emagi
31e8f782ce MoveInZone was causing inconsistencies since client was desyncing, we will do a full zone, fixed CheckTransporters to not send you to safe location 2025-06-21 21:13:14 -04:00
Emagi
6b22386ef6 #37 Fix north qeynos temple of life, ForceZone transport_type added to transporters table see comment for table updates.
ALTER TABLE transporters
MODIFY COLUMN transport_type ENUM('Zone', 'Location', 'Generic Transport', 'Flight', 'ForceZone')
NOT NULL DEFAULT 'Zone';

This provides the north qeynos teleporters for Temple of Life to work as zone points (with code update):

update transporters set transport_type='ForceZone' where id=43;
update transporters set transport_type='ForceZone' where id=44;
2025-06-20 09:17:25 -04:00
Emagi
712b5ebf3f Fix flight paths for KoS, DoF clients. Working around by sending the single flight path due to indexing issues with the client. 2025-06-18 17:04:13 -04:00
Emagi
d5e19e145c dead client ptr protection 2025-06-13 19:53:32 -04:00
Emagi
82a5e96000 Work in progress for 0.9.9 so far (making its own branch for now)
- Fixed a repeated rubberband like behavior that Spawn's would run forward toward their target in combat or on their return run to their starting point.
- WS_HearCastSpell for 546-561 version has an extra byte at the end of the packet we were missing (might be in later clients too have to confirm)
- PlayerScripts support added, new function calls, AddTimer support for Players.
- Static Zones / Special Zones will now silently check to startup zones without reporting the log message, log message only on startup or taking on peer leadership.
- Broadcast and Global Announcement are now supported through peering.
- Fix #22 identified a number of loose spawn pointers and changed to int32 spawn id reference.
- Fix #1 support for all known chat codes for various channels, spell casting and damage.
- In conjunction with Fix #1 spell combat messages are fixed, no longer 'YOU cast' when another spawn casts, added last_tell_name to track the chat code %RT server side.
- size_mod added to InfoStruct Float, supports shrinking and growing Non Player's. InfoStruct also has a UINT ignore_size_mod_calc set to 0 by default, when 1 it will let you set the size_mod and items/spells will not override it from stat calculation.
- XP Table is now static (global) in the Player class so we do not constantly call the database each time the player needs to know a level's XP requirement.
- Removal of duplicate spell cast success and effect messages.
- Fix #21 blue xp bar for KoS and DoF displays properly now.
- GetExpRequiredByLevel(level) added to return the EXP required for to reach the level.
- Fix #25 teleporters cleaned up during /reload spawns to avoid crash
- Fix #16 /reload items supported in peering mode.
2025-06-08 14:53:52 -04:00
Emagi
b937444425 Fix leashing, leading, rubberbanding mobs. Work in progress for size mod.
Fix #18 Leashing, leading, rubberbanding issues with spawns resolved
Issue #17 Work in Progress, size mod stat support in the works, setting temporary_scale in info struct seems to modify size, the pos_size values in the position struct are not for KoS and older clients.
AddSpellBonus was translating values from float to sint32 early, now we take bonus values into player add bonus so that float values will be honored, as well as sint32.  This applies to uncontested parry, block, dodge, riposte and the size mod.
2025-05-30 21:55:10 -04:00
Emagi
5d77208ff1 Revert "If a grid is not assigned to a spawn then we will try to force one on the map if they are not a flying creature"
This reverts commit c177dc910d0adcf7cfda5415d6eecae681754553.
2025-04-21 21:42:40 -04:00
Emagi
c177dc910d If a grid is not assigned to a spawn then we will try to force one on the map if they are not a flying creature 2025-04-21 14:18:55 -04:00
Emagi
8b4a623f42 more /reload spells junk 2025-02-09 16:37:16 -05:00
Emagi
9250118b05 More work for /reload spells when multiple zones / players are on 2025-02-09 15:25:16 -05:00
Emagi
9bfa15d628 make sure spells are cleaned up when zone is shutdown 2025-02-09 09:11:17 -05:00
Emagi
3efce0abd6 call spell remove function for reason "target_dead" and "target_removed" also address the long delay between calling the remove function and the death of a spawn. Lastly made it so we can reference the spawn group id after death for a spawn since we remove it from a spawn group. 2025-01-16 12:29:24 -05:00
Emagi
e20b45eedd Fixed issues with /reload spells causing a crash 2025-01-16 10:53:12 -05:00
Emagi
9b60035656 LUA function Resurrect updated with 8th and 9th argument for revive_sickness_spell_id and revive_sickness_spell_tier respectively. Fixed avoiding crash with bad spawn ptr if resurrect caster left zone. 2025-01-11 09:22:25 -05:00
Emagi
3162106580 Added Lua Functions PlayAnimationString(Spawn: Spawn, String: EmoteStringCommand, Spawn: OptTarget, Boolean: SetNoTarget, Boolean: UseAllSpellTargets, Boolean: IgnoreSelf) and GetSpellTargets(Optional_Spell) if no argument must be in spell script. Fixed spells with no range that are group based to apply to all in group. 2025-01-10 19:08:47 -05:00
Emagi
c24f0c89fc only create a persisted respawn if it has a respawn time 2025-01-09 17:44:11 -05:00
Emagi
1cc7d22a44 support flight paths in KoS and earlier clients, also start of showing loot to other group/raid members 2025-01-04 15:24:02 -05:00
Emagi
04f38a6599 added zone info into memory, you can use /reload zoneinfo to clear the cache if GM status available. 2024-12-30 10:10:48 -05:00
Emagi
3200c1d66d Fix the number of players in zone to be more accurate 2024-12-23 19:16:16 -05:00
Emagi
42173ceef2 Added support to create duplicated zones of public zones (non city zone). Additionally spawn locations can be limited to the primary public zone and not replicated (for epics). 2024-12-23 08:46:11 -05:00
Emagi
7f138c5bef Support in eq2emu for respawn_offset_low respawn_offset_high to align with changes in spawn_location_placement for editor
alter table spawn_location_placement add column respawn_offset_low int(10) signed not null default 0 after respawn;
alter table spawn_location_placement add column respawn_offset_high int(10) signed not null default 0 after respawn_offset_low;
2024-12-19 13:02:18 -05:00
Emagi
fe10353863 Added public zone persistence of spawns back, command /location list respawns added, additionally added tracking of duplicate zones for exceeding player limits 2024-12-15 15:22:21 -05:00
Emagi
35bbb09096 Fixed LogError for GetSpellInitialTarget to show correct function name, pNumPlayers implemented for ZoneServer, will peer that data as well 2024-12-11 08:27:16 -05:00
Emagi
c17b4d5588 Added CreateChoiceWindow, ClearChoice and GetChoiceSpawnID lua functions, added base of tracking for min, max, avg, first level for raid/group into instances... more work to complete tomorrow 2024-12-04 21:53:57 -05:00
Emagi
14bb60caf8 avoid crash on remove caster when in a spell attack 2024-12-01 06:29:13 -05:00
Emagi
52ed0cf1d3 make sure spell caster does not persist if they are removed from the spawn list 2024-11-29 09:49:57 -05:00
Emagi
d03c86efef CheckEncounterState behavior added 2024-11-27 17:17:26 -05:00
Emagi
31fc7aea63 disable zone persistence for now issue with doors/widgets disappearing 2024-11-23 07:53:22 -05:00
Emagi
51107a23f1 Update zoneserver.cpp 2024-11-18 19:47:29 -05:00
Emagi
315ab1d0e7 Project Nebulark Part 1, So much to list, this is a rough summary
- Raid support and cross peer support for Isle of Refuge, DoF, KoS and AoM clients.
- Zone Persistence added to non-instanced zones.
- Commands: /whogroup, /whoraid, /raidinvite, /raid_looter, /kickfromgroup, /kickfromraid, /leaveraid, /split, /raidsay (rsay) added.
- Cross peer zone and instance support
- Cross tell support (along with ignore)
- Cross ooc support
- Cross group support (can chat, leave group, disband cross peers, update group options)
- Cross who all support
- houses/instances fixed no more cross objects/spawns/etc from other houses
- houses now display characters name with the house zone description
- 1000's of house items now properly work with wall/ceiling
- debug messages removed from housing placement
- Encounters locked to raid instead of group
- group options restricted to raid leader
- reload rules for following are peer wide:
COMMAND_RELOADSTRUCTS
COMMAND_RELOAD_QUESTS
COMMAND_RELOAD_SPELLS
COMMAND_RELOAD_ZONESCRIPTS
COMMAND_RELOAD_FACTIONS
COMMAND_RELOAD_MAIL
COMMAND_RELOAD_GUILDS
COMMAND_RELOAD_RULES
COMMAND_RELOAD_STARTABILITIES
COMMAND_RELOAD_VOICEOVERS
COMMAND_RELOADSPAWNSCRIPTS
COMMAND_RELOADREGIONSCRIPTS
COMMAND_RELOADLUASYSTEM
- special/static zones (always_loaded) are now defined by a peer_priority unsigned short (smallint(5)) in zones table.  peer_priority = server_config world.peerpriority will spawn on that exe instance, if it is not available it is distributed to all peers.  Using the value of 0 (assuming no peer has priority of 0) or 65535 will result in peer distribution of zones.
server_config.json "WorldServer" block updated with the following (web peer port information), priority must be unique for EACH peer:
        "peeraddress": "10.1.1.2",
        "peerport": "9102",
        "peerpriority": "1",

New Command Line Run Arguments for World Exe to override server_config.json values
Allowed options:
  --worldaddress arg         World address
  --internalworldaddress arg Internal world address
  --worldport arg (=0)       Web world port
  --webworldaddress arg      Web world address
  --webworldport arg (=0)    Web world port
  --peerpriority arg (=0)    Peer priority

- fixed Isle of Refuge client group struct (raids added also)
- new log category Peering
- new LUA Functions AddRespawn(Zone, LocationID, RespawnTime) and CreatePersistedRespawn(LocationID, SpawnType, RespawnTime, ZoneID)
2024-11-18 11:13:04 -05:00
Emagi
e4fc6aad5a Zone ruleset_id support for most rules 2024-10-20 09:35:41 -04:00