48 Commits

Author SHA1 Message Date
Alex King
40738b29e3
[Quest API] Add Area-Based Quest Methods to Perl/Lua (#4447)
* [Quest API] Add Area-Based Quest Methods to Perl/Lua

* Convert some to mob

* Fix
2024-08-26 20:29:07 -05:00
Chris Miles
8fce86c396
[Quest API] Adjust GetCloseMobList calls internally (#3530)
* [Quest API] Adjust GetCloseMobList calls internally

* Tweaks
2023-08-04 13:05:22 -05:00
Alex King
728ce0c519
[Quest API] Add GetCloseMobList() and CalculateDistance() overload to Perl/Lua (#3455)
* [Quest API] Add GetCloseMobList() and CalculateDistance() overload to Perl/Lua

# Perl
- Add `$entity_list->GetCloseMobList(mob)`.
- Add `$entity_list->GetCloseMobList(mob, distance)`.
- Add `$mob->CalculateDistance(mob)`.
- Add `$mob->GetCloseMobList()`.
- Add `$mob->GetCloseMobList(distance)`.

# Lua
- Add `eq.get_entity_list():GetCloseMobList(mob)`.
- Add `eq.get_entity_list():GetCloseMobList(mob, distance)`.
- Add `mob:CalculateDistance(mob)`.
- Add `mob:GetCloseMobList()`.
- Add `mob:GetCloseMobList(distance)`.

* Ignore Self

* Update lua_entity_list.cpp

* Cleanup
2023-07-02 10:55:27 -04:00
Alex King
a13fa07e68
[Quest API] Add Spawn2 Class to Perl (#3456)
# Perl
- Add `$spawn->Depop()`.
- Add `$spawn->Disable()`.
- Add `$spawn->Enable()`.
- Add `$spawn->ForceDespawn()`.
- Add `$spawn->GetCurrentNPCID()`.
- Add `$spawn->GetHeading()`.
- Add `$spawn->GetID()`.
- Add `$spawn->GetKillCount()`.
- Add `$spawn->GetRespawnTimer()`.
- Add `$spawn->GetSpawnCondition()`.
- Add `$spawn->GetSpawnGroupID()`.
- Add `$spawn->GetVariance()`.
- Add `$spawn->GetX()`.
- Add `$spawn->GetY()`.
- Add `$spawn->GetZ()`.
- Add `$spawn->IsEnabled()`.
- Add `$spawn->IsNPCPointerValid()`.
- Add `$spawn->LoadGrid()`.
- Add `$spawn->Repop()`.
- Add `$spawn->Repop(delay)`.
- Add `$spawn->Reset()`.
- Add `$spawn->SetCurrentNPCID(npc_id)`.
- Add `$spawn->SetNPCPointer(npc_pointer)`.
- Add `$spawn->SetRespawnTimer(new_respawn_time)`.
- Add `$spawn->SetTimer(duration)`.
- Add `$spawn->SetVariance(variance)`.

# Notes
- Adds support for Spawn2 class to Perl.
2023-07-02 10:26:32 -04:00
Aeadoin
7f7ba2e6c2
[Cleanup] Remove unused Includes under zone files (#3162) 2023-04-01 22:55:28 -04:00
Alex King
3335cacac1
[Bots] Cleanup and remove preprocessors. (#2757)
* [Bots] Cleanup and remove preprocessors.

- Removes every `#ifdef BOTS` we have and locks bots behind `Bots:AllowBots` rule.
- Bot updates are now done by default similar to regular database updates.
- Modify `CMakeLists.txt`, `.drone.yml`, and `BUILD.md` to match the removal of `EQEMU_ENABLE_BOTS`.

* Cleanup

- Add SQL for enabling bots for servers with bots.
- Add message that tells players/operators bots are disabled.

* Suggested changes.

* Bot injection stuff

* Change SQL to bot SQL.

* Tweaks

* Remove `is_bot`

* Update version.h

* Update main.cpp

* Update database.cpp

* Fix name availability crash

* Remove bots from update script

Co-authored-by: Akkadius <akkadius1@gmail.com>
2023-01-20 12:35:33 -06:00
Alex King
095f4fb56c
[Quest API] Add SignalAllBotsByOwnerName() to Perl/Lua. (#2730)
# Perl
- Add `$entity_list->SignalAllBotsByOwnerName(owner_name)`.

# Lua
- Add `eq.get_entity_list():SignalAllBotsByOwnerName(owner_name)`.

# Notes
- Adds a way to signal all bots by owner name instead of only character ID.
2023-01-13 04:54:20 -06:00
Aeadoin
8fe02b5ed1
[Bot] Add GetBotOwnerByBotID Method (#2715)
* [Bot] Add GetBotOwnerByBotID Method

* Cleanup.

* Remove EVENT_DESPAWN exports in Lua.

Co-authored-by: Kinglykrab <kinglykrab@gmail.com>
2023-01-10 21:14:42 -05:00
Alex King
e1d5274bd5
[Quest API] Cleanup Signal Methods in Perl/Lua. (#2604)
# Perl
- Add `$client->Signal(signal_id)`.

# Notes
- Some places still had signal as `uint32` versus `int`.
- Rename `signal` to `signal_id` where valid so we don't have conflicts.
2022-12-04 17:40:48 -05:00
Alex King
290ebf3b26
[Quest API] Add GetBotListByClientName() Class Overload to Perl/Lua. (#2577)
# Perl
- Add `$entity_list->GetBotListByClientName(client_name, class_id)`.

# Lua
- Add `eq.get_entity_list():GetBotListByClientName(client_name, class_id)`.

# Notes
- Adds overload to get bots by client name and class ID.
2022-11-26 15:47:45 -05:00
Kinglykrab
856aa51cb8
[Bots] Add support for Bot scripting. (#2515)
* [Bots] Add support for Bot scripting.

# Perl
- Add support for `zone/bot.pl` and `zone/bot_v#.pl`.
- Add support for `global/global_bot.pl`.
- Add `$bot->SignalBot(signal_id)` to Perl.
- Add `$bot->OwnerMessage(message)` to Perl.
- Add `$entity_list->SignalAllBotsByOwnerCharacterID(character_id, signal_id)` to Perl.
- Add `$entity_list->SignalBotByBotID(bot_id, signal_id)` to Perl.
- Add `$entity_list->SignalBotByBotName(bot_name, signal_id)` to Perl.
- Add `EVENT_SPELL_EFFECT_BOT` to Perl.
- Add `EVENT_SPELL_EFFECT_BUFF_TIC_BOT` to Perl.

# Lua
- Add support for `zone/bot.lua` and `zone/bot_v#.lua`.
- Add support for `global/global_bot.lua`.
- Add `bot:SignalBot(signal_id)` to Lua.
- Add `bot:OwnerMessage(message)` to Lua.
- Add `entity_list:SignalAllBotsByOwnerCharacterID(character_id, signal_id)` to Lua.
- Add `entity_list:SignalBotByBotID(bot_id, signal_id)` to Lua.
- Add `entity_list:SignalBotByBotName(bot_name, signal_id)` to Lua.
- Add `EVENT_SPELL_EFFECT_BOT` to Lua.
- Add `EVENT_SPELL_EFFECT_BUFF_TIC_BOT` to Lua.

# Supported Bot Events
1. `EVENT_CAST`
2. `EVENT_CAST_BEGIN`
3. `EVENT_CAST_ON`
4. `EVENT_COMBAT`
5. `EVENT_DEATH`
6. `EVENT_DEATH_COMPLETE`
7. `EVENT_SAY`
8. `EVENT_SIGNAL`
9. `EVENT_SLAY`
10. `EVENT_SLAY_NPC`
11. `EVENT_SPAWN`
12. `EVENT_TARGET_CHANGE`
13. `EVENT_TIMER`
14. `EVENT_USE_SKILL`

# Common
- Convert NPC pointers in common events to Mob pointers so bots are supported.
- Convert signal IDs to `int` where it wasn't already, allowing negative signals to be sent properly.

* Add EVENT_POPUP_RESPONSE.

* Cleanup and fix EVENT_COMBAT/EVENT_SLAY/EVENT_NPC_SLAY.

* Fix DoNPCEmote calls.

* Update attack.cpp

* Update event_codes.h

* Update bot_command.cpp
2022-11-16 21:02:16 -06:00
Kinglykrab
7ea77ee027
[Bots] Add Quest API Support for Limits. (#2522)
* [Bots] Add Quest API Support for Limits.

# Perl
- Add `$client->GetBotCreationLimit()` to Perl.
- Add `$client->GetBotCreationLimit(class_id)` to Perl.
- Add `$client->GetBotRequiredLevel()` to Perl.
- Add `$client->GetBotRequiredLevel(class_id)` to Perl.
- Add `$client->GetBotSpawnLimit()` to Perl.
- Add `$client->GetBotSpawnLimit(class_id)` to Perl.
- Add `$client->SetBotCreationLimit(creation_limit)` to Perl.
- Add `$client->SetBotCreationLimit(creation_limit, class_id)` to Perl.
- Add `$client->SetBotRequiredLevel(required_level)` to Perl.
- Add `$client->SetBotRequiredLevel(required_level, class_id)` to Perl.
- Add `$client->SetBotSpawnLimit(spawn_limit)` to Perl.
- Add `$client->SetBotSpawnLimit(spawn_limit, class_id)` to Perl.
- Add `$entity_list->GetBotListByCharacterID(character_id, class_id)` to Perl.

# Lua
- Add `client:GetBotCreationLimit()` to Lua.
- Add `client:GetBotCreationLimit(class_id)` to Lua.
- Add `client:GetBotRequiredLevel()` to Lua.
- Add `client:GetBotRequiredLevel(class_id)` to Lua.
- Add `client:GetBotSpawnLimit()` to Lua.
- Add `client:GetBotSpawnLimit(class_id)` to Lua.
- Add `client:SetBotCreationLimit(creation_limit)` to Lua.
- Add `client:SetBotCreationLimit(creation_limit, class_id)` to Lua.
- Add `client:SetBotRequiredLevel(required_level)` to Lua.
- Add `client:SetBotRequiredLevel(required_level, class_id)` to Lua.
- Add `client:SetBotSpawnLimit(spawn_limit)` to Lua.
- Add `client:SetBotSpawnLimit(spawn_limit, class_id)` to Lua.
- Add `entity_list:GetBotListByCharacterID(character_id, class_id)` to Lua.

# Notes
- Allows operators to set creation and spawn limits based on class, as well as required level.
- Using the class-inspecific methods sets the global limit or required level.
- Global limits are checked prior to class-specific limits and if they are not met, creation or spawn is disallowed.
- Modified preexisting Quest API to make use of this new stuff under the hood.

* Update bot_command.cpp

* Add client bot file.
2022-11-16 19:51:13 -05:00
Kinglykrab
bd95daa1f3
[Quest API] Add GetRandomBot() to Perl/Lua (#2543)
* [Quest API] Add GetRandomBot() to Perl/lua.

# Perl
- Add `$entity_list->GetRandomBot()` to Perl.
- Add `$entity_list->GetRandomBot(x, y, z, distance)` to Perl.
- Add `$entity_list->GetRandomBot(x, y, z, distance, exclude_bot)` to Perl.

# Lua
- Add `eq.get_entity_list():GetRandomBot()` to Lua.
- Add `eq.get_entity_list():GetRandomBot(x, y, z, distance)` to Lua.
- Add `eq.get_entity_list():GetRandomBot(x, y, z, distance, exclude_bot)` to Lua.

# Notes
- Allows operators to grab a random Bot from entity list similar to Client, Mob, and NPC.

* Cleanup and fix Perl distance.

- Perl distance was sending as already squared, Lua was not.
- Send as non-squared and square in the method so that both work the same.

* Update entity.cpp

* Update entity.cpp
2022-11-16 18:54:15 -05:00
Kinglykrab
bb58a9cd20
[Quest API] Add Marquee methods to Perl/Lua. (#2544)
* [Quest API] Add zonemarquee to Perl/Lua.

# Perl
- Add `quest::zonemarquee(type, priority, fade_in, fade_out, duration, message)` to Perl.

# Lua
- Add `eq.zone_marquee(type, priority, fade_in, fade_out, duration, message)` to Lua.

# Notes
- Allows operators to easily send a zone-wide marquee, similar to `quest::ze`/`eq.zone_emote`.

* Update lua_general.cpp

* Add other methods.

* Add entity list marquee

* Update client.cpp

* Add more shorthands.
2022-11-16 07:23:39 -06:00
Kinglykrab
e5ad9264d0
[Quest API] Add GetRandomClient(), GetRandomMob() and GetRandomNPC() overloads to Perl/Lua. (#2541)
* [Quest API] Add GetRandomClient(), GetRandomMob() and GetRandomNPC() overloads to Perl/Lua.

# Perl
- Add `$entity_list->GetRandomClient()` to Perl.
- Add `$entity_list->GetRandomMob()` to Perl.
- Add `$entity_list->GetRandomNPC()` to Perl.

# Lua
- Add `eq.get_entity_list():GetRandomClient()` to Lua.
- Add `eq.get_entity_list():GetRandomMob()` to Lua.
- Add `eq.get_entity_list():GetRandomNPC()` to Lua.

# Notes
- We didn't have overloads before without XYZ, so was harder to do a zone-wide random.

* Update lua_entity_list.cpp
2022-11-14 14:08:02 -05:00
hg
4cf6db79aa
[Saylinks] Inject Saylinks in MessageClose API (#2335) 2022-07-30 19:16:25 -05:00
Chris Miles
dfd8f84cac
[Strings] Refactor Strings Usage (#2305)
* Initial commit checkpoint

* More functions converted

* Commify

* More functions

* Fin

* Sort declarations

* Split functions between files

* Bots

* Update strings.h

* Split

* Revert find replaces

* Repository template

* Money

* Misc function

* Update CMakeLists.txt

* Saylink

* Update strings.cpp

* Swap Strings::Saylink for Saylink::Create since saylink is coupled to zone database

* API casings
2022-07-14 02:10:52 -05:00
hg
7e8a24fcec
[Quest API] Use binding library for perl apis (#2216)
* Add perlbind library

* Convert perl apis to perlbind
2022-07-03 21:33:45 -05:00
Kinglykrab
7c1a139991
[Cleanup] Quest API push methods using invalid types. (#2172)
* [Cleanup] Quest API push methods using invalid types.
- Some push methods were pushing integers as unsigned integers or unsigned integer as integers, this fixes all of that.
- Also cleans up some lines that had multiple function calls on them.

* More cleanup of bools and one expansion name was wrong.
2022-05-15 22:14:16 -04:00
Kinglykrab
a39a825045
[Quest API] Add GetBotListByCharacterID() to Perl/Lua. (#2069) 2022-04-02 17:51:26 -04:00
Kinglykrab
5dc76e595b
[Quest API] Add GetBotListByClientName(client_name) to Perl/Lua. (#2064)
* [Quest API] Add GetBotListByClientName(client_name) to Perl/Lua.
- Add $entity_list->GetBotListByClientName(client_name) to Perl.
- Add eq.get_entity_list():GetBotListByClientName(client_name) to Lua.
- Allows you to get a bot list comprised solely of a specific character's bots.

* Update lua_entity_list.cpp
2022-03-23 08:47:47 -04:00
Kinglykrab
0d02fadb60
[Quest API] Add GetRandomMob() and GetRandomNPC() to Perl/Lua. (#2006)
- Add $entity_list->GetRandomMob(x, y, z, distance, exclude_mob) to Perl.
- Add $entity_list->GetRandomNPC(x, y, z, distance, exclude_npc) to Perl.
- Add eq.get_entity_list():GetRandomMob(x, y, z, distance, exclude_mob) to Lua.
- Add eq.get_entity_list():GetRandomNPC(x, y, z, distance, exclude_npc) to Lua.
2022-02-17 08:57:02 -05:00
Kinglykrab
5470ec6293
[Commands] Cleanup #corpse Command. (#1790)
- Cleanup message and logic.
- Add ConvertMoneyToString(platinum, gold, silver, copper) helper method.
- Cleanup NPC::QueryLoot() and Corpse::QueryLoot().
2021-11-21 14:02:03 -05:00
Kinglykrab
293361a1f7
[Cleanup] Make use of AccountStatus constants wherever status is checked or used. (#1764)
* [Cleanup] Make use of AccountStatus constants wherever status is checked or used.
- Cleanup all instances of SendEmoteMessage.
- Cleanup all instances of SendEmoteMessageRaw.
- Cleanup all instances of MessageStatus.
- Convert Quest API method defaults to use constants.

* Cleanup constant names.
2021-11-14 21:01:13 -06:00
Kinglykrab
b983fac860
[Quest API] Alphabetize Perl method exports. (#1672)
- Keeps things tidier.
Perl script was used to get this in order easily.
```pl
my @perl_file_types = (
	"bot",
	"client",
	"doors",
	"entity",
	"expedition",
	"groups",
	"hateentry",
	"inventory",
	"mob",
	"npc",
	"object",
	"perlpacket",
	"player_corpse",
	"questitem",
	"raids",
	"spell"
);

foreach my $file_type (sort {$a cmp $b} @perl_file_types) {
	my $perl_file = "perl_$file_type.cpp";
	open my $client_file, '<', $perl_file or die "Cannot open file_name $perl_file";
	{
		local $/;
		$content = <$client_file>;
	}
	close $client_file;

	open my $perl_data_file, ">", "perl_$file_type\_data.cpp";

	my @variables = ();

	foreach my $line (split("\n", $content)) {
		if ($line=~/newXSproto\(/i) {
			$line =~ s/\s+/ /g;
			my @line_data = split(/ /, $line);
			push(@variables, join(" ", @line_data));
		}
	}

	foreach my $variable (sort {$a cmp $b} @variables) {
		$variable =~ s/^ //ig;
		print $perl_data_file "\t$variable\n";
	}

	close $perl_data_file;
}```
2021-11-06 17:36:06 -04:00
Kinglykrab
0762ffa3dc
[Quest API] Typo in Perl $entity_lsit->IsMobSpawnedByNpcTypeID(). (#1576)
This causes the wrong name to show up on Spire.
2021-10-01 21:19:26 -04:00
Alex
d9d6a64941
[Bots] Add Bot scripting capabilities to the source. (#1378)
- This will allow server operators to interact with bots within a script in Perl or Lua.
2021-06-11 13:46:30 -05:00
TurmoilToad
fa9478ac44
[Quest API] Perl Entity List Annotations (#1243)
Added category tag annotations for perl entity list methods.
2021-02-23 12:03:16 -06:00
Kinglykrab
64c97a5283 [Quest API] Perl Entity Validation Macro
Add validation macro to all entitylist methods.
2021-02-01 22:06:41 -05:00
Alex
0b03f27660 Add GetNPCBySpawnID() to Perl/Lua. 2020-05-07 23:11:36 -04:00
Kinglykrab
499c0fdca5 Fixes multi-link Perl croaks, allowing the quest API reader to function properly. 2019-09-10 21:48:15 -04:00
KimLS
f754cb1307 Move update path to movement manager so all movement will use paths 2018-09-18 23:06:56 -07:00
Akkadius
2bab945c34 perl_entity.cpp formatting 2018-07-01 19:50:56 -05:00
Akkadius
a6c1314e3e perl_entity.cpp formatting 2018-07-01 19:49:31 -05:00
Akkadius
979e54daa7 Update usage croak docs perl_entity.cpp 2018-07-01 19:49:21 -05:00
Michael Cook (mackal)
60da544d3a clang-tidy modernize-use-auto 2016-05-25 16:10:28 -04:00
KimLS
17af9e3808 Merge fixes, hopefully didn't break anything. 2015-01-23 13:36:27 -08:00
KimLS
269d56e1d0 Switched out our kinda juryrigged vector types for glm::vec types since we use that as a 3d math library already but never switched out the types 2015-01-23 00:01:10 -08:00
Akkadius
c5447778a6 Merge remote-tracking branch 'remotes/origin/master' into logging_changes
Conflicts:
	world/client.cpp
	world/worlddb.cpp
	zone/aggro.cpp
	zone/bot.cpp
	zone/client.cpp
	zone/client_packet.cpp
	zone/client_process.cpp
	zone/doors.cpp
	zone/entity.cpp
	zone/inventory.cpp
	zone/mob_ai.cpp
	zone/perl_client.cpp
	zone/spells.cpp
	zone/waypoints.cpp
	zone/zone.cpp
	zone/zonedb.cpp
	zone/zoning.cpp
2015-01-21 17:29:30 -06:00
Akkadius
0d9b6703a6 Rename debug.h to global_define.h, update cmakelists and such 2015-01-19 04:12:09 -06:00
Arthur Ice
54f3f7f343 EntityList::GetRandomClient converted to xyz_location 2014-11-30 22:28:17 -08:00
Michael Cook (mackal)
970b30b467 Added entity_list::IsMobSpawnedByNpcTypeID
Exported to both lua and perl
2014-02-25 23:15:14 -05:00
j883376
4bdd8b2502 Change space indentation to tabs 2013-05-09 11:37:51 -04:00
j883376
ffcff4aea1 Remove trailing whitespace 2013-05-09 11:13:16 -04:00
Arthur Ice
7560b6b0a7 NULL to nullptr 2013-05-04 18:06:58 -07:00
KimLS
f32048808a c++11 linux compile conflicts with perl 2013-02-23 00:06:03 -08:00
KimLS
8eb7d0aaa8 Skill caps load with new smem scheme 2013-02-20 13:54:26 -08:00
KimLS
da7347f76f svn -> git Migration 2013-02-16 16:14:39 -08:00