forked from celguar/mangos-eluna
-
Notifications
You must be signed in to change notification settings - Fork 0
/
PlayerMethods.h
4297 lines (3867 loc) · 116 KB
/
PlayerMethods.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
/*
* Copyright (C) 2010 - 2016 Eluna Lua Engine <http://emudevs.com/>
* This program is free software licensed under GPL version 3
* Please see the included DOCS/LICENSE.md for more information
*/
#ifndef PLAYERMETHODS_H
#define PLAYERMETHODS_H
/***
* Inherits all methods from: [Object], [WorldObject], [Unit]
*/
namespace LuaPlayer
{
#if (!defined(TBC) && !defined(CLASSIC))
/**
* Returns 'true' if the [Player] can Titan Grip, 'false' otherwise.
*
* @return bool canTitanGrip
*/
int CanTitanGrip(lua_State* L, Player* player)
{
Eluna::Push(L, player->CanTitanGrip());
return 1;
}
/**
* Returns 'true' if the [Player] has a talent by ID in specified spec, 'false' otherwise.
*
* @param uint32 spellId : talent spellId to check
* @param uint8 spec : specified spec. 0 for primary, 1 for secondary.
* @return bool hasTalent
*/
int HasTalent(lua_State* L, Player* player)
{
uint32 spellId = Eluna::CHECKVAL<uint32>(L, 2);
#ifdef MANGOS
uint8 maxSpecs = MAX_TALENT_SPEC_COUNT;
#else
uint8 maxSpecs = MAX_TALENT_SPECS;
#endif
uint8 spec = Eluna::CHECKVAL<uint8>(L, 3);
if (spec >= maxSpecs)
return 1;
Eluna::Push(L, player->HasTalent(spellId, spec));
return 1;
}
/**
* Returns 'true' if the [Player] has completed the specified achievement, 'false' otherwise.
*
* @param uint32 achievementId
* @return bool hasAchieved
*/
int HasAchieved(lua_State* L, Player* player)
{
uint32 achievementId = Eluna::CHECKVAL<uint32>(L, 2);
#if defined TRINITY || AZEROTHCORE
Eluna::Push(L, player->HasAchieved(achievementId));
#else
Eluna::Push(L, player->GetAchievementMgr().HasAchievement(achievementId));
#endif
return 1;
}
#endif
/**
* Returns 'true' if the [Player] has an active [Quest] by specific ID, 'false' otherwise.
*
* @param uint32 questId
* @return bool hasQuest
*/
int HasQuest(lua_State* L, Player* player)
{
uint32 quest = Eluna::CHECKVAL<uint32>(L, 2);
Eluna::Push(L, player->IsActiveQuest(quest));
return 1;
}
/**
* Returns 'true' if the [Player] has a skill by specific ID, 'false' otherwise.
*
* @param uint32 skill
* @return bool hasSkill
*/
int HasSkill(lua_State* L, Player* player)
{
uint32 skill = Eluna::CHECKVAL<uint32>(L, 2);
Eluna::Push(L, player->HasSkill(skill));
return 1;
}
/**
* Returns 'true' if the [Player] has a [Spell] by specific ID, 'false' otherwise.
*
* @param uint32 spellId
* @return bool hasSpell
*/
int HasSpell(lua_State* L, Player* player)
{
uint32 id = Eluna::CHECKVAL<uint32>(L, 2);
Eluna::Push(L, player->HasSpell(id));
return 1;
}
/**
* Returns true if [Player] has specified login flag
*
* @param uint32 flag
* @return bool hasLoginFlag
*/
int HasAtLoginFlag(lua_State* L, Player* player)
{
uint32 flag = Eluna::CHECKVAL<uint32>(L, 2);
Eluna::Push(L, player->HasAtLoginFlag((AtLoginFlags)flag));
return 1;
}
/**
* Returns true if [Player] has [Quest] for [GameObject]
*
* @param int32 entry : entry of a [GameObject]
* @return bool hasQuest
*/
int HasQuestForGO(lua_State* L, Player* player)
{
int32 entry = Eluna::CHECKVAL<int32>(L, 2);
Eluna::Push(L, player->HasQuestForGO(entry));
return 1;
}
#ifndef CLASSIC
/**
* Returns 'true' if the [Player] has a title by specific ID, 'false' otherwise.
*
* @param uint32 titleId
* @return bool hasTitle
*/
int HasTitle(lua_State* L, Player* player)
{
uint32 id = Eluna::CHECKVAL<uint32>(L, 2);
CharTitlesEntry const* titleInfo = sCharTitlesStore.LookupEntry(id);
if (titleInfo)
Eluna::Push(L, player->HasTitle(titleInfo));
return 1;
}
#endif
/**
* Returns 'true' if the [Player] has the given amount of item entry specified, 'false' otherwise.
*
* @param uint32 itemId : entry of the item
* @param uint32 count = 1 : amount of items the player needs should have
* @param bool check_bank = false : determines if the item can be in player bank
* @return bool hasItem
*/
int HasItem(lua_State* L, Player* player)
{
uint32 itemId = Eluna::CHECKVAL<uint32>(L, 2);
uint32 count = Eluna::CHECKVAL<uint32>(L, 3, 1);
bool check_bank = Eluna::CHECKVAL<bool>(L, 4, false);
Eluna::Push(L, player->HasItemCount(itemId, count, check_bank));
return 1;
}
/**
* Returns 'true' if the [Player] has a quest for the item entry specified, 'false' otherwise.
*
* @param uint32 entry : entry of the item
* @return bool hasQuest
*/
int HasQuestForItem(lua_State* L, Player* player)
{
uint32 entry = Eluna::CHECKVAL<uint32>(L, 2);
Eluna::Push(L, player->HasQuestForItem(entry));
return 1;
}
/**
* Returns 'true' if the [Player] can use the item or item entry specified, 'false' otherwise.
*
* @proto canUse = (item)
* @proto canUse = (entry)
* @param [Item] item : an instance of an item
* @param uint32 entry : entry of the item
* @return bool canUse
*/
int CanUseItem(lua_State* L, Player* player)
{
Item* item = Eluna::CHECKOBJ<Item>(L, 2, false);
if (item)
Eluna::Push(L, player->CanUseItem(item) == EQUIP_ERR_OK);
else
{
uint32 entry = Eluna::CHECKVAL<uint32>(L, 2);
const ItemTemplate* temp = eObjectMgr->GetItemTemplate(entry);
if (temp)
Eluna::Push(L, player->CanUseItem(temp) == EQUIP_ERR_OK);
else
Eluna::Push(L, false);
}
return 1;
}
/**
* Returns 'true' if the [Spell] specified by ID is currently on cooldown for the [Player], 'false' otherwise.
*
* @param uint32 spellId
* @return bool hasSpellCooldown
*/
int HasSpellCooldown(lua_State* L, Player* player)
{
uint32 spellId = Eluna::CHECKVAL<uint32>(L, 2);
#ifdef TRINITY
Eluna::Push(L, player->GetSpellHistory()->HasCooldown(spellId));
#else
Eluna::Push(L, player->HasSpellCooldown(spellId));
#endif
return 1;
}
/**
* Returns 'true' if the [Player] can share [Quest] specified by ID, 'false' otherwise.
*
* @param uint32 entryId
* @return bool hasSpellCooldown
*/
int CanShareQuest(lua_State* L, Player* player)
{
uint32 entry = Eluna::CHECKVAL<uint32>(L, 2);
Eluna::Push(L, player->CanShareQuest(entry));
return 1;
}
/**
* Returns 'true' if the [Player] can currently communicate through chat, 'false' otherwise.
*
* @return bool canSpeak
*/
int CanSpeak(lua_State* L, Player* player)
{
#ifdef TRINITY
Eluna::Push(L, player->GetSession()->CanSpeak());
#else
Eluna::Push(L, player->CanSpeak());
#endif
return 1;
}
/**
* Returns 'true' if the [Player] has permission to uninvite others from the current group, 'false' otherwise.
*
* @return bool canUninviteFromGroup
*/
int CanUninviteFromGroup(lua_State* L, Player* player)
{
Eluna::Push(L, player->CanUninviteFromGroup() == ERR_PARTY_RESULT_OK);
return 1;
}
#ifndef CLASSIC
/**
* Returns 'true' if the [Player] can fly, 'false' otherwise.
*
* @return bool canFly
*/
int CanFly(lua_State* L, Player* player)
{
Eluna::Push(L, player->CanFly());
return 1;
}
#endif
#ifdef CLASSIC
/**
* Returns [Player] kills
*
* @param bool honorable = true : if victims are honorable
* @return uint32 kills
*/
int GetHonorStoredKills(lua_State* L, Player* player)
{
bool honorable = Eluna::CHECKVAL<bool>(L, 2, true);
Eluna::Push(L, player->GetHonorStoredKills(honorable));
return 1;
}
/**
* Returns rank points
*
* @return float rankPoints
*/
int GetRankPoints(lua_State* L, Player* player)
{
Eluna::Push(L, player->GetRankPoints());
return 1;
}
/**
* Returns last week's standing position
*
* @return int32 standingPos
*/
int GetHonorLastWeekStandingPos(lua_State* L, Player* player)
{
Eluna::Push(L, player->GetHonorLastWeekStandingPos());
return 1;
}
#endif
/**
* Returns 'true' if the [Player] is currently in water, 'false' otherwise.
*
* @return bool isInWater
*/
int IsInWater(lua_State* L, Player* player)
{
Eluna::Push(L, player->IsInWater());
return 1;
}
/**
* Returns 'true' if the [Player] is currently moving, 'false' otherwise.
*
* @return bool isMoving
*/
int IsMoving(lua_State* L, Player* player) // enable for unit when mangos support it
{
#ifdef CMANGOS
Eluna::Push(L, player->IsMoving());
#else
Eluna::Push(L, player->isMoving());
#endif
return 1;
}
#ifdef CLASSIC
/**
* Updates the [Player]s weekly honor status
*/
int UpdateHonor(lua_State* L, Player* player)
{
player->UpdateHonor();
return 0;
}
/**
* Resets the [Player]s weekly honor status
*/
int ResetHonor(lua_State* L, Player* player)
{
player->ResetHonor();
return 0;
}
/**
* Clears all of [Player]s weekly honor status
*/
int ClearHonorInfo(lua_State* L, Player* player)
{
player->ClearHonorInfo();
return 0;
}
#endif
#ifndef CLASSIC
/**
* Returns 'true' if the [Player] is currently flying, 'false' otherwise.
*
* @return bool isFlying
*/
int IsFlying(lua_State* L, Player* player) // enable for unit when mangos support it
{
Eluna::Push(L, player->IsFlying());
return 1;
}
#endif
/**
* Returns 'true' if the [Player] is in a [Group], 'false' otherwise.
*
* @return bool isInGroup
*/
int IsInGroup(lua_State* L, Player* player)
{
Eluna::Push(L, (player->GetGroup() != NULL));
return 1;
}
/**
* Returns 'true' if the [Player] is in a [Guild], 'false' otherwise.
*
* @return bool isInGuild
*/
int IsInGuild(lua_State* L, Player* player)
{
Eluna::Push(L, (player->GetGuildId() != 0));
return 1;
}
/**
* Returns 'true' if the [Player] is a Game Master, 'false' otherwise.
*
* Note: This is only true when GM tag is activated! For alternative see [Player:GetGMRank]
*
* @return bool isGM
*/
int IsGM(lua_State* L, Player* player)
{
#if defined TRINITY || AZEROTHCORE || CMANGOS
Eluna::Push(L, player->IsGameMaster());
#else
Eluna::Push(L, player->isGameMaster());
#endif
return 1;
}
#ifndef CLASSIC
/**
* Returns 'true' if the [Player] is in an arena team specified by type, 'false' otherwise.
*
* @param uint32 type
* @return bool isInArenaTeam
*/
int IsInArenaTeam(lua_State* L, Player* player)
{
uint32 type = Eluna::CHECKVAL<uint32>(L, 2);
if (type < MAX_ARENA_SLOT && player->GetArenaTeamId(type))
Eluna::Push(L, true);
else
Eluna::Push(L, false);
return 1;
}
#endif
/**
* Returns 'true' if the [Player] is immune to everything.
*
* @return bool isImmune
*/
int IsImmuneToDamage(lua_State* L, Player* player)
{
Eluna::Push(L, player->isTotalImmune());
return 1;
}
/**
* Returns 'true' if the [Player] satisfies all requirements to complete the quest entry.
*
* @param uint32 entry
* @return bool canComplete
*/
int CanCompleteQuest(lua_State* L, Player* player)
{
uint32 entry = Eluna::CHECKVAL<uint32>(L, 2);
Eluna::Push(L, player->CanCompleteQuest(entry));
return 1;
}
/**
* Returns 'true' if the [Player] is a part of the Horde faction, 'false' otherwise.
*
* @return bool isHorde
*/
int IsHorde(lua_State* L, Player* player)
{
#ifdef AZEROTHCORE
Eluna::Push(L, (player->GetTeamId() == TEAM_HORDE));
#else
Eluna::Push(L, (player->GetTeam() == HORDE));
#endif
return 1;
}
/**
* Returns 'true' if the [Player] is a part of the Alliance faction, 'false' otherwise.
*
* @return bool isAlliance
*/
int IsAlliance(lua_State* L, Player* player)
{
#ifdef AZEROTHCORE
Eluna::Push(L, (player->GetTeamId() == TEAM_ALLIANCE));
#else
Eluna::Push(L, (player->GetTeam() == ALLIANCE));
#endif
return 1;
}
/**
* Returns 'true' if the [Player] is 'Do Not Disturb' flagged, 'false' otherwise.
*
* @return bool isDND
*/
int IsDND(lua_State* L, Player* player)
{
Eluna::Push(L, player->isDND());
return 1;
}
/**
* Returns 'true' if the [Player] is 'Away From Keyboard' flagged, 'false' otherwise.
*
* @return bool isAFK
*/
int IsAFK(lua_State* L, Player* player)
{
Eluna::Push(L, player->isAFK());
return 1;
}
/**
* Returns 'true' if the [Player] is currently falling, 'false' otherwise.
*
* @return bool isFalling
*/
int IsFalling(lua_State* L, Player* player)
{
Eluna::Push(L, player->IsFalling());
return 1;
}
int IsGroupVisibleFor(lua_State* L, Player* player)
{
Player* target = Eluna::CHECKOBJ<Player>(L, 2);
Eluna::Push(L, player->IsGroupVisibleFor(target));
return 1;
}
/**
* Returns 'true' if the [Player] is currently in the same raid as another [Player] by object, 'false' otherwise.
*
* @param [Player] player
* @return bool isInSameRaidWith
*/
int IsInSameRaidWith(lua_State* L, Player* player)
{
Player* target = Eluna::CHECKOBJ<Player>(L, 2);
Eluna::Push(L, player->IsInSameRaidWith(target));
return 1;
}
/**
* Returns 'true' if the [Player] is currently in the same [Group] as another [Player] by object, 'false' otherwise.
*
* @param [Player] player
* @return bool isInSameGroupWith
*/
int IsInSameGroupWith(lua_State* L, Player* player)
{
Player* target = Eluna::CHECKOBJ<Player>(L, 2);
Eluna::Push(L, player->IsInSameGroupWith(target));
return 1;
}
/**
* Returns 'true' if the [Player] is eligible for Honor or XP gain by [Unit] specified, 'false' otherwise.
*
* @param [Unit] unit
* @return bool isHonorOrXPTarget
*/
int IsHonorOrXPTarget(lua_State* L, Player* player)
{
Unit* victim = Eluna::CHECKOBJ<Unit>(L, 2);
Eluna::Push(L, player->isHonorOrXPTarget(victim));
return 1;
}
/**
* Returns 'true' if the [Player] can see anoter [Player] specified by object, 'false' otherwise.
*
* @param [Player] player
* @return bool isVisibleForPlayer
*/
int IsVisibleForPlayer(lua_State* L, Player* player)
{
Player* target = Eluna::CHECKOBJ<Player>(L, 2);
Eluna::Push(L, player->IsVisibleGloballyFor(target));
return 1;
}
int IsGMVisible(lua_State* L, Player* player)
{
Eluna::Push(L, player->isGMVisible());
return 1;
}
/**
* Returns 'true' if the [Player] has taxi cheat activated, 'false' otherwise.
*
* @return bool isTaxiCheater
*/
int IsTaxiCheater(lua_State* L, Player* player)
{
#ifdef MANGOS
Eluna::Push(L, player->IsTaxiCheater());
#else
Eluna::Push(L, player->isTaxiCheater());
#endif
return 1;
}
int IsGMChat(lua_State* L, Player* player)
{
Eluna::Push(L, player->isGMChat());
return 1;
}
/**
* Returns 'true' if the [Player] is accepting whispers, 'false' otherwise.
*
* @return bool isAcceptingWhispers
*/
int IsAcceptingWhispers(lua_State* L, Player* player)
{
Eluna::Push(L, player->isAcceptWhispers());
return 1;
}
/**
* Returns 'true' if the [Player] is currently rested, 'false' otherwise.
*
* @return bool isRested
*/
int IsRested(lua_State* L, Player* player)
{
Eluna::Push(L, player->GetRestBonus() > 0.0f);
return 1;
}
/**
* Returns 'true' if the [Player] is currently in a [BattleGround] queue, 'false' otherwise.
*
* @return bool inBattlegroundQueue
*/
int InBattlegroundQueue(lua_State* L, Player* player)
{
#if defined TRINITY || AZEROTHCORE
Eluna::Push(L, player->InBattlegroundQueue());
#else
Eluna::Push(L, player->InBattleGroundQueue());
#endif
return 1;
}
#ifndef CLASSIC
/**
* Returns 'true' if the [Player] is currently in an arena, 'false' otherwise.
*
* @return bool inArena
*/
int InArena(lua_State* L, Player* player)
{
Eluna::Push(L, player->InArena());
return 1;
}
#endif
/**
* Returns 'true' if the [Player] is currently in a [BattleGround], 'false' otherwise.
*
* @return bool inBattleGround
*/
int InBattleground(lua_State* L, Player* player)
{
#if defined TRINITY || AZEROTHCORE
Eluna::Push(L, player->InBattleground());
#else
Eluna::Push(L, player->InBattleGround());
#endif
return 1;
}
/**
* Returns 'true' if the [Player] can block incomming attacks, 'false' otherwise.
*
* @return bool canBlock
*/
int CanBlock(lua_State* L, Player* player)
{
Eluna::Push(L, player->CanBlock());
return 1;
}
/**
* Returns 'true' if the [Player] can parry incomming attacks, 'false' otherwise.
*
* @return bool canParry
*/
int CanParry(lua_State* L, Player* player)
{
Eluna::Push(L, player->CanParry());
return 1;
}
/*int HasReceivedQuestReward(lua_State* L, Player* player)
{
uint32 entry = Eluna::CHECKVAL<uint32>(L, 2);
Eluna::Push(L, player->IsQuestRewarded(entry));
return 1;
}*/
/*int IsOutdoorPvPActive(lua_State* L, Player* player)
{
Eluna::Push(L, player->IsOutdoorPvPActive());
return 1;
}*/
/*int IsImmuneToEnvironmentalDamage(lua_State* L, Player* player)
{
Eluna::Push(L, player->IsImmuneToEnvironmentalDamage());
return 1;
}*/
/*int InRandomLfgDungeon(lua_State* L, Player* player)
{
Eluna::Push(L, player->inRandomLfgDungeon());
return 1;
}*/
/*int IsUsingLfg(lua_State* L, Player* player)
{
Eluna::Push(L, player->isUsingLfg());
return 1;
}*/
/*int IsNeverVisible(lua_State* L, Player* player)
{
Eluna::Push(L, player->IsNeverVisible());
return 1;
}*/
/*int CanFlyInZone(lua_State* L, Player* player)
{
uint32 mapid = Eluna::CHECKVAL<uint32>(L, 2);
uint32 zone = Eluna::CHECKVAL<uint32>(L, 2);
Eluna::Push(L, player->IsKnowHowFlyIn(mapid, zone));
return 1;
}*/
/*int HasPendingBind(lua_State* L, Player* player)
{
Eluna::Push(L, player->PendingHasPendingBind());
return 1;
}*/
/*int IsARecruiter(lua_State* L, Player* player)
{
Eluna::Push(L, player->GetSession()->IsARecruiter() || (player->GetSession()->GetRecruiterId() != 0));
return 1;
}*/
#if (!defined(TBC) && !defined(CLASSIC))
/**
* Returns the amount of available specs the [Player] currently has
*
* @return uint8 specCount
*/
int GetSpecsCount(lua_State* L, Player* player)
{
Eluna::Push(L, player->GetSpecsCount());
return 1;
}
/**
* Returns the [Player]s active spec ID
*
* @return uint32 specId
*/
int GetActiveSpec(lua_State* L, Player* player)
{
Eluna::Push(L, player->GetActiveSpec());
return 1;
}
#endif
#ifdef WOTLK
/**
* Returns the normal phase of the player instead of the actual phase possibly containing GM phase
*
* @return uint32 phasemask
*/
int GetPhaseMaskForSpawn(lua_State* L, Player* player)
{
Eluna::Push(L, player->GetPhaseMaskForSpawn());
return 1;
}
#endif
#if defined(TBC) || defined (WOTLK)
/**
* Returns the [Player]s current amount of Arena Points
*
* @return uint32 arenaPoints
*/
int GetArenaPoints(lua_State* L, Player* player)
{
Eluna::Push(L, player->GetArenaPoints());
return 1;
}
/**
* Returns the [Player]s current amount of Honor Points
*
* @return uint32 honorPoints
*/
int GetHonorPoints(lua_State* L, Player* player)
{
Eluna::Push(L, player->GetHonorPoints());
return 1;
}
#endif
#if defined(CLASSIC) || defined(TBC) || defined (WOTLK)
/**
* Returns the [Player]s current shield block value
*
* @return uint32 blockValue
*/
int GetShieldBlockValue(lua_State* L, Player* player)
{
Eluna::Push(L, player->GetShieldBlockValue());
return 1;
}
#endif
/**
* Returns the [Player]s cooldown delay by specified [Spell] ID
*
* @param uint32 spellId
* @return uint32 spellCooldownDelay
*/
int GetSpellCooldownDelay(lua_State* L, Player* player)
{
uint32 spellId = Eluna::CHECKVAL<uint32>(L, 2);
#ifdef TRINITY
if (SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(spellId))
Eluna::Push(L, player->GetSpellHistory()->GetRemainingCooldown(spellInfo));
else
Eluna::Push(L, 0);
#else
Eluna::Push(L, uint32(player->GetSpellCooldownDelay(spellId)));
#endif
return 1;
}
/**
* Returns the [Player]s current latency in MS
*
* @return uint32 latency
*/
int GetLatency(lua_State* L, Player* player)
{
Eluna::Push(L, player->GetSession()->GetLatency());
return 1;
}
#if defined TRINITY || AZEROTHCORE
/**
* Returns the faction ID the [Player] is currently flagged as champion for
*
* @return uint32 championingFaction
*/
int GetChampioningFaction(lua_State* L, Player* player)
{
Eluna::Push(L, player->GetChampioningFaction());
return 1;
}
#endif
/**
* Returns [Player]s original sub group
*
* @return uint8 subGroup
*/
int GetOriginalSubGroup(lua_State* L, Player* player)
{
Eluna::Push(L, player->GetOriginalSubGroup());
return 1;
}
/**
* Returns [Player]s original [Group] object
*
* @return [Group] group
*/
int GetOriginalGroup(lua_State* L, Player* player)
{
Eluna::Push(L, player->GetOriginalGroup());
return 1;
}
/**
* Returns a random Raid Member [Player] object within radius specified of [Player]
*
* @param float radius
* @return [Player] player
*/
int GetNextRandomRaidMember(lua_State* L, Player* player)
{
float radius = Eluna::CHECKVAL<float>(L, 2);
#ifndef CMANGOS
Eluna::Push(L, player->GetNextRandomRaidMember(radius));
#else
Eluna::Push(L, player->GetNextRandomRaidMember(radius, SPELL_AURA_NONE));
#endif
return 1;
}
/**
* Returns [Player]s current sub group
*
* @return uint8 subGroup
*/
int GetSubGroup(lua_State* L, Player* player)
{
Eluna::Push(L, player->GetSubGroup());
return 1;
}
/**
* Returns [Group] invitation
*
* @return [Group] group
*/
int GetGroupInvite(lua_State* L, Player* player)
{
Eluna::Push(L, player->GetGroupInvite());
return 1;
}
/**
* Returns rested experience bonus
*
* @param uint32 xp
* @return uint32 xpBonus
*/
int GetXPRestBonus(lua_State* L, Player* player)
{
uint32 xp = Eluna::CHECKVAL<uint32>(L, 2);
Eluna::Push(L, player->GetXPRestBonus(xp));
return 1;
}
/**
* Returns the [Player]s current [BattleGround] type ID
*
* @return [BattleGroundTypeId] typeId
*/
int GetBattlegroundTypeId(lua_State* L, Player* player)
{
#if defined TRINITY || AZEROTHCORE
Eluna::Push(L, player->GetBattlegroundTypeId());
#else
Eluna::Push(L, player->GetBattleGroundTypeId());
#endif
return 1;
}
/**
* Returns the [Player]s current [BattleGround] ID
*
* @return uint32 battleGroundId
*/
int GetBattlegroundId(lua_State* L, Player* player)
{
#if defined TRINITY || AZEROTHCORE
Eluna::Push(L, player->GetBattlegroundId());
#else
Eluna::Push(L, player->GetBattleGroundId());
#endif
return 1;
}
/**
* Returns the [Player]s reputation rank of faction specified
*
* @param uint32 faction
* @return [ReputationRank] rank
*/
int GetReputationRank(lua_State* L, Player* player)
{
uint32 faction = Eluna::CHECKVAL<uint32>(L, 2);