450 Commits

Author SHA1 Message Date
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
480086d85d Fix allowing equipment during engagement based on the engaged_encounter info struct, not the engagedincombat (melee attack enabled flag) 2025-08-08 14:39:56 -04:00
Emagi
25325477ab Fixed loading player scripts for zones by their zones table name parameter 2025-08-02 15:42:36 -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
6e25f0062f Segmented queries and query escaped the character name (in case) 2025-07-31 18:36:36 -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
8f47a27b1d better DB inserting of the query to not move around the char array later 2025-07-30 08:44:01 -04:00
Emagi
74fa672e65 enforce attempting a DB deleting on broker, even if the item does not exist in the broker memory 2025-07-30 08:22:25 -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
020058b395 LUA Functions Added, AttackAllowed, IsInRaid, InSameRaid, GetRaid
AttackAllowed(Spawn, Target, Distance, RangeAttack)
    Distance default is 0.0f and just checks if you can attack the target.
    Otherwise distance greater than 0.0f relates to the distance between the Spawn and Target which you first obtain using GetDistance(Spawn, Target).
    RangeAttack is a boolean (default: false) when true we use range info for the ranged attack min/max distance versus max distance melee combat range.

IsInRaid(Spawn, IsLeaderGroup) - Establishes if the Spawn is currently in a raid.    IsLeaderGroup is boolean (default: false) returns true if Spawn is the leader group of the raid.

InSameRaid(Spawn, Target, IsLeaderGroup) - determines if Spawn and Target are within the same raid groups.  IsLeaderGroup is boolean (default: false) returns true if Spawn is the leader group of the raid.

GetRaid(Spawn, PlayersOnly) - gets the array of all the members in the raid.  PlayersOnly is boolean (default: false), if true we return only clients/players in the list for the raid.
2025-07-27 17:40:05 -04:00
Emagi
8838ca9b2b Don't send message to players when we can't update shop window 2025-07-27 17:39:28 -04:00
Emagi
9f7a0d0e53 use the seller_cid not the seller ptr 2025-07-26 07:26:02 -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
21052e3289 Found the vault_slots setting in character sheet for the house, also fixed the upkeep display for the house in DoF/KoS clients 2025-07-10 10:04:29 -04:00
Emagi
9f129586fb make sure to memset if the house item info isn't set properly in the database 2025-07-08 13:41:49 -04:00
Emagi
878c422c0f Support house containers being placed inside house. Need to have an appearance set with equip_type as model type/id 2025-07-08 10:32:56 -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
9e1f77e28e HTTP Persistence for world client/server peering 2025-07-01 20:24:15 -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
398a4ef1f4 Fixed target type 9 (AE other groups) like Shout getting implied or proper targets
- (Enemy) Players targetting NPCs and their spawn groups
- (Friendly) NPCs targetting NPCs and their own spawn groups
2025-07-01 07:39:16 -04:00
Emagi
bc925887ad Fixed missing return for /activequery 2025-06-30 11:16:01 -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
260a48be1e Fix #38 address issues with food/drink cross zone
Custom spells now survive cross zone with their modified spell stats saved to the database for reloading later.  The design is such that a spell can be custom defined for its spell stats, but a character/player cannot have more than one of that spell (eg. food can share a spell id since only one food can be applied to you, but you can't have many spells apply using the same custom spell id).

CREATE TABLE character_custom_spell_dataindex (
    charid INT UNSIGNED NOT NULL,
    spell_id INT UNSIGNED NOT NULL,
    idx INT UNSIGNED NOT NULL,
    type ENUM('int', 'float', 'bool', 'string') NOT NULL,
    value1 TEXT,
    value2 TEXT,
    PRIMARY KEY (charid, spell_id, idx)
);

CREATE TABLE character_custom_spell_display (
    charid INT UNSIGNED NOT NULL,
    spell_id INT UNSIGNED NOT NULL,
    idx INT UNSIGNED NOT NULL,
    field VARCHAR(64) NOT NULL,
    value TEXT,
    PRIMARY KEY (charid, spell_id, idx, field)
);

CREATE TABLE character_custom_spell_data (
    charid INT UNSIGNED NOT NULL,
    spell_id INT UNSIGNED NOT NULL,
    field VARCHAR(64) NOT NULL,
    type ENUM('int', 'float', 'bool', 'string') NOT NULL,
    value TEXT NOT NULL,
    PRIMARY KEY (charid, spell_id, field)
);
2025-06-26 18:27:35 -04:00
Emagi
11a6a80647 Fixed CheckRemoveTargetFromSpell we should handle RemoveSpawnFromSpell outside MRemoveTargetList lock 2025-06-23 13:19:12 -04:00
Emagi
e54ed5e730 make sure spell data exists for the spell to check detrimental 2025-06-22 13:41:18 -04:00
Emagi
a8eb9c9ebc Extensive changes to remove SpellTargets write and read mutex locks to avoi ddeadlocks 2025-06-22 13:20:07 -04:00
Emagi
6b0f551552 fix mishandling of the ProcessSpell return, we need to return false if we fail to call the lua function correctly 2025-06-22 08:55:11 -04:00
Emagi
c25ac12cd6 Make sure all spell references are removed when a spell is removed from an entity 2025-06-21 21:13:45 -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
6f3dc5119a Avoid transporters triggering repeatedly after a destination is selected 2025-06-20 09:49:44 -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
08204186c8 Stop spells being put on hotbar that are not supposed to be visible like archetypes 2025-06-20 07:45:22 -04:00
Emagi
2b36a05a1c Reduce log spam in the world server 2025-06-20 07:36:48 -04:00
Emagi
42f776168f Additional check for players to avoid adding spell effects to db that are HO with no icon/duration 2025-06-20 07:36:27 -04:00
Emagi
108af53730 avoid adding heroic op spell effects (usually have no icon set) with no duration to the spell effects (ends up adding them to the db unnecessarily) 2025-06-19 18:53:48 -04:00
Emagi
62d44c5e0a Address avoidance base display percentage for KoS and DoF 2025-06-19 08:49:10 -04:00
Emagi
f32050e66d #36 address mitigation display in the player profile showing red when no detrimental effects on player 2025-06-19 08:23:00 -04:00
Emagi
41a8f5ca31 #34 address hail facing direction, we were changing the heading before setting the runback info 2025-06-19 08:03:01 -04:00
Emagi
9fbae149d8 DoF and KoS clients support quantity in the quest offer/accept windows, AoM does not show quantity so it has to be sent differently (earlier clients were not considered as it is not really vital) 2025-06-18 20:14:16 -04:00
Emagi
b5a42d39b2 Fixed recipe book structure for DoF and KoS clients 2025-06-18 19:53:58 -04:00
Emagi
8be57ce9eb #35 world peering limit client to one character active, only recover linkdead 2025-06-18 18:28:39 -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
0f5cfddf89 fix compile bug 2025-06-18 16:49:04 -04:00
Emagi
f03069a475 Update SpellProcess.cpp 2025-06-17 08:42:31 -04:00