Compare commits

..

70 Commits

Author SHA1 Message Date
Chris Miles ea9b7841d4 [Release] 22.48.0 (#4200) 2024-03-23 00:24:01 -05:00
Alex King 8826d7b927 [Rules] Add World:Rules Rule (#4194)
* [Rules] Add World:Rules Rule

# Notes
- Adds `World:Rules` rule to take the place of the variables table value.

* Update client.cpp

* Update client.cpp
2024-03-23 00:01:27 -05:00
JJ e4157f0221 [Bug Fix] Fix reusing timers (#4199)
Fixes regression from #4099 where timers that were reused were not getting changed with their updated times
2024-03-23 00:01:15 -05:00
Alex King 66cc947b2a [Quest API] Add Restore Methods for Health, Mana, and Endurance to Perl/Lua (#4179)
* [Quest API] Add Restore Methods for Health, Mana, and Endurance to Perl/Lua

- Add `$mob->RestoreEndurance()`.
- Add `$mob->RestoreHealth()`.
- Add `$mob->RestoreMana()`.

- Add `mob:RestoreEndurance()`.
- Add `mob:RestoreHealth()`.
- Add `mob:RestoreMana()`.

- Allows operators to easily restore a mob to full health, mana, or endurance.
- `RestoreHealth` is just a more verbosely named `Heal`.
- Convert spots in source to use these short hands instead of directly using `SetEndurance(GetMaxEndurance())`, `SetHP(GetMaxHP())`, or `SetMana(GetMaxMana())`.

* Update mob.h

* Update mob.h
2024-03-22 23:53:35 -05:00
hg 5bfd8f5da2 [Tradeskills] Implement learning recipes from books (#4170)
This uses the book scribe button to learn recipes in SoF+ clients. For
Titanium clients the button is not available so a workaround will need
to be added later.

Note live gives no feedback when scribing books (at least those tested).
2024-03-22 23:50:06 -05:00
Chris Miles 96830b4a19 [Loot] Fix issue with nested data being loaded multiple times (#4192)
* [Loot] Fix issue with nested data being loaded multiple times

* Update zone_loot.cpp

* Fix #lootsim printout

* Update loot.cpp
2024-03-22 23:49:23 -05:00
Alex King 4bf60a6522 [Bug Fix] Fix ScaleNPC() in Perl (#4196)
# Notes
- We were not passing `override_special_abilities` in the right parameter slot.
- Default `always_scale` to `true` when using the Perl/Lua method.
2024-03-22 23:36:30 -05:00
JJ 16cb7364e8 [Misc] Windows preprocessor define in crash.cpp (#4191) 2024-03-22 23:27:31 -05:00
Alex King f5050ab5dc [Bug Fix] Fix range_percent (#4197)
# Notes
- This was uninitialized and was getting bogus values.
2024-03-22 16:17:38 -04:00
Alex King e32cbf19ee [Bug Fix] Fix #serverrules Command (#4193)
* [Bug Fix] Fix #serverrules Command

# Notes
- This command was effectively disabled as it was not included nor was the command itself defined within a `command_add`

* Update command.cpp
2024-03-20 03:31:49 -04:00
Alex King ee12a7ad2e [Bug Fix] Fix EVENT_KILLED_MERIT firing before NPC removal (#4185)
* [Bug Fix] Fix EVENT_KILLED_MERIT firing before NPC removal

# Notes
- NPCs were parsing this event too early and anything that checked if they were still alive in `EVENT_KILLED_MERIT` would show them still alive because of this.

# Image

* Code cleanup

* Update client.h

* Add GetRaidOrGroupOrSelf() to Perl/Lua

* Update to luabind::object, fix logic per comments.

* Fix

* Fix per comments.
2024-03-17 17:32:44 -04:00
Alex King e5bdbc4f1e [Bug Fix] Fix Bot Cloning (#4186)
# Notes
- We were not setting `inventories_index` to `0` so it was trying to use the pre-existing unique identifier, causing the query to fail.
2024-03-16 23:09:57 -04:00
Alex King f829a99e6d [Quest API] Add RemoveAlternateCurrencyValue() to Perl/Lua (#4190)
# Perl
- Add `$client->RemoveAlternateCurrencyValue(currency_id, amount)`.

# Lua
- Add `client:RemoveAlternateCurrencyValue(currency_id, amount)`.

# Notes
- Allows operators to more easily remove alternate currencies, returns a `bool`, `false` if failed`, `true` if succeeded.
- Added `Zone::DoesAlternateCurrencyExist` that will reject setting, removing, or adding  to a currency that does not exist.
2024-03-16 23:09:51 -04:00
Alex King 82aa6a1587 [Bug Fix] Fix Proximity Say (#4189)
# Notes
- Without setting `HaveProximitySays` to `true` along with if `n->proximity->say` NPCs will not respond to proximity say stuff.
2024-03-14 20:26:30 -04:00
Alex King 161c13f457 [Quest API] Add Buff Support to Perl/Lua (#4182)
* [Quest API] Add Buff Support to Perl/Lua

- Add `$mob->GetCasterID()`.
- Add `$mob->GetCasterLevel()`.
- Add `$mob->GetCasterName()`.
- Add `$mob->GetCastOnX()`.
- Add `$mob->GetCastOnY()`.
- Add `$mob->GetCastOnZ()`.
- Add `$mob->GetCounters()`.
- Add `$mob->GetDOTRune()`.
- Add `$mob->GetExtraDIChance()`.
- Add `$mob->GetInstrumentModi()`.
- Add `$mob->GetMagicRune()`.
- Add `$mob->GetMeleeRune()`.
- Add `$mob->GetNumberOfHits()`.
- Add `$mob->GetRootBreakChanc()`.
- Add `$mob->GetSpellID()`.
- Add `$mob->GetTicsRemaining()`.
- Add `$mob->GetVirusSpreadTim()`.
- Add `$mob->IsCasterClient()`.
- Add `$mob->IsPersistentBuff()`.
- Add `$mob->SendsClientUpdate()`.

- Add `mob:GetCasterID()`.
- Add `mob:GetCasterLevel()`.
- Add `mob:GetCasterName()`.
- Add `mob:GetCastOnX()`.
- Add `mob:GetCastOnY()`.
- Add `mob:GetCastOnZ()`.
- Add `mob:GetCounters()`.
- Add `mob:GetDOTRune()`.
- Add `mob:GetExtraDIChance()`.
- Add `mob:GetInstrumentModi()`.
- Add `mob:GetMagicRune()`.
- Add `mob:GetMeleeRune()`.
- Add `mob:GetNumberOfHits()`.
- Add `mob:GetRootBreakChanc()`.
- Add `mob:GetSpellID()`.
- Add `mob:GetTicsRemaining()`.
- Add `mob:GetVirusSpreadTim()`.
- Add `mob:IsCasterClient()`.
- Add `mob:IsPersistentBuff()`.
- Add `mob:SendsClientUpdate()`.

- Adds support for `Buffs_Struct` to Perl/Lua.
- Allows operators to read a mob's buff data directly to determine caster, melee rune, etc.

* Fix GetCasterID() to proper data type.

* Remove Lua_Buffs, return table instead.

* Cleanup
2024-03-13 23:38:15 -04:00
Alex King b29c26becb [Bug Fix] Fix GetLeaderName() for Groups (#4184)
* [Bug Fix] Fix GetLeaderName() for Groups

# Notes
- We were getting bogus data in this.
- Made it its own method.

* Remove ExpeditionRequest::GetGroupLeaderName()
2024-03-13 21:52:02 -04:00
Alex King e48dae2392 [Quest API] Add Silent Saylink Methods to Perl/Lua (#4177)
# Perl
- Add `quest::silent_saylink(text)`.
- Add `quest::silent_saylink(text, link_name)`.

# Lua
- Add `eq.silent_say_link(text)`.
- Add `eq.silent_say_link(text, link_name)`.

# Notes
- Allows operators to more easily use silent saylinks without an optional silent parameter in the traditional saylink methods.
- Sets `silent` parameter default to `false` so we do not need to pass `false` when we are not using a a silent saylink.
- Changes all places that used `EQ::SayLinkEngine::GenerateQuestSaylink` to `Saylink::Create` where possible.
- Removed `questmgr` method that is no longer necessary.
- Cleaned up Lua methods to use the strings directly instead of building one out.
2024-03-13 20:27:44 -04:00
Alex King 4b83a96f64 [Bug Fix] Fix Empty Groups When Removing Bots (#4178)
# Notes
- We were checking for the incorrect value, meaning you could end up in an empty group.
2024-03-13 20:27:38 -04:00
Alex King 95cc22ffbb [Quest API] Add GetDeityName() to Perl/Lua (#4180)
# Perl
- Add `$mob->GetDeityName()`.

# Lua
- Add `mob:GetDeityName()`.

# Notes
- Allows operators to get a mob's deity name.
2024-03-13 20:27:31 -04:00
nytmyr 6ca11256c6 [Bots] IsValidTarget Crash Fix (#4187)
* [Bots] IsValidTarget crash fix

This addresses crashes related to IsValidTarget on multiple servers.

Unsure of the exact reason if anyone can explain why changing from const bool to bool in this situation fixes the problem.

Is it because the const is somehow crashing on a bad pointer or is it attempting to be force changed?

* Update bot.cpp

---------

Co-authored-by: Alex King <89047260+Kinglykrab@users.noreply.github.com>
2024-03-12 12:34:27 -04:00
Alex King d94493468c [Bug Fix] Fix Mob::CalculateDistance(mob) Typo (#4183)
# Notes
- Was using `GetX()` for all parts of the calculation, meaning it would produce incorrect values.
- Part of [this](https://github.com/EQEmu/Server/pull/3455/files#diff-94a8e3b04f001e4f74ce2da8404cbce7653146d963a3b93be6536505035ce96dR602-R607).
2024-03-09 22:20:02 -05:00
Alex King 957b4f8821 [Bug Fix] Fix Crash in ClientList::GetCLEIP (#4173)
* [Bug Fix] Fix Crash in ClientList::GetCLEIP

# Notes
- We were not validating pointer when moving to next iterator.

# Crashes
https://spire.akkadius.com/dev/release/22.46.1?id=19955
https://spire.akkadius.com/dev/release/22.46.1?id=19948
https://spire.akkadius.com/dev/release/22.46.0?id=19945

* Update clientlist.cpp

* Update clientlist.cpp
2024-03-09 19:47:58 -05:00
Alex King 5013459824 [Hot Fix] Add bool return to fix Client::RemoveAAPoints (#4176)
# Notes
- Was missing the `return true;` at the bottom.
2024-03-09 10:07:13 -05:00
Alex King 94af2843e3 [Cleanup] Cleanup Zone Get Methods (#4169)
# Notes
- Utilize `GetZoneVersionWithFallback` to shorten methods and reduce duplicate code.
2024-03-08 21:22:11 -05:00
Alex King 3bfb148bdc [Quest API] Add RemoveAAPoints() and AA Loss Event to Perl/Lua (#4174)
* [Quest API] Add RemoveAAPoints() and AA Loss Event to Perl/Lua

# Perl
- Add `$client->RemoveAAPoints(points)`.
- Add `EVENT_AA_LOSS`, exports `$aa_lost`.

# Lua
- Add `client:RemoveAAPoints(points)`.
- Add `event_aa_loss`, exports `e.aa_lost`.

# Notes
- Allows operators to more easily remove AA Points.
- Has a bool return type that will return false if the player does not have enough AA Points to complete the removal.

* Update client.cpp
2024-03-08 21:20:33 -05:00
MortimerGreenwald 96370e0298 [Bug Fix] An Update to Xtarget to exclude Bot owned Temp/Swarm Pets (#4172)
* An Update to Xtarget to exclude Bot owned Temp/Swarm Pets

* Missing a parentheses

* Cleaned up logic.
2024-03-08 15:29:53 -05:00
nytmyr fef5108b0d [Bots] Move BotGroupSay to Pet Response (#4171)
* [Bots] Move BotGroupSay messages to PetResponse filter to reduce spam

* Cleanup raid checks

* Group cleanup
2024-03-08 11:46:50 -05:00
Alex King 6f883566f6 [Bug Fix] Fix Default Value in rule_values table (#4166)
# Notes
- Some versions of SQL do not allow a default value for text fields.
2024-03-07 16:41:41 -05:00
nytmyr 45b1501c8a [Quest API] Add DeleteBot() to Perl/Lua (#4167)
### Perl
- Add $bot->DeleteBot().
```
sub EVENT_SAY {
	if ($text =~/#deletebot/i && $client->Admin() >= 100) {
		my @bot_list = $entity_list->GetBotList();

		foreach $ent (@bot_list) {
			if ($ent) {
				quest::shout("Deleting " . $ent->GetCleanName());
				$ent->DeleteBot();
				$ent->Camp(0);
			}
		}
	}
}
```
### Lua
- Add bot:DeleteBot().
```
function event_say(e)
	if(e.message:findi("#deletebot")) then
		local bot_list = eq.get_entity_list():GetBotList();

		for ent in bot_list.entries do
			if (ent) then
				e.self:Message(7,"Deleting " .. ent:GetCleanName() .. "");
				ent:DeleteBot();
				ent:Camp(false);
			end
		end
	end
end
```
### Notes
- Allows operators to delete bots.
2024-03-07 06:08:17 -05:00
Akkadius 7e94f0ac72 [Release] 22.47.0 2024-03-05 22:18:16 -06:00
Chris Miles 2aa19f4cae [Release] 22.47.0 (#4164) 2024-03-05 22:04:35 -06:00
Mitch Freeman 805829f15d [Crash Fix] Added a guild_mgr check (#4163)
* CrashFix and Cleanup

* Formatting, add safe_delete

---------

Co-authored-by: Akkadius <akkadius1@gmail.com>
2024-03-05 22:00:08 -06:00
Alex King 2c2a8cdb63 [Bug Fix] Fix Character EXP Modifiers default (#4161)
# Notes
- The `-1.0f` was causing these modifiers to be set to `0.0` and when people would enable them they would get no experience.
- We now use the zone based grabbed methods when setting which will default to a value of `1.0f` if there is not a value found.
2024-03-05 21:54:07 -06:00
Chris Miles ee3d02bac6 [Zoning] Zone routing adjustment (#4162) 2024-03-05 21:53:07 -06:00
Alex King b90139bd9a [Feature] Adjust String-based Rules Length (#4138) 2024-03-05 21:52:34 -06:00
catapultam-habeo e6a3d5e1c5 [Bug Fix] Prevent NPE when creating DZ using ad-hoc version IDs (#4141)
* initial commit

* corrected based on hgtw feedback
2024-03-05 18:21:04 -05:00
Alex King 74f1eac401 [Bug Fix] Fix Spawns Not Parsing Quest on Zone Bootup (#4149)
* Update zone.cpp

* Fix

---------

Co-authored-by: Natedog2012 <jwalters_06@yahoo.com>
2024-03-05 18:20:42 -05:00
JJ 1be9b2cdfd [Bug Fix] Fix typo when updating spawn events in spawn condition manager (#4160) 2024-03-05 05:44:38 -05:00
Mitch Freeman add0a8dddf [Bug Fix] Add id to the guild_bank table (#4155)
* Add id to guild_bank table

Add id as a primary key to guild_bank

* Remove content schema update flag
2024-03-04 19:02:35 -05:00
catapultam-habeo 8c226054e7 [Feature] Adds rules to control level requirements for Double Backstab, Assassinate, and Double Bowshot (#29) (#4159)
Co-authored-by: mute <natanx@gmail.com>
2024-03-04 18:41:25 -05:00
Mitch Freeman b4605f77e3 [Crash Fix] Goto Command could crash using Developer Tools (#4158) 2024-03-03 22:33:12 -05:00
Mitch Freeman 74a63daf7e [Crash Fix] Groundspawn Memory Corruption (#4157) 2024-03-03 22:32:29 -05:00
Alex King 8ee7910569 [Quest API] Add IsAlwaysAggro() to Perl/Lua (#4152)
- Add `$mob->IsAlwaysAggro()`.

- Add `mob:IsAlwaysAggro()`.

- Allows operators to determine if a mob is set to always aggro.
2024-03-03 20:40:20 -05:00
Alex King b766a79c11 [Quest API] Add GetHeroicStrikethrough() to Perl/Lua (#4150)
- Add `$mob->GetHeroicStrikethrough()`.

- Add `mob:GetHeroicStrikethrough()`.

- Allows operators to get a mob's Heroic Strikethrough.
2024-03-03 13:05:01 -05:00
Alex King 5e3b6d363a [Quest API] Add IsBoat()/IsControllableBoat() to Perl/Lua (#4151)
- Add `$mob->IsBoat()`.
- Add `$mob->IsControllableBoat()`.

- Add `mob:IsBoat()`.
- Add `mob:IsControllableBoat()`.

- Allows operators to determine if a mob is a boat or a controllable boat.
2024-03-03 12:34:21 -05:00
Alex King b2fc59878a [Quest API] Add IsDestructibleObject() to Perl/Lua (#4153)
# Perl
- Add `$mob-.IsDestructibleObject()`.

# Lua
- Add `mob:IsDestructibleObject()`.

# Notes
- Allows operators to determine if a mob is a destructible object.
2024-03-03 11:43:54 -05:00
JJ 4896688ac5 [Release] 22.46.1 (#4148)
### Fixes

* Change `UnburyCorpse` to use repository methods ([#4147](https://github.com/EQEmu/Server/pull/4147)) @joligario 2024-03-03
2024-03-02 19:56:29 -05:00
JJ 0385ed8526 [Bug Fix] Change UnburyCorpse to use repository methods (#4147) 2024-03-02 19:23:43 -05:00
Chris Miles 9974aaff57 [Release] 22.46.0 (#4146) 2024-03-02 15:21:32 -06:00
Chris Miles b6c3e549da [Zone] Zone Routing Improvements (#4142)
* Routing changes

* Update world_content_service.cpp

* Cleanup routing logic

* Tweaks
2024-03-02 15:19:42 -06:00
Alex King 70ee95efc0 [Quest API] Add Bot Special Attacks for Immune Aggro/Damage (#4108)
* [Quest API] Add Bot Special Attacks for Immune Aggro/Damage

# Notes
- Adds `IMMUNE_AGGRO_BOT` and `IMMUNE_DAMAGE_BOT` for uses in special abilities.

* Cleanup

* Update attack.cpp
2024-03-02 15:19:31 -06:00
Alex King 1d38e473d7 [Bug Fix] GetBotNameByID Temporary Reference Warning (#4145)
# Notes
- We were getting a warning for returning `std::string()` from this method as it's a temporary reference.
- Change from `const std::string&` to `const std::string` to avoid this.
```
/home/eqemu/source/zone/bot_database.cpp: In member function ‘const std::string& BotDatabase::GetBotNameByID(uint32)’:
/home/eqemu/source/zone/bot_database.cpp:2374:25: warning: returning reference to temporary [-Wreturn-local-addr]
 2374 |         return e.bot_id ? e.name : std::string();
```
2024-03-02 15:18:57 -06:00
Alex King 1aa3a4b11a [Bug Fix] Fix Bots/Bot Pets ending up on XTargets (#4132)
* [XTargets]

* Update eqemu_logsys.h

* Update client.cpp

* Update table column

* Undo unnecessary commit
2024-03-02 15:18:37 -06:00
Mitch Freeman 398ecbc8cf [Bug Fix] Update FreeGuildID Routine (#4143)
Updates the routine to determine a free guild id on guild creation
2024-03-02 15:17:28 -06:00
Mitch Freeman c4613e1b0f [Crash Fix] Update to location of qGlobals initialization (#4144) 2024-03-02 15:16:51 -06:00
catapultam-habeo 3003a59955 [Feature] Exempt a zone from IP-limit checks. (#4137)
* Exempt zone from IP checks

* [Feature] Add Support for String-based Rules

# Notes
- Add support for string-based rules.

# Images

* convert to comma-seperated list

* Forgot to convert the zone to a string

* Update lua_general.cpp

* fixed rule name

* use the local string methods instead

* I think this will work as desired without the extra condition

---------

Co-authored-by: Kinglykrab <kinglykrab@gmail.com>
2024-03-01 23:11:34 -05:00
Paul Coene 0c582cc4f9 [Bug Fix] Cleanup NPC Mana Tap Logic (#4134)
* [Bug Fix] Cleanup NPC Mana Tap Logic

Mana Tap rule logic was invalid - Cleaned up and simplified, either we care about npc mana or we dont.

* Updated for bypass all rule

* Change so melee targets get blocked even with requiremana rule off

---------

Co-authored-by: Trust <fryguy503@gmail.com>
2024-03-01 22:48:50 -05:00
Mitch Freeman 69c42510ca [Crash Fix] Raid::UpdateGroupAAs (#4139)
Added checks to potentially resolve a crash situation with raids and group AAs.
2024-03-01 22:46:16 -05:00
JJ 79c8858ec8 [Bug Fix] Use std::clamp for Mob::ChangeSize (#4140)
Helper template was not deducing float for lower/upper values allowing invalid sizes
Limit to sane values of 1-255 unrestricted and 3-15 for clients and pets
2024-03-01 22:46:00 -05:00
Alex King c3d8d423fe [Commands] Add #fish Command (#4136)
* [Commands] Add #fish Command

# Notes
- Adds `#fish` command.
- Allows operators to simulate fishing to see what they would get, consumes no bait.

* `use_bait`

* Update fish.cpp
2024-02-29 21:24:16 -05:00
Alex King 1cbda61891 [Bug Fix] Fix issue with NPC Secondary Textures (#4129)
* [Bug Fix] Fix issue with NPC heads

# Notes
- We were overwriting head material within this secondary loop which caused NPC's heads to show their body texture in some places or no texture if their `showhelm` was not flagged.

# Images

* Update mob.cpp

* Update mob.cpp

* Update mob.cpp
2024-02-29 20:45:54 -05:00
JJ 8d12a5b1b1 [Release] 22.45.1 (#4135)
### Character Creation

* Improved Random Name Generator ([#4081](https://github.com/EQEmu/Server/pull/4081)) @catapultam-habeo 2024-02-27

### Code

* Fix Server Rules Documentation Generation ([#4125](https://github.com/EQEmu/Server/pull/4125)) @Kinglykrab 2024-02-26
* Remove unnecessary stoptimer logs ([#4128](https://github.com/EQEmu/Server/pull/4128)) @Kinglykrab 2024-02-28

### Commands

* Add `#forage` command ([#4133](https://github.com/EQEmu/Server/pull/4133)) @joligario 2024-02-29

### Crash

* Fix crash issue during database dump ([#4127](https://github.com/EQEmu/Server/pull/4127)) @Akkadius 2024-02-29

### Crash Fix

* D20 crash if mitigation average resulted in 0 ([#4131](https://github.com/EQEmu/Server/pull/4131)) @nytmyr 2024-02-29

### Fixes

* Fix forage returning first result from table ([#4130](https://github.com/EQEmu/Server/pull/4130)) @nytmyr 2024-02-29
* Who /all displays incorrect guild name ([#4123](https://github.com/EQEmu/Server/pull/4123)) @neckkola 2024-02-25

### Quest API

* Add Pet Owner Methods to Perl/Lua ([#4115](https://github.com/EQEmu/Server/pull/4115)) @Kinglykrab 2024-02-25
2024-02-29 18:22:40 -05:00
JJ 182327b385 [Commands] Add #forage command (#4133) 2024-02-28 20:43:14 -05:00
Chris Miles aa0ca88d9d [Crash] Fix crash issue during database dump (#4127) 2024-02-28 20:36:06 -05:00
nytmyr 103a37e762 [Crash Fix] D20 crash if mitigation average resulted in 0 (#4131) 2024-02-28 20:35:56 -05:00
nytmyr 34f19489d0 [Hotfix] Fix forage returning first result from table (#4130)
Forage was not properly incrementing the total chance of items when more than one was found and would result in the final chance roll being based off the last item found rather than the total. This would cause the first item returned to be chosen in most cases when the chances are the same in the table.
2024-02-28 20:34:40 -05:00
Alex King c001060429 [Cleanup] Remove unnecessary stoptimer logs (#4128)
# Notes
- These logs were for testing and are unnecessary.
- They cause a lot of spam for servers using `Info` logs.
2024-02-27 21:35:51 -05:00
catapultam-habeo 89be55254e [Character Creation] Improved Random Name Generator (#4081)
* test against vanilla branch

* use existing methods to validate name instead of raw sql

* Revert "use existing methods to validate name instead of raw sql"

This reverts commit 43750c6f4f.

* ReserveName doesn't work like that. Oops. Well, check against Name Filter at least.

* That db access condition was wrong.

* that isn't how CheckNameFilter works, either.

* apply editorconfig w/ trivial change

* Actually apply editorconfig changes.
2024-02-26 23:15:40 -06:00
Alex King 2da6190950 [Cleanup] Fix Server Rules Documentation Generation (#4125)
# Notes
- These spaces prevented the docs server rules generator from parsing these rules.
2024-02-26 18:36:12 -05:00
Mitch Freeman d5e024cc02 [Bug Fix] Who /all displays incorrect guild name (#4123)
Issue: guild creation routine does not update world memory holding guild details until the player zones.

Between the creation of a new guild, and a guild member zones, a /who all displays 'Invalid Guild' instead of the actual guild name.
2024-02-25 18:14:28 -05:00
107 changed files with 2415 additions and 1484 deletions
+169
View File
@@ -1,3 +1,172 @@
## [22.48.0] 3/23/2024
### Bots
* IsValidTarget Crash Fix ([#4187](https://github.com/EQEmu/Server/pull/4187)) @nytmyr 2024-03-12
* Move BotGroupSay to Pet Response ([#4171](https://github.com/EQEmu/Server/pull/4171)) @nytmyr 2024-03-08
### Code
* Cleanup Zone Get Methods ([#4169](https://github.com/EQEmu/Server/pull/4169)) @Kinglykrab 2024-03-09
### Fixes
* An Update to Xtarget to exclude Bot owned Temp/Swarm Pets ([#4172](https://github.com/EQEmu/Server/pull/4172)) @MortimerGreenwald 2024-03-08
* Fix #serverrules Command ([#4193](https://github.com/EQEmu/Server/pull/4193)) @Kinglykrab 2024-03-20
* Fix Bot Cloning ([#4186](https://github.com/EQEmu/Server/pull/4186)) @Kinglykrab 2024-03-17
* Fix Crash in ClientList::GetCLEIP ([#4173](https://github.com/EQEmu/Server/pull/4173)) @Kinglykrab 2024-03-10
* Fix Default Value in `rule_values` table ([#4166](https://github.com/EQEmu/Server/pull/4166)) @Kinglykrab 2024-03-07
* Fix EVENT_KILLED_MERIT firing before NPC removal ([#4185](https://github.com/EQEmu/Server/pull/4185)) @Kinglykrab 2024-03-17
* Fix Empty Groups When Removing Bots ([#4178](https://github.com/EQEmu/Server/pull/4178)) @Kinglykrab 2024-03-14
* Fix GetLeaderName() for Groups ([#4184](https://github.com/EQEmu/Server/pull/4184)) @Kinglykrab 2024-03-14
* Fix Mob::CalculateDistance(mob) Typo ([#4183](https://github.com/EQEmu/Server/pull/4183)) @Kinglykrab 2024-03-10
* Fix Proximity Say ([#4189](https://github.com/EQEmu/Server/pull/4189)) @Kinglykrab 2024-03-15
* Fix ScaleNPC() in Perl ([#4196](https://github.com/EQEmu/Server/pull/4196)) @Kinglykrab 2024-03-23
* Fix range_percent ([#4197](https://github.com/EQEmu/Server/pull/4197)) @Kinglykrab 2024-03-22
* Fix reusing timers ([#4199](https://github.com/EQEmu/Server/pull/4199)) @joligario 2024-03-23
### Hot Fix
* Add bool return to fix Client::RemoveAAPoints ([#4176](https://github.com/EQEmu/Server/pull/4176)) @Kinglykrab 2024-03-09
### Loot
* Fix issue with nested data being loaded multiple times ([#4192](https://github.com/EQEmu/Server/pull/4192)) @Akkadius 2024-03-23
### Misc
* Windows preprocessor define in crash.cpp ([#4191](https://github.com/EQEmu/Server/pull/4191)) @joligario 2024-03-23
### Quest API
* Add Buff Support to Perl/Lua ([#4182](https://github.com/EQEmu/Server/pull/4182)) @Kinglykrab 2024-03-14
* Add DeleteBot() to Perl/Lua ([#4167](https://github.com/EQEmu/Server/pull/4167)) @nytmyr 2024-03-07
* Add GetDeityName() to Perl/Lua ([#4180](https://github.com/EQEmu/Server/pull/4180)) @Kinglykrab 2024-03-14
* Add RemoveAAPoints() and AA Loss Event to Perl/Lua ([#4174](https://github.com/EQEmu/Server/pull/4174)) @Kinglykrab 2024-03-09
* Add RemoveAlternateCurrencyValue() to Perl/Lua ([#4190](https://github.com/EQEmu/Server/pull/4190)) @Kinglykrab 2024-03-17
* Add Restore Methods for Health, Mana, and Endurance to Perl/Lua ([#4179](https://github.com/EQEmu/Server/pull/4179)) @Kinglykrab 2024-03-23
* Add Silent Saylink Methods to Perl/Lua ([#4177](https://github.com/EQEmu/Server/pull/4177)) @Kinglykrab 2024-03-14
### Rules
* Add World:Rules Rule ([#4194](https://github.com/EQEmu/Server/pull/4194)) @Kinglykrab 2024-03-23
### Tradeskills
* Implement learning recipes from books ([#4170](https://github.com/EQEmu/Server/pull/4170)) @hgtw 2024-03-23
## [22.47.0] 3/5/2024
### Crash Fix
* Added a guild_mgr check ([#4163](https://github.com/EQEmu/Server/pull/4163)) @neckkola 2024-03-06
* Goto Command could crash using Developer Tools ([#4158](https://github.com/EQEmu/Server/pull/4158)) @neckkola 2024-03-04
* Groundspawn Memory Corruption ([#4157](https://github.com/EQEmu/Server/pull/4157)) @neckkola 2024-03-04
* Update to location of qGlobals initialization ([#4144](https://github.com/EQEmu/Server/pull/4144)) @neckkola 2024-03-02
### Feature
* Adds rules to control level requirements for Double Backstab, Assassinate, and Double Bowshot (#4159) ([#29](https://github.com/EQEmu/Server/pull/29)) @catapultam-habeo 2024-03-04
* Adjust String-based Rules Length ([#4138](https://github.com/EQEmu/Server/pull/4138)) @Kinglykrab 2024-03-06
* Exempt a zone from IP-limit checks. ([#4137](https://github.com/EQEmu/Server/pull/4137)) @catapultam-habeo 2024-03-02
### Fixes
* Add id to the guild_bank table ([#4155](https://github.com/EQEmu/Server/pull/4155)) @neckkola 2024-03-05
* Fix Bots/Bot Pets ending up on XTargets ([#4132](https://github.com/EQEmu/Server/pull/4132)) @Kinglykrab 2024-03-02
* Fix Character EXP Modifiers default ([#4161](https://github.com/EQEmu/Server/pull/4161)) @Kinglykrab 2024-03-06
* Fix Spawns Not Parsing Quest on Zone Bootup ([#4149](https://github.com/EQEmu/Server/pull/4149)) @Kinglykrab 2024-03-05
* Fix typo when updating spawn events in spawn condition manager ([#4160](https://github.com/EQEmu/Server/pull/4160)) @joligario 2024-03-05
* GetBotNameByID Temporary Reference Warning ([#4145](https://github.com/EQEmu/Server/pull/4145)) @Kinglykrab 2024-03-02
* Prevent NPE when creating DZ using ad-hoc version IDs ([#4141](https://github.com/EQEmu/Server/pull/4141)) @catapultam-habeo 2024-03-05
* Update FreeGuildID Routine ([#4143](https://github.com/EQEmu/Server/pull/4143)) @neckkola 2024-03-02
### Quest API
* Add Bot Special Attacks for Immune Aggro/Damage ([#4108](https://github.com/EQEmu/Server/pull/4108)) @Kinglykrab 2024-03-02
* Add GetHeroicStrikethrough() to Perl/Lua ([#4150](https://github.com/EQEmu/Server/pull/4150)) @Kinglykrab 2024-03-03
* Add IsAlwaysAggro() to Perl/Lua ([#4152](https://github.com/EQEmu/Server/pull/4152)) @Kinglykrab 2024-03-04
* Add IsBoat()/IsControllableBoat() to Perl/Lua ([#4151](https://github.com/EQEmu/Server/pull/4151)) @Kinglykrab 2024-03-03
* Add IsDestructibleObject() to Perl/Lua ([#4153](https://github.com/EQEmu/Server/pull/4153)) @Kinglykrab 2024-03-03
### Zone
* Zone Routing Improvements ([#4142](https://github.com/EQEmu/Server/pull/4142)) @Akkadius 2024-03-02
### Zoning
* Zone routing adjustment ([#4162](https://github.com/EQEmu/Server/pull/4162)) @Akkadius 2024-03-06
## [22.46.1] 3/2/2024
### Fixes
* Change `UnburyCorpse` to use repository methods ([#4147](https://github.com/EQEmu/Server/pull/4147)) @joligario 2024-03-03
## [22.46.0] 3/2/2024
### Commands
* Add #fish Command ([#4136](https://github.com/EQEmu/Server/pull/4136)) @Kinglykrab 2024-03-01
### Crash Fix
* Raid::UpdateGroupAAs ([#4139](https://github.com/EQEmu/Server/pull/4139)) @neckkola 2024-03-02
* Update to location of qGlobals initialization ([#4144](https://github.com/EQEmu/Server/pull/4144)) @neckkola 2024-03-02
### Feature
* Exempt a zone from IP-limit checks. ([#4137](https://github.com/EQEmu/Server/pull/4137)) @catapultam-habeo 2024-03-02
### Fixes
* Cleanup NPC Mana Tap Logic ([#4134](https://github.com/EQEmu/Server/pull/4134)) @noudess 2024-03-02
* Fix Bots/Bot Pets ending up on XTargets ([#4132](https://github.com/EQEmu/Server/pull/4132)) @Kinglykrab 2024-03-02
* Fix issue with NPC Secondary Textures ([#4129](https://github.com/EQEmu/Server/pull/4129)) @Kinglykrab 2024-03-01
* GetBotNameByID Temporary Reference Warning ([#4145](https://github.com/EQEmu/Server/pull/4145)) @Kinglykrab 2024-03-02
* Update FreeGuildID Routine ([#4143](https://github.com/EQEmu/Server/pull/4143)) @neckkola 2024-03-02
* Use std::clamp for Mob::ChangeSize ([#4140](https://github.com/EQEmu/Server/pull/4140)) @joligario 2024-03-02
### Quest API
* Add Bot Special Attacks for Immune Aggro/Damage ([#4108](https://github.com/EQEmu/Server/pull/4108)) @Kinglykrab 2024-03-02
### Zone
* Zone Routing Improvements ([#4142](https://github.com/EQEmu/Server/pull/4142)) @Akkadius 2024-03-02
## [22.45.1] 2/29/2024
### Character Creation
* Improved Random Name Generator ([#4081](https://github.com/EQEmu/Server/pull/4081)) @catapultam-habeo 2024-02-27
### Code
* Fix Server Rules Documentation Generation ([#4125](https://github.com/EQEmu/Server/pull/4125)) @Kinglykrab 2024-02-26
* Remove unnecessary stoptimer logs ([#4128](https://github.com/EQEmu/Server/pull/4128)) @Kinglykrab 2024-02-28
### Commands
* Add `#forage` command ([#4133](https://github.com/EQEmu/Server/pull/4133)) @joligario 2024-02-29
### Crash
* Fix crash issue during database dump ([#4127](https://github.com/EQEmu/Server/pull/4127)) @Akkadius 2024-02-29
### Crash Fix
* D20 crash if mitigation average resulted in 0 ([#4131](https://github.com/EQEmu/Server/pull/4131)) @nytmyr 2024-02-29
### Fixes
* Fix forage returning first result from table ([#4130](https://github.com/EQEmu/Server/pull/4130)) @nytmyr 2024-02-29
* Who /all displays incorrect guild name ([#4123](https://github.com/EQEmu/Server/pull/4123)) @neckkola 2024-02-25
### Quest API
* Add Pet Owner Methods to Perl/Lua ([#4115](https://github.com/EQEmu/Server/pull/4115)) @Kinglykrab 2024-02-25
## [22.45.0] 2/24/2024
### Beacon
+83 -42
View File
@@ -178,12 +178,13 @@ void WorldContentService::ReloadContentFlags()
LogInfo(
"Loaded content flag [{}] [{}]",
f.flag_name,
(f.enabled ? "Enabled" : "Disabled")
(f.enabled ? "enabled" : "disabled")
);
}
SetContentFlags(set_content_flags);
SetContentZones(ZoneRepository::All(*m_content_database));
LoadZones();
LoadStaticGlobalZoneInstances();
}
Database *WorldContentService::GetDatabase() const
@@ -235,19 +236,6 @@ void WorldContentService::SetContentFlag(const std::string &content_flag_name, b
ReloadContentFlags();
}
// SetZones sets the zones for the world content service
// this is used for zone routing middleware
// we pull the zone list from the zone repository and feed from the zone store for now
// we're holding a copy in the content service - but we're talking 250kb of data in memory to handle routing of zoning
WorldContentService *WorldContentService::SetContentZones(const std::vector<BaseZoneRepository::Zone>& zones)
{
m_zones = zones;
LogInfo("Loaded [{}] zones", m_zones.size());
return this;
}
// HandleZoneRoutingMiddleware is meant to handle content and context aware zone routing
//
// example # 1
@@ -260,16 +248,57 @@ WorldContentService *WorldContentService::SetContentZones(const std::vector<Base
// scripts handle all the same way, you don't have to think about instances, the middleware will handle the magic
// the versions of zones are represented by two zone entries that have potentially different min/max expansion and/or different content flags
// we decide to route the client to the correct version of the zone based on the current server side expansion
// example # 2
void WorldContentService::HandleZoneRoutingMiddleware(ZoneChange_Struct *zc)
{
// if we're already in an instance, we don't want to route the player to another instance
if (zc->instanceID > 0) {
auto r = FindZone(zc->zoneID, zc->instanceID);
if (r.zone_id == 0) {
return;
}
zc->instanceID = r.instance.id;
}
// LoadStaticGlobalZoneInstances loads all static global zone instances
// these are zones that are never set to expire and are global
// these are used commonly in v1/v2/v3 versions of the same zone for expansion routing
WorldContentService * WorldContentService::LoadStaticGlobalZoneInstances()
{
m_zone_instances = InstanceListRepository::GetWhere(*GetDatabase(), fmt::format("never_expires = 1 AND is_global = 1"));
LogInfo("Loaded [{}] zone_instances", m_zone_instances.size());
return this;
}
// LoadZones sets the zones for the world content service
// this is used for zone routing middleware
// we pull the zone list from the zone repository and feed from the zone store for now
// we're holding a copy in the content service - but we're talking 250kb of data in memory to handle routing of zoning
WorldContentService * WorldContentService::LoadZones()
{
m_zones = ZoneRepository::All(*GetContentDatabase());
LogInfo("Loaded [{}] zones", m_zones.size());
return this;
}
// FindZone is critical to the zone routing middleware and any logic that needs to route players to the correct zone
// era contextual routing, multiple version of zones, etc
WorldContentService::FindZoneResult WorldContentService::FindZone(uint32 zone_id, uint32 instance_id)
{
// if there's an active dynamic instance, we don't need to route
if (instance_id > 0) {
auto inst = InstanceListRepository::FindOne(*GetDatabase(), instance_id);
if (inst.id != 0 && !inst.is_global && !inst.never_expires) {
return WorldContentService::FindZoneResult{
.zone_id = 0,
};
}
}
for (auto &z: m_zones) {
if (z.zoneidnumber == zc->zoneID) {
if (z.zoneidnumber == zone_id) {
auto f = ContentFlags{
.min_expansion = z.min_expansion,
.max_expansion = z.max_expansion,
@@ -286,33 +315,45 @@ void WorldContentService::HandleZoneRoutingMiddleware(ZoneChange_Struct *zc)
z.long_name
);
auto instances = InstanceListRepository::GetWhere(
*GetDatabase(),
fmt::format(
"zone = {} AND version = {} AND never_expires = 1 AND is_global = 1",
z.zoneidnumber,
z.version
)
// first pass, explicit match on public static global zone instances
for (auto &i: m_zone_instances) {
if (i.zone == zone_id && i.version == z.version) {
LogInfo(
"Routed player to instance [{}] of zone [{}] ({}) version [{}] long_name [{}] notes [{}]",
i.id,
z.short_name,
z.zoneidnumber,
z.version,
z.long_name,
i.notes
);
return WorldContentService::FindZoneResult{
.zone_id = static_cast<uint32>(z.zoneidnumber),
.instance = i,
.zone = z
};
}
}
LogInfo(
"Routed player to non-instance zone [{}] ({}) version [{}] long_name [{}] notes [{}]",
z.short_name,
z.zoneidnumber,
z.version,
z.long_name,
z.note
);
if (!instances.empty()) {
auto instance = instances.front();
zc->instanceID = instance.id;
LogInfo(
"Routed player to instance [{}] of zone [{}] ({}) version [{}] long_name [{}] notes [{}]",
instance.id,
z.short_name,
z.zoneidnumber,
z.version,
z.long_name,
instance.notes
);
break;
}
return WorldContentService::FindZoneResult{
.zone_id = static_cast<uint32>(z.zoneidnumber),
.instance = InstanceListRepository::NewEntity(),
.zone = z
};
}
}
}
return WorldContentService::FindZoneResult{.zone_id = 0};
}
+12 -1
View File
@@ -5,6 +5,7 @@
#include <vector>
#include "../repositories/content_flags_repository.h"
#include "../repositories/zone_repository.h"
#include "../repositories/instance_list_repository.h"
class Database;
@@ -169,7 +170,14 @@ public:
void SetContentFlag(const std::string &content_flag_name, bool enabled);
void HandleZoneRoutingMiddleware(ZoneChange_Struct *zc);
WorldContentService * SetContentZones(const std::vector<ZoneRepository::Zone>& zones);
struct FindZoneResult {
uint32 zone_id = 0;
InstanceListRepository::InstanceList instance;
ZoneRepository::Zone zone;
};
FindZoneResult FindZone(uint32 zone_id, uint32 instance_id);
private:
int current_expansion{};
std::vector<ContentFlagsRepository::ContentFlags> content_flags;
@@ -180,6 +188,9 @@ private:
// holds a record of the zone table from the database
std::vector<ZoneRepository::Zone> m_zones = {};
WorldContentService *LoadStaticGlobalZoneInstances();
std::vector<InstanceListRepository::InstanceList> m_zone_instances;
WorldContentService * LoadZones();
};
extern WorldContentService content_service;
+1 -1
View File
@@ -15,7 +15,7 @@
#include <cstdio>
#include <vector>
#if WINDOWS
#ifdef _WINDOWS
#define popen _popen
#endif
+18
View File
@@ -1389,6 +1389,24 @@ void Database::SetGroupLeaderName(uint32 gid, const char* name) {
}
}
std::string Database::GetGroupLeaderName(uint32 group_id)
{
const std::string& query = fmt::format(
"SELECT `leadername` FROM `group_leaders` WHERE `gid` = {}",
group_id
);
auto results = QueryDatabase(query);
if (!results.Success() || !results.RowCount()) {
return std::string();
}
auto row = results.begin();
return row[0];
}
char *Database::GetGroupLeadershipInfo(uint32 gid, char* leaderbuf, char* maintank, char* assist, char* puller, char *marknpc, char *mentoree, int *mentor_percent, GroupLeadershipAA_Struct* GLAA)
{
std::string query = StringFormat("SELECT `leadername`, `maintank`, `assist`, `puller`, `marknpc`, `mentoree`, `mentor_percent`, `leadershipaa` FROM `group_leaders` WHERE `gid` = %lu",(unsigned long)gid);
+2
View File
@@ -205,6 +205,8 @@ public:
std::string GetGroupLeaderForLogin(std::string character_name);
char* GetGroupLeadershipInfo(uint32 gid, char* leaderbuf, char* maintank = nullptr, char* assist = nullptr, char* puller = nullptr, char *marknpc = nullptr, char *mentoree = nullptr, int *mentor_percent = nullptr, GroupLeadershipAA_Struct* GLAA = nullptr);
std::string GetGroupLeaderName(uint32 group_id);
uint32 GetGroupID(const char* name);
void ClearGroup(uint32 gid = 0);
+6 -1
View File
@@ -575,7 +575,12 @@ void DatabaseDumpService::RemoveSqlBackup()
{
std::string file = fmt::format("{}.sql", GetDumpFileNameWithPath());
if (File::Exists(file)) {
std::filesystem::remove(file);
try {
std::filesystem::remove(file);
}
catch (std::exception &e) {
LogError("std::filesystem::remove err [{}]", e.what());
}
}
RemoveCredentialsFile();
@@ -5410,6 +5410,29 @@ ADD COLUMN `augment_five` int(11) UNSIGNED NOT NULL DEFAULT 0 AFTER `augment_fou
ADD COLUMN `augment_six` int(11) UNSIGNED NOT NULL DEFAULT 0 AFTER `augment_five`;
)",
.content_schema_update = true
},
ManifestEntry{
.version = 9265,
.description = "2024_03_03_add_id_to_guild_bank.sql",
.check = "SHOW COLUMNS FROM `guild_bank` LIKE 'id'",
.condition = "empty",
.match = "",
.sql = R"(
ALTER TABLE `guild_bank`
ADD COLUMN `id` INT UNSIGNED NOT NULL AUTO_INCREMENT FIRST,
ADD PRIMARY KEY (`id`);
)",
},
ManifestEntry{
.version = 9266,
.description = "2024_03_02_rule_values_rule_value_length.sql",
.check = "SHOW COLUMNS FROM `rule_values` LIKE 'rule_value'",
.condition = "contains",
.match = "varchar(30)",
.sql = R"(
ALTER TABLE `rule_values`
MODIFY COLUMN `rule_value` text CHARACTER SET latin1 COLLATE latin1_swedish_ci NULL DEFAULT NULL AFTER `rule_name`;
)"
}
// -- template; copy/paste this when you need to create a new entry
// ManifestEntry{
+2
View File
@@ -698,6 +698,8 @@ const std::map<uint32, std::string>& EQ::constants::GetSpecialAbilityMap()
{ IMMUNE_OPEN, "Immune to Open" },
{ IMMUNE_ASSASSINATE, "Immune to Assassinate" },
{ IMMUNE_HEADSHOT, "Immune to Headshot" },
{ IMMUNE_AGGRO_BOT, "Immune to Bot Aggro" },
{ IMMUNE_DAMAGE_BOT, "Immune to Bot Damage" },
};
return special_ability_map;
+3 -1
View File
@@ -656,7 +656,9 @@ enum {
IMMUNE_OPEN = 53,
IMMUNE_ASSASSINATE = 54,
IMMUNE_HEADSHOT = 55,
MAX_SPECIAL_ATTACK = 56
IMMUNE_AGGRO_BOT = 56,
IMMUNE_DAMAGE_BOT = 57,
MAX_SPECIAL_ATTACK = 58
};
+2
View File
@@ -141,6 +141,7 @@ namespace Logs {
Zoning,
EqTime,
Corpses,
XTargets,
MaxCategoryID /* Don't Remove this */
};
@@ -241,6 +242,7 @@ namespace Logs {
"Zoning",
"EqTime",
"Corpses",
"XTargets"
};
}
+10
View File
@@ -834,6 +834,16 @@
OutF(LogSys, Logs::Detail, Logs::Corpses, __FILE__, __func__, __LINE__, message, ##__VA_ARGS__);\
} while (0)
#define LogXTargets(message, ...) do {\
if (LogSys.IsLogEnabled(Logs::General, Logs::XTargets))\
OutF(LogSys, Logs::General, Logs::XTargets, __FILE__, __func__, __LINE__, message, ##__VA_ARGS__);\
} while (0)
#define LogXTargetsDetail(message, ...) do {\
if (LogSys.IsLogEnabled(Logs::Detail, Logs::XTargets))\
OutF(LogSys, Logs::Detail, Logs::XTargets, __FILE__, __func__, __LINE__, message, ##__VA_ARGS__);\
} while (0)
#define Log(debug_level, log_category, message, ...) do {\
if (LogSys.IsLogEnabled(debug_level, log_category))\
LogSys.Out(debug_level, log_category, __FILE__, __func__, __LINE__, message, ##__VA_ARGS__);\
+7 -34
View File
@@ -342,41 +342,14 @@ bool BaseGuildManager::_StoreGuildDB(uint32 guild_id)
return true;
}
uint32 BaseGuildManager::_GetFreeGuildID()
{
GuildsRepository::DeleteWhere(*m_db, "`name` = ''");
GuildsRepository::Guilds out;
out.id = 0;
out.leader = 0;
out.minstatus = 0;
out.tribute = 0;
out.name = "";
out.motd = "";
out.motd_setter = "";
out.url = "";
out.channel = "";
auto last_insert_id = GuildsRepository::InsertOne(*m_db, out);
if (last_insert_id.id > 0) {
LogGuilds("Located a free guild ID [{}] in the database", last_insert_id.id);
return last_insert_id.id;
}
LogGuilds("Unable to find a free guild ID in the database");
return GUILD_NONE;
}
uint32 BaseGuildManager::CreateGuild(std::string name, uint32 leader_char_id)
{
uint32 guild_id = UpdateDbCreateGuild(name, leader_char_id);
if (guild_id == GUILD_NONE) {
return (GUILD_NONE);
}
//RefreshGuild(guild_id);
//SendGuildRefresh(guild_id, true, false, false, false);
//SendCharRefresh(GUILD_NONE, guild_id, leader_char_id);
uint32 guild_id = UpdateDbCreateGuild(name, leader_char_id);
if (guild_id == GUILD_NONE) {
return (GUILD_NONE);
}
return guild_id;
return guild_id;
}
bool BaseGuildManager::DeleteGuild(uint32 guild_id)
@@ -539,8 +512,8 @@ bool BaseGuildManager::SetPublicNote(uint32 charid, std::string public_note)
uint32 BaseGuildManager::UpdateDbCreateGuild(std::string name, uint32 leader)
{
auto new_id = _GetFreeGuildID();
if (new_id == GUILD_NONE) {
auto new_id = GuildsRepository::GetMaxId(*m_db) + 1;
if (!new_id) {
return GUILD_NONE;
}
-1
View File
@@ -208,7 +208,6 @@ class BaseGuildManager
bool _StoreGuildDB(uint32 guild_id);
GuildInfo* _CreateGuild(uint32 guild_id, std::string guild_name, uint32 leader_char_id, uint8 minstatus, std::string guild_motd, std::string motd_setter, std::string Channel, std::string URL, uint32 favour);
uint32 _GetFreeGuildID();
GuildsRepository::Guilds CreateGuildRepoFromGuildInfo(uint32 guild_id, BaseGuildManager::GuildInfo& in);
};
#endif /*GUILD_BASE_H_*/
@@ -59,6 +59,24 @@ public:
return NewEntity();
}
// insert with ON DUPLICATE KEY UPDATE to leave rows that exist unchanged
static int InsertUpdateMany(Database& db, const std::vector<CharRecipeList>& entries)
{
std::vector<std::string> values;
values.reserve(entries.size());
for (const auto& e: entries)
{
values.emplace_back(fmt::format("({},{},{})", e.char_id, e.recipe_id, e.madecount));
}
auto results = db.QueryDatabase(fmt::format(
"INSERT INTO {0} (char_id, recipe_id, madecount) VALUES {1} ON DUPLICATE KEY UPDATE {2}={2}",
TableName(), fmt::join(values, ","), PrimaryKey()));
return results.Success() ? results.RowsAffected() : 0;
}
};
#endif //EQEMU_CHAR_RECIPE_LIST_REPOSITORY_H
@@ -213,23 +213,23 @@ public:
const glm::vec4& position
)
{
auto results = db.QueryDatabase(
fmt::format(
"UPDATE `{}` SET `is_buried` = 0, `zone_id` = {}, `instance_id` = {}, `x` = {:.2f}, `y` = {:.2f}, `z` = {:.2f}, `heading` = {:.2f}, `time_of_death` = {}, `was_at_graveyard` = 0 WHERE `{}` = {}",
TableName(),
zone_id,
instance_id,
position.x,
position.y,
position.z,
position.w,
std::time(nullptr),
PrimaryKey(),
corpse_id
)
);
auto corpse = FindOne(db, corpse_id);
return results.Success() ? results.RowsAffected() : 0;
if (corpse.id == 0) {
return 0;
}
corpse.is_buried = 0;
corpse.zone_id = zone_id;
corpse.instance_id = instance_id;
corpse.x = position.x;
corpse.y = position.y;
corpse.z = position.z;
corpse.heading = position.w;
corpse.time_of_death = time(nullptr);
corpse.was_at_graveyard = 0;
return UpdateOne(db, corpse);
}
};
@@ -74,9 +74,11 @@ public:
};
}
const auto& m = l.front();
return EXPModifier{
.aa_modifier = l[0].aa_modifier,
.exp_modifier = l[0].exp_modifier
.aa_modifier = m.aa_modifier,
.exp_modifier = m.exp_modifier
};
}
+35 -5
View File
@@ -34,8 +34,8 @@ const char *RuleManager::s_categoryNames[_CatCount + 1] = {
"InvalidCategory"
};
const RuleManager::RuleInfo RuleManager::s_RuleInfo[IntRuleCount + RealRuleCount + BoolRuleCount + 1] = {
/* this is done in three steps so we can reliably get to them by index*/
const RuleManager::RuleInfo RuleManager::s_RuleInfo[IntRuleCount + RealRuleCount + BoolRuleCount + StringRuleCount + 1] = {
/* this is done in three steps, so we can reliably get to them by index*/
#define RULE_INT(category_name, rule_name, default_value, notes) \
{ #category_name ":" #rule_name, Category__##category_name, IntRule, Int__##rule_name, notes },
#include "ruletypes.h"
@@ -45,6 +45,9 @@ const RuleManager::RuleInfo RuleManager::s_RuleInfo[IntRuleCount + RealRuleCount
#define RULE_BOOL(category_name, rule_name, default_value, notes) \
{ #category_name ":" #rule_name, Category__##category_name, BoolRule, Bool__##rule_name, notes },
#include "ruletypes.h"
#define RULE_STRING(category_name, rule_name, default_value, notes) \
{ #category_name ":" #rule_name, Category__##category_name, StringRule, String__##rule_name, notes },
#include "ruletypes.h"
{ "Invalid Rule", _CatCount, IntRule }
};
@@ -114,6 +117,9 @@ bool RuleManager::GetRule(const std::string &rule_name, std::string &rule_value)
case BoolRule:
rule_value = m_RuleBoolValues[index] ? "true" : "false";
break;
case StringRule:
rule_value = m_RuleStringValues[index];
break;
}
return true;
@@ -152,6 +158,10 @@ bool RuleManager::SetRule(const std::string &rule_name, const std::string &rule_
m_RuleBoolValues[index] = static_cast<uint32>(Strings::ToBool(rule_value));
LogRules("Set rule [{}] to value [{}]", rule_name, m_RuleBoolValues[index] == 1 ? "true" : "false");
break;
case StringRule:
m_RuleStringValues[index] = rule_value;
LogRules("Set rule [{}] to value [{}]", rule_name, rule_value);
break;
}
if (db_save) {
@@ -215,11 +225,13 @@ std::string RuleManager::_GetRuleName(RuleType type, uint16 index) {
return s_RuleInfo[index + IntRuleCount].name;
case BoolRule:
return s_RuleInfo[index + IntRuleCount + RealRuleCount].name;
case StringRule:
return s_RuleInfo[index + IntRuleCount + RealRuleCount + StringRuleCount].name;
default:
break;
}
return s_RuleInfo[IntRuleCount + RealRuleCount + BoolRuleCount].name;
return s_RuleInfo[IntRuleCount + RealRuleCount + BoolRuleCount + StringRuleCount].name;
}
//assumes index is valid!
@@ -231,11 +243,13 @@ const std::string &RuleManager::_GetRuleNotes(RuleType type, uint16 index) {
return s_RuleInfo[index + IntRuleCount].notes;
case BoolRule:
return s_RuleInfo[index + IntRuleCount + RealRuleCount].notes;
case StringRule:
return s_RuleInfo[index + IntRuleCount + RealRuleCount + StringRuleCount].notes;
default:
break;
}
return s_RuleInfo[IntRuleCount + RealRuleCount + BoolRuleCount].notes;
return s_RuleInfo[IntRuleCount + RealRuleCount + BoolRuleCount + StringRuleCount].notes;
}
bool RuleManager::LoadRules(Database *db, const std::string &rule_set_name, bool reload) {
@@ -343,6 +357,10 @@ void RuleManager::SaveRules(Database *db, const std::string &rule_set_name) {
for (i = 0; i < BoolRuleCount; i++) {
_SaveRule(db, BoolRule, i);
}
for (i = 0; i < StringRuleCount; i++) {
_SaveRule(db, StringRule, i);
}
}
void RuleManager::_SaveRule(Database *db, RuleType type, uint16 index) {
@@ -367,6 +385,9 @@ void RuleManager::_SaveRule(Database *db, RuleType type, uint16 index) {
case BoolRule:
rule_value = m_RuleBoolValues[index] ? "true" : "false";
break;
case StringRule:
rule_value = m_RuleStringValues[index];
break;
}
const auto& rule_notes = _GetRuleNotes(type, index);
@@ -446,6 +467,10 @@ bool RuleManager::UpdateInjectedRules(Database *db, const std::string &rule_set_
rule_data[r.name].first = fmt::format("{}", m_RuleBoolValues[r.rule_index] ? "true" : "false");
rule_data[r.name].second = &r.notes;
break;
case StringRule:
rule_data[r.name].first = m_RuleStringValues[r.rule_index];
rule_data[r.name].second = &r.notes;
break;
default:
break;
}
@@ -552,7 +577,7 @@ bool RuleManager::RestoreRuleNotes(Database *db)
}
}
return s_RuleInfo[IntRuleCount + RealRuleCount + BoolRuleCount];
return s_RuleInfo[IntRuleCount + RealRuleCount + BoolRuleCount + StringRuleCount];
}(e.rule_name);
if (Strings::Contains(rule.name, e.rule_name)) {
@@ -617,3 +642,8 @@ bool RuleManager::GetBoolRule(RuleManager::BoolType t) const
{
return m_RuleBoolValues[t] == 1;
}
std::string RuleManager::GetStringRule(RuleManager::StringType t) const
{
return m_RuleStringValues[t];
}
+45 -25
View File
@@ -23,6 +23,7 @@
* - RuleI(category, rule) -> fetch an integer rule's value
* - RuleR(category, rule) -> fetch a real (float) rule's value
* - RuleB(category, rule) -> fetch a boolean/flag rule's value
* - RuleS(category, rule) -> fetch a string rule's value
*
*/
@@ -35,6 +36,8 @@
RuleManager::Instance()->GetRealRule( RuleManager::Real__##rule_name )
#define RuleB(category_name, rule_name) \
RuleManager::Instance()->GetBoolRule( RuleManager::Bool__##rule_name )
#define RuleS(category_name, rule_name) \
RuleManager::Instance()->GetStringRule( RuleManager::String__##rule_name )
#include <vector>
@@ -81,6 +84,17 @@ public:
static const int BoolRuleCount = static_cast<int>(_BoolRuleCount);
typedef enum {
#define RULE_STRING(category_name, rule_name, default_value, notes) \
String__##rule_name,
#include "ruletypes.h"
_StringRuleCount
} StringType;
static const int StringRuleCount = static_cast<int>(_StringRuleCount);
typedef enum {
#define RULE_CATEGORY(category_name) \
Category__##category_name,
@@ -99,45 +113,49 @@ public:
static const IntType InvalidInt = _IntRuleCount;
static const RealType InvalidReal = _RealRuleCount;
static const BoolType InvalidBool = _BoolRuleCount;
static const StringType InvalidString = _StringRuleCount;
static const CategoryType InvalidCategory = _CatCount;
static const uint32 RulesCount = IntRuleCount + RealRuleCount + BoolRuleCount;
static const uint32 RulesCount = IntRuleCount + RealRuleCount + BoolRuleCount + StringRuleCount;
//fetch routines, you should generally use the Rule* macros instead of this
int GetIntRule(IntType t) const;
float GetRealRule(RealType t) const;
bool GetBoolRule(BoolType t) const;
std::string GetStringRule(StringType t) const;
//management routines
static std::string GetRuleName(IntType t) { return s_RuleInfo[static_cast<int>(t)].name; }
static std::string GetRuleName(RealType t) { return s_RuleInfo[static_cast<int>(t) + IntRuleCount].name; }
static std::string GetRuleName(BoolType t) { return s_RuleInfo[static_cast<int>(t) + IntRuleCount + RealRuleCount].name; }
static const std::string &GetRuleNotes(IntType t) { return s_RuleInfo[static_cast<int>(t)].notes; }
static const std::string &GetRuleNotes(RealType t) { return s_RuleInfo[static_cast<int>(t) + IntRuleCount].notes; }
static const std::string &GetRuleNotes(BoolType t) { return s_RuleInfo[static_cast<int>(t) + IntRuleCount + RealRuleCount].notes; }
static std::string GetRuleName(StringType t) { return s_RuleInfo[static_cast<int>(t) + IntRuleCount + RealRuleCount + StringRuleCount].name; }
static const std::string& GetRuleNotes(IntType t) { return s_RuleInfo[static_cast<int>(t)].notes; }
static const std::string& GetRuleNotes(RealType t) { return s_RuleInfo[static_cast<int>(t) + IntRuleCount].notes; }
static const std::string& GetRuleNotes(BoolType t) { return s_RuleInfo[static_cast<int>(t) + IntRuleCount + RealRuleCount].notes; }
static const std::string& GetRuleNotes(StringType t) { return s_RuleInfo[static_cast<int>(t) + IntRuleCount + RealRuleCount + StringRuleCount].notes; }
static uint32 CountRules() { return RulesCount; }
static CategoryType FindCategory(const std::string &category_name);
bool ListRules(const std::string &category_name, std::vector <std::string> &l);
bool ListCategories(std::vector <std::string> &l);
bool GetRule(const std::string &rule_name, std::string &rule_value);
static CategoryType FindCategory(const std::string& category_name);
bool ListRules(const std::string& category_name, std::vector<std::string>& l);
bool ListCategories(std::vector<std::string>& l);
bool GetRule(const std::string& rule_name, std::string& rule_value);
bool SetRule(
const std::string &rule_name,
const std::string &rule_value,
Database *db = nullptr,
const std::string& rule_name,
const std::string& rule_value,
Database* db = nullptr,
bool db_save = false,
bool reload = false
);
int GetActiveRulesetID() const { return m_activeRuleset; }
std::string GetActiveRuleset() const { return m_activeName; }
static bool ListRulesets(Database *db, std::map<int, std::string> &l);
static bool ListRulesets(Database* db, std::map<int, std::string>& l);
void ResetRules(bool reload = false);
bool LoadRules(Database *db, const std::string &rule_set_name, bool reload = false);
void SaveRules(Database *db, const std::string &rule_set_name);
bool UpdateInjectedRules(Database *db, const std::string &rule_set_name, bool quiet_update = false);
bool UpdateOrphanedRules(Database *db, bool quiet_update = false);
bool RestoreRuleNotes(Database *db);
bool LoadRules(Database* db, const std::string& rule_set_name, bool reload = false);
void SaveRules(Database* db, const std::string& rule_set_name);
bool UpdateInjectedRules(Database* db, const std::string& rule_set_name, bool quiet_update = false);
bool UpdateOrphanedRules(Database* db, bool quiet_update = false);
bool RestoreRuleNotes(Database* db);
private:
RuleManager();
@@ -147,21 +165,23 @@ private:
int m_activeRuleset;
std::string m_activeName;
int m_RuleIntValues[IntRuleCount];
float m_RuleRealValues[RealRuleCount];
uint32 m_RuleBoolValues[BoolRuleCount];
int m_RuleIntValues[IntRuleCount];
float m_RuleRealValues[RealRuleCount];
uint32 m_RuleBoolValues[BoolRuleCount];
std::string m_RuleStringValues[StringRuleCount];
typedef enum {
IntRule,
RealRule,
BoolRule
BoolRule,
StringRule
} RuleType;
static bool _FindRule(const std::string &rule_name, RuleType &type_into, uint16 &index_into);
static bool _FindRule(const std::string& rule_name, RuleType& type_into, uint16& index_into);
static std::string _GetRuleName(RuleType type, uint16 index);
static const std::string &_GetRuleNotes(RuleType type, uint16 index);
static int _FindOrCreateRuleset(Database *db, const std::string &rule_set_name);
void _SaveRule(Database *db, RuleType type, uint16 index);
static const std::string& _GetRuleNotes(RuleType type, uint16 index);
static int _FindOrCreateRuleset(Database* db, const std::string& rule_set_name);
void _SaveRule(Database* db, RuleType type, uint16 index);
static const char* s_categoryNames[];
typedef struct {
+13 -3
View File
@@ -28,6 +28,9 @@
#ifndef RULE_BOOL
#define RULE_BOOL(cat, rule, default_value, notes)
#endif
#ifndef RULE_STRING
#define RULE_STRING(cat, rule, default_value, notes)
#endif
#ifndef RULE_CATEGORY_END
#define RULE_CATEGORY_END()
#endif
@@ -48,10 +51,10 @@ RULE_BOOL(Character, DeathKeepLevel, false, "Players can not drop below 0% exper
RULE_BOOL(Character, UseDeathExpLossMult, false, "Setting to control whether DeathExpLossMultiplier or the code default is used: (Level x Level / 18.0) x 12000")
RULE_BOOL(Character, UseOldRaceRezEffects, false, "Older clients had ID 757 for races with high starting STR, but it doesn't seem used anymore")
RULE_INT(Character, CorpseDecayTime, 604800000, "Time after which the corpse decays (milliseconds) DEFAULT: 604800000 (7 Days)")
RULE_INT( Character, EmptyCorpseDecayTime, 10800000, "Time after which an empty corpse decays (milliseconds) DEFAULT: 10800000 (3 Hours)")
RULE_INT(Character, EmptyCorpseDecayTime, 10800000, "Time after which an empty corpse decays (milliseconds) DEFAULT: 10800000 (3 Hours)")
RULE_INT(Character, CorpseResTime, 10800000, "Time after which the corpse can no longer be resurrected (milliseconds) DEFAULT: 10800000 (3 Hours)")
RULE_INT( Character, DuelCorpseResTime, 600000, "Time before cant res corpse after a duel (milliseconds) DEFAULT: 600000 (10 Minutes)")
RULE_INT( Character, CorpseOwnerOnlineTime, 30000, "How often corpse will check if its owner is online DEFAULT: 30000 (30 Seconds)")
RULE_INT(Character, DuelCorpseResTime, 600000, "Time before cant res corpse after a duel (milliseconds) DEFAULT: 600000 (10 Minutes)")
RULE_INT(Character, CorpseOwnerOnlineTime, 30000, "How often corpse will check if its owner is online DEFAULT: 30000 (30 Seconds)")
RULE_BOOL(Character, LeaveCorpses, true, "Setting whether you leave a corpse behind")
RULE_BOOL(Character, LeaveNakedCorpses, false, "Setting whether you leave a corpse without items")
RULE_INT(Character, MaxDraggedCorpses, 2, "Maximum number of corpses you can drag at once")
@@ -324,6 +327,9 @@ RULE_INT(World, MaximumQuestErrors, 30, "Changes the maximum number of quest err
RULE_INT(World, BootHour, 0, "Sets the in-game hour world will set when it first boots. 0-24 are valid options, where 0 disables this rule")
RULE_BOOL(World, UseItemLinksForKeyRing, false, "Uses item links for Key Ring Listing instead of item name")
RULE_BOOL(World, UseOldShadowKnightClassExport, true, "Disable to have Shadowknight show as Shadow Knight (live-like)")
RULE_STRING(World, IPExemptionZones, "", "Comma-delimited list of zones to exclude from IP-limit checks. Empty string to disable.")
RULE_STRING(World, MOTD, "", "Server MOTD sent on login, change from empty to have this be used instead of variables table 'motd' value")
RULE_STRING(World, Rules, "", "Server Rules, change from empty to have this be used instead of variables table 'rules' value, lines are pipe (|) separated, example: A|B|C")
RULE_CATEGORY_END()
RULE_CATEGORY(Zone)
@@ -522,6 +528,7 @@ RULE_REAL(Combat, BaseProcChance, 0.035, "Base chance for procs")
RULE_REAL(Combat, ProcDexDivideBy, 11000, "Divisor for the probability of a proc increased by dexterity")
RULE_INT(Combat, MinRangedAttackDist, 25, "Minimum Distance to use Ranged Attacks")
RULE_BOOL(Combat, ArcheryBonusRequiresStationary, true, "does the 2x archery bonus chance require a stationary npc")
RULE_INT(Combat, ArcheryBonusLevelRequirement, 51, "Level requirement when the 2x archery bonus will be enabled. The default is 51.")
RULE_REAL(Combat, ArcheryNPCMultiplier, 1.0, "Value is multiplied by the regular dmg to get the archery dmg")
RULE_BOOL(Combat, AssistNoTargetSelf, true, "When assisting a target that does not have a target: true = target self, false = leave target as was before assist (false = live like)")
RULE_INT(Combat, MaxRampageTargets, 3, "Maximum number of people hit with rampage")
@@ -570,10 +577,12 @@ RULE_BOOL(Combat, NPCsUseFrontalStunImmunityClasses, false, "Enable or disable N
RULE_INT(Combat, FrontalStunImmunityRaces, 512, "Bitmask for Races than have frontal stun immunity, Ogre (512) only by default.")
RULE_BOOL(Combat, NPCsUseFrontalStunImmunityRaces, true, "Enable or disable NPCs using frontal stun immunity Races from Combat:FrontalStunImmunityRaces, true by default.")
RULE_BOOL(Combat, AssassinateOnlyHumanoids, true, "Enable or disable Assassinate only being allowed on Humanoids, true by default.")
RULE_INT(Combat, AssassinateLevelRequirement, 60, "Level requirement to enable assassinate attempts on backstabs. The default is 60.")
RULE_BOOL(Combat, HeadshotOnlyHumanoids, true, "Enable or disable Headshot only being allowed on Humanoids, true by default.")
RULE_BOOL(Combat, EnableWarriorShielding, true, "Enable or disable Warrior Shielding Ability (/shield), true by default.")
RULE_BOOL(Combat, BackstabIgnoresElemental, false, "Enable or disable Elemental weapon damage affecting backstab damage, false by default.")
RULE_BOOL(Combat, BackstabIgnoresBane, false, "Enable or disable Bane weapon damage affecting backstab damage, false by default.")
RULE_INT(Combat, DoubleBackstabLevelRequirement, 55, "Level requirement to enable double backstab attempts. The default is 55.")
RULE_BOOL(Combat, SummonMeleeRange, true, "Enable or disable summoning of a player when already in melee range of the summoner.")
RULE_BOOL(Combat, WaterMatchRequiredForAutoFireLoS, true, "Enable/Disable the requirement of both the attacker/victim being both in or out of water for AutoFire LoS to pass.")
RULE_INT(Combat, ExtraAllowedKickClassesBitmask, 0, "Bitmask for allowing extra classes beyond Warrior, Ranger, Beastlord, and Berserker to kick, No Extra Classes (0) by default")
@@ -951,4 +960,5 @@ RULE_CATEGORY_END()
#undef RULE_INT
#undef RULE_REAL
#undef RULE_BOOL
#undef RULE_STRING
#undef RULE_CATEGORY_END
+4 -3
View File
@@ -348,7 +348,7 @@ std::string EQ::SayLinkEngine::InjectSaylinksIfNotExist(const char *message)
if (ch != startpos)
{
std::string str(startpos, ch - startpos);
new_message += EQ::SayLinkEngine::GenerateQuestSaylink(str, false, str);
new_message += Saylink::Create(str);
}
in_bracket_state = false;
}
@@ -417,11 +417,12 @@ SaylinkRepository::Saylink EQ::SayLinkEngine::GetOrSaveSaylink(std::string sayli
return {};
}
std::string Saylink::Create(const std::string &saylink_text, bool silent, const std::string &link_name)
std::string Saylink::Create(const std::string& saylink_text, bool silent, const std::string& link_name)
{
return EQ::SayLinkEngine::GenerateQuestSaylink(saylink_text, silent, (link_name.empty() ? saylink_text : link_name));
}
std::string Saylink::Silent(const std::string &saylink_text, const std::string &link_name) {
std::string Saylink::Silent(const std::string& saylink_text, const std::string& link_name)
{
return EQ::SayLinkEngine::GenerateQuestSaylink(saylink_text, true, (link_name.empty() ? saylink_text : link_name));
}
+1 -1
View File
@@ -130,7 +130,7 @@ namespace EQ
class Saylink {
public:
static std::string Create(const std::string &saylink_text, bool silent, const std::string &link_name = "");
static std::string Create(const std::string &saylink_text, bool silent = false, const std::string &link_name = "");
static std::string Silent(const std::string &saylink_text, const std::string &link_name = "");
};
+2 -2
View File
@@ -25,7 +25,7 @@
// Build variables
// these get injected during the build pipeline
#define CURRENT_VERSION "22.45.0-dev" // always append -dev to the current version for custom-builds
#define CURRENT_VERSION "22.48.0-dev" // always append -dev to the current version for custom-builds
#define LOGIN_VERSION "0.8.0"
#define COMPILE_DATE __DATE__
#define COMPILE_TIME __TIME__
@@ -42,7 +42,7 @@
* Manifest: https://github.com/EQEmu/Server/blob/master/utils/sql/db_update_manifest.txt
*/
#define CURRENT_BINARY_DATABASE_VERSION 9264
#define CURRENT_BINARY_DATABASE_VERSION 9266
#define CURRENT_BINARY_BOTS_DATABASE_VERSION 9043
#endif
+225 -891
View File
File diff suppressed because it is too large Load Diff
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "eqemu-server",
"version": "22.45.0",
"version": "22.48.0",
"repository": {
"type": "git",
"url": "https://github.com/EQEmu/Server.git"
+72 -70
View File
@@ -52,6 +52,7 @@
#include "../common/repositories/player_event_logs_repository.h"
#include "../common/repositories/inventory_repository.h"
#include "../common/events/player_event_logs.h"
#include "../common/content/world_content_service.h"
#include <iostream>
#include <iomanip>
@@ -599,79 +600,63 @@ bool Client::HandleNameApprovalPacket(const EQApplicationPacket *app)
}
bool Client::HandleGenerateRandomNamePacket(const EQApplicationPacket *app) {
// creates up to a 10 char name
char vowels[18]="aeiouyaeiouaeioe";
char cons[48]="bcdfghjklmnpqrstvwxzybcdgklmnprstvwbcdgkpstrkd";
char rndname[17]="\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0";
char paircons[33]="ngrkndstshthphsktrdrbrgrfrclcr";
int rndnum=emu_random.Int(0, 75),n=1;
bool dlc=false;
bool vwl=false;
bool dbl=false;
if (rndnum>63)
{ // rndnum is 0 - 75 where 64-75 is cons pair, 17-63 is cons, 0-16 is vowel
rndnum=(rndnum-61)*2; // name can't start with "ng" "nd" or "rk"
rndname[0]=paircons[rndnum];
rndname[1]=paircons[rndnum+1];
n=2;
}
else if (rndnum>16)
{
rndnum-=17;
rndname[0]=cons[rndnum];
}
else
{
rndname[0]=vowels[rndnum];
vwl=true;
}
int namlen=emu_random.Int(5, 10);
for (int i=n;i<namlen;i++)
{
dlc=false;
if (vwl) //last char was a vowel
{ // so pick a cons or cons pair
rndnum=emu_random.Int(0, 62);
if (rndnum>46)
{ // pick a cons pair
if (i>namlen-3) // last 2 chars in name?
{ // name can only end in cons pair "rk" "st" "sh" "th" "ph" "sk" "nd" or "ng"
rndnum=emu_random.Int(0, 7)*2;
}
else
{ // pick any from the set
rndnum=(rndnum-47)*2;
}
rndname[i]=paircons[rndnum];
rndname[i+1]=paircons[rndnum+1];
dlc=true; // flag keeps second letter from being doubled below
i+=1;
}
else
{ // select a single cons
rndname[i]=cons[rndnum];
char newName[17] = {0};
bool unique = false;
while (!unique) {
std::string cons = "bcdfghjklmnpqrstvwxyz";
std::string vows = "aeou";
std::string allVows = "aeiou";
std::vector<std::string> endPhon = {"a", "e", "i", "o", "u", "os", "as", "us", "is", "y", "an", "en", "in", "on", "un"};
std::random_device rd;
std::mt19937 gen(rd());
std::uniform_int_distribution<int> lenDist(5, 10);
std::uniform_int_distribution<int> firstCharDist(0, 1);
std::uniform_int_distribution<int> consDist(0, cons.size() - 1);
std::uniform_int_distribution<int> vowDist(0, vows.size() - 1);
std::uniform_int_distribution<int> allVowDist(0, allVows.size() - 1);
std::uniform_int_distribution<int> endPhonDist(0, endPhon.size() - 1);
int len = 0;
memset(newName, 0, sizeof(newName));
if (firstCharDist(gen) == 0) {
newName[len++] = vows[vowDist(gen)];
newName[len++] = cons[consDist(gen)];
} else {
newName[len++] = cons[consDist(gen)];
newName[len++] = allVows[allVowDist(gen)];
}
newName[0] = toupper(newName[0]);
while (len < lenDist(gen) - 1) {
if (len % 2 == 0) {
newName[len++] = cons[consDist(gen)];
} else {
newName[len++] = allVows[allVowDist(gen)];
}
}
else
{ // select a vowel
rndname[i]=vowels[emu_random.Int(0, 16)];
std::string end = endPhon[endPhonDist(gen)];
for (char c : end) {
if (len < 10) newName[len++] = c;
}
vwl=!vwl;
if (!dbl && !dlc)
{ // one chance at double letters in name
if (!emu_random.Int(0, i+9)) // chances decrease towards end of name
{
rndname[i+1]=rndname[i];
dbl=true;
i+=1;
if (database.CheckNameFilter(newName)) {
std::string query = StringFormat("SELECT `name` FROM `character_data` WHERE `name` = '%s'", newName);
auto res = database.QueryDatabase(query);
if (res.Success() && res.RowCount() == 0) {
unique = true;
}
}
}
rndname[0]=toupper(rndname[0]);
NameGeneration_Struct* ngs = (NameGeneration_Struct*)app->pBuffer;
memset(ngs->name,0,64);
strcpy(ngs->name,rndname);
memset(ngs->name, 0, 64);
strcpy(ngs->name, newName);
QueuePacket(app);
return true;
@@ -787,6 +772,18 @@ bool Client::HandleEnterWorldPacket(const EQApplicationPacket *app) {
return true;
}
auto r = content_service.FindZone(zone_id, instance_id);
if (r.zone_id && r.instance.id != instance_id) {
LogInfo(
"Zone [{}] has been remapped to instance_id [{}] from instance_id [{}] for client [{}]",
r.zone.short_name,
r.instance.id,
instance_id,
char_name
);
instance_id = r.instance.id;
}
// Make sure this account owns this character
if (temporary_account_id != account_id) {
LogInfo("Account [{}] does not own the character named [{}] from account [{}]", account_id, char_name, temporary_account_id);
@@ -903,14 +900,19 @@ bool Client::HandleEnterWorldPacket(const EQApplicationPacket *app) {
}
auto outapp = new EQApplicationPacket(OP_MOTD);
std::string motd_message;
if (database.GetVariable("MOTD", motd_message)) {
outapp->size = motd_message.length() + 1;
std::string motd = RuleS(World, MOTD);
if (!motd.empty()) {
outapp->size = motd.length() + 1;
outapp->pBuffer = new uchar[outapp->size];
memset(outapp->pBuffer, 0, outapp->size);
strcpy((char*)outapp->pBuffer, motd_message.c_str());
strcpy((char*) outapp->pBuffer, motd.c_str());
} else if (database.GetVariable("MOTD", motd)) {
outapp->size = motd.length() + 1;
outapp->pBuffer = new uchar[outapp->size];
memset(outapp->pBuffer, 0, outapp->size);
strcpy((char*) outapp->pBuffer, motd.c_str());
} else { // Null Message of the Day. :)
outapp->size = 1;
outapp->size = 1;
outapp->pBuffer = new uchar[outapp->size];
outapp->pBuffer[0] = 0;
}
+17
View File
@@ -94,8 +94,25 @@ void ClientList::GetCLEIP(uint32 in_ip) {
int count = 0;
iterator.Reset();
const auto& zones = Strings::Split(RuleS(World, IPExemptionZones), ",");
while (iterator.MoreElements()) {
cle = iterator.GetData();
if (!zones.empty() && cle->zone()) {
auto it = std::ranges::find_if(
zones,
[cle](const auto& z) {
return Strings::ToUnsignedInt(z) == cle->zone();
}
);
if (it != zones.end()) {
iterator.Advance();
continue;
}
}
if (
cle->GetIP() == in_ip &&
(
+1
View File
@@ -142,6 +142,7 @@ std::vector<Reload> reload_types = {
Reload{.command = "base_data", .opcode = ServerOP_ReloadBaseData, .desc = "Base Data"},
Reload{.command = "blocked_spells", .opcode = ServerOP_ReloadBlockedSpells, .desc = "Blocked Spells"},
Reload{.command = "commands", .opcode = ServerOP_ReloadCommands, .desc = "Commands"},
Reload{.command = "content_flags", .opcode = ServerOP_ReloadContentFlags, .desc = "Content Flags"},
Reload{.command = "data_buckets_cache", .opcode = ServerOP_ReloadDataBucketsCache, .desc = "Data Buckets Cache"},
Reload{.command = "doors", .opcode = ServerOP_ReloadDoors, .desc = "Doors"},
Reload{.command = "dztemplates", .opcode = ServerOP_ReloadDzTemplates, .desc = "Dynamic Zone Templates"},
+5
View File
@@ -188,6 +188,11 @@ int main(int argc, char **argv)
RegisterConsoleFunctions(console);
}
content_service.SetDatabase(&database)
->SetContentDatabase(&content_db)
->SetExpansionContext()
->ReloadContentFlags();
std::unique_ptr<EQ::Net::ServertalkServer> server_connection;
server_connection = std::make_unique<EQ::Net::ServertalkServer>();
+11 -1
View File
@@ -230,13 +230,23 @@ void WorldGuildManager::ProcessZonePacket(ServerPacket *pack) {
case ServerOP_GuildChannel:
case ServerOP_GuildURL:
case ServerOP_GuildMemberRemove:
case ServerOP_GuildMemberAdd:
case ServerOP_GuildSendGuildList:
case ServerOP_GuildMembersList:
{
zoneserver_list.SendPacketToBootedZones(pack);
break;
}
case ServerOP_GuildMemberAdd:
{
auto in = (ServerOP_GuildMessage_Struct *)pack->pBuffer;
auto guild = GetGuildByGuildID(in->guild_id);
if (!guild) {
BaseGuildManager::RefreshGuild(in->guild_id);
}
zoneserver_list.SendPacketToBootedZones(pack);
break;
}
default:
LogGuilds("Unknown packet {:#04x} received from zone??", pack->opcode);
break;
+1 -1
View File
@@ -1100,7 +1100,7 @@ void ZoneServer::HandleMessage(uint16 opcode, const EQ::Net::Packet &p) {
}
auto smotd = (ServerMotd_Struct*) pack->pBuffer;
database.SetVariable("MOTD", smotd->motd);
RuleManager::Instance()->SetRule("MOTD", smotd->motd, &database, true, true);
zoneserver_list.SendPacket(pack);
break;
}
+3
View File
@@ -51,6 +51,7 @@ SET(zone_sources
loot.cpp
lua_bot.cpp
lua_bit.cpp
lua_buff.cpp
lua_corpse.cpp
lua_client.cpp
lua_door.cpp
@@ -105,6 +106,7 @@ SET(zone_sources
pathfinder_null.cpp
pathing.cpp
perl_bot.cpp
perl_buff.cpp
perl_client.cpp
perl_doors.cpp
perl_entity.cpp
@@ -207,6 +209,7 @@ SET(zone_headers
horse.h
lua_bot.h
lua_bit.h
lua_buff.h
lua_client.h
lua_corpse.h
lua_door.h
+25 -15
View File
@@ -621,28 +621,38 @@ bool Mob::IsAttackAllowed(Mob *target, bool isSpellAttack)
// NPC *npc1, *npc2;
int reverse;
if(!zone->CanDoCombat())
return false;
// some special cases
if(!target)
return false;
if(this == target) // you can attack yourself
return true;
if(target->GetSpecialAbility(NO_HARM_FROM_CLIENT)){
if (!zone->CanDoCombat()) {
return false;
}
if (target->GetSpecialAbility(IMMUNE_DAMAGE_CLIENT) && IsClient())
// some special cases
if (!target) {
return false;
}
if (target->GetSpecialAbility(IMMUNE_DAMAGE_NPC) && IsNPC())
return false;
if (this == target) { // you can attack yourself
return true;
}
if (target->IsHorse())
if (target->GetSpecialAbility(NO_HARM_FROM_CLIENT)) {
return false;
}
if (IsBot() && target->GetSpecialAbility(IMMUNE_DAMAGE_BOT)) {
return false;
}
if (IsClient() && target->GetSpecialAbility(IMMUNE_DAMAGE_CLIENT)) {
return false;
}
if (IsNPC() && target->GetSpecialAbility(IMMUNE_DAMAGE_NPC)) {
return false;
}
if (target->IsHorse()) {
return false;
}
// can't damage own pet (applies to everthing)
Mob *target_owner = target->GetOwner();
+44 -45
View File
@@ -1005,7 +1005,7 @@ double Mob::RollD20(int offense, int mitigation)
auto atk_roll = zone->random.Roll0(offense + 5);
auto def_roll = zone->random.Roll0(mitigation + 5);
int avg = (offense + mitigation + 10) / 2;
int avg = std::max(1, (offense + mitigation + 10) / 2);
int index = std::max(0, (atk_roll - def_roll) + (avg / 2));
index = EQ::Clamp((index * 20) / avg, 0, 19);
@@ -1687,13 +1687,6 @@ bool Mob::Attack(Mob* other, int Hand, bool bRiposte, bool IsStrikethrough, bool
}
}
//used by complete heal and #heal
void Mob::Heal()
{
SetMaxHP();
SendHPUpdate();
}
void Client::Damage(Mob* other, int64 damage, uint16 spell_id, EQ::skills::SkillType attack_skill, bool avoidable, int8 buffslot, bool iBuffTic, eSpecialAttacks special)
{
if (dead || IsCorpse())
@@ -2618,12 +2611,6 @@ bool NPC::Death(Mob* killer_mob, int64 damage, uint16 spell, EQ::skills::SkillTy
}
if (m.member) {
m.member->RecordKilledNPCEvent(this);
if (parse->HasQuestSub(GetNPCTypeID(), EVENT_KILLED_MERIT)) {
parse->EventNPC(EVENT_KILLED_MERIT, this, m.member, "killed", 0);
}
if (RuleB(NPC, EnableMeritBasedFaction)) {
m.member->SetFactionLevel(
m.member->CharacterID(),
@@ -2683,18 +2670,11 @@ bool NPC::Death(Mob* killer_mob, int64 damage, uint16 spell, EQ::skills::SkillTy
}
}
/* Send the EVENT_KILLED_MERIT event and update kill tasks
* for all group members */
/* Update kill tasks for all group members */
for (const auto& m : killer_group->members) {
if (m && m->IsClient()) {
Client* c = m->CastToClient();
c->RecordKilledNPCEvent(this);
if (parse->HasQuestSub(GetNPCTypeID(), EVENT_KILLED_MERIT)) {
parse->EventNPC(EVENT_KILLED_MERIT, this, c, "killed", 0);
}
if (RuleB(NPC, EnableMeritBasedFaction)) {
c->SetFactionLevel(
c->CharacterID(),
@@ -2756,13 +2736,6 @@ bool NPC::Death(Mob* killer_mob, int64 damage, uint16 spell, EQ::skills::SkillTy
}
}
/* Send the EVENT_KILLED_MERIT event */
give_exp_client->RecordKilledNPCEvent(this);
if (parse->HasQuestSub(GetNPCTypeID(), EVENT_KILLED_MERIT)) {
parse->EventNPC(EVENT_KILLED_MERIT, this, give_exp_client, "killed", 0);
}
if (RuleB(NPC, EnableMeritBasedFaction)) {
give_exp_client->SetFactionLevel(
give_exp_client->CharacterID(),
@@ -2991,6 +2964,17 @@ bool NPC::Death(Mob* killer_mob, int64 damage, uint16 spell, EQ::skills::SkillTy
m_combat_record.Stop();
if (give_exp_client && !IsCorpse()) {
const auto& v = give_exp_client->GetRaidOrGroupOrSelf(true);
for (const auto& m : v) {
m->CastToClient()->RecordKilledNPCEvent(this);
if (parse->HasQuestSub(GetNPCTypeID(), EVENT_KILLED_MERIT)) {
parse->EventNPC(EVENT_KILLED_MERIT, this, m, "killed", 0);
}
}
}
if (parse->HasQuestSub(GetNPCTypeID(), EVENT_DEATH_COMPLETE)) {
const auto& export_string = fmt::format(
"{} {} {} {} {} {} {} {} {}",
@@ -3091,26 +3075,37 @@ void Mob::AddToHateList(Mob* other, int64 hate /*= 0*/, int64 damage /*= 0*/, bo
TryTriggerOnCastRequirement();
}
if (IsClient() && !IsAIControlled())
if (IsClient() && !IsAIControlled()) {
return;
}
if (IsFamiliar() || GetSpecialAbility(IMMUNE_AGGRO))
if (IsFamiliar() || GetSpecialAbility(IMMUNE_AGGRO)) {
return;
}
if (GetSpecialAbility(IMMUNE_AGGRO_NPC) && other->IsNPC())
if (other->IsBot() && GetSpecialAbility(IMMUNE_AGGRO_BOT)) {
return;
}
if (GetSpecialAbility(IMMUNE_AGGRO_CLIENT) && other->IsClient())
if (other->IsClient() && GetSpecialAbility(IMMUNE_AGGRO_CLIENT)) {
return;
}
if (IsValidSpell(spell_id) && IsNoDetrimentalSpellAggroSpell(spell_id))
if (other->IsNPC() && GetSpecialAbility(IMMUNE_AGGRO_NPC)) {
return;
}
if (other == myowner)
if (IsValidSpell(spell_id) && IsNoDetrimentalSpellAggroSpell(spell_id)) {
return;
}
if (other->GetSpecialAbility(IMMUNE_AGGRO_ON))
if (other == myowner) {
return;
}
if (other->GetSpecialAbility(IMMUNE_AGGRO_ON)) {
return;
}
if (GetSpecialAbility(NPC_TUNNELVISION)) {
int tv_mod = GetSpecialAbilityParam(NPC_TUNNELVISION, 0);
@@ -3194,8 +3189,9 @@ void Mob::AddToHateList(Mob* other, int64 hate /*= 0*/, int64 damage /*= 0*/, bo
// owner must get on list, but he's not actually gained any hate yet
if (
!owner->GetSpecialAbility(IMMUNE_AGGRO) &&
!(GetSpecialAbility(IMMUNE_AGGRO_CLIENT) && owner->IsClient()) &&
!(GetSpecialAbility(IMMUNE_AGGRO_NPC) && owner->IsNPC())
!(owner->IsBot() && GetSpecialAbility(IMMUNE_AGGRO_BOT)) &&
!(owner->IsClient() && GetSpecialAbility(IMMUNE_AGGRO_CLIENT)) &&
!(owner->IsNPC() && GetSpecialAbility(IMMUNE_AGGRO_NPC))
) {
if (owner->IsClient() && !CheckAggro(owner)) {
owner->CastToClient()->AddAutoXTarget(this);
@@ -3209,8 +3205,9 @@ void Mob::AddToHateList(Mob* other, int64 hate /*= 0*/, int64 damage /*= 0*/, bo
if (
!mypet->IsFamiliar() &&
!mypet->GetSpecialAbility(IMMUNE_AGGRO) &&
!(mypet->GetSpecialAbility(IMMUNE_AGGRO_CLIENT) && IsClient()) &&
!(mypet->GetSpecialAbility(IMMUNE_AGGRO_NPC) && IsNPC())
!(IsBot() && mypet->GetSpecialAbility(IMMUNE_AGGRO_BOT)) &&
!(IsClient() && mypet->GetSpecialAbility(IMMUNE_AGGRO_CLIENT)) &&
!(IsNPC() && mypet->GetSpecialAbility(IMMUNE_AGGRO_NPC))
) {
mypet->hate_list.AddEntToHateList(other, 0, 0, bFrenzy);
}
@@ -3219,8 +3216,9 @@ void Mob::AddToHateList(Mob* other, int64 hate /*= 0*/, int64 damage /*= 0*/, bo
if (
myowner->IsAIControlled() &&
!myowner->GetSpecialAbility(IMMUNE_AGGRO) &&
!(GetSpecialAbility(IMMUNE_AGGRO_CLIENT) && myowner->IsClient()) &&
!(GetSpecialAbility(IMMUNE_AGGRO_NPC) && myowner->IsNPC())
!(myowner->IsBot() && GetSpecialAbility(IMMUNE_AGGRO_BOT)) &&
!(myowner->IsClient() && GetSpecialAbility(IMMUNE_AGGRO_CLIENT)) &&
!(myowner->IsNPC() && GetSpecialAbility(IMMUNE_AGGRO_NPC))
) {
myowner->hate_list.AddEntToHateList(other, 0, 0, bFrenzy);
}
@@ -4060,8 +4058,9 @@ void Mob::CommonDamage(Mob* attacker, int64 &damage, const uint16 spell_id, cons
!pet->GetSpecialAbility(IMMUNE_AGGRO) &&
!pet->IsEngaged() &&
attacker &&
!(pet->GetSpecialAbility(IMMUNE_AGGRO_CLIENT) && attacker->IsClient()) &&
!(pet->GetSpecialAbility(IMMUNE_AGGRO_NPC) && attacker->IsNPC()) &&
!(attacker->IsBot() && pet->GetSpecialAbility(IMMUNE_AGGRO_BOT)) &&
!(attacker->IsClient() && pet->GetSpecialAbility(IMMUNE_AGGRO_CLIENT)) &&
!(attacker->IsNPC() && pet->GetSpecialAbility(IMMUNE_AGGRO_NPC)) &&
attacker != this &&
!attacker->IsCorpse() &&
!pet->IsGHeld() &&
@@ -6194,7 +6193,7 @@ void Mob::CommonOutgoingHitSuccess(Mob* defender, DamageHitInfo &hit, ExtraAttac
if (headshot > 0) {
hit.damage_done = headshot;
}
else if (GetClass() == Class::Ranger && GetLevel() > 50) { // no double dmg on headshot
else if (GetClass() == Class::Ranger && GetLevel() >= RuleI(Combat, ArcheryBonusLevelRequirement)) { // no double dmg on headshot
if ((defender->IsNPC() && !defender->IsMoving() && !defender->IsRooted()) || !RuleB(Combat, ArcheryBonusRequiresStationary)) {
hit.damage_done *= 2;
MessageString(Chat::MeleeCrit, BOW_DOUBLE_DAMAGE);
+57 -14
View File
@@ -2684,16 +2684,19 @@ bool Bot::IsValidTarget(
return false;
}
const bool valid_target_state = (
HOLDING ||
bool invalid_target_state = false;
if (HOLDING ||
!tar->IsNPC() ||
tar->IsMezzed() ||
lo_distance > leash_distance ||
tar_distance > leash_distance
);
const bool valid_target = !GetAttackingFlag() && !CheckLosFN(tar) && !leash_owner->CheckLosFN(tar);
tar_distance > leash_distance ||
(!GetAttackingFlag() && !CheckLosFN(tar) && !leash_owner->CheckLosFN(tar)) ||
!IsAttackAllowed(tar)
) {
invalid_target_state = true;
}
if (valid_target_state || valid_target || !IsAttackAllowed(tar)) {
if (invalid_target_state) {
// Normally, we wouldn't want to do this without class checks..but, too many issues can arise if we let enchanter animation pets run rampant
if (HasPet()) {
GetPet()->RemoveFromHateList(tar);
@@ -3630,7 +3633,7 @@ bool Bot::RemoveBotFromGroup(Bot* bot, Group* group) {
if (group->DelMember(bot)) {
group->DelMemberOOZ(bot->GetName());
database.SetGroupID(bot->GetCleanName(), 0, bot->GetBotID());
if (group->GroupCount() < 1) {
if (group->GroupCount() < 2) {
group->DisbandGroup();
}
}
@@ -7640,18 +7643,58 @@ void Bot::SetDefaultBotStance() {
_botStance = defaultStance;
}
void Bot::BotGroupSay(Mob *speaker, const char *msg, ...) {
void Bot::BotGroupSay(Mob* speaker, const char* msg, ...) {
char buf[1000];
va_list ap;
va_start(ap, msg);
vsnprintf(buf, 1000, msg, ap);
va_end(ap);
if (speaker->HasGroup()) {
Group *g = speaker->GetGroup();
if (g)
g->GroupMessage(speaker->CastToMob(), Language::CommonTongue, Language::MaxValue, buf);
} else
speaker->Say("%s", buf);
if (speaker->IsRaidGrouped()) {
Raid* r = entity_list.GetRaidByBotName(speaker->GetName());
if (r) {
for (const auto& m : r->members) {
if (m.member && !m.is_bot) {
m.member->FilteredMessageString(
speaker,
Chat::PetResponse,
FilterSocials,
GENERIC_SAY,
speaker->GetCleanName(),
buf
);
}
}
}
}
else if (speaker->HasGroup()) {
Group* g = speaker->GetGroup();
if (g) {
for (auto& m : g->members) {
if (m && !m->IsBot()) {
m->FilteredMessageString(
speaker,
Chat::PetResponse,
FilterSocials,
GENERIC_SAY,
speaker->GetCleanName(),
buf
);
}
}
}
}
else {
//speaker->Say("%s", buf);
speaker->GetOwner()->FilteredMessageString(
speaker,
Chat::PetResponse,
FilterSocials,
GENERIC_SAY,
speaker->GetCleanName(),
buf
);
}
}
bool Bot::UseDiscipline(uint32 spell_id, uint32 target) {
+3 -2
View File
@@ -1788,7 +1788,8 @@ bool BotDatabase::CreateCloneBotInventory(const uint32 bot_id, const uint32 clon
}
for (auto& e : l) {
e.bot_id = clone_id;
e.inventories_index = 0;
e.bot_id = clone_id;
}
return BotInventoriesRepository::InsertMany(database, l);
@@ -2367,7 +2368,7 @@ const uint8 BotDatabase::GetBotLevelByID(const uint32 bot_id)
return e.bot_id ? e.level : 0;
}
const std::string& BotDatabase::GetBotNameByID(const uint32 bot_id)
const std::string BotDatabase::GetBotNameByID(const uint32 bot_id)
{
const auto& e = BotDataRepository::FindOne(database, bot_id);
+1 -1
View File
@@ -164,7 +164,7 @@ public:
const uint8 GetBotGenderByID(const uint32 bot_id);
std::vector<uint32> GetBotIDsByCharacterID(const uint32 character_id, uint8 class_id = Class::None);
const uint8 GetBotLevelByID(const uint32 bot_id);
const std::string& GetBotNameByID(const uint32 bot_id);
const std::string GetBotNameByID(const uint32 bot_id);
const uint16 GetBotRaceByID(const uint32 bot_id);
class fail {
+191 -41
View File
@@ -68,6 +68,7 @@ extern volatile bool RunLoops;
#include "../common/repositories/discovered_items_repository.h"
#include "../common/repositories/inventory_repository.h"
#include "../common/repositories/keyring_repository.h"
#include "../common/repositories/tradeskill_recipe_repository.h"
#include "../common/events/player_events.h"
#include "../common/events/player_event_logs.h"
#include "dialogue_window.h"
@@ -284,6 +285,7 @@ Client::Client(EQStreamInterface *ieqs) : Mob(
PendingSacrifice = false;
controlling_boat_id = 0;
controlled_mob_id = 0;
qGlobals = nullptr;
if (!RuleB(Character, PerCharacterQglobalMaxLevel) && !RuleB(Character, PerCharacterBucketMaxLevel)) {
SetClientMaxLevel(0);
@@ -311,7 +313,6 @@ Client::Client(EQStreamInterface *ieqs) : Mob(
aa_los_them_mob = nullptr;
los_status = false;
los_status_facing = false;
qGlobals = nullptr;
HideCorpseMode = HideCorpseNone;
PendingGuildInvitation = false;
@@ -2294,29 +2295,23 @@ void Client::ReadBook(BookRequest_Struct *book) {
BookText_Struct *out = (BookText_Struct *) outapp->pBuffer;
out->window = book->window;
if (ClientVersion() >= EQ::versions::ClientVersion::SoF) {
// SoF+ need to look up book type for the output message.
const EQ::ItemInstance *inst = nullptr;
if (book->invslot <= EQ::invbag::GENERAL_BAGS_END)
{
inst = m_inv[book->invslot];
}
if(inst)
out->type = inst->GetItem()->Book;
else
out->type = book->type;
}
else {
out->type = book->type;
}
out->type = book->type;
out->invslot = book->invslot;
out->target_id = book->target_id;
out->can_cast = 0; // todo: implement
out->can_scribe = 0; // todo: implement
out->can_scribe = false;
if (ClientVersion() >= EQ::versions::ClientVersion::SoF && book->invslot <= EQ::invbag::GENERAL_BAGS_END)
{
const EQ::ItemInstance* inst = m_inv[book->invslot];
if (inst && inst->GetItem())
{
auto recipe = TradeskillRecipeRepository::GetWhere(content_db,
fmt::format("learned_by_item_id = {} LIMIT 1", inst->GetItem()->ID));
out->type = inst->GetItem()->Book;
out->can_scribe = !recipe.empty();
}
}
memcpy(out->booktext, booktxt2.c_str(), length);
@@ -3791,14 +3786,12 @@ void Client::GetRaidAAs(RaidLeadershipAA_Struct *into) const {
void Client::EnteringMessages(Client* client)
{
std::string rules;
if (database.GetVariable("Rules", rules)) {
uint8 flag = database.GetAgreementFlag(client->AccountID());
std::string rules = RuleS(World, Rules);
if (!rules.empty() || database.GetVariable("Rules", rules)) {
const uint8 flag = database.GetAgreementFlag(client->AccountID());
if (!flag) {
auto rules_link = Saylink::Silent(
"#serverrules",
"rules"
);
const std::string& rules_link = Saylink::Silent("#serverrules", "rules");
client->Message(
Chat::White,
@@ -3815,9 +3808,9 @@ void Client::EnteringMessages(Client* client)
void Client::SendRules()
{
std::string rules;
std::string rules = RuleS(World, Rules);
if (!database.GetVariable("Rules", rules)) {
if (rules.empty() && !database.GetVariable("Rules", rules)) {
return;
}
@@ -6285,7 +6278,17 @@ void Client::SendZonePoints()
zp->zpe[i].z = data->target_z;
zp->zpe[i].heading = data->target_heading;
zp->zpe[i].zoneid = data->target_zone_id;
zp->zpe[i].zoneinstance = data->target_zone_instance;
// if the target zone is the same as the current zone, use the instance of the current zone
// if we don't use the same instance_id that the client was sent, the client will forcefully
// issue a zone change request when they should be simply moving to a different point in the same zone
// because the client will think the zone point target is different from the current instance
auto target_instance = data->target_zone_instance;
if (data->target_zone_id == zone->GetZoneID() && data->target_zone_instance == 0) {
target_instance = zone->GetInstanceID();
}
zp->zpe[i].zoneinstance = target_instance;
i++;
}
iterator.Advance();
@@ -6610,13 +6613,72 @@ void Client::SendAltCurrencies() {
void Client::SetAlternateCurrencyValue(uint32 currency_id, uint32 new_amount)
{
if (!zone->DoesAlternateCurrencyExist(currency_id)) {
return;
}
const uint32 current_amount = alternate_currency[currency_id];
const bool is_gain = new_amount > current_amount;
const uint32 change_amount = is_gain ? (new_amount - current_amount) : (current_amount - new_amount);
if (!change_amount) {
return;
}
alternate_currency[currency_id] = new_amount;
database.UpdateAltCurrencyValue(CharacterID(), currency_id, new_amount);
SendAlternateCurrencyValue(currency_id);
QuestEventID event_id = is_gain ? EVENT_ALT_CURRENCY_GAIN : EVENT_ALT_CURRENCY_LOSS;
if (parse->PlayerHasQuestSub(event_id)) {
const std::string &export_string = fmt::format(
"{} {} {}",
currency_id,
change_amount,
new_amount
);
parse->EventPlayer(event_id, this, export_string, 0);
}
}
bool Client::RemoveAlternateCurrencyValue(uint32 currency_id, uint32 amount)
{
if (!amount || !zone->DoesAlternateCurrencyExist(currency_id)) {
return false;
}
const uint32 current_amount = alternate_currency[currency_id];
if (current_amount < amount) {
return false;
}
const uint32 new_amount = (current_amount - amount);
alternate_currency[currency_id] = new_amount;
if (parse->PlayerHasQuestSub(EVENT_ALT_CURRENCY_LOSS)) {
const std::string &export_string = fmt::format(
"{} {} {}",
currency_id,
amount,
new_amount
);
parse->EventPlayer(EVENT_ALT_CURRENCY_LOSS, this, export_string, 0);
}
return true;
}
int Client::AddAlternateCurrencyValue(uint32 currency_id, int amount, bool is_scripted)
{
if (!zone->DoesAlternateCurrencyExist(currency_id)) {
return 0;
}
/* Added via Quest, rest of the logging methods may be done inline due to information available in that area of the code */
if (is_scripted) {
/* QS: PlayerLogAlternateCurrencyTransactions :: Cursor to Item Storage */
@@ -6655,7 +6717,6 @@ int Client::AddAlternateCurrencyValue(uint32 currency_id, int amount, bool is_sc
SendAlternateCurrencyValue(currency_id);
QuestEventID event_id = amount > 0 ? EVENT_ALT_CURRENCY_GAIN : EVENT_ALT_CURRENCY_LOSS;
if (parse->PlayerHasQuestSub(event_id)) {
const std::string &export_string = fmt::format(
"{} {} {}",
@@ -6696,6 +6757,10 @@ void Client::SendAlternateCurrencyValue(uint32 currency_id, bool send_if_null)
uint32 Client::GetAlternateCurrencyValue(uint32 currency_id) const
{
if (!zone->DoesAlternateCurrencyExist(currency_id)) {
return 0;
}
auto iter = alternate_currency.find(currency_id);
return iter == alternate_currency.end() ? 0 : (*iter).second;
@@ -6765,23 +6830,36 @@ void Client::UpdateClientXTarget(Client *c)
// IT IS NOT SAFE TO CALL THIS IF IT'S NOT INITIAL AGGRO
void Client::AddAutoXTarget(Mob *m, bool send)
{
if (m->IsBot() || ((m->IsPet() || m->IsTempPet()) && m->IsPetOwnerBot())) {
return;
}
m_activeautohatermgr->increment_count(m);
if (!XTargettingAvailable() || !XTargetAutoAddHaters || IsXTarget(m))
if (!XTargettingAvailable() || !XTargetAutoAddHaters || IsXTarget(m)) {
return;
}
for(int i = 0; i < GetMaxXTargets(); ++i)
{
if((XTargets[i].Type == Auto) && (XTargets[i].ID == 0))
{
for (int i = 0; i < GetMaxXTargets(); ++i) {
if (XTargets[i].Type == Auto && XTargets[i].ID == 0) {
XTargets[i].ID = m->GetID();
if (send) // if we don't send we're bulk sending updates later on
if (send) { // if we don't send we're bulk sending updates later on
SendXTargetPacket(i, m);
else
} else {
XTargets[i].dirty = true;
}
break;
}
}
LogXTargets(
"Adding [{}] to [{}] ({}) XTargets",
m->GetCleanName(),
GetCleanName(),
GetID()
);
}
void Client::RemoveXTarget(Mob *m, bool OnlyAutoSlots)
@@ -6790,15 +6868,23 @@ void Client::RemoveXTarget(Mob *m, bool OnlyAutoSlots)
// now we may need to clean up our CurrentTargetNPC entries
for (int i = 0; i < GetMaxXTargets(); ++i) {
if (XTargets[i].Type == CurrentTargetNPC && XTargets[i].ID == m->GetID()) {
XTargets[i].Type = Auto;
XTargets[i].ID = 0;
XTargets[i].Type = Auto;
XTargets[i].ID = 0;
XTargets[i].dirty = true;
}
}
auto r = GetRaid();
if (r) {
r->UpdateRaidXTargets();
}
LogXTargets(
"Removing [{}] from [{}] ({}) XTargets",
m->GetCleanName(),
GetCleanName(),
GetID()
);
}
void Client::UpdateXTargetType(XTargetType Type, Mob *m, const char *Name)
@@ -11442,6 +11528,39 @@ void Client::SetLockSavePosition(bool lock_save_position)
Client::m_lock_save_position = lock_save_position;
}
void Client::SetAAPoints(uint32 points)
{
const uint32 current_points = m_pp.aapoints;
m_pp.aapoints = points;
QuestEventID event_id = points > current_points ? EVENT_AA_GAIN : EVENT_AA_LOSS;
const uint32 change = event_id == EVENT_AA_GAIN ? points - current_points : current_points - points;
if (parse->PlayerHasQuestSub(event_id)) {
parse->EventPlayer(event_id, this, std::to_string(change), 0);
}
SendAlternateAdvancementStats();
}
bool Client::RemoveAAPoints(uint32 points)
{
if (m_pp.aapoints < points) {
return false;
}
m_pp.aapoints -= points;
if (parse->PlayerHasQuestSub(EVENT_AA_LOSS)) {
parse->EventPlayer(EVENT_AA_LOSS, this, std::to_string(points), 0);
}
SendAlternateAdvancementStats();
return true;
}
void Client::AddAAPoints(uint32 points)
{
m_pp.aapoints += points;
@@ -12194,3 +12313,34 @@ int Client::GetEXPPercentage()
return static_cast<int>(std::round(scaled * 100.0 / 330.0)); // unscaled pct
}
std::vector<Mob*> Client::GetRaidOrGroupOrSelf(bool clients_only)
{
std::vector<Mob*> v;
if (IsRaidGrouped()) {
Raid* r = GetRaid();
if (r) {
for (const auto& m : r->members) {
if (m.member && (!m.is_bot || !clients_only)) {
v.emplace_back(m.member);
}
}
}
} else if (IsGrouped()) {
Group* g = GetGroup();
if (g) {
for (const auto& m : g->members) {
if (m && (m->IsClient() || !clients_only)) {
v.emplace_back(m);
}
}
}
} else {
v.emplace_back(this);
}
return v;
}
+7 -2
View File
@@ -272,6 +272,8 @@ public:
int GetQuiverHaste(int delay);
void DoAttackRounds(Mob *target, int hand, bool IsFromSpell = false);
std::vector<Mob*> GetRaidOrGroupOrSelf(bool clients_only = false);
void AI_Init();
void AI_Start(uint32 iMoveDelay = 0);
void AI_Stop();
@@ -348,6 +350,7 @@ public:
int GetRecipeMadeCount(uint32 recipe_id);
bool HasRecipeLearned(uint32 recipe_id);
bool CanIncreaseTradeskill(EQ::skills::SkillType tradeskill);
void ScribeRecipes(uint32_t item_id) const;
bool GetRevoked() const { return revoked; }
void SetRevoked(bool rev) { revoked = rev; }
@@ -933,8 +936,9 @@ public:
void ResetAlternateAdvancementTimers();
void ResetOnDeathAlternateAdvancement();
void SetAAPoints(uint32 points) { m_pp.aapoints = points; SendAlternateAdvancementStats(); }
void SetAAPoints(uint32 points);
void AddAAPoints(uint32 points);
bool RemoveAAPoints(uint32 points);
int GetAAPoints() { return m_pp.aapoints; }
int GetSpentAA() { return m_pp.aapoints_spent; }
uint32 GetRequiredAAExperience();
@@ -1090,7 +1094,7 @@ public:
void SetPEQZoneFlag(uint32 zone_id);
bool CanFish();
void GoFish();
void GoFish(bool guarantee = false, bool use_bait = true);
void ForageItem(bool guarantee = false);
//Calculate vendor price modifier based on CHA: (reverse==selling)
float CalcPriceMod(Mob* other = 0, bool reverse = false);
@@ -1539,6 +1543,7 @@ public:
void SendAltCurrencies();
void SetAlternateCurrencyValue(uint32 currency_id, uint32 new_amount);
int AddAlternateCurrencyValue(uint32 currency_id, int amount, bool is_scripted = false);
bool RemoveAlternateCurrencyValue(uint32 currency_id, uint32 amount);
void SendAlternateCurrencyValues();
void SendAlternateCurrencyValue(uint32 currency_id, bool send_if_null = true);
uint32 GetAlternateCurrencyValue(uint32 currency_id) const;
+4 -3
View File
@@ -4168,10 +4168,11 @@ void Client::Handle_OP_BookButton(const EQApplicationPacket* app)
BookButton_Struct* book = reinterpret_cast<BookButton_Struct*>(app->pBuffer);
const EQ::ItemInstance* const inst = GetInv().GetItem(book->invslot);
if (inst && inst->GetItem()->Book)
if (inst && inst->GetItem())
{
// todo: if scribe book learn recipes and delete book from inventory
// todo: if cast book use its spell on target and delete book from inventory (unless reusable?)
// todo: cast spell button (unknown if anything on live uses this)
ScribeRecipes(inst->GetItem()->ID);
DeleteItemInInventory(book->invslot, 1, true);
}
EQApplicationPacket outapp(OP_FinishWindow, 0);
+6 -6
View File
@@ -1064,9 +1064,9 @@ void Client::OPRezzAnswer(uint32 Action, uint32 SpellID, uint16 ZoneID, uint16 I
);
SpellOnTarget(resurrection_sickness_spell_id, this);
} else if (SpellID == SPELL_DIVINE_REZ) {
SetHP(GetMaxHP());
SetMana(GetMaxMana());
SetEndurance(GetMaxEndurance());
RestoreHealth();
RestoreMana();
RestoreEndurance();
} else {
SetHP(GetMaxHP() / 20);
SetMana(GetMaxMana() / 20);
@@ -2177,9 +2177,9 @@ void Client::HandleRespawnFromHover(uint32 Option)
FastQueuePacket(&outapp);
CalcBonuses();
SetHP(GetMaxHP());
SetMana(GetMaxMana());
SetEndurance(GetMaxEndurance());
RestoreHealth();
RestoreMana();
RestoreEndurance();
m_Position.x = chosen->x;
m_Position.y = chosen->y;
+6
View File
@@ -131,8 +131,10 @@ int command_init(void)
command_add("feature", "Change your or your target's feature's temporarily", AccountStatus::QuestTroupe, command_feature) ||
command_add("size", "Change your targets size (alias of #feature size)", AccountStatus::QuestTroupe, command_feature) ||
command_add("find", "Search command used to find various things", AccountStatus::Guide, command_find) ||
command_add("fish", "Fish for an item", AccountStatus::QuestTroupe, command_fish) ||
command_add("fixmob", "[race|gender|texture|helm|face|hair|haircolor|beard|beardcolor|heritage|tattoo|detail] [next|prev] - Manipulate appearance of your target", AccountStatus::QuestTroupe, command_fixmob) ||
command_add("flagedit", "Edit zone flags on your target. Use #flagedit help for more info.", AccountStatus::GMAdmin, command_flagedit) ||
command_add("forage", "Forage an item", AccountStatus::QuestTroupe, command_forage) ||
command_add("gearup", "Developer tool to quickly equip yourself or your target", AccountStatus::GMMgmt, command_gearup) ||
command_add("giveitem", "[itemid] [charges] - Summon an item onto your target's cursor. Charges are optional.", AccountStatus::GMMgmt, command_giveitem) ||
command_add("givemoney", "[Platinum] [Gold] [Silver] [Copper] - Gives specified amount of money to you or your player target", AccountStatus::GMMgmt, command_givemoney) ||
@@ -206,6 +208,7 @@ int command_init(void)
command_add("scribespells", "[Max level] [Min level] - Scribe all spells for you or your player target that are usable by them, up to level specified. (may freeze client for a few seconds)", AccountStatus::GMLeadAdmin, command_scribespells) ||
command_add("sendzonespawns", "Refresh spawn list for all clients in zone", AccountStatus::GMLeadAdmin, command_sendzonespawns) ||
command_add("sensetrap", "Analog for ldon sense trap for the newer clients since we still don't have it working.", AccountStatus::Player, command_sensetrap) ||
command_add("serverrules", "Show server rules", AccountStatus::Player, command_serverrules) ||
command_add("set", "Set command used to set various things", AccountStatus::Guide, command_set) ||
command_add("show", "Show command used to show various things", AccountStatus::Guide, command_show) ||
command_add("shutdown", "Shut this zone process down", AccountStatus::GMLeadAdmin, command_shutdown) ||
@@ -822,8 +825,10 @@ void command_bot(Client *c, const Seperator *sep)
#include "gm_commands/faction.cpp"
#include "gm_commands/feature.cpp"
#include "gm_commands/find.cpp"
#include "gm_commands/fish.cpp"
#include "gm_commands/fixmob.cpp"
#include "gm_commands/flagedit.cpp"
#include "gm_commands/forage.cpp"
#include "gm_commands/gearup.cpp"
#include "gm_commands/giveitem.cpp"
#include "gm_commands/givemoney.cpp"
@@ -893,6 +898,7 @@ void command_bot(Client *c, const Seperator *sep)
#include "gm_commands/scribespells.cpp"
#include "gm_commands/sendzonespawns.cpp"
#include "gm_commands/sensetrap.cpp"
#include "gm_commands/serverrules.cpp"
#include "gm_commands/set.cpp"
#include "gm_commands/show.cpp"
#include "gm_commands/shutdown.cpp"
+2
View File
@@ -83,8 +83,10 @@ void command_faction(Client *c, const Seperator *sep);
void command_faction_association(Client *c, const Seperator *sep);
void command_feature(Client *c, const Seperator *sep);
void command_find(Client *c, const Seperator *sep);
void command_fish(Client* c, const Seperator* sep);
void command_fixmob(Client *c, const Seperator *sep);
void command_flagedit(Client *c, const Seperator *sep);
void command_forage(Client* c, const Seperator* sep);
void command_gearup(Client *c, const Seperator *sep);
void command_giveitem(Client *c, const Seperator *sep);
void command_givemoney(Client *c, const Seperator *sep);
+2 -1
View File
@@ -826,7 +826,8 @@ struct ExtraAttackOptions {
armor_pen_percent(0.0f), armor_pen_flat(0),
crit_percent(1.0f), crit_flat(0.0f),
hate_percent(1.0f), hate_flat(0), hit_chance(0),
melee_damage_bonus_flat(0), skilldmgtaken_bonus_flat(0)
melee_damage_bonus_flat(0), skilldmgtaken_bonus_flat(0),
range_percent(0)
{ }
float damage_percent;
+1 -1
View File
@@ -334,7 +334,7 @@ void DialogueWindow::Render(Client *c, std::string markdown)
if (responses.size() > 1) {
for (auto &r: responses) {
bracket_responses.emplace_back(
fmt::format("[{}]", Saylink::Create(r, false))
fmt::format("[{}]", Saylink::Create(r))
);
}
}
+9
View File
@@ -73,6 +73,15 @@ Doors::Doors(const DoorsRepository::Doors &door) :
m_door_param = door.door_param;
m_size = door.size;
m_invert_state = door.invert_state;
// if the target zone is the same as the current zone, use the instance of the current zone
// if we don't use the same instance_id that the client was sent, the client will forcefully
// issue a zone change request when they should be simply moving to a different point in the same zone
// because the client will think the zone point target is different from the current instance
if (door.dest_zone == zone->GetShortName() && m_destination_instance_id == 0) {
m_destination_instance_id = zone->GetInstanceID();
}
m_destination_instance_id = door.dest_instance;
m_is_ldon_door = door.is_ldon_door;
m_dz_switch_id = door.dz_switch_id;
+8
View File
@@ -56,6 +56,7 @@ void perl_register_doors();
void perl_register_expedition();
void perl_register_expedition_lock_messages();
void perl_register_bot();
void perl_register_buff();
#endif // EMBPERL_XS_CLASSES
#endif // EMBPERL_XS
@@ -200,6 +201,7 @@ const char* QuestEventSubroutines[_LargestEventID] = {
"EVENT_ENTITY_VARIABLE_DELETE",
"EVENT_ENTITY_VARIABLE_SET",
"EVENT_ENTITY_VARIABLE_UPDATE",
"EVENT_AA_LOSS",
// Add new events before these or Lua crashes
"EVENT_SPELL_EFFECT_BOT",
@@ -1174,6 +1176,7 @@ void PerlembParser::MapFunctions()
perl_register_expedition();
perl_register_expedition_lock_messages();
perl_register_bot();
perl_register_buff();
#endif // EMBPERL_XS_CLASSES
}
@@ -2273,6 +2276,11 @@ void PerlembParser::ExportEventVariables(
break;
}
case EVENT_AA_LOSS: {
ExportVar(package_name.c_str(), "aa_lost", data);
break;
}
case EVENT_AA_EXP_GAIN: {
ExportVar(package_name.c_str(), "aa_exp_gained", data);
break;
+26 -15
View File
@@ -380,12 +380,12 @@ void Perl__settimer(std::string timer_name, uint32 seconds)
void Perl__settimer(std::string timer_name, uint32 seconds, Mob* m)
{
quest_manager.settimer(timer_name, seconds);
quest_manager.settimer(timer_name, seconds, m);
}
void Perl__settimer(std::string timer_name, uint32 seconds, EQ::ItemInstance* inst)
{
quest_manager.settimer(timer_name, seconds);
quest_manager.settimerMS(timer_name, seconds * 1000, inst);
}
void Perl__settimerMS(std::string timer_name, uint32 milliseconds)
@@ -1654,20 +1654,19 @@ void Perl__FlagInstanceByRaidLeader(uint32 zone, uint16 version)
quest_manager.FlagInstanceByRaidLeader(zone, version);
}
std::string Perl__saylink(const char* text)
std::string Perl__saylink(std::string text)
{
// const cast is safe since, target api doesn't modify it
return quest_manager.saylink(const_cast<char*>(text), false, text);
return Saylink::Create(text);
}
std::string Perl__saylink(const char* text, bool silent)
std::string Perl__saylink(std::string text, bool silent)
{
return quest_manager.saylink(const_cast<char*>(text), silent, text);
return Saylink::Create(text, silent);
}
std::string Perl__saylink(const char* text, bool silent, const char* link_name)
std::string Perl__saylink(std::string text, bool silent, std::string link_name)
{
return quest_manager.saylink(const_cast<char*>(text), silent, link_name);
return Saylink::Create(text, silent, link_name);
}
std::string Perl__getcharnamebyid(uint32 char_id)
@@ -5833,6 +5832,16 @@ uint16 Perl__GetBotRaceByID(uint32 bot_id)
return database.botdb.GetBotRaceByID(bot_id);
}
std::string Perl__silent_saylink(std::string text)
{
return Saylink::Silent(text);
}
std::string Perl__silent_saylink(std::string text, std::string link_name)
{
return Saylink::Silent(text, link_name);
}
void perl_register_quest()
{
perl::interpreter perl(PERL_GET_THX);
@@ -6644,9 +6653,9 @@ void perl_register_quest()
package.add("say", (void(*)(const char*, uint8, int))&Perl__say);
package.add("say", (void(*)(const char*, uint8, int, int))&Perl__say);
package.add("say", (void(*)(const char*, uint8, int, int, int))&Perl__say);
package.add("saylink", (std::string(*)(const char*))&Perl__saylink);
package.add("saylink", (std::string(*)(const char*, bool))&Perl__saylink);
package.add("saylink", (std::string(*)(const char*, bool, const char*))&Perl__saylink);
package.add("saylink", (std::string(*)(std::string))&Perl__saylink);
package.add("saylink", (std::string(*)(std::string, bool))&Perl__saylink);
package.add("saylink", (std::string(*)(std::string, bool, std::string))&Perl__saylink);
package.add("scribespells", (int(*)(int))&Perl__scribespells);
package.add("scribespells", (int(*)(int, int))&Perl__scribespells);
package.add("secondstotime", &Perl__secondstotime);
@@ -6684,9 +6693,9 @@ void perl_register_quest()
package.add("settarget", &Perl__settarget);
package.add("settime", (void(*)(int, int))&Perl__settime);
package.add("settime", (void(*)(int, int, bool))&Perl__settime);
package.add("settimer", (void(*)(std::string, uint32))&Perl__settimer),
package.add("settimer", (void(*)(std::string, uint32, EQ::ItemInstance*))&Perl__settimer),
package.add("settimer", (void(*)(std::string, uint32, Mob*))&Perl__settimer),
package.add("settimer", (void(*)(std::string, uint32))&Perl__settimer);
package.add("settimer", (void(*)(std::string, uint32, EQ::ItemInstance*))&Perl__settimer);
package.add("settimer", (void(*)(std::string, uint32, Mob*))&Perl__settimer);
package.add("settimerMS", (void(*)(std::string, uint32))&Perl__settimerMS);
package.add("settimerMS", (void(*)(std::string, uint32, EQ::ItemInstance*))&Perl__settimerMS);
package.add("settimerMS", (void(*)(std::string, uint32, Mob*))&Perl__settimerMS);
@@ -6698,6 +6707,8 @@ void perl_register_quest()
package.add("signal", (void(*)(int, int))&Perl__signal);
package.add("signalwith", (void(*)(int, int))&Perl__signalwith);
package.add("signalwith", (void(*)(int, int, int))&Perl__signalwith);
package.add("silent_saylink", (std::string(*)(std::string))&Perl__silent_saylink);
package.add("silent_saylink", (std::string(*)(std::string, std::string))&Perl__silent_saylink);
package.add("snow", &Perl__snow);
package.add("spawn", &Perl__spawn);
package.add("spawn2", &Perl__spawn2);
+7 -5
View File
@@ -2152,7 +2152,7 @@ Group *EntityList::GetGroupByLeaderName(const char *leader)
iterator = group_list.begin();
while (iterator != group_list.end()) {
if (!strcmp((*iterator)->GetLeaderName(), leader))
if (!strcmp((*iterator)->GetLeaderName().c_str(), leader))
return *iterator;
++iterator;
}
@@ -4379,8 +4379,9 @@ void EntityList::AddTempPetsToHateList(Mob *owner, Mob* other, bool bFrenzy)
if (n->GetSwarmInfo()->owner_id == owner->GetID()) {
if (
!n->GetSpecialAbility(IMMUNE_AGGRO) &&
!(n->GetSpecialAbility(IMMUNE_AGGRO_CLIENT) && other->IsClient()) &&
!(n->GetSpecialAbility(IMMUNE_AGGRO_NPC) && other->IsNPC())
!(other->IsBot() && n->GetSpecialAbility(IMMUNE_AGGRO_BOT)) &&
!(other->IsClient() && n->GetSpecialAbility(IMMUNE_AGGRO_CLIENT)) &&
!(other->IsNPC() && n->GetSpecialAbility(IMMUNE_AGGRO_NPC))
) {
n->hate_list.AddEntToHateList(other, 0, 0, bFrenzy);
}
@@ -4405,8 +4406,9 @@ void EntityList::AddTempPetsToHateListOnOwnerDamage(Mob *owner, Mob* attacker, i
attacker != n &&
!n->IsEngaged() &&
!n->GetSpecialAbility(IMMUNE_AGGRO) &&
!(n->GetSpecialAbility(IMMUNE_AGGRO_CLIENT) && attacker->IsClient()) &&
!(n->GetSpecialAbility(IMMUNE_AGGRO_NPC) && attacker->IsNPC()) &&
!(attacker->IsBot() && n->GetSpecialAbility(IMMUNE_AGGRO_BOT)) &&
!(attacker->IsClient() && n->GetSpecialAbility(IMMUNE_AGGRO_CLIENT)) &&
!(attacker->IsNPC() && n->GetSpecialAbility(IMMUNE_AGGRO_NPC)) &&
!attacker->IsTrap() &&
!attacker->IsCorpse()
) {
+1
View File
@@ -142,6 +142,7 @@ typedef enum {
EVENT_ENTITY_VARIABLE_DELETE,
EVENT_ENTITY_VARIABLE_SET,
EVENT_ENTITY_VARIABLE_UPDATE,
EVENT_AA_LOSS,
// Add new events before these or Lua crashes
EVENT_SPELL_EFFECT_BOT,
+1 -8
View File
@@ -125,7 +125,7 @@ bool ExpeditionRequest::CanGroupRequest(Group* group)
}
// Group::GetLeaderName() is broken if group formed across zones, ask database instead
m_leader_name = m_leader ? m_leader->GetName() : GetGroupLeaderName(group->GetID()); // group->GetLeaderName();
m_leader_name = m_leader ? m_leader->GetName() : group->GetLeaderName();
m_leader_id = m_leader ? m_leader->CharacterID() : database.GetCharacterID(m_leader_name);
std::vector<std::string> member_names;
@@ -148,13 +148,6 @@ bool ExpeditionRequest::CanGroupRequest(Group* group)
return CanMembersJoin(member_names);
}
std::string ExpeditionRequest::GetGroupLeaderName(uint32_t group_id)
{
char leader_name_buffer[64] = { 0 };
database.GetGroupLeadershipInfo(group_id, leader_name_buffer);
return std::string(leader_name_buffer);
}
bool ExpeditionRequest::CanMembersJoin(const std::vector<std::string>& member_names)
{
if (member_names.empty())
-1
View File
@@ -54,7 +54,6 @@ private:
bool CanRaidRequest(Raid* raid);
bool CanGroupRequest(Group* group);
bool CheckMembersForConflicts(const std::vector<std::string>& member_names);
std::string GetGroupLeaderName(uint32_t group_id);
bool IsPlayerCountValidated();
bool SaveLeaderLockouts(const std::vector<ExpeditionLockoutTimer>& leader_lockouts);
void SendLeaderMemberInExpedition(const std::string& member_name, bool is_solo);
+7 -5
View File
@@ -89,7 +89,7 @@ uint32 ZoneDatabase::LoadForage(uint32 zone_id, uint8 skill_level)
}
forage_items[count] = e.Itemid;
forage_chances[count] = e.chance;
forage_chances[count] = e.chance + current_chance;
current_chance = forage_chances[count];
@@ -257,7 +257,7 @@ bool Client::CanFish() {
return true;
}
void Client::GoFish()
void Client::GoFish(bool guarantee, bool use_bait)
{
//TODO: generate a message if we're already fishing
@@ -306,7 +306,7 @@ void Client::GoFish()
fishing_skill = 100+((fishing_skill-100)/2);
}
if (zone->random.Int(0,175) < fishing_skill) {
if (guarantee || zone->random.Int(0,175) < fishing_skill) {
uint32 food_id = 0;
//25% chance to fish an item.
@@ -343,8 +343,10 @@ void Client::GoFish()
}
}
//consume bait, should we always consume bait on success?
DeleteItemInInventory(bslot, 1, true); //do we need client update?
if (use_bait) {
//consume bait, should we always consume bait on success?
DeleteItemInInventory(bslot, 1, true); //do we need client update?
}
if(food_id == 0) {
int index = zone->random.Int(0, MAX_COMMON_FISH_IDS-1);
+6
View File
@@ -0,0 +1,6 @@
#include "../client.h"
void command_fish(Client *c, const Seperator *sep)
{
c->GoFish(true, false);
}
+6
View File
@@ -0,0 +1,6 @@
#include "../client.h"
void command_forage(Client *c, const Seperator *sep)
{
c->ForageItem(true);
}
+2 -1
View File
@@ -3,6 +3,7 @@
void command_goto(Client *c, const Seperator *sep)
{
std::string arg1 = sep->arg[1];
std::string arg4 = sep->arg[4];
bool goto_via_target_no_args = sep->arg[1][0] == '\0' && c->GetTarget();
bool goto_via_player_name = !sep->IsNumber(1) && !arg1.empty();
@@ -52,7 +53,7 @@ void command_goto(Client *c, const Seperator *sep)
Strings::ToFloat(sep->arg[1]),
Strings::ToFloat(sep->arg[2]),
Strings::ToFloat(sep->arg[3]),
(sep->arg[4] ? Strings::ToFloat(sep->arg[4]) : c->GetHeading())
(!arg4.empty() ? Strings::ToFloat(sep->arg[4]) : c->GetHeading())
);
}
else {
+4 -4
View File
@@ -82,7 +82,7 @@ void command_logs(Client *c, const Seperator *sep)
}
gmsay.emplace_back(
EQ::SayLinkEngine::GenerateQuestSaylink(
Saylink::Create(
fmt::format("#logs set gmsay {} {}", index, i), false, std::to_string(i)
)
);
@@ -96,7 +96,7 @@ void command_logs(Client *c, const Seperator *sep)
}
file.emplace_back(
EQ::SayLinkEngine::GenerateQuestSaylink(
Saylink::Create(
fmt::format("#logs set file {} {}", index, i), false, std::to_string(i)
)
);
@@ -110,7 +110,7 @@ void command_logs(Client *c, const Seperator *sep)
}
console.emplace_back(
EQ::SayLinkEngine::GenerateQuestSaylink(
Saylink::Create(
fmt::format("#logs set console {} {}", index, i), false, std::to_string(i)
)
);
@@ -124,7 +124,7 @@ void command_logs(Client *c, const Seperator *sep)
}
discord.emplace_back(
EQ::SayLinkEngine::GenerateQuestSaylink(
Saylink::Create(
fmt::format("#logs set discord {} {}", index, i), false, std::to_string(i)
)
);
+2 -2
View File
@@ -116,13 +116,13 @@ void command_lootsim(Client *c, const Seperator *sep)
c->Message(Chat::White, fmt::format("# Global Loot Table ID [{}]", id).c_str());
c->SendChatLineBreak();
loot_table = zone->GetLootTable(loottable_id);
loot_table = zone->GetLootTable(id);
if (!loot_table) {
c->Message(Chat::Red, fmt::format("Global Loot table not found [{}]", id).c_str());
continue;
}
le = zone->GetLootTableEntries(loottable_id);
le = zone->GetLootTableEntries(id);
// translate above for loop using loot_table_entries
for (auto &e: le) {
+1 -1
View File
@@ -7,7 +7,7 @@ void SetHPFull(Client *c, const Seperator *sep)
t = c->GetTarget();
}
t->Heal();
t->RestoreHealth();
c->Message(
Chat::White,
+7 -9
View File
@@ -620,7 +620,7 @@ bool Group::DelMemberOOZ(const char *Name) {
if(!strcasecmp(Name, membername[i]))
// This shouldn't be called if the member is in this zone.
if(!members[i]) {
if(!strncmp(GetLeaderName(), Name, 64))
if(!strncmp(GetLeaderName().c_str(), Name, 64))
{
//TODO: Transfer leadership if leader disbands OOZ.
UpdateGroupAAs();
@@ -703,7 +703,7 @@ bool Group::DelMember(Mob* oldmember, bool ignoresender)
}
}
if (!GetLeaderName())
if (GetLeaderName().empty())
{
DisbandGroup();
return true;
@@ -1676,7 +1676,7 @@ void Group::NotifyMainTank(Client *c, uint8 toggle)
strn0cpy(grs->Name1, MainTankName.c_str(), sizeof(grs->Name1));
strn0cpy(grs->Name2, GetLeaderName(), sizeof(grs->Name2));
strn0cpy(grs->Name2, GetLeaderName().c_str(), sizeof(grs->Name2));
grs->RoleNumber = 1;
@@ -1729,7 +1729,7 @@ void Group::NotifyMainAssist(Client *c, uint8 toggle)
strn0cpy(grs->Name1, MainAssistName.c_str(), sizeof(grs->Name1));
strn0cpy(grs->Name2, GetLeaderName(), sizeof(grs->Name2));
strn0cpy(grs->Name2, GetLeaderName().c_str(), sizeof(grs->Name2));
grs->RoleNumber = 2;
@@ -1771,7 +1771,7 @@ void Group::NotifyPuller(Client *c, uint8 toggle)
strn0cpy(grs->Name1, PullerName.c_str(), sizeof(grs->Name1));
strn0cpy(grs->Name2, GetLeaderName(), sizeof(grs->Name2));
strn0cpy(grs->Name2, GetLeaderName().c_str(), sizeof(grs->Name2));
grs->RoleNumber = 3;
@@ -2511,8 +2511,6 @@ bool Group::IsLeader(const char* name) {
return false;
}
std::string Group::GetGroupLeaderName(uint32 group_id) {
char leader_name_buffer[64] = { 0 };
database.GetGroupLeadershipInfo(group_id, leader_name_buffer);
return std::string(leader_name_buffer);
std::string Group::GetLeaderName() {
return database.GetGroupLeaderName(GetID());
}
+1 -3
View File
@@ -76,7 +76,7 @@ public:
void SplitMoney(uint32 copper, uint32 silver, uint32 gold, uint32 platinum, Client *splitter = nullptr);
inline void SetLeader(Mob* c){ leader = c; };
inline Mob* GetLeader() { return leader; };
const char* GetLeaderName() { return GetGroupLeaderName(GetID()).c_str(); };
std::string GetLeaderName();
void SendHPManaEndPacketsTo(Mob* newmember);
void SendHPPacketsFrom(Mob* member);
void SendManaPacketFrom(Mob* member);
@@ -177,8 +177,6 @@ private:
int mentor_percent;
XTargetAutoHaters m_autohatermgr;
std::string GetGroupLeaderName(uint32 group_id);
};
#endif
+33 -2
View File
@@ -22,7 +22,7 @@ void NPC::AddLootTable(uint32 loottable_id, bool is_global)
if (!npctype_id) {
return;
}
if (!is_global) {
m_loot_copper = 0;
m_loot_silver = 0;
@@ -37,6 +37,14 @@ void NPC::AddLootTable(uint32 loottable_id, bool is_global)
return;
}
LogLootDetail(
"Attempting to load loot [{}] loottable [{}] ({}) is_global [{}]",
GetCleanName(),
loottable_id,
l->name,
is_global
);
auto content_flags = ContentFlags{
.min_expansion = l->min_expansion,
.max_expansion = l->max_expansion,
@@ -106,7 +114,12 @@ void NPC::AddLootTable(uint32 loottable_id, bool is_global)
}
}
LogLootDetail("Loaded [{}] Loot Table [{}]", GetCleanName(), loottable_id);
LogLootDetail(
"Loaded [{}] Loot Table [{}] is_global [{}]",
GetCleanName(),
loottable_id,
is_global
);
}
void NPC::AddLootDropTable(uint32 lootdrop_id, uint8 drop_limit, uint8 min_drop)
@@ -128,10 +141,28 @@ void NPC::AddLootDropTable(uint32 lootdrop_id, uint8 drop_limit, uint8 min_drop)
// if this lootdrop is droplimit=0 and mindrop 0, scan list once and return
if (drop_limit == 0 && min_drop == 0) {
for (const auto &e: le) {
LogLootDetail(
"-- NPC [{}] Lootdrop [{}] Item [{}] ({}_ Chance [{}] Multiplier [{}]",
GetCleanName(),
lootdrop_id,
database.GetItem(e.item_id)->Name,
e.item_id,
e.chance,
e.multiplier
);
for (int j = 0; j < e.multiplier; ++j) {
if (zone->random.Real(0.0, 100.0) <= e.chance && MeetsLootDropLevelRequirements(e, true)) {
const EQ::ItemData *database_item = database.GetItem(e.item_id);
AddLootDrop(database_item, e);
LogLootDetail(
"---- NPC (Rolled) [{}] Lootdrop [{}] Item [{}] ({}) Chance [{}] Multiplier [{}]",
GetCleanName(),
lootdrop_id,
database_item->Name,
e.item_id,
e.chance,
e.multiplier
);
}
}
}
+6
View File
@@ -659,6 +659,11 @@ void Lua_Bot::SetBucket(std::string bucket_name, std::string bucket_value, std::
self->SetBucket(bucket_name, bucket_value, expiration);
}
void Lua_Bot::DeleteBot() {
Lua_Safe_Call_Void();
self->DeleteBot();
}
luabind::scope lua_register_bot() {
return luabind::class_<Lua_Bot, Lua_Mob>("Bot")
.def(luabind::constructor<>())
@@ -698,6 +703,7 @@ luabind::scope lua_register_bot() {
.def("ClearSpellRecastTimer", (void(Lua_Bot::*)(uint16))&Lua_Bot::ClearSpellRecastTimer)
.def("CountBotItem", (uint32(Lua_Bot::*)(uint32))&Lua_Bot::CountBotItem)
.def("CountItemEquippedByID", (int(Lua_Bot::*)(uint32))&Lua_Bot::CountItemEquippedByID)
.def("DeleteBot", (void(Lua_Bot::*)(void))&Lua_Bot::DeleteBot)
.def("DeleteBucket", (void(Lua_Bot::*)(std::string))&Lua_Bot::DeleteBucket)
.def("Escape", (void(Lua_Bot::*)(void))&Lua_Bot::Escape)
.def("Fling", (void(Lua_Bot::*)(float,float,float))&Lua_Bot::Fling)
+1
View File
@@ -60,6 +60,7 @@ public:
uint32 GetBotID();
void Camp();
void Camp(bool save_to_database);
void DeleteBot();
Lua_ItemInst GetAugmentAt(int16 slot_id, uint8 augment_index);
int GetAugmentIDAt(int16 slot_id, uint8 augment_index);
luabind::object GetAugmentIDsBySlotID(lua_State* L, int16 slot_id) const;
+154
View File
@@ -0,0 +1,154 @@
#ifdef LUA_EQEMU
#include "lua.hpp"
#include <luabind/luabind.hpp>
#include <luabind/iterator_policy.hpp>
#include "lua_buff.h"
uint16 Lua_Buff::GetCasterID()
{
Lua_Safe_Call_Int();
return self->casterid;
}
uint8 Lua_Buff::GetCasterLevel()
{
Lua_Safe_Call_Int();
return self->casterlevel;
}
std::string Lua_Buff::GetCasterName()
{
Lua_Safe_Call_String();
return self->caster_name;
}
int Lua_Buff::GetCastOnX()
{
Lua_Safe_Call_Int();
return self->caston_x;
}
int Lua_Buff::GetCastOnY()
{
Lua_Safe_Call_Int();
return self->caston_y;
}
int Lua_Buff::GetCastOnZ()
{
Lua_Safe_Call_Int();
return self->caston_z;
}
uint32 Lua_Buff::GetCounters()
{
Lua_Safe_Call_Int();
return self->counters;
}
uint32 Lua_Buff::GetDOTRune()
{
Lua_Safe_Call_Int();
return self->dot_rune;
}
int Lua_Buff::GetExtraDIChance()
{
Lua_Safe_Call_Int();
return self->ExtraDIChance;
}
uint32 Lua_Buff::GetInstrumentModifier()
{
Lua_Safe_Call_Int();
return self->instrument_mod;
}
uint32 Lua_Buff::GetMagicRune()
{
Lua_Safe_Call_Int();
return self->magic_rune;
}
uint32 Lua_Buff::GetMeleeRune()
{
Lua_Safe_Call_Int();
return self->melee_rune;
}
uint32 Lua_Buff::GetNumberOfHits()
{
Lua_Safe_Call_Int();
return self->hit_number;
}
int16 Lua_Buff::GetRootBreakChance()
{
Lua_Safe_Call_Int();
return self->RootBreakChance;
}
uint16 Lua_Buff::GetSpellID()
{
Lua_Safe_Call_Int();
return self->spellid;
}
int Lua_Buff::GetTicsRemaining()
{
Lua_Safe_Call_Int();
return self->ticsremaining;
}
int Lua_Buff::GetVirusSpreadTime()
{
Lua_Safe_Call_Int();
return self->virus_spread_time;
}
bool Lua_Buff::IsCasterClient()
{
Lua_Safe_Call_Bool();
return self->client;
}
bool Lua_Buff::IsPersistentBuff()
{
Lua_Safe_Call_Bool();
return self->persistant_buff;
}
bool Lua_Buff::SendsClientUpdate()
{
Lua_Safe_Call_Bool();
return self->UpdateClient;
}
luabind::scope lua_register_buff() {
return luabind::class_<Lua_Buff>("Buff")
.def(luabind::constructor<>())
.def("GetCasterID", &Lua_Buff::GetCasterID)
.def("GetCasterLevel", &Lua_Buff::GetCasterLevel)
.def("GetCasterName", &Lua_Buff::GetCasterName)
.def("GetCastOnX", &Lua_Buff::GetCastOnX)
.def("GetCastOnY", &Lua_Buff::GetCastOnY)
.def("GetCastOnZ", &Lua_Buff::GetCastOnZ)
.def("GetCounters", &Lua_Buff::GetCounters)
.def("GetDOTRune", &Lua_Buff::GetDOTRune)
.def("GetExtraDIChance", &Lua_Buff::GetExtraDIChance)
.def("GetInstrumentModifier", &Lua_Buff::GetInstrumentModifier)
.def("GetMagicRune", &Lua_Buff::GetMagicRune)
.def("GetMeleeRune", &Lua_Buff::GetMeleeRune)
.def("GetNumberOfHits", &Lua_Buff::GetNumberOfHits)
.def("GetRootBreakChance", &Lua_Buff::GetRootBreakChance)
.def("GetSpellID", &Lua_Buff::GetSpellID)
.def("GetTicsRemaining", &Lua_Buff::GetTicsRemaining)
.def("GetVirusSpreadTime", &Lua_Buff::GetVirusSpreadTime)
.def("IsCasterClient", &Lua_Buff::IsCasterClient)
.def("IsPersistentBuff", &Lua_Buff::IsPersistentBuff)
.def("SendsClientUpdate", &Lua_Buff::SendsClientUpdate);
}
#endif
+51
View File
@@ -0,0 +1,51 @@
#ifndef EQEMU_LUA_BUFF_H
#define EQEMU_LUA_BUFF_H
#ifdef LUA_EQEMU
#include "common.h"
#include "lua_ptr.h"
struct Buffs_Struct;
namespace luabind {
struct scope;
}
luabind::scope lua_register_buff();
class Lua_Buff : public Lua_Ptr<const Buffs_Struct>
{
typedef const Buffs_Struct NativeType;
public:
Lua_Buff() : Lua_Ptr(nullptr) { }
Lua_Buff(const Buffs_Struct *d) : Lua_Ptr(d) { }
virtual ~Lua_Buff() { }
operator const Buffs_Struct*() {
return reinterpret_cast<const Buffs_Struct*>(GetLuaPtrData());
}
uint16 GetCasterID();
uint8 GetCasterLevel();
std::string GetCasterName();
int GetCastOnX();
int GetCastOnY();
int GetCastOnZ();
uint32 GetCounters();
uint32 GetDOTRune();
int GetExtraDIChance();
uint32 GetInstrumentModifier();
uint32 GetMagicRune();
uint32 GetMeleeRune();
uint32 GetNumberOfHits();
int16 GetRootBreakChance();
uint16 GetSpellID();
int GetTicsRemaining();
int GetVirusSpreadTime();
bool IsCasterClient();
bool IsPersistentBuff();
bool SendsClientUpdate();
};
#endif
#endif
+48
View File
@@ -3296,6 +3296,50 @@ bool Lua_Client::IsInAGuild()
return self->IsInAGuild();
}
bool Lua_Client::RemoveAAPoints(uint32 points)
{
Lua_Safe_Call_Bool();
return self->RemoveAAPoints(points);
}
bool Lua_Client::RemoveAlternateCurrencyValue(uint32 currency_id, uint32 amount)
{
Lua_Safe_Call_Bool();
return self->RemoveAlternateCurrencyValue(currency_id, amount);
}
luabind::object Lua_Client::GetRaidOrGroupOrSelf(lua_State* L)
{
auto t = luabind::newtable(L);
if (d_) {
auto self = reinterpret_cast<NativeType*>(d_);
auto l = self->GetRaidOrGroupOrSelf();
int i = 1;
for (const auto& e : l) {
t[i] = Lua_Mob(e);
i++;
}
}
return t;
}
luabind::object Lua_Client::GetRaidOrGroupOrSelf(lua_State* L, bool clients_only)
{
auto t = luabind::newtable(L);
if (d_) {
auto self = reinterpret_cast<NativeType*>(d_);
auto l = self->GetRaidOrGroupOrSelf(clients_only);
int i = 1;
for (const auto& e : l) {
t[i] = Lua_Mob(e);
i++;
}
}
return t;
}
luabind::scope lua_register_client() {
return luabind::class_<Lua_Client, Lua_Mob>("Client")
.def(luabind::constructor<>())
@@ -3530,6 +3574,8 @@ luabind::scope lua_register_client() {
.def("GetRaceBitmask", (int(Lua_Client::*)(void))&Lua_Client::GetRaceBitmask)
.def("GetRadiantCrystals", (uint32(Lua_Client::*)(void))&Lua_Client::GetRadiantCrystals)
.def("GetRaid", (Lua_Raid(Lua_Client::*)(void))&Lua_Client::GetRaid)
.def("GetRaidOrGroupOrSelf", (luabind::object(Lua_Client::*)(lua_State*))&Lua_Client::GetRaidOrGroupOrSelf)
.def("GetRaidOrGroupOrSelf", (luabind::object(Lua_Client::*)(lua_State*,bool))&Lua_Client::GetRaidOrGroupOrSelf)
.def("GetRaidPoints", (uint32(Lua_Client::*)(void))&Lua_Client::GetRaidPoints)
.def("GetRaceAbbreviation", (std::string(Lua_Client::*)(void))&Lua_Client::GetRaceAbbreviation)
.def("GetRawItemAC", (int(Lua_Client::*)(void))&Lua_Client::GetRawItemAC)
@@ -3669,8 +3715,10 @@ luabind::scope lua_register_client() {
.def("ReadBookByName", (void(Lua_Client::*)(std::string,uint8))&Lua_Client::ReadBookByName)
.def("RefundAA", (void(Lua_Client::*)(void))&Lua_Client::RefundAA)
.def("ReloadDataBuckets", (bool(Lua_Client::*)(void))&Lua_Client::ReloadDataBuckets)
.def("RemoveAAPoints", (bool(Lua_Client::*)(uint32))&Lua_Client::RemoveAAPoints)
.def("RemoveAllExpeditionLockouts", (void(Lua_Client::*)(std::string))&Lua_Client::RemoveAllExpeditionLockouts)
.def("RemoveAllExpeditionLockouts", (void(Lua_Client::*)(void))&Lua_Client::RemoveAllExpeditionLockouts)
.def("RemoveAlternateCurrencyValue", (bool(Lua_Client::*)(uint32,uint32))&Lua_Client::RemoveAlternateCurrencyValue)
.def("RemoveExpeditionLockout", (void(Lua_Client::*)(std::string, std::string))&Lua_Client::RemoveExpeditionLockout)
.def("RemoveItem", (void(Lua_Client::*)(uint32))&Lua_Client::RemoveItem)
.def("RemoveItem", (void(Lua_Client::*)(uint32,uint32))&Lua_Client::RemoveItem)
+4
View File
@@ -496,6 +496,8 @@ public:
int GetAAEXPPercentage();
int GetEXPPercentage();
bool IsInAGuild();
luabind::object GetRaidOrGroupOrSelf(lua_State* L);
luabind::object GetRaidOrGroupOrSelf(lua_State* L, bool clients_only);
void ApplySpell(int spell_id);
void ApplySpell(int spell_id, int duration);
@@ -566,6 +568,8 @@ public:
void SetBotSpawnLimit(int new_spawn_limit, uint8 class_id);
void CampAllBots();
void CampAllBots(uint8 class_id);
bool RemoveAAPoints(uint32 points);
bool RemoveAlternateCurrencyValue(uint32 currency_id, uint32 amount);
void DialogueWindow(std::string markdown);
+39 -20
View File
@@ -894,25 +894,16 @@ std::string lua_get_item_name(uint32 item_id) {
return quest_manager.getitemname(item_id);
}
std::string lua_say_link(const char *phrase, bool silent, const char *link_name) {
char text[256] = { 0 };
strncpy(text, phrase, 255);
return quest_manager.saylink(text, silent, link_name);
std::string lua_say_link(std::string text) {
return Saylink::Create(text);
}
std::string lua_say_link(const char *phrase, bool silent) {
char text[256] = { 0 };
strncpy(text, phrase, 255);
return quest_manager.saylink(text, silent, text);
std::string lua_say_link(std::string text, bool silent) {
return Saylink::Create(text, silent, text);
}
std::string lua_say_link(const char *phrase) {
char text[256] = { 0 };
strncpy(text, phrase, 255);
return quest_manager.saylink(text, false, text);
std::string lua_say_link(std::string text, bool silent, std::string link_name) {
return Saylink::Create(text, silent, link_name);
}
void lua_set_rule(std::string rule_name, std::string rule_value) {
@@ -5475,6 +5466,14 @@ uint16 lua_get_bot_race_by_id(uint32 bot_id)
return database.botdb.GetBotRaceByID(bot_id);
}
std::string lua_silent_say_link(std::string text) {
return Saylink::Silent(text);
}
std::string lua_silent_say_link(std::string text, std::string link_name) {
return Saylink::Silent(text, link_name);
}
#define LuaCreateNPCParse(name, c_type, default_value) do { \
cur = table[#name]; \
if(luabind::type(cur) != LUA_TNIL) { \
@@ -5653,6 +5652,10 @@ bool get_ruleb(int rule) {
return RuleManager::Instance()->GetBoolRule((RuleManager::BoolType)rule);
}
std::string get_rules(int rule) {
return RuleManager::Instance()->GetStringRule((RuleManager::StringType)rule);
}
luabind::scope lua_register_general() {
return luabind::namespace_("eq")
[(
@@ -5824,9 +5827,9 @@ luabind::scope lua_register_general() {
luabind::def("get_item_comment", (std::string(*)(uint32))&lua_get_item_comment),
luabind::def("get_item_lore", (std::string(*)(uint32))&lua_get_item_lore),
luabind::def("get_item_name", (std::string(*)(uint32))&lua_get_item_name),
luabind::def("say_link", (std::string(*)(const char*,bool,const char*))&lua_say_link),
luabind::def("say_link", (std::string(*)(const char*,bool))&lua_say_link),
luabind::def("say_link", (std::string(*)(const char*))&lua_say_link),
luabind::def("say_link", (std::string(*)(std::string))&lua_say_link),
luabind::def("say_link", (std::string(*)(std::string,bool))&lua_say_link),
luabind::def("say_link", (std::string(*)(std::string,bool,std::string))&lua_say_link),
luabind::def("set_rule", (void(*)(std::string, std::string))&lua_set_rule),
luabind::def("get_rule", (std::string(*)(std::string))&lua_get_rule),
luabind::def("get_data", (std::string(*)(std::string))&lua_get_data),
@@ -6265,6 +6268,8 @@ luabind::scope lua_register_general() {
luabind::def("get_bot_level_by_id", &lua_get_bot_level_by_id),
luabind::def("get_bot_name_by_id", &lua_get_bot_name_by_id),
luabind::def("get_bot_race_by_id", &lua_get_bot_race_by_id),
luabind::def("silent_say_link", (std::string(*)(std::string))&lua_silent_say_link),
luabind::def("silent_say_link", (std::string(*)(std::string,std::string))&lua_silent_say_link),
/*
Cross Zone
*/
@@ -6729,7 +6734,8 @@ luabind::scope lua_register_events() {
luabind::value("timer_stop", static_cast<int>(EVENT_TIMER_STOP)),
luabind::value("entity_variable_delete", static_cast<int>(EVENT_ENTITY_VARIABLE_DELETE)),
luabind::value("entity_variable_set", static_cast<int>(EVENT_ENTITY_VARIABLE_SET)),
luabind::value("entity_variable_update", static_cast<int>(EVENT_ENTITY_VARIABLE_UPDATE))
luabind::value("entity_variable_update", static_cast<int>(EVENT_ENTITY_VARIABLE_UPDATE)),
luabind::value("aa_loss", static_cast<int>(EVENT_AA_LOSS))
)];
}
@@ -7244,7 +7250,13 @@ luabind::scope lua_register_rules_const() {
#define RULE_BOOL(cat, rule, default_value, notes) \
luabind::value(#rule, RuleManager::Bool__##rule),
#include "../common/ruletypes.h"
luabind::value("_BoolRuleCount", RuleManager::_BoolRuleCount)
luabind::value("_BoolRuleCount", RuleManager::_BoolRuleCount),
#undef RULE_BOOL
#define RULE_STRING(cat, rule, default_value, notes) \
luabind::value(#rule, RuleManager::String__##rule),
#include "../common/ruletypes.h"
luabind::value("_StringRuleCount", RuleManager::_StringRuleCount)
#undef RULE_STRING
)];
}
@@ -7269,6 +7281,13 @@ luabind::scope lua_register_ruleb() {
];
}
luabind::scope lua_register_rules() {
return luabind::namespace_("RuleS")
[
luabind::def("Get", &get_rules)
];
}
luabind::scope lua_register_journal_speakmode() {
return luabind::class_<Journal_SpeakMode>("SpeakMode")
.enum_("constants")
+1 -1
View File
@@ -72,7 +72,7 @@ Lua_Mob Lua_Group::GetLeader() {
return self->GetLeader();
}
const char *Lua_Group::GetLeaderName() {
std::string Lua_Group::GetLeaderName() {
Lua_Safe_Call_String();
return self->GetLeaderName();
}
+1 -1
View File
@@ -39,7 +39,7 @@ public:
void SplitMoney(uint32 copper, uint32 silver, uint32 gold, uint32 platinum, Lua_Client splitter);
void SetLeader(Lua_Mob c);
Lua_Mob GetLeader();
const char *GetLeaderName();
std::string GetLeaderName();
bool IsLeader(const char* name);
bool IsLeader(Lua_Mob c);
int GroupCount();
+90 -12
View File
@@ -3,18 +3,19 @@
#include "lua.hpp"
#include <luabind/luabind.hpp>
#include "client.h"
#include "npc.h"
#include "bot.h"
#include "client.h"
#include "dialogue_window.h"
#include "lua_bot.h"
#include "lua_buff.h"
#include "lua_client.h"
#include "lua_hate_list.h"
#include "lua_item.h"
#include "lua_iteminst.h"
#include "lua_mob.h"
#include "lua_npc.h"
#include "lua_hate_list.h"
#include "lua_client.h"
#include "lua_stat_bonuses.h"
#include "dialogue_window.h"
#include "npc.h"
struct SpecialAbilities { };
@@ -215,11 +216,6 @@ void Lua_Mob::ThrowingAttack(Lua_Mob other) {
self->ThrowingAttack(other);
}
void Lua_Mob::Heal() {
Lua_Safe_Call_Void();
self->Heal();
}
void Lua_Mob::HealDamage(uint64 amount) {
Lua_Safe_Call_Void();
self->HealDamage(amount);
@@ -3267,6 +3263,76 @@ bool Lua_Mob::IsPetOwnerNPC()
return self->IsPetOwnerNPC();
}
bool Lua_Mob::IsDestructibleObject()
{
Lua_Safe_Call_Bool();
return self->IsDestructibleObject();
}
bool Lua_Mob::IsBoat()
{
Lua_Safe_Call_Bool();
return self->IsBoat();
}
bool Lua_Mob::IsControllableBoat()
{
Lua_Safe_Call_Bool();
return self->IsControllableBoat();
}
int Lua_Mob::GetHeroicStrikethrough()
{
Lua_Safe_Call_Int();
return self->GetHeroicStrikethrough();
}
bool Lua_Mob::IsAlwaysAggro()
{
Lua_Safe_Call_Bool();
return self->AlwaysAggro();
}
std::string Lua_Mob::GetDeityName()
{
Lua_Safe_Call_String();
return EQ::deity::GetDeityName(static_cast<EQ::deity::DeityType>(self->GetDeity()));
}
luabind::object Lua_Mob::GetBuffs(lua_State* L)
{
auto t = luabind::newtable(L);
if (d_) {
auto self = reinterpret_cast<NativeType *>(d_);
auto l = self->GetBuffs();
int i = 1;
for (int slot_id = 0; slot_id < self->GetMaxBuffSlots(); slot_id++) {
t[i] = Lua_Buff(&l[slot_id]);
i++;
}
}
return t;
}
void Lua_Mob::RestoreEndurance()
{
Lua_Safe_Call_Void();
self->RestoreEndurance();
}
void Lua_Mob::RestoreHealth()
{
Lua_Safe_Call_Void();
self->RestoreHealth();
}
void Lua_Mob::RestoreMana()
{
Lua_Safe_Call_Void();
self->RestoreMana();
}
luabind::scope lua_register_mob() {
return luabind::class_<Lua_Mob, Lua_Entity>("Mob")
.def(luabind::constructor<>())
@@ -3469,6 +3535,7 @@ luabind::scope lua_register_mob() {
.def("GetBucketExpires", (std::string(Lua_Mob::*)(std::string))&Lua_Mob::GetBucketExpires)
.def("GetBucketKey", (std::string(Lua_Mob::*)(void))&Lua_Mob::GetBucketKey)
.def("GetBucketRemaining", (std::string(Lua_Mob::*)(std::string))&Lua_Mob::GetBucketRemaining)
.def("GetBuffs", &Lua_Mob::GetBuffs)
.def("GetBuffSlotFromType", &Lua_Mob::GetBuffSlotFromType)
.def("GetBuffSpellIDs", &Lua_Mob::GetBuffSpellIDs)
.def("GetBuffStatValueBySlot", (void(Lua_Mob::*)(uint8, const char*))& Lua_Mob::GetBuffStatValueBySlot)
@@ -3492,6 +3559,7 @@ luabind::scope lua_register_mob() {
.def("GetDefaultRaceSize", (float(Lua_Mob::*)(int))&Lua_Mob::GetDefaultRaceSize)
.def("GetDefaultRaceSize", (float(Lua_Mob::*)(int,int))&Lua_Mob::GetDefaultRaceSize)
.def("GetDeity", &Lua_Mob::GetDeity)
.def("GetDeityName", &Lua_Mob::GetDeityName)
.def("GetDisplayAC", &Lua_Mob::GetDisplayAC)
.def("GetDrakkinDetails", &Lua_Mob::GetDrakkinDetails)
.def("GetDrakkinHeritage", &Lua_Mob::GetDrakkinHeritage)
@@ -3546,6 +3614,7 @@ luabind::scope lua_register_mob() {
.def("GetHateTopNPC", (Lua_NPC(Lua_Mob::*)(void))&Lua_Mob::GetHateTopNPC)
.def("GetHeading", &Lua_Mob::GetHeading)
.def("GetHelmTexture", &Lua_Mob::GetHelmTexture)
.def("GetHeroicStrikethrough", &Lua_Mob::GetHeroicStrikethrough)
.def("GetHerosForgeModel", (int32(Lua_Mob::*)(uint8))&Lua_Mob::GetHerosForgeModel)
.def("GetINT", &Lua_Mob::GetINT)
.def("GetInvisibleLevel", (uint8(Lua_Mob::*)(void))&Lua_Mob::GetInvisibleLevel)
@@ -3636,12 +3705,13 @@ luabind::scope lua_register_mob() {
.def("HasTimer", &Lua_Mob::HasTimer)
.def("HasTwoHandBluntEquipped", (bool(Lua_Mob::*)(void))&Lua_Mob::HasTwoHandBluntEquipped)
.def("HasTwoHanderEquipped", (bool(Lua_Mob::*)(void))&Lua_Mob::HasTwoHanderEquipped)
.def("Heal", &Lua_Mob::Heal)
.def("Heal", &Lua_Mob::RestoreHealth)
.def("HealDamage", (void(Lua_Mob::*)(uint64))&Lua_Mob::HealDamage)
.def("HealDamage", (void(Lua_Mob::*)(uint64,Lua_Mob))&Lua_Mob::HealDamage)
.def("InterruptSpell", (void(Lua_Mob::*)(int))&Lua_Mob::InterruptSpell)
.def("InterruptSpell", (void(Lua_Mob::*)(void))&Lua_Mob::InterruptSpell)
.def("IsAIControlled", (bool(Lua_Mob::*)(void))&Lua_Mob::IsAIControlled)
.def("IsAlwaysAggro", &Lua_Mob::IsAlwaysAggro)
.def("IsAmnesiad", (bool(Lua_Mob::*)(void))&Lua_Mob::IsAmnesiad)
.def("IsAnimation", &Lua_Mob::IsAnimation)
.def("IsAttackAllowed", (bool(Lua_Mob::*)(Lua_Mob))&Lua_Mob::IsAttackAllowed)
@@ -3649,8 +3719,11 @@ luabind::scope lua_register_mob() {
.def("IsBeneficialAllowed", (bool(Lua_Mob::*)(Lua_Mob))&Lua_Mob::IsBeneficialAllowed)
.def("IsBerserk", &Lua_Mob::IsBerserk)
.def("IsBlind", (bool(Lua_Mob::*)(void))&Lua_Mob::IsBlind)
.def("IsBoat", &Lua_Mob::IsBoat)
.def("IsCasting", &Lua_Mob::IsCasting)
.def("IsCharmed", &Lua_Mob::IsCharmed)
.def("IsControllableBoat", &Lua_Mob::IsControllableBoat)
.def("IsDestructibleObject", &Lua_Mob::IsDestructibleObject)
.def("IsEliteMaterialItem", (uint32(Lua_Mob::*)(uint8))&Lua_Mob::IsEliteMaterialItem)
.def("IsEngaged", (bool(Lua_Mob::*)(void))&Lua_Mob::IsEngaged)
.def("IsEnraged", (bool(Lua_Mob::*)(void))&Lua_Mob::IsEnraged)
@@ -3712,6 +3785,9 @@ luabind::scope lua_register_mob() {
.def("ResistSpell", (double(Lua_Mob::*)(int,int,Lua_Mob,bool))&Lua_Mob::ResistSpell)
.def("ResistSpell", (double(Lua_Mob::*)(int,int,Lua_Mob,bool,int))&Lua_Mob::ResistSpell)
.def("ResistSpell", (double(Lua_Mob::*)(int,int,Lua_Mob,bool,int,bool))&Lua_Mob::ResistSpell)
.def("RestoreEndurance", &Lua_Mob::RestoreEndurance)
.def("RestoreHealth", &Lua_Mob::RestoreHealth)
.def("RestoreMana", &Lua_Mob::RestoreMana)
.def("ResumeTimer", &Lua_Mob::ResumeTimer)
.def("RunTo", (void(Lua_Mob::*)(double, double, double))&Lua_Mob::RunTo)
.def("Say", (void(Lua_Mob::*)(const char*))& Lua_Mob::Say)
@@ -3866,7 +3942,9 @@ luabind::scope lua_register_special_abilities() {
luabind::value("modify_avoid_damage", static_cast<int>(MODIFY_AVOID_DAMAGE)),
luabind::value("immune_open", static_cast<int>(IMMUNE_OPEN)),
luabind::value("immune_assassinate", static_cast<int>(IMMUNE_ASSASSINATE)),
luabind::value("immune_headshot", static_cast<int>(IMMUNE_HEADSHOT))
luabind::value("immune_headshot", static_cast<int>(IMMUNE_HEADSHOT)),
luabind::value("immune_aggro_bot", static_cast<int>(IMMUNE_AGGRO_BOT)),
luabind::value("immune_damage_bot", static_cast<int>(IMMUNE_DAMAGE_BOT))
)];
}
+10 -1
View File
@@ -63,7 +63,6 @@ public:
void Damage(Lua_Mob from, int64 damage, int spell_id, int attack_skill, bool avoidable, int buffslot, bool buff_tic);
void RangedAttack(Lua_Mob other);
void ThrowingAttack(Lua_Mob other);
void Heal();
void HealDamage(uint64 amount);
void HealDamage(uint64 amount, Lua_Mob other);
uint32 GetLevelCon(int other);
@@ -577,6 +576,16 @@ public:
bool IsPetOwnerBot();
bool IsPetOwnerClient();
bool IsPetOwnerNPC();
bool IsDestructibleObject();
bool IsBoat();
bool IsControllableBoat();
int GetHeroicStrikethrough();
bool IsAlwaysAggro();
std::string GetDeityName();
luabind::object GetBuffs(lua_State* L);
void RestoreEndurance();
void RestoreHealth();
void RestoreMana();
};
#endif
+1 -1
View File
@@ -758,7 +758,7 @@ void Lua_NPC::SetLDoNTrapDetected(bool is_detected) {
void Lua_NPC::ScaleNPC(uint8 npc_level)
{
Lua_Safe_Call_Void();
self->ScaleNPC(npc_level);
self->ScaleNPC(npc_level, true);
}
void Lua_NPC::ScaleNPC(uint8 npc_level, bool override_special_abilities)
+20 -17
View File
@@ -16,32 +16,32 @@
#include "zone.h"
#include "zone_config.h"
#include "lua_parser.h"
#include "lua_bit.h"
#include "lua_bot.h"
#include "lua_buff.h"
#include "lua_client.h"
#include "lua_corpse.h"
#include "lua_door.h"
#include "lua_encounter.h"
#include "lua_entity.h"
#include "lua_entity_list.h"
#include "lua_expedition.h"
#include "lua_general.h"
#include "lua_group.h"
#include "lua_hate_list.h"
#include "lua_inventory.h"
#include "lua_item.h"
#include "lua_iteminst.h"
#include "lua_mob.h"
#include "lua_hate_list.h"
#include "lua_client.h"
#include "lua_inventory.h"
#include "lua_npc.h"
#include "lua_spell.h"
#include "lua_entity_list.h"
#include "lua_group.h"
#include "lua_raid.h"
#include "lua_corpse.h"
#include "lua_object.h"
#include "lua_door.h"
#include "lua_spawn.h"
#include "lua_packet.h"
#include "lua_general.h"
#include "lua_encounter.h"
#include "lua_parser.h"
#include "lua_raid.h"
#include "lua_spawn.h"
#include "lua_spell.h"
#include "lua_stat_bonuses.h"
#include "lua_bot.h"
const char *LuaEvents[_LargestEventID] = {
"event_say",
"event_trade",
@@ -182,7 +182,8 @@ const char *LuaEvents[_LargestEventID] = {
"event_timer_stop",
"event_entity_variable_delete",
"event_entity_variable_set",
"event_entity_variable_update"
"event_entity_variable_update",
"event_aa_loss"
};
extern Zone *zone;
@@ -343,6 +344,7 @@ LuaParser::LuaParser() {
PlayerArgumentDispatch[EVENT_ENTITY_VARIABLE_DELETE] = handle_player_entity_variable;
PlayerArgumentDispatch[EVENT_ENTITY_VARIABLE_SET] = handle_player_entity_variable;
PlayerArgumentDispatch[EVENT_ENTITY_VARIABLE_UPDATE] = handle_player_entity_variable;
PlayerArgumentDispatch[EVENT_AA_LOSS] = handle_player_aa_loss;
ItemArgumentDispatch[EVENT_ITEM_CLICK] = handle_item_click;
ItemArgumentDispatch[EVENT_ITEM_CLICK_CAST] = handle_item_click;
@@ -1303,7 +1305,8 @@ void LuaParser::MapFunctions(lua_State *L) {
lua_register_journal_speakmode(),
lua_register_journal_mode(),
lua_register_expedition(),
lua_register_expedition_lock_messages()
lua_register_expedition_lock_messages(),
lua_register_buff()
)];
} catch(std::exception &ex) {
+12
View File
@@ -1667,6 +1667,18 @@ void handle_player_entity_variable(
}
}
void handle_player_aa_loss(
QuestInterface *parse,
lua_State* L,
Client* client,
std::string data,
uint32 extra_data,
std::vector<std::any> *extra_pointers
) {
lua_pushinteger(L, Strings::ToInt(data));
lua_setfield(L, -2, "aa_lost");
}
// Item
void handle_item_click(
QuestInterface *parse,
+9
View File
@@ -827,6 +827,15 @@ void handle_player_entity_variable(
std::vector<std::any> *extra_pointers
);
void handle_player_aa_loss(
QuestInterface *parse,
lua_State* L,
Client* client,
std::string data,
uint32 extra_data,
std::vector<std::any> *extra_pointers
);
// Item
void handle_item_click(
QuestInterface *parse,
-1
View File
@@ -403,7 +403,6 @@ int main(int argc, char **argv)
content_service.SetDatabase(&database)
->SetContentDatabase(&content_db)
->SetContentZones(zone_store.GetZones())
->SetExpansionContext()
->ReloadContentFlags();
+6 -6
View File
@@ -73,9 +73,9 @@ Merc::Merc(const NPCType* d, float x, float y, float z, float heading)
// Class should use npc constructor to set light properties
SetHP(GetMaxHP());
SetMana(GetMaxMana());
SetEndurance(GetMaxEndurance());
RestoreHealth();
RestoreMana();
RestoreEndurance();
AI_Start();
}
@@ -5289,9 +5289,9 @@ bool Merc::Unsuspend(bool setMaxStats) {
{
if(setMaxStats)
{
SetHP(GetMaxHP());
SetMana(GetMaxMana());
SetEndurance(GetMaxEndurance());
RestoreHealth();
RestoreMana();
RestoreEndurance();
}
//check for sufficient funds and remove them last
+128 -45
View File
@@ -1220,10 +1220,7 @@ void Mob::FillSpawnStruct(NewSpawn_Struct* ns, Mob* ForWho)
UpdateActiveLight();
ns->spawn.light = m_Light.Type[EQ::lightsource::LightActive];
if (IsNPC() && race == ERUDITE)
ns->spawn.showhelm = 1;
else
ns->spawn.showhelm = (helmtexture && helmtexture != 0xFF) ? 1 : 0;
ns->spawn.showhelm = helmtexture != std::numeric_limits<uint8>::max() ? 1 : 0;
ns->spawn.invis = (invisible || hidden) ? 1 : 0; // TODO: load this before spawning players
ns->spawn.NPC = IsClient() ? 0 : 1;
@@ -1272,10 +1269,8 @@ void Mob::FillSpawnStruct(NewSpawn_Struct* ns, Mob* ForWho)
strn0cpy(ns->spawn.lastName, lastname, sizeof(ns->spawn.lastName));
//for (i = 0; i < _MaterialCount; i++)
for (i = 0; i < 9; i++) {
// Only Player Races Wear Armor
if (IsPlayerRace(race) || i > 6) {
for (i = 0; i < EQ::textures::materialCount; i++) {
if (IsPlayerRace(race) || i > EQ::textures::armorFeet) {
ns->spawn.equipment.Slot[i].Material = GetEquipmentMaterial(i);
ns->spawn.equipment.Slot[i].EliteModel = IsEliteMaterialItem(i);
ns->spawn.equipment.Slot[i].HerosForgeModel = GetHerosForgeModel(i);
@@ -1283,13 +1278,42 @@ void Mob::FillSpawnStruct(NewSpawn_Struct* ns, Mob* ForWho)
}
}
if (texture > 0) {
for (i = 0; i < 9; i++) {
if (i == EQ::textures::weaponPrimary || i == EQ::textures::weaponSecondary || texture == 255) {
continue;
}
ns->spawn.equipment.Slot[i].Material = texture;
for (i = 0; i < EQ::textures::weaponPrimary; i++) {
if (texture == std::numeric_limits<uint8>::max()) {
continue;
}
if (i == EQ::textures::armorHead && helmtexture != texture) {
ns->spawn.equipment.Slot[i].Material = helmtexture;
continue;
}
if (i == EQ::textures::armorArms && armtexture != 0) {
ns->spawn.equipment.Slot[i].Material = armtexture;
continue;
}
if (i == EQ::textures::armorWrist && bracertexture != 0) {
ns->spawn.equipment.Slot[i].Material = bracertexture;
continue;
}
if (i == EQ::textures::armorHands && handtexture != 0) {
ns->spawn.equipment.Slot[i].Material = handtexture;
continue;
}
if (i == EQ::textures::armorLegs && legtexture != 0) {
ns->spawn.equipment.Slot[i].Material = legtexture;
continue;
}
if (i == EQ::textures::armorFeet && feettexture != 0) {
ns->spawn.equipment.Slot[i].Material = feettexture;
continue;
}
ns->spawn.equipment.Slot[i].Material = texture;
}
memset(ns->spawn.set_to_0xFF, 0xFF, sizeof(ns->spawn.set_to_0xFF));
@@ -4360,17 +4384,15 @@ void Mob::SendWearChangeAndLighting(int8 last_texture) {
void Mob::ChangeSize(float in_size = 0, bool unrestricted)
{
size = std::clamp(in_size, 1.0f, 255.0f);
if (!unrestricted) {
if (IsClient() || petid != 0) {
EQ::Clamp(in_size, 3.0f, 15.0f);
size = std::clamp(in_size, 3.0f, 15.0f);
}
}
EQ::Clamp(in_size, 1.0f, 255.0f);
size = in_size;
SendAppearancePacket(AppearanceType::Size, static_cast<uint32>(in_size));
SendAppearancePacket(AppearanceType::Size, static_cast<uint32>(size));
}
Mob* Mob::GetOwnerOrSelf()
@@ -5182,32 +5204,47 @@ int32 Mob::GetActSpellCasttime(uint16 spell_id, int32 casttime)
}
void Mob::ExecWeaponProc(const EQ::ItemInstance *inst, uint16 spell_id, Mob *on, int level_override) {
void Mob::ExecWeaponProc(const EQ::ItemInstance* inst, uint16 spell_id, Mob* on, int level_override)
{
// Changed proc targets to look up based on the spells goodEffect flag.
// This should work for the majority of weapons.
if (!on) {
return;
}
if(!IsValidSpell(spell_id) || on->GetSpecialAbility(NO_HARM_FROM_CLIENT)) {
if (!IsValidSpell(spell_id) || on->GetSpecialAbility(NO_HARM_FROM_CLIENT)) {
//This is so 65535 doesn't get passed to the client message and to logs because it is not relavant information for debugging.
return;
}
if (on->GetSpecialAbility(IMMUNE_DAMAGE_CLIENT) && IsClient())
if (IsBot() && on->GetSpecialAbility(IMMUNE_DAMAGE_BOT)) {
return;
}
if (on->GetSpecialAbility(IMMUNE_DAMAGE_NPC) && IsNPC())
if (IsClient() && on->GetSpecialAbility(IMMUNE_DAMAGE_CLIENT)) {
return;
}
if (IsNoCast())
if (IsNPC() && on->GetSpecialAbility(IMMUNE_DAMAGE_NPC)) {
return;
}
if(!IsValidSpell(spell_id)) { // Check for a valid spell otherwise it will crash through the function
if(IsClient()){
Message(0, "Invalid spell proc %u", spell_id);
if (IsNoCast()) {
return;
}
if (!IsValidSpell(spell_id)) { // Check for a valid spell otherwise it will crash through the function
if (IsClient()) {
Message(
Chat::White,
fmt::format(
"Invalid spell ID for proc {}.",
spell_id
).c_str()
);
LogSpells("Player [{}] Weapon Procced invalid spell [{}]", GetName(), spell_id);
}
return;
}
@@ -5221,7 +5258,7 @@ void Mob::ExecWeaponProc(const EQ::ItemInstance *inst, uint16 spell_id, Mob *on,
return;
}
if(inst && IsClient()) {
if (inst && IsClient()) {
//const cast is dirty but it would require redoing a ton of interfaces at this point
//It should be safe as we don't have any truly const EQ::ItemInstance floating around anywhere.
//So we'll live with it for now
@@ -5241,30 +5278,76 @@ void Mob::ExecWeaponProc(const EQ::ItemInstance *inst, uint16 spell_id, Mob *on,
}
}
bool twinproc = false;
int32 twinproc_chance = 0;
bool twin_proc = false;
int32 twin_proc_chance = 0;
if (IsClient() || IsBot()) {
twinproc_chance = GetFocusEffect(focusTwincast, spell_id);
twin_proc_chance = GetFocusEffect(focusTwincast, spell_id);
}
if (twinproc_chance && zone->random.Roll(twinproc_chance)) {
twinproc = true;
if (twin_proc_chance && zone->random.Roll(twin_proc_chance)) {
twin_proc = true;
}
if (IsBeneficialSpell(spell_id) && (!IsNPC() || (IsNPC() && CastToNPC()->GetInnateProcSpellID() != spell_id)) && spells[spell_id].target_type != ST_TargetsTarget) { // NPC innate procs don't take this path ever
SpellFinished(spell_id, this, EQ::spells::CastingSlot::Item, 0, -1, spells[spell_id].resist_difficulty, true, level_override);
if (twinproc) {
SpellFinished(spell_id, this, EQ::spells::CastingSlot::Item, 0, -1, spells[spell_id].resist_difficulty, true, level_override);
if (
IsBeneficialSpell(spell_id) &&
(
!IsNPC() ||
(
IsNPC() &&
CastToNPC()->GetInnateProcSpellID() != spell_id
)
) &&
spells[spell_id].target_type != ST_TargetsTarget
) { // NPC innate procs don't take this path ever
SpellFinished(
spell_id,
this,
EQ::spells::CastingSlot::Item,
0,
-1,
spells[spell_id].resist_difficulty,
true,
level_override
);
if (twin_proc) {
SpellFinished(
spell_id,
this,
EQ::spells::CastingSlot::Item,
0,
-1,
spells[spell_id].resist_difficulty,
true,
level_override
);
}
} else if (!(on->IsClient() && on->CastToClient()->dead)) { //dont proc on dead clients
SpellFinished(
spell_id,
on,
EQ::spells::CastingSlot::Item,
0,
-1,
spells[spell_id].resist_difficulty,
true,
level_override
);
if (twin_proc && (!(on->IsClient() && on->CastToClient()->dead))) {
SpellFinished(
spell_id,
on,
EQ::spells::CastingSlot::Item,
0,
-1,
spells[spell_id].resist_difficulty,
true,
level_override
);
}
}
else if(!(on->IsClient() && on->CastToClient()->dead)) { //dont proc on dead clients
SpellFinished(spell_id, on, EQ::spells::CastingSlot::Item, 0, -1, spells[spell_id].resist_difficulty, true, level_override);
if (twinproc && (!(on->IsClient() && on->CastToClient()->dead))) {
SpellFinished(spell_id, on, EQ::spells::CastingSlot::Item, 0, -1, spells[spell_id].resist_difficulty, true, level_override);
}
}
return;
}
uint32 Mob::GetZoneID() const {
+4 -1
View File
@@ -546,7 +546,6 @@ public:
bool avoidable = true, int8 buffslot = -1, bool iBuffTic = false, eSpecialAttacks special = eSpecialAttacks::None) = 0;
void SetHP(int64 hp);
inline void SetOOCRegen(int64 new_ooc_regen) { ooc_regen = new_ooc_regen; }
virtual void Heal();
virtual void HealDamage(uint64 ammount, Mob* caster = nullptr, uint16 spell_id = SPELL_UNKNOWN);
virtual void SetMaxHP() { current_hp = max_hp; }
virtual inline uint16 GetBaseRace() const { return base_race; }
@@ -1336,6 +1335,10 @@ public:
inline virtual bool IsBlockedBuff(int32 SpellID) { return false; }
inline virtual bool IsBlockedPetBuff(int32 SpellID) { return false; }
inline void RestoreEndurance() { SetEndurance(GetMaxEndurance()); }
inline void RestoreHealth() { SetMaxHP(); SendHPUpdate(); }
inline void RestoreMana() { SetMana(GetMaxMana()); }
std::string GetGlobal(const char *varname);
void SetGlobal(const char *varname, const char *newvalue, int options, const char *duration, Mob *other = nullptr);
void TarGlobal(const char *varname, const char *value, const char *duration, int npcid, int charid, int zoneid);
+1 -1
View File
@@ -1136,7 +1136,7 @@ void Mob::AI_Process() {
if (DistanceSquaredNoZ(m_Position, npcSpawnPoint) > leash_range) {
GMMove(npcSpawnPoint.x, npcSpawnPoint.y, npcSpawnPoint.z, npcSpawnPoint.w);
SetHP(GetMaxHP());
RestoreHealth();
BuffFadeAll();
WipeHateList();
return;
+1 -1
View File
@@ -605,7 +605,7 @@ public:
mob->BuffFadeAll();
mob->WipeHateList();
mob->Heal();
mob->RestoreHealth();
return false;
}
+4 -2
View File
@@ -246,7 +246,7 @@ NPC::NPC(const NPCType *npc_type_data, Spawn2 *in_respawn, const glm::vec4 &posi
charm_atk = npc_type_data->charm_atk;
CalcMaxMana();
SetMana(GetMaxMana());
RestoreMana();
MerchantType = npc_type_data->merchanttype;
merchant_open = (
@@ -448,7 +448,7 @@ NPC::NPC(const NPCType *npc_type_data, Spawn2 *in_respawn, const glm::vec4 &posi
npc_scale_manager->ScaleNPC(this);
SetMana(GetMaxMana());
RestoreMana();
if (GetBodyType() == BT_Animal && !RuleB(NPC, AnimalsOpenDoors)) {
m_can_open_doors = false;
@@ -3798,6 +3798,8 @@ void NPC::DescribeSpecialAbilities(Client* c)
IMMUNE_OPEN,
IMMUNE_ASSASSINATE,
IMMUNE_HEADSHOT,
IMMUNE_AGGRO_BOT,
IMMUNE_DAMAGE_BOT
};
// These abilities have parameters that need to be parsed out individually
+1 -1
View File
@@ -64,7 +64,7 @@ void NpcScaleManager::ScaleNPC(
if (always_scale || npc->GetMaxHP() == 0) {
npc->ModifyNPCStat("max_hp", std::to_string(scale_data.hp));
npc->Heal();
npc->RestoreHealth();
}
if (always_scale || npc->GetAccuracyRating() == 0) {
+6
View File
@@ -615,6 +615,11 @@ std::string Perl_Bot_GetRaceAbbreviation(Bot* self)
return GetPlayerRaceAbbreviation(self->GetBaseRace());
}
void Perl_Bot_DeleteBot(Bot* self) // @categories Script Utility
{
self->DeleteBot();
}
void perl_register_bot()
{
perl::interpreter state(PERL_GET_THX);
@@ -655,6 +660,7 @@ void perl_register_bot()
package.add("CountAugmentEquippedByID", &Perl_Bot_CountAugmentEquippedByID);
package.add("CountBotItem", &Perl_Bot_CountBotItem);
package.add("CountItemEquippedByID", &Perl_Bot_CountItemEquippedByID);
package.add("DeleteBot", (void(*)(Bot*)) &Perl_Bot_DeleteBot);
package.add("Escape", &Perl_Bot_Escape);
package.add("Fling", (void(*)(Bot*, float, float, float))&Perl_Bot_Fling);
package.add("Fling", (void(*)(Bot*, float, float, float, bool))&Perl_Bot_Fling);
+134
View File
@@ -0,0 +1,134 @@
#include "../common/features.h"
#ifdef EMBPERL_XS_CLASSES
#include "../common/global_define.h"
#include "embperl.h"
#include "common.h"
uint16 Perl_Buff_GetCasterID(Buffs_Struct* self)
{
return self->casterid;
}
uint8 Perl_Buff_GetCasterLevel(Buffs_Struct* self)
{
return self->casterlevel;
}
std::string Perl_Buff_GetCasterName(Buffs_Struct* self)
{
return self->caster_name;
}
int Perl_Buff_GetCastOnX(Buffs_Struct* self)
{
return self->caston_x;
}
int Perl_Buff_GetCastOnY(Buffs_Struct* self)
{
return self->caston_y;
}
int Perl_Buff_GetCastOnZ(Buffs_Struct* self)
{
return self->caston_z;
}
uint32 Perl_Buff_GetCounters(Buffs_Struct* self)
{
return self->counters;
}
uint32 Perl_Buff_GetDOTRune(Buffs_Struct* self)
{
return self->dot_rune;
}
int Perl_Buff_GetExtraDIChance(Buffs_Struct* self)
{
return self->ExtraDIChance;
}
uint32 Perl_Buff_GetInstrumentModifier(Buffs_Struct* self)
{
return self->instrument_mod;
}
uint32 Perl_Buff_GetMagicRune(Buffs_Struct* self)
{
return self->magic_rune;
}
uint32 Perl_Buff_GetMeleeRune(Buffs_Struct* self)
{
return self->melee_rune;
}
uint32 Perl_Buff_GetNumberOfHits(Buffs_Struct* self)
{
return self->hit_number;
}
int16 Perl_Buff_GetRootBreakChance(Buffs_Struct* self)
{
return self->RootBreakChance;
}
uint16 Perl_Buff_GetSpellID(Buffs_Struct* self)
{
return self->spellid;
}
int Perl_Buff_GetTicsRemaining(Buffs_Struct* self)
{
return self->ticsremaining;
}
int Perl_Buff_GetVirusSpreadTime(Buffs_Struct* self)
{
return self->virus_spread_time;
}
bool Perl_Buff_IsCasterClient(Buffs_Struct* self)
{
return self->client;
}
bool Perl_Buff_IsPersistentBuff(Buffs_Struct* self)
{
return self->persistant_buff;
}
bool Perl_Buff_SendsClientUpdate(Buffs_Struct* self)
{
return self->UpdateClient;
}
void perl_register_buff()
{
perl::interpreter state(PERL_GET_THX);
auto package = state.new_class<Buffs_Struct>("Buff");
package.add("GetCasterID", &Perl_Buff_GetCasterID);
package.add("GetCasterLevel", &Perl_Buff_GetCasterLevel);
package.add("GetCasterName", &Perl_Buff_GetCasterName);
package.add("GetCastOnX", &Perl_Buff_GetCastOnX);
package.add("GetCastOnY", &Perl_Buff_GetCastOnY);
package.add("GetCastOnZ", &Perl_Buff_GetCastOnZ);
package.add("GetCounters", &Perl_Buff_GetCounters);
package.add("GetDOTRune", &Perl_Buff_GetDOTRune);
package.add("GetExtraDIChance", &Perl_Buff_GetExtraDIChance);
package.add("GetInstrumentModifier", &Perl_Buff_GetInstrumentModifier);
package.add("GetMagicRune", &Perl_Buff_GetMagicRune);
package.add("GetMeleeRune", &Perl_Buff_GetMeleeRune);
package.add("GetNumberOfHits", &Perl_Buff_GetNumberOfHits);
package.add("GetRootBreakChance", &Perl_Buff_GetRootBreakChance);
package.add("GetSpellID", &Perl_Buff_GetSpellID);
package.add("GetTicsRemaining", &Perl_Buff_GetTicsRemaining);
package.add("GetVirusSpreadTime", &Perl_Buff_GetVirusSpreadTime);
package.add("IsCasterClient", &Perl_Buff_IsCasterClient);
package.add("IsPersistentBuff", &Perl_Buff_IsPersistentBuff);
package.add("SendsClientUpdate", &Perl_Buff_SendsClientUpdate);
}
#endif //EMBPERL_XS_CLASSES
+44
View File
@@ -3103,6 +3103,46 @@ bool Perl_Client_IsInAGuild(Client* self)
return self->IsInAGuild();
}
bool Perl_Client_RemoveAAPoints(Client* self, uint32 points)
{
return self->RemoveAAPoints(points);
}
bool Perl_Client_RemoveAlternateCurrencyValue(Client* self, uint32 currency_id, uint32 amount)
{
return self->RemoveAlternateCurrencyValue(currency_id, amount);
}
perl::array Perl_Client_GetRaidOrGroupOrSelf(Client* self)
{
perl::array result;
const auto& l = self->GetRaidOrGroupOrSelf();
result.reserve(l.size());
for (const auto& e : l) {
result.push_back(e);
}
return result;
}
perl::array Perl_Client_GetRaidOrGroupOrSelf(Client* self, bool clients_only)
{
perl::array result;
const auto& l = self->GetRaidOrGroupOrSelf(clients_only);
result.reserve(l.size());
for (const auto& e : l) {
result.push_back(e);
}
return result;
}
void perl_register_client()
{
perl::interpreter perl(PERL_GET_THX);
@@ -3336,6 +3376,8 @@ void perl_register_client()
package.add("GetRaceBitmask", &Perl_Client_GetRaceBitmask);
package.add("GetRadiantCrystals", &Perl_Client_GetRadiantCrystals);
package.add("GetRaid", &Perl_Client_GetRaid);
package.add("GetRaidOrGroupOrSelf", (perl::array(*)(Client*))&Perl_Client_GetRaidOrGroupOrSelf);
package.add("GetRaidOrGroupOrSelf", (perl::array(*)(Client*, bool))&Perl_Client_GetRaidOrGroupOrSelf);
package.add("GetRaidPoints", &Perl_Client_GetRaidPoints);
package.add("GetRawItemAC", &Perl_Client_GetRawItemAC);
package.add("GetRawSkill", &Perl_Client_GetRawSkill);
@@ -3470,8 +3512,10 @@ void perl_register_client()
package.add("ReadBookByName", &Perl_Client_ReadBookByName);
package.add("RefundAA", &Perl_Client_RefundAA);
package.add("ReloadDataBuckets", &Perl_Client_ReloadDataBuckets);
package.add("RemoveAAPoints", &Perl_Client_RemoveAAPoints);
package.add("RemoveAllExpeditionLockouts", (void(*)(Client*))&Perl_Client_RemoveAllExpeditionLockouts);
package.add("RemoveAllExpeditionLockouts", (void(*)(Client*, std::string))&Perl_Client_RemoveAllExpeditionLockouts);
package.add("RemoveAlternateCurrencyValue", (bool(*)(Client*, uint32, uint32))&Perl_Client_RemoveAlternateCurrencyValue);
package.add("RemoveEbonCrystals", &Perl_Client_RemoveEbonCrystals);
package.add("RemoveExpeditionLockout", &Perl_Client_RemoveExpeditionLockout);
package.add("RemoveFromInstance", &Perl_Client_RemoveFromInstance);
+69 -6
View File
@@ -256,11 +256,6 @@ void Perl_Mob_ThrowingAttack(Mob* self, Mob* other) // @categories Skills and Re
self->ThrowingAttack(other);
}
void Perl_Mob_Heal(Mob* self)// @categories Script Utility
{
self->Heal();
}
void Perl_Mob_HealDamage(Mob* self, int64_t amount) // @categories Script Utility
{
self->HealDamage(amount);
@@ -3395,6 +3390,64 @@ bool Perl_Mob_IsPetOwnerNPC(Mob* self)
return self->IsPetOwnerNPC();
}
bool Perl_Mob_IsDestructibleObject(Mob* self)
{
return self->IsDestructibleObject();
}
bool Perl_Mob_IsBoat(Mob* self)
{
return self->IsBoat();
}
bool Perl_Mob_IsControllableBoat(Mob* self)
{
return self->IsControllableBoat();
}
int Perl_Mob_GetHeroicStrikethrough(Mob* self)
{
return self->GetHeroicStrikethrough();
}
bool Perl_Mob_IsAlwaysAggro(Mob* self)
{
return self->AlwaysAggro();
}
std::string Perl_Mob_GetDeityName(Mob* self)
{
return EQ::deity::GetDeityName(static_cast<EQ::deity::DeityType>(self->GetDeity()));
}
perl::array Perl_Mob_GetBuffs(Mob* self)
{
perl::array result;
const auto &buffs = self->GetBuffs();
for (int slot_id = 0; slot_id < self->GetMaxBuffSlots(); slot_id++) {
result.push_back(&buffs[slot_id]);
}
return result;
}
void Perl_Mob_RestoreEndurance(Mob* self)
{
self->RestoreEndurance();
}
void Perl_Mob_RestoreHealth(Mob* self)
{
self->RestoreHealth();
}
void Perl_Mob_RestoreMana(Mob* self)
{
self->RestoreMana();
}
void perl_register_mob()
{
perl::interpreter perl(PERL_GET_THX);
@@ -3580,6 +3633,7 @@ void perl_register_mob()
package.add("GetBucketExpires", &Perl_Mob_GetBucketExpires);
package.add("GetBucketKey", &Perl_Mob_GetBucketKey);
package.add("GetBucketRemaining", &Perl_Mob_GetBucketRemaining);
package.add("GetBuffs", &Perl_Mob_GetBuffs);
package.add("GetBuffSlotFromType", &Perl_Mob_GetBuffSlotFromType);
package.add("GetBuffSpellIDs", &Perl_Mob_GetBuffSpellIDs);
package.add("GetBuffStatValueBySpell", &Perl_Mob_GetBuffStatValueBySpell);
@@ -3603,6 +3657,7 @@ void perl_register_mob()
package.add("GetDR", &Perl_Mob_GetDR);
package.add("GetDamageAmount", &Perl_Mob_GetDamageAmount);
package.add("GetDeity", &Perl_Mob_GetDeity);
package.add("GetDeityName", &Perl_Mob_GetDeityName);
package.add("GetDisplayAC", &Perl_Mob_GetDisplayAC);
package.add("GetDrakkinDetails", &Perl_Mob_GetDrakkinDetails);
package.add("GetDrakkinHeritage", &Perl_Mob_GetDrakkinHeritage);
@@ -3660,6 +3715,7 @@ void perl_register_mob()
package.add("GetHateTopNPC", &Perl_Mob_GetHateTopNPC);
package.add("GetHeading", &Perl_Mob_GetHeading);
package.add("GetHelmTexture", &Perl_Mob_GetHelmTexture);
package.add("GetHeroicStrikethrough", &Perl_Mob_GetHeroicStrikethrough);
package.add("GetHerosForgeModel", &Perl_Mob_GetHerosForgeModel);
package.add("GetID", &Perl_Mob_GetID);
package.add("GetINT", &Perl_Mob_GetINT);
@@ -3753,12 +3809,13 @@ void perl_register_mob()
package.add("HasTwoHandBluntEquipped", &Perl_Mob_HasTwoHandBluntEquipped);
package.add("HasTwoHanderEquipped", &Perl_Mob_HasTwoHanderEquipped);
package.add("HateSummon", &Perl_Mob_HateSummon);
package.add("Heal", &Perl_Mob_Heal);
package.add("Heal", &Perl_Mob_RestoreHealth);
package.add("HealDamage", (void(*)(Mob*, int64_t))&Perl_Mob_HealDamage);
package.add("HealDamage", (void(*)(Mob*, int64_t, Mob*))&Perl_Mob_HealDamage);
package.add("InterruptSpell", (void(*)(Mob*))&Perl_Mob_InterruptSpell);
package.add("InterruptSpell", (void(*)(Mob*, uint16))&Perl_Mob_InterruptSpell);
package.add("IsAIControlled", &Perl_Mob_IsAIControlled);
package.add("IsAlwaysAggro", &Perl_Mob_IsAlwaysAggro);
package.add("IsAmnesiad", &Perl_Mob_IsAmnesiad);
package.add("IsAnimation", &Perl_Mob_IsAnimation);
package.add("IsAttackAllowed", (bool(*)(Mob*, Mob*))&Perl_Mob_IsAttackAllowed);
@@ -3768,11 +3825,14 @@ void perl_register_mob()
package.add("IsBeneficialAllowed", &Perl_Mob_IsBeneficialAllowed);
package.add("IsBerserk", &Perl_Mob_IsBerserk);
package.add("IsBlind", &Perl_Mob_IsBlind);
package.add("IsBoat", &Perl_Mob_IsBoat);
package.add("IsBot", &Perl_Mob_IsBot);
package.add("IsCasting", &Perl_Mob_IsCasting);
package.add("IsCharmed", &Perl_Mob_IsCharmed);
package.add("IsClient", &Perl_Mob_IsClient);
package.add("IsControllableBoat", &Perl_Mob_IsControllableBoat);
package.add("IsCorpse", &Perl_Mob_IsCorpse);
package.add("IsDestructibleObject", &Perl_Mob_IsDestructibleObject);
package.add("IsDoor", &Perl_Mob_IsDoor);
package.add("IsEliteMaterialItem", &Perl_Mob_IsEliteMaterialItem);
package.add("IsEncounter", &Perl_Mob_IsEncounter);
@@ -3850,6 +3910,9 @@ void perl_register_mob()
package.add("RemoveNimbusEffect", &Perl_Mob_RemoveNimbusEffect);
package.add("RemovePet", &Perl_Mob_RemovePet);
package.add("ResistSpell", &Perl_Mob_ResistSpell);
package.add("RestoreEndurance", &Perl_Mob_RestoreEndurance);
package.add("RestoreHealth", &Perl_Mob_RestoreHealth);
package.add("RestoreMana", &Perl_Mob_RestoreMana);
package.add("ResumeTimer", &Perl_Mob_ResumeTimer);
package.add("RogueAssassinate", &Perl_Mob_RogueAssassinate);
package.add("RunTo", &Perl_Mob_RunTo);
+2 -2
View File
@@ -758,12 +758,12 @@ void Perl_NPC_SetLDoNTrapDetected(NPC* self, bool is_detected)
void Perl_NPC_ScaleNPC(NPC* self, uint8 npc_level)
{
return self->ScaleNPC(npc_level);
self->ScaleNPC(npc_level, true);
}
void Perl_NPC_ScaleNPC(NPC* self, uint8 npc_level, bool override_special_abilities)
{
return self->ScaleNPC(npc_level, override_special_abilities);
self->ScaleNPC(npc_level, true, override_special_abilities);
}
bool Perl_NPC_IsUnderwaterOnly(NPC* self) // @categories Script Utility
+9 -9
View File
@@ -805,7 +805,7 @@ int QuestParserCollection::EventBotGlobal(
QuestInterface* QuestParserCollection::GetQIByNPCQuest(uint32 npc_id, std::string& filename)
{
if (!zone || !zone->IsLoaded()) {
if (!zone) {
return nullptr;
}
@@ -871,7 +871,7 @@ QuestInterface* QuestParserCollection::GetQIByNPCQuest(uint32 npc_id, std::strin
QuestInterface* QuestParserCollection::GetQIByPlayerQuest(std::string& filename)
{
if (!zone || !zone->IsLoaded()) {
if (!zone) {
return nullptr;
}
@@ -922,7 +922,7 @@ QuestInterface* QuestParserCollection::GetQIByPlayerQuest(std::string& filename)
QuestInterface* QuestParserCollection::GetQIByGlobalNPCQuest(std::string& filename)
{
if (!zone || !zone->IsLoaded()) {
if (!zone) {
return nullptr;
}
@@ -947,7 +947,7 @@ QuestInterface* QuestParserCollection::GetQIByGlobalNPCQuest(std::string& filena
QuestInterface* QuestParserCollection::GetQIByGlobalPlayerQuest(std::string& filename)
{
if (!zone || !zone->IsLoaded()) {
if (!zone) {
return nullptr;
}
@@ -971,7 +971,7 @@ QuestInterface* QuestParserCollection::GetQIByGlobalPlayerQuest(std::string& fil
QuestInterface* QuestParserCollection::GetQIBySpellQuest(uint32 spell_id, std::string& filename)
{
if (!zone || !zone->IsLoaded()) {
if (!zone) {
return nullptr;
}
@@ -1023,7 +1023,7 @@ QuestInterface* QuestParserCollection::GetQIBySpellQuest(uint32 spell_id, std::s
QuestInterface* QuestParserCollection::GetQIByItemQuest(std::string item_script, std::string& filename)
{
if (!zone || !zone->IsLoaded()) {
if (!zone) {
return nullptr;
}
@@ -1075,7 +1075,7 @@ QuestInterface* QuestParserCollection::GetQIByItemQuest(std::string item_script,
QuestInterface* QuestParserCollection::GetQIByEncounterQuest(std::string encounter_name, std::string& filename)
{
if (!zone || !zone->IsLoaded()) {
if (!zone) {
return nullptr;
}
@@ -1125,7 +1125,7 @@ QuestInterface* QuestParserCollection::GetQIByEncounterQuest(std::string encount
QuestInterface* QuestParserCollection::GetQIByBotQuest(std::string& filename)
{
if (!zone || !zone->IsLoaded()) {
if (!zone) {
return nullptr;
}
@@ -1176,7 +1176,7 @@ QuestInterface* QuestParserCollection::GetQIByBotQuest(std::string& filename)
QuestInterface* QuestParserCollection::GetQIByGlobalBotQuest(std::string& filename)
{
if (!zone || !zone->IsLoaded()) {
if (!zone) {
return nullptr;
}
+11 -17
View File
@@ -537,9 +537,8 @@ void QuestManager::settimer(const std::string& timer_name, uint32 seconds, Mob*
);
if (!QTimerList.empty()) {
for (auto e : QTimerList) {
for (auto& e : QTimerList) {
if (e.mob && e.mob == mob && e.name == timer_name) {
e.Timer_.Enable();
e.Timer_.Start(seconds * 1000, false);
if (has_start_event) {
@@ -613,9 +612,8 @@ void QuestManager::settimerMS(const std::string& timer_name, uint32 milliseconds
}
if (!QTimerList.empty()) {
for (auto e : QTimerList) {
for (auto& e : QTimerList) {
if (e.mob && e.mob == owner && e.name == timer_name) {
e.Timer_.Enable();
e.Timer_.Start(milliseconds, false);
if (has_start_event) {
@@ -678,9 +676,8 @@ void QuestManager::settimerMS(const std::string& timer_name, uint32 milliseconds
);
if (!QTimerList.empty()) {
for (auto e : QTimerList) {
for (auto& e : QTimerList) {
if (e.mob && e.mob == m && e.name == timer_name) {
e.Timer_.Enable();
e.Timer_.Start(milliseconds, false);
if (has_start_event) {
@@ -752,11 +749,7 @@ void QuestManager::stoptimer(const std::string& timer_name)
);
for (auto e = QTimerList.begin(); e != QTimerList.end(); ++e) {
LogInfo("Current [{}] Timer [{}]", e->name, timer_name);
if (e->mob && e->mob == owner && e->name == timer_name) {
LogInfo("Matched [{}] Timer [{}]", e->name, timer_name);
if (has_stop_event) {
if (owner->IsClient()) {
parse->EventPlayer(EVENT_TIMER_STOP, owner->CastToClient(), timer_name, 0);
@@ -2342,6 +2335,10 @@ void QuestManager::set_proximity_range(float x_range, float y_range, float z_ran
n->proximity->max_z = n->GetZ() + z_range;
n->proximity->say = enable_say;
n->proximity->proximity_set = true;
if (enable_say) {
HaveProximitySays = enable_say;
}
}
void QuestManager::set_proximity(float min_x, float max_x, float min_y, float max_y, float min_z, float max_z, bool enable_say)
@@ -2363,6 +2360,10 @@ void QuestManager::set_proximity(float min_x, float max_x, float min_y, float ma
n->proximity->max_z = max_z;
n->proximity->say = enable_say;
n->proximity->proximity_set = true;
if (enable_say) {
HaveProximitySays = enable_say;
}
}
void QuestManager::clear_proximity() {
@@ -3873,13 +3874,6 @@ void QuestManager::FlagInstanceByRaidLeader(uint32 zone, int16 version)
}
}
std::string QuestManager::saylink(char *saylink_text, bool silent, const char *link_name)
{
QuestManagerCurrentQuestVars();
return Saylink::Create(saylink_text, silent, link_name);
}
std::string QuestManager::getcharnamebyid(uint32 char_id) {
std::string res;
if (char_id > 0) {
-1
View File
@@ -285,7 +285,6 @@ public:
void FlagInstanceByGroupLeader(uint32 zone, int16 version);
void FlagInstanceByRaidLeader(uint32 zone, int16 version);
std::string varlink(uint32 item_id, int16 charges = 0, uint32 aug1 = 0, uint32 aug2 = 0, uint32 aug3 = 0, uint32 aug4 = 0, uint32 aug5 = 0, uint32 aug6 = 0, bool attuned = false);
std::string saylink(char *saylink_text, bool silent, const char *link_name);
std::string getcharnamebyid(uint32 char_id);
uint32 getcharidbyname(const char* name);
std::string getclassname(uint8 class_id, uint8 level = 0);
+2 -6
View File
@@ -40,8 +40,6 @@ extern WorldServer worldserver;
Raid::Raid(uint32 raidID)
: GroupIDConsumer(raidID)
{
memset(&raid_aa, 0, sizeof(RaidLeadershipAA_Struct));
memset(group_aa, 0, sizeof(GroupLeadershipAA_Struct) * MAX_RAID_GROUPS);
for (auto& gm : group_mentor) {
gm.mentor_percent = 0;
gm.mentoree = nullptr;
@@ -65,8 +63,6 @@ Raid::Raid(uint32 raidID)
Raid::Raid(Client* nLeader)
: GroupIDConsumer()
{
memset(&raid_aa, 0, sizeof(RaidLeadershipAA_Struct));
memset(group_aa, 0, sizeof(GroupLeadershipAA_Struct) * MAX_RAID_GROUPS);
for (auto& gm : group_mentor) {
gm.mentor_percent = 0;
gm.mentoree = nullptr;
@@ -451,13 +447,13 @@ void Raid::SaveRaidLeaderAA()
void Raid::UpdateGroupAAs(uint32 gid)
{
if (gid > MAX_RAID_GROUPS) {
if (gid > MAX_RAID_GROUPS || gid == RAID_GROUPLESS || gid < 0) {
return;
}
Client *gl = GetGroupLeader(gid);
if (gl) {
if (gl && gl->IsClient()) {
gl->GetGroupAAs(&group_aa[gid]);
} else {
memset(&group_aa[gid], 0, sizeof(GroupLeadershipAA_Struct));
+2 -2
View File
@@ -292,8 +292,8 @@ protected:
bool disbandCheck;
bool forceDisband;
std::string motd;
RaidLeadershipAA_Struct raid_aa;
GroupLeadershipAA_Struct group_aa[MAX_RAID_GROUPS];
RaidLeadershipAA_Struct raid_aa{};
GroupLeadershipAA_Struct group_aa[MAX_RAID_GROUPS]{};
GroupMentor group_mentor[MAX_RAID_GROUPS];
+1 -1
View File
@@ -807,7 +807,7 @@ void SpawnConditionManager::UpdateSpawnEvent(SpawnEvent &event)
e.next_month = event.next.month;
e.next_year = event.next.year;
e.enabled = event.enabled ? 1 : 0;
e.next_minute = event.strict;
e.strict = event.strict ? 1 : 0;
SpawnEventsRepository::UpdateOne(database, e);
}
+2 -2
View File
@@ -707,7 +707,7 @@ void Mob::TryBackstab(Mob *other, int ReuseTime) {
CastToClient()->Message(Chat::White,"Your fierce attack is executed with such grace, your target did not see it coming!");
RogueBackstab(other,false,ReuseTime);
if (level > 54) {
if (level >= RuleI(Combat, DoubleBackstabLevelRequirement)) {
// TODO: 55-59 doesn't appear to match just checking double attack, 60+ does though
if(IsClient() && CastToClient()->CheckDoubleAttack())
{
@@ -2402,7 +2402,7 @@ int Mob::TryAssassinate(Mob *defender, EQ::skills::SkillType skillInUse)
if (
defender &&
!defender->IsClient() &&
GetLevel() >= 60 &&
GetLevel() >= RuleI(Combat, AssassinateLevelRequirement) &&
(skillInUse == EQ::skills::SkillBackstab || skillInUse == EQ::skills::SkillThrowing) &&
(defender->GetBodyType() == BT_Humanoid || !RuleB(Combat, AssassinateOnlyHumanoids)) &&
!defender->GetSpecialAbility(IMMUNE_ASSASSINATE)
+5 -2
View File
@@ -221,9 +221,12 @@ bool Mob::CastSpell(uint16 spell_id, uint16 target_id, CastingSlot slot,
BuffFadeByEffect(SE_NegateIfCombat);
}
// check to see if target is a caster mob before performing a mana tap
if(GetTarget() && IsManaTapSpell(spell_id)) {
if (!RuleB(Spells, ManaTapsOnAnyClass) && GetTarget()->GetCasterClass() != 'N' && RuleB(Spells, ManaTapsRequireNPCMana) && GetTarget()->GetMana() == 0) {
// If melee, block if ManaTapsOnAnyClass rule is false
// if caster, block if ManaTapsRequireNPCMana and no mana
bool melee_block = !RuleB(Spells, ManaTapsOnAnyClass);
bool caster_block = (GetTarget()->GetCasterClass() != 'N' && RuleB(Spells, ManaTapsRequireNPCMana) && GetTarget()->GetMana() == 0);
if (melee_block || caster_block) {
InterruptSpell(TARGET_NO_MANA, 0x121, spell_id);
return false;
}
+2 -2
View File
@@ -2290,8 +2290,8 @@ void ClientTaskState::CreateTaskDynamicZone(Client* client, int task_id, Dynamic
}
// dz should be named the version-based zone name (used in choose zone window and dz window on live)
auto zone_info = zone_store.GetZone(dz_request.GetZoneID(), dz_request.GetZoneVersion());
dz_request.SetName(zone_info->long_name.empty() ? task->title : zone_info->long_name);
auto zone_info = zone_store.GetZoneWithFallback(dz_request.GetZoneID(), dz_request.GetZoneVersion());
dz_request.SetName(zone_info && !zone_info->long_name.empty() ? zone_info->long_name : task->title);
dz_request.SetMinPlayers(task->min_players);
dz_request.SetMaxPlayers(task->max_players);
+28
View File
@@ -34,6 +34,7 @@
#include "zonedb.h"
#include "worldserver.h"
#include "../common/repositories/char_recipe_list_repository.h"
#include "../common/repositories/criteria/content_filter_criteria.h"
#include "../common/repositories/tradeskill_recipe_repository.h"
#include "../common/repositories/tradeskill_recipe_entries_repository.h"
@@ -1892,4 +1893,31 @@ bool Client::CheckTradeskillLoreConflict(int32 recipe_id)
return false;
}
void Client::ScribeRecipes(uint32_t item_id) const
{
if (item_id == 0)
{
return;
}
auto recipes = TradeskillRecipeRepository::GetWhere(content_db, fmt::format(
"learned_by_item_id = {} {}", item_id, ContentFilterCriteria::apply()));
std::vector<CharRecipeListRepository::CharRecipeList> learned;
learned.reserve(recipes.size());
for (const auto& recipe : recipes)
{
auto entry = CharRecipeListRepository::NewEntity();
entry.char_id = static_cast<int32_t>(CharacterID());
entry.recipe_id = recipe.id;
learned.push_back(entry);
}
if (!learned.empty())
{
// avoid replacing madecount for recipes the client already has
int rows = CharRecipeListRepository::InsertUpdateMany(database, learned);
LogTradeskills("Client [{}] scribed [{}] recipes from [{}]", CharacterID(), rows, item_id);
}
}

Some files were not shown because too many files have changed in this diff Show More