-
-
Notifications
You must be signed in to change notification settings - Fork 664
/
Copy pathplayer.lua
685 lines (591 loc) · 20.3 KB
/
player.lua
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
local storeItemID = {
-- registered item ids here are not tradable with players
-- these items can be set to movable at items.xml
-- 500 charges exercise weapons
28552, -- exercise sword
28553, -- exercise axe
28554, -- exercise club
28555, -- exercise bow
28556, -- exercise rod
28557, -- exercise wand
44065, -- exercise shield
-- 50 charges exercise weapons
28540, -- training sword
28541, -- training axe
28542, -- training club
28543, -- training bow
28544, -- training wand
28545, -- training club
44064, -- training shield
-- magic gold and magic converter (activated/deactivated)
28525, -- magic gold converter
28526, -- magic gold converter
23722, -- gold converter
25719, -- gold converter
-- foods
29408, -- roasted wyvern wings
29409, -- carrot pie
29410, -- tropical marinated tiger
29411, -- delicatessen salad
29412, -- chilli con carniphila
29413, -- svargrond salmon filet
29414, -- carrion casserole
29415, -- consecrated beef
29416, -- overcooked noodles
}
-- Players cannot throw items on teleports if set to true
local blockTeleportTrashing = true
local configPush = {
maxItemsPerSeconds = 1,
exhaustTime = 2000,
}
local pushDelay = {}
local function antiPush(player, item, count, fromPosition, toPosition, fromCylinder, toCylinder)
if not player then
player:sendCancelMessage(RETURNVALUE_NOTPOSSIBLE)
return false
end
if toPosition.x == CONTAINER_POSITION then
return true
end
local tile = Tile(toPosition)
if not tile then
player:sendCancelMessage(RETURNVALUE_NOTPOSSIBLE)
return false
end
local playerId = player:getId()
if not pushDelay[playerId] then
pushDelay[playerId] = { items = 0, time = 0 }
end
pushDelay[playerId].items = pushDelay[playerId].items + 1
local currentTime = systemTime()
if pushDelay[playerId].time == 0 then
pushDelay[playerId].time = currentTime
elseif pushDelay[playerId].time == currentTime then
pushDelay[playerId].items = pushDelay[playerId].items + 1
elseif currentTime > pushDelay[playerId].time then
pushDelay[playerId].time = 0
pushDelay[playerId].items = 0
end
if pushDelay[playerId].items > configPush.maxItemsPerSeconds then
pushDelay[playerId].time = currentTime + configPush.exhaustTime
end
if pushDelay[playerId].time > currentTime then
player:sendCancelMessage("You can't move that item so fast.")
return false
end
return true
end
local soulCondition = Condition(CONDITION_SOUL, CONDITIONID_DEFAULT)
soulCondition:setTicks(4 * 60 * 1000)
soulCondition:setParameter(CONDITION_PARAM_SOULGAIN, 1)
local function useStamina(player, isStaminaEnabled)
if not player then
return false
end
local staminaMinutes = player:getStamina()
if staminaMinutes == 0 then
return
end
local playerId = player:getId()
if not playerId or not _G.NextUseStaminaTime[playerId] then
return false
end
local currentTime = os.time()
local timePassed = currentTime - _G.NextUseStaminaTime[playerId]
if timePassed <= 0 then
return
end
if timePassed > 60 then
if staminaMinutes > 2 then
staminaMinutes = staminaMinutes - 2
else
staminaMinutes = 0
end
_G.NextUseStaminaTime[playerId] = currentTime + 120
player:removePreyStamina(120)
else
staminaMinutes = staminaMinutes - 1
_G.NextUseStaminaTime[playerId] = currentTime + 60
player:removePreyStamina(60)
end
if isStaminaEnabled then
player:setStamina(staminaMinutes)
end
end
local function useStaminaXpBoost(player)
if not player then
return false
end
local staminaMinutes = player:getExpBoostStamina() / 60
if staminaMinutes == 0 then
return
end
local playerId = player:getId()
if not playerId then
return false
end
local currentTime = os.time()
local timePassed = currentTime - _G.NextUseXpStamina[playerId]
if timePassed <= 0 then
return
end
if timePassed > 60 then
if staminaMinutes > 2 then
staminaMinutes = staminaMinutes - 2
else
staminaMinutes = 0
end
_G.NextUseXpStamina[playerId] = currentTime + 120
else
staminaMinutes = staminaMinutes - 1
_G.NextUseXpStamina[playerId] = currentTime + 60
end
player:setExpBoostStamina(staminaMinutes * 60)
end
local function useConcoctionTime(player)
if not player then
return false
end
local playerId = player:getId()
if not playerId or not _G.NextUseConcoctionTime[playerId] then
return false
end
local currentTime = os.time()
local timePassed = currentTime - _G.NextUseConcoctionTime[playerId]
if timePassed <= 0 then
return false
end
local deduction = 60
if timePassed > 60 then
_G.NextUseConcoctionTime[playerId] = currentTime + 120
deduction = 120
else
_G.NextUseConcoctionTime[playerId] = currentTime + 60
end
Concoction.experienceTick(player, deduction)
end
function Player:onLookInBattleList(creature, distance)
if not creature then
return false
end
local description = "You see " .. creature:getDescription(distance)
if creature:isMonster() then
local master = creature:getMaster()
local summons = { "sorcerer familiar", "knight familiar", "druid familiar", "paladin familiar" }
if master and table.contains(summons, creature:getName():lower()) then
local familiarSummonTime = master:kv():get("familiar-summon-time") or 0
description = description .. " (Master: " .. master:getName() .. "). \z
It will disappear in " .. getTimeInWords(familiarSummonTime - os.time())
end
end
if self:getGroup():getAccess() then
local str = "%s\nHealth: %d / %d"
if creature:isPlayer() and creature:getMaxMana() > 0 then
str = string.format("%s, Mana: %d / %d", str, creature:getMana(), creature:getMaxMana())
end
description = string.format(str, description, creature:getHealth(), creature:getMaxHealth()) .. "."
local position = creature:getPosition()
description = string.format("%s\nPosition: %d, %d, %d", description, position.x, position.y, position.z)
if creature:isPlayer() then
description = string.format("%s\nIP: %s", description, Game.convertIpToString(creature:getIp()))
end
end
self:sendTextMessage(MESSAGE_LOOK, description)
end
local exhaust = {}
function Player:onMoveItem(item, count, fromPosition, toPosition, fromCylinder, toCylinder)
if item:getActionId() == IMMOVABLE_ACTION_ID then
self:sendCancelMessage(RETURNVALUE_NOTPOSSIBLE)
return false
end
-- No move if tile item count > 20 items
local tile = Tile(toPosition)
if tile and tile:getItemCount() > 20 then
self:sendCancelMessage(RETURNVALUE_NOTPOSSIBLE)
return false
end
-- Players cannot throw items on teleports
if blockTeleportTrashing and tile and toPosition.x ~= CONTAINER_POSITION then
local thing = tile:getItemByType(ITEM_TYPE_TELEPORT)
if thing then
self:sendCancelMessage(RETURNVALUE_NOTPOSSIBLE)
self:getPosition():sendMagicEffect(CONST_ME_POFF)
return false
end
end
-- SSA exhaust
if toPosition.x == CONTAINER_POSITION and toPosition.y == CONST_SLOT_NECKLACE and item:getId() == ITEM_STONE_SKIN_AMULET then
local playerId = self:getId()
if exhaust[playerId] then
self:sendCancelMessage(RETURNVALUE_YOUAREEXHAUSTED)
return false
end
exhaust[playerId] = true
addEvent(function(id)
exhaust[id] = nil
end, 2000, playerId)
return true
end
-- Bath tube
local toTile = Tile(toCylinder:getPosition())
if toTile then
local topDownItem = toTile:getTopDownItem()
if topDownItem and table.contains({ BATHTUB_EMPTY, BATHTUB_FILLED }, topDownItem:getId()) then
return false
end
end
-- Handle move items to the ground
if toPosition.x ~= CONTAINER_POSITION then
return true
end
-- Check two-handed weapons
if item:getTopParent() == self and bit.band(toPosition.y, 0x40) == 0 then
local itemType, moveItem = ItemType(item:getId())
if bit.band(itemType:getSlotPosition(), SLOTP_TWO_HAND) ~= 0 and toPosition.y == CONST_SLOT_LEFT then
moveItem = self:getSlotItem(CONST_SLOT_RIGHT)
if moveItem and itemType:getWeaponType() == WEAPON_DISTANCE and ItemType(moveItem:getId()):isQuiver() then
return true
end
elseif itemType:getWeaponType() == WEAPON_SHIELD and toPosition.y == CONST_SLOT_RIGHT then
moveItem = self:getSlotItem(CONST_SLOT_LEFT)
if moveItem and bit.band(ItemType(moveItem:getId()):getSlotPosition(), SLOTP_TWO_HAND) == 0 then
return true
end
end
if moveItem then
local parent = item:getParent()
if parent:getSize() == parent:getCapacity() then
self:sendTextMessage(MESSAGE_FAILURE, Game.getReturnMessage(RETURNVALUE_CONTAINERNOTENOUGHROOM))
return false
end
return moveItem:moveTo(parent)
end
end
-- Reward System
if toPosition.x == CONTAINER_POSITION then
local containerId = toPosition.y - 64
local container = self:getContainerById(containerId)
if not container then
return true
end
-- Do not let the player insert items into either the Reward Container or the Reward Chest
local itemId = container:getId()
if itemId == ITEM_REWARD_CONTAINER or itemId == ITEM_REWARD_CHEST then
self:sendCancelMessage(RETURNVALUE_NOTPOSSIBLE)
return false
end
-- The player also shouldn't be able to insert items into the boss corpse
local tileCorpse = Tile(container:getPosition())
if tileCorpse then
for index, value in ipairs(tileCorpse:getItems() or {}) do
if value:getAttribute(ITEM_ATTRIBUTE_CORPSEOWNER) == 2 ^ 31 - 1 and value:getName() == container:getName() then
self:sendCancelMessage(RETURNVALUE_NOTPOSSIBLE)
return false
end
end
end
end
-- Do not let the player move the boss corpse.
if item:getAttribute(ITEM_ATTRIBUTE_CORPSEOWNER) == 2 ^ 31 - 1 then
self:sendCancelMessage(RETURNVALUE_NOTPOSSIBLE)
return false
end
-- Players cannot throw items on reward chest
local tileChest = Tile(toPosition)
if tileChest and tileChest:getItemById(ITEM_REWARD_CHEST) then
self:sendCancelMessage(RETURNVALUE_NOTPOSSIBLE)
self:getPosition():sendMagicEffect(CONST_ME_POFF)
return false
end
if tile and tile:getItemById(370) then
-- Trapdoor
self:sendCancelMessage(RETURNVALUE_NOTPOSSIBLE)
self:getPosition():sendMagicEffect(CONST_ME_POFF)
return false
end
if not antiPush(self, item, count, fromPosition, toPosition, fromCylinder, toCylinder) then
return false
end
return true
end
function Player:onItemMoved(item, count, fromPosition, toPosition, fromCylinder, toCylinder)
if IsRunningGlobalDatapack() then
-- Cults of Tibia begin
local frompos = Position(33023, 31904, 14) -- Checagem
local topos = Position(33052, 31932, 15) -- Checagem
local removeItem = false
if self:getPosition():isInRange(frompos, topos) and item:getId() == 23729 then
local tile = Tile(toPosition)
if tile then
local tileBoss = tile:getTopCreature()
if tileBoss and tileBoss:isMonster() then
if tileBoss:getName():lower() == "the remorseless corruptor" then
tileBoss:addHealth(-17000)
tileBoss:remove()
local monster = Game.createMonster("The Corruptor of Souls", toPosition)
if not monster then
return false
end
removeItem = true
monster:registerEvent("CheckTile")
if Game.getStorageValue("healthSoul") > 0 then
monster:addHealth(-(monster:getHealth() - Game.getStorageValue("healthSoul")))
end
Game.setStorageValue("CheckTile", os.time() + 30)
elseif tileBoss:getName():lower() == "the corruptor of souls" then
Game.setStorageValue("CheckTile", os.time() + 30)
removeItem = true
end
end
end
if removeItem then
item:remove(1)
end
end
-- Cults of Tibia end
end
return true
end
function Player:onMoveCreature(creature, fromPosition, toPosition)
local player = creature:getPlayer()
if player and _G.OnExerciseTraining[player:getId()] and not self:getGroup():hasFlag(PlayerFlag_CanPushAllCreatures) then
self:sendCancelMessage(RETURNVALUE_NOTPOSSIBLE)
return false
end
return true
end
local function hasPendingReport(playerGuid, targetName, reportType)
local player = Player(playerGuid)
if not player then
return false
end
local name = player:getName():gsub("%s+", "_")
FS.mkdir_p(string.format("%s/reports/players/%s", CORE_DIRECTORY, name))
local file = io.open(string.format("%s/reports/players/%s-%s-%d.txt", CORE_DIRECTORY, name, targetName, reportType), "r")
if file then
io.close(file)
return true
end
return false
end
function Player:onReportRuleViolation(targetName, reportType, reportReason, comment, translation)
local name = self:getName()
if hasPendingReport(self:getGuid(), targetName, reportType) then
self:sendTextMessage(MESSAGE_EVENT_ADVANCE, "Your report is being processed.")
return
end
local file = io.open(string.format("%s/reports/players/%s-%s-%d.txt", CORE_DIRECTORY, name, targetName, reportType), "a")
if not file then
self:sendTextMessage(MESSAGE_EVENT_ADVANCE, "There was an error when processing your report, please contact a gamemaster.")
return
end
io.output(file)
io.write("------------------------------\n")
io.write("Reported by: " .. name .. "\n")
io.write("Target: " .. targetName .. "\n")
io.write("Type: " .. reportType .. "\n")
io.write("Reason: " .. reportReason .. "\n")
io.write("Comment: " .. comment .. "\n")
if reportType ~= REPORT_TYPE_BOT then
io.write("Translation: " .. translation .. "\n")
end
io.write("------------------------------\n")
io.close(file)
self:sendTextMessage(
MESSAGE_EVENT_ADVANCE,
string.format(
"Thank you for reporting %s. Your report \z
will be processed by %s team as soon as possible.",
targetName,
configManager.getString(configKeys.SERVER_NAME)
)
)
return
end
function Player:onReportBug(message, position, category)
local name = self:getName():gsub("%s+", "_")
FS.mkdir_p(string.format("%s/reports/bugs/%s", CORE_DIRECTORY, name))
local file = io.open(string.format("%s/reports/bugs/%s/report.txt", CORE_DIRECTORY, name), "a")
if not file then
self:sendTextMessage(MESSAGE_EVENT_ADVANCE, "There was an error when processing your report, please contact a gamemaster.")
return true
end
io.output(file)
io.write("------------------------------\n")
io.write("Name: " .. name)
if category == BUG_CATEGORY_MAP then
io.write(" [Map position: " .. position.x .. ", " .. position.y .. ", " .. position.z .. "]")
end
local playerPosition = self:getPosition()
io.write(" [Player Position: " .. playerPosition.x .. ", " .. playerPosition.y .. ", " .. playerPosition.z .. "]\n")
io.write("Comment: " .. message .. "\n")
io.close(file)
self:sendTextMessage(MESSAGE_EVENT_ADVANCE, "Your report has been sent to " .. configManager.getString(configKeys.SERVER_NAME) .. ".")
return true
end
function Player:onTurn(direction)
if self:getGroup():getAccess() and self:getDirection() == direction then
local nextPosition = self:getPosition()
nextPosition:getNextPosition(direction)
self:teleportTo(nextPosition, true)
end
return true
end
function Player:onTradeRequest(target, item)
if item:getActionId() == IMMOVABLE_ACTION_ID then
return false
end
if table.contains(storeItemID, item.itemid) then
return false
end
return true
end
function Player:onGainExperience(target, exp, rawExp)
if not target or target:isPlayer() then
return exp
end
-- Soul regeneration
local vocation = self:getVocation()
if self:getSoul() < vocation:getMaxSoul() and exp >= self:getLevel() then
soulCondition:setParameter(CONDITION_PARAM_SOULTICKS, vocation:getSoulGainTicks())
self:addCondition(soulCondition)
end
-- Store Bonus
useStaminaXpBoost(self) -- Use store boost stamina
local Boost = self:getExpBoostStamina()
local stillHasBoost = Boost > 0
local storeXpBoostAmount = stillHasBoost and self:getStoreXpBoost() or 0
self:setStoreXpBoost(storeXpBoostAmount)
-- Stamina Bonus
local staminaBonusXp = 1
local isStaminaEnabled = configManager.getBoolean(configKeys.STAMINA_SYSTEM)
useStamina(self, isStaminaEnabled)
if isStaminaEnabled then
staminaBonusXp = self:getFinalBonusStamina()
self:setStaminaXpBoost(staminaBonusXp * 100)
end
-- Concoction System
useConcoctionTime(self)
-- Boosted creature
if target:getName():lower() == (Game.getBoostedCreature()):lower() then
exp = exp * 2
end
-- Prey system
if configManager.getBoolean(configKeys.PREY_ENABLED) then
local monsterType = target:getType()
if monsterType and monsterType:raceId() > 0 then
exp = math.ceil((exp * self:getPreyExperiencePercentage(monsterType:raceId())) / 100)
end
end
if configManager.getBoolean(configKeys.VIP_SYSTEM_ENABLED) then
local vipBonusExp = configManager.getNumber(configKeys.VIP_BONUS_EXP)
if vipBonusExp > 0 and self:isVip() then
vipBonusExp = (vipBonusExp > 100 and 100) or vipBonusExp
exp = exp * (1 + (vipBonusExp / 100))
end
end
local lowLevelBonuxExp = self:getFinalLowLevelBonus()
local baseRate = self:getFinalBaseRateExperience()
return (exp + (exp * (storeXpBoostAmount / 100) + (exp * (lowLevelBonuxExp / 100)))) * staminaBonusXp * baseRate
end
function Player:onLoseExperience(exp)
return exp
end
function Player:onGainSkillTries(skill, tries)
-- Dawnport skills limit
if IsRunningGlobalDatapack() and isSkillGrowthLimited(self, skill) then
return 0
end
if not APPLY_SKILL_MULTIPLIER then
return tries
end
-- Event scheduler skill rate
local STAGES_DEFAULT = nil
if configManager.getBoolean(configKeys.RATE_USE_STAGES) then
STAGES_DEFAULT = skillsStages
end
local SKILL_DEFAULT = self:getSkillLevel(skill)
local RATE_DEFAULT = configManager.getNumber(configKeys.RATE_SKILL)
if skill == SKILL_MAGLEVEL then
-- Magic Level
if configManager.getBoolean(configKeys.RATE_USE_STAGES) then
STAGES_DEFAULT = magicLevelStages
end
SKILL_DEFAULT = self:getBaseMagicLevel()
RATE_DEFAULT = configManager.getNumber(configKeys.RATE_MAGIC)
end
local skillOrMagicRate = getRateFromTable(STAGES_DEFAULT, SKILL_DEFAULT, RATE_DEFAULT)
if SCHEDULE_SKILL_RATE ~= 100 then
skillOrMagicRate = math.max(0, (skillOrMagicRate * SCHEDULE_SKILL_RATE) / 100)
end
if configManager.getBoolean(configKeys.VIP_SYSTEM_ENABLED) then
local vipBoost = configManager.getNumber(configKeys.VIP_BONUS_SKILL)
if vipBoost > 0 and self:isVip() then
vipBoost = (vipBoost > 100 and 100) or vipBoost
skillOrMagicRate = skillOrMagicRate + (skillOrMagicRate * (vipBoost / 100))
end
end
return tries / 100 * (skillOrMagicRate * 100)
end
function Player:onCombat(target, item, primaryDamage, primaryType, secondaryDamage, secondaryType)
if not item or not target then
return primaryDamage, primaryType, secondaryDamage, secondaryType
end
if ItemType(item:getId()):getWeaponType() == WEAPON_AMMO then
if table.contains({ ITEM_OLD_DIAMOND_ARROW, ITEM_DIAMOND_ARROW }, item:getId()) then
return primaryDamage, primaryType, secondaryDamage, secondaryType
end
item = self:getSlotItem(CONST_SLOT_LEFT)
end
return primaryDamage, primaryType, secondaryDamage, secondaryType
end
function Player:onChangeZone(zone)
if self:isPremium() then
local event = staminaBonus.eventsPz[self:getId()]
if configManager.getBoolean(configKeys.STAMINA_PZ) then
if zone == ZONE_PROTECTION then
local stamina = self:getStamina()
if stamina < 2520 then
if not event then
local delay = configManager.getNumber(configKeys.STAMINA_ORANGE_DELAY)
if stamina > 2340 and stamina <= 2520 then
delay = configManager.getNumber(configKeys.STAMINA_GREEN_DELAY)
end
local message = string.format("In protection zone. Recharging %i stamina every %i minutes.", configManager.getNumber(configKeys.STAMINA_PZ_GAIN), delay)
self:sendTextMessage(MESSAGE_FAILURE, message)
staminaBonus.eventsPz[self:getId()] = addEvent(addStamina, delay * 60 * 1000, nil, self:getId(), delay * 60 * 1000)
end
end
else
if event then
self:sendTextMessage(MESSAGE_FAILURE, "You are no longer refilling stamina, since you left a regeneration zone.")
stopEvent(event)
staminaBonus.eventsPz[self:getId()] = nil
end
end
return not configManager.getBoolean(configKeys.STAMINA_PZ)
end
end
return false
end
function Player:onInventoryUpdate(item, slot, equip) end
function Player:getURL()
local playerLink = string.gsub(self:getName(), "%s+", "+")
local serverURL = configManager.getString(configKeys.URL)
return serverURL .. "/characters/" .. playerLink
end
function Player:getMarkdownLink()
local vocation = self:vocationAbbrev()
local emoji = ":school_satchel:"
if self:isKnight() then
emoji = ":crossed_swords:"
elseif self:isPaladin() then
emoji = ":bow_and_arrow:"
elseif self:isDruid() then
emoji = ":herb:"
elseif self:isSorcerer() then
emoji = ":crystal_ball:"
end
return "**[" .. self:getName() .. "](" .. self:getURL() .. ")** " .. emoji .. " [_" .. vocation .. "_]"
end