-
Notifications
You must be signed in to change notification settings - Fork 16
/
PacketAPICallbackManager.cs
557 lines (472 loc) · 22.9 KB
/
PacketAPICallbackManager.cs
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
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using EndlessClient.Audio;
using EndlessClient.Dialogs;
using EOLib;
using EOLib.Domain.Character;
using EOLib.Domain.Chat;
using EOLib.Domain.Map;
using EOLib.IO;
using EOLib.IO.Extensions;
using EOLib.Localization;
using EOLib.Net.API;
using XNAControls.Old;
namespace EndlessClient.Old
{
public sealed class PacketAPICallbackManager
{
private readonly PacketAPI m_packetAPI;
private readonly EOGame m_game;
public PacketAPICallbackManager(PacketAPI apiObj, EOGame game)
{
m_packetAPI = apiObj;
m_game = game;
}
public void AssignCallbacks()
{
m_packetAPI.OnPlayerPaperdollChange += _playerPaperdollChange;
m_packetAPI.OnViewPaperdoll += _playerViewPaperdoll;
//chest related
m_packetAPI.OnChestOpened += _chestOpen;
m_packetAPI.OnChestAgree += _chestAgree;
m_packetAPI.OnChestAddItem += _chestAddItem;
m_packetAPI.OnChestGetItem += _chestGetItem;
//recovery related
m_packetAPI.OnRecoverReply += _recoverReply;
m_packetAPI.OnPlayerHeal += _playerHeal;
//item related
m_packetAPI.OnRemoveItemFromMap += _removeItemFromMap;
m_packetAPI.OnDropItem += _dropItem;
m_packetAPI.OnItemChange += _itemChange;
m_packetAPI.OnMapMutation += _mapMutate;
//npc related
m_packetAPI.OnRemoveChildNPCs += _removeChildNPCs;
//bank related
m_packetAPI.OnBankOpen += _bankOpen;
m_packetAPI.OnBankChange += _bankChange;
//shop
m_packetAPI.OnShopOpen += _shopOpen;
m_packetAPI.OnShopTradeItem += _shopTrade;
m_packetAPI.OnShopCraftItem += _shopCraft;
//locker
m_packetAPI.OnLockerOpen += _lockerOpen;
m_packetAPI.OnLockerItemChange += _lockerItemChange;
m_packetAPI.OnLockerUpgrade += _lockerUpgrade;
m_packetAPI.OnOtherPlayerEmote += _playerEmote;
//party
m_packetAPI.OnPartyClose += _partyClose;
m_packetAPI.OnPartyDataRefresh += _partyDataRefresh;
m_packetAPI.OnPartyRequest += _partyRequest;
m_packetAPI.OnPartyMemberJoin += _partyMemberJoin;
m_packetAPI.OnPartyMemberLeave += _partyMemberLeave;
//trade
m_packetAPI.OnTradeRequested += _tradeRequested;
m_packetAPI.OnTradeOpen += _tradeOpen;
m_packetAPI.OnTradeCancel += _tradeCancel;
m_packetAPI.OnTradeOtherPlayerAgree += _tradeRemotePlayerAgree;
m_packetAPI.OnTradeYouAgree += _tradeSetLocalPlayerAgree;
m_packetAPI.OnTradeOfferUpdate += _tradeOfferUpdate;
m_packetAPI.OnTradeCompleted += _tradeCompleted;
//skills
m_packetAPI.OnSkillmasterOpen += _skillmasterOpen;
m_packetAPI.OnSpellLearnError += _statskillLearnError;
m_packetAPI.OnSpellLearnSuccess += _statskillLearnSpellSuccess;
m_packetAPI.OnSpellForget += _statskillForgetSpell;
m_packetAPI.OnSpellTrain += _statskillTrainSpell;
m_packetAPI.OnCharacterStatsReset += _statskillReset;
//quests
m_packetAPI.OnQuestDialog += _questDialog;
m_packetAPI.OnViewQuestProgress += _questProgress;
m_packetAPI.OnViewQuestHistory += _questHistory;
m_packetAPI.OnStatusMessage += _setStatusLabel;
m_packetAPI.OnPlaySoundEffect += _playSoundEffect;
//spell casting
m_packetAPI.OnCastSpellTargetGroup += _playerCastGroupSpell;
}
private void _playerPaperdollChange(PaperdollEquipData _data)
{
OldCharacter c;
if (!_data.ItemWasUnequipped)
{
var rec = OldWorld.Instance.EIF[_data.ItemID];
//update inventory
(c = OldWorld.Instance.MainPlayer.ActiveCharacter).UpdateInventoryItem(_data.ItemID, _data.ItemAmount);
//equip item
c.EquipItem(rec.Type, (short) rec.ID, (short) rec.DollGraphic, true, (sbyte) _data.SubLoc);
//add to paperdoll dialog
if (EOPaperdollDialog.Instance != null)
EOPaperdollDialog.Instance.SetItem(rec.GetEquipLocation() + _data.SubLoc, rec);
}
else
{
c = OldWorld.Instance.MainPlayer.ActiveCharacter;
//update inventory
c.UpdateInventoryItem(_data.ItemID, 1, true); //true: add to existing quantity
//unequip item
c.UnequipItem(OldWorld.Instance.EIF[_data.ItemID].Type, _data.SubLoc);
}
c.UpdateStatsAfterEquip(_data);
}
private void _playerViewPaperdoll(PaperdollDisplayData _data)
{
if (EOPaperdollDialog.Instance != null) return;
OldCharacter c;
if (OldWorld.Instance.MainPlayer.ActiveCharacter.ID == _data.PlayerID)
{
//paperdoll requested for main player, all info should be up to date
c = OldWorld.Instance.MainPlayer.ActiveCharacter;
Array.Copy(_data.Paperdoll.ToArray(), c.PaperDoll, (int) EquipLocation.PAPERDOLL_MAX);
}
else
{
if ((c = OldWorld.Instance.ActiveMapRenderer.GetOtherPlayerByID(_data.PlayerID)) != null)
{
c.Class = _data.Class;
c.RenderData.SetGender(_data.Gender);
c.Title = _data.Title;
c.GuildName = _data.Guild;
Array.Copy(_data.Paperdoll.ToArray(), c.PaperDoll, (int) EquipLocation.PAPERDOLL_MAX);
}
}
if (c != null)
{
EOPaperdollDialog.Show(m_packetAPI, c, _data);
}
}
private void _chestOpen(ChestData data)
{
if (ChestDialog.Instance == null || data.X != ChestDialog.Instance.CurrentChestX ||
data.Y != ChestDialog.Instance.CurrentChestY)
return;
ChestDialog.Instance.InitializeItems(data.Items);
}
private void _chestAgree(ChestData data)
{
if (ChestDialog.Instance != null)
ChestDialog.Instance.InitializeItems(data.Items);
}
private void _chestAddItem(short id, int amount, byte weight, byte maxWeight, ChestData data)
{
OldWorld.Instance.MainPlayer.ActiveCharacter.UpdateInventoryItem(id, amount, weight, maxWeight);
ChestDialog.Instance.InitializeItems(data.Items);
m_game.Hud.RefreshStats();
}
private void _chestGetItem(short id, int amount, byte weight, byte maxWeight, ChestData data)
{
OldWorld.Instance.MainPlayer.ActiveCharacter.UpdateInventoryItem(id, amount, weight, maxWeight, true);
ChestDialog.Instance.InitializeItems(data.Items);
m_game.Hud.RefreshStats();
}
private void _recoverReply(int exp, short karma, byte level, short statpoints, short skillpoints)
{
OldWorld.Instance.MainPlayer.ActiveCharacter.Stats.Experience = exp;
OldWorld.Instance.MainPlayer.ActiveCharacter.Stats.Karma = karma;
if (level > 0)
OldWorld.Instance.MainPlayer.ActiveCharacter.Stats.Level = level;
OldWorld.Instance.MainPlayer.ActiveCharacter.Stats.StatPoints = statpoints;
OldWorld.Instance.MainPlayer.ActiveCharacter.Stats.SkillPoints = skillpoints;
m_game.Hud.RefreshStats();
}
private void _playerHeal(short playerid, int healamount, byte percenthealth)
{
OldWorld.Instance.ActiveMapRenderer.OtherPlayerHeal(playerid, healamount, percenthealth);
}
//private void _junkItem(short id, int amountRemoved, int amountRemaining, byte weight, byte maxWeight)
//{
// OldWorld.Instance.MainPlayer.ActiveCharacter.UpdateInventoryItem(id, amountRemaining, weight, maxWeight);
// var rec = OldWorld.Instance.EIF[id];
// m_game.Hud.AddChat(ChatTab.System, "",
// $"{OldWorld.GetString(EOResourceID.STATUS_LABEL_ITEM_JUNK_YOU_JUNKED)} {amountRemoved} {rec.Name}", ChatIcon.DownArrow);
// m_game.Hud.SetStatusLabel(EOResourceID.STATUS_LABEL_TYPE_INFORMATION, EOResourceID.STATUS_LABEL_ITEM_JUNK_YOU_JUNKED,
// $" {amountRemoved} {rec.Name}");
//}
private void _dropItem(int characterAmount, byte weight, byte maxWeight, OldMapItem item)
{
OldWorld.Instance.ActiveMapRenderer.AddMapItem(item);
if (characterAmount >= 0) //will be -1 when another player drops
{
OldWorld.Instance.MainPlayer.ActiveCharacter.UpdateInventoryItem(item.ItemID, characterAmount, weight, maxWeight);
var rec = OldWorld.Instance.EIF[item.ItemID];
m_game.Hud.AddChat(ChatTab.System, "",
$"{OldWorld.GetString(EOResourceID.STATUS_LABEL_ITEM_DROP_YOU_DROPPED)} {item.Amount} {rec.Name}",
ChatIcon.DownArrow);
m_game.Hud.SetStatusLabel(EOResourceID.STATUS_LABEL_TYPE_INFORMATION, EOResourceID.STATUS_LABEL_ITEM_DROP_YOU_DROPPED,
$" {item.Amount} {rec.Name}");
}
}
private void _itemChange(bool wasItemObtained, short id, int amount, byte weight)
{
OldWorld.Instance.MainPlayer.ActiveCharacter.UpdateInventoryItem(id, amount, weight,
OldWorld.Instance.MainPlayer.ActiveCharacter.MaxWeight, wasItemObtained);
}
private void _removeItemFromMap(short itemuid)
{
OldWorld.Instance.ActiveMapRenderer.RemoveMapItem(itemuid);
}
private void _mapMutate()
{
if (File.Exists("maps\\00000.emf"))
{
string fmt = $"maps\\{OldWorld.Instance.MainPlayer.ActiveCharacter.CurrentMap,5:D5}.emf";
if (File.Exists(fmt))
File.Delete(fmt);
File.Move("maps\\00000.emf", fmt);
OldWorld.Instance.Remap();
}
else
throw new FileNotFoundException("Unable to remap the file, something broke");
}
private void _removeChildNPCs(short childNPCID)
{
OldWorld.Instance.ActiveMapRenderer.RemoveNPCsWhere(x => x.NPC.Data.ID == childNPCID);
}
private void _bankOpen(int gold, int upgrades)
{
if (BankAccountDialog.Instance == null) return;
BankAccountDialog.Instance.AccountBalance = $"{gold}";
BankAccountDialog.Instance.LockerUpgrades = upgrades;
}
private void _bankChange(int gold, int bankGold)
{
if (BankAccountDialog.Instance == null) return;
OldWorld.Instance.MainPlayer.ActiveCharacter.UpdateInventoryItem(1, gold);
BankAccountDialog.Instance.AccountBalance = $"{bankGold}";
}
private void _shopOpen(int shopid, string name, List<ShopItem> tradeitems, List<CraftItem> craftitems)
{
if (ShopDialog.Instance == null) return;
ShopDialog.Instance.SetShopData(shopid, name, tradeitems, craftitems);
}
private void _shopTrade(int gold, short itemID, int amount, byte weight, byte maxWeight, bool isBuy)
{
OldWorld.Instance.MainPlayer.ActiveCharacter.UpdateInventoryItem(1, gold);
OldWorld.Instance.MainPlayer.ActiveCharacter.UpdateInventoryItem(itemID, amount, weight, maxWeight, isBuy);
}
private void _shopCraft(short id, byte weight, byte maxWeight, List<InventoryItem> ingredients)
{
OldCharacter c = OldWorld.Instance.MainPlayer.ActiveCharacter;
c.UpdateInventoryItem(id, 1, weight, maxWeight, true);
foreach (var ingred in ingredients)
c.UpdateInventoryItem(ingred.ItemID, ingred.Amount);
}
private void _lockerOpen(byte x, byte y, List<InventoryItem> items)
{
if (LockerDialog.Instance == null || LockerDialog.Instance.X != x || LockerDialog.Instance.Y != y)
return;
LockerDialog.Instance.SetLockerData(items);
}
private void _lockerItemChange(short id, int amount, byte weight, byte maxWeight, bool existingAmount, List<InventoryItem> items)
{
if (LockerDialog.Instance == null) return;
OldWorld.Instance.MainPlayer.ActiveCharacter.UpdateInventoryItem(id, amount, weight, maxWeight, existingAmount);
LockerDialog.Instance.SetLockerData(items);
}
private void _lockerUpgrade(int remaining, byte upgrades)
{
if (BankAccountDialog.Instance == null) return;
OldWorld.Instance.MainPlayer.ActiveCharacter.UpdateInventoryItem(1, remaining);
BankAccountDialog.Instance.LockerUpgrades = upgrades;
m_game.Hud.SetStatusLabel(EOResourceID.STATUS_LABEL_TYPE_INFORMATION, EOResourceID.STATUS_LABEL_LOCKER_SPACE_INCREASED);
}
private void _playerEmote(short playerID, Emote emote)
{
if (playerID != OldWorld.Instance.MainPlayer.ActiveCharacter.ID)
OldWorld.Instance.ActiveMapRenderer.OtherPlayerEmote(playerID, emote);
}
private void _partyClose()
{
m_game.Hud.CloseParty();
}
private void _partyDataRefresh(List<PartyMember> list)
{
m_game.Hud.SetPartyData(list);
}
private void _partyRequest(PartyRequestType type, short id, string name)
{
if (!OldWorld.Instance.Interaction)
return;
EOMessageBox.Show(name + " ",
type == PartyRequestType.Join ? DialogResourceID.PARTY_GROUP_REQUEST_TO_JOIN : DialogResourceID.PARTY_GROUP_SEND_INVITATION,
EODialogButtons.OkCancel, EOMessageBoxStyle.SmallDialogSmallHeader,
(o, e) =>
{
if (e.Result == XNADialogResult.OK)
{
if (!m_packetAPI.PartyAcceptRequest(type, id))
m_game.DoShowLostConnectionDialogAndReturnToMainMenu();
}
});
}
private void _partyMemberJoin(PartyMember member)
{
m_game.Hud.AddPartyMember(member);
}
private void _partyMemberLeave(short id)
{
m_game.Hud.RemovePartyMember(id);
}
private void _tradeRequested(short playerID, string name)
{
if (!OldWorld.Instance.Interaction)
return;
EOMessageBox.Show(char.ToUpper(name[0]) + name.Substring(1) + " ", DialogResourceID.TRADE_REQUEST, EODialogButtons.OkCancel,
EOMessageBoxStyle.SmallDialogSmallHeader, (o, e) =>
{
if (e.Result == XNADialogResult.OK && !m_packetAPI.TradeAcceptRequest(playerID))
m_game.DoShowLostConnectionDialogAndReturnToMainMenu();
});
}
private void _tradeOpen(short p1, string p1name, short p2, string p2name)
{
TradeDialog dlg = new TradeDialog(m_packetAPI);
dlg.InitPlayerInfo(p1, p1name, p2, p2name);
string otherName;
if (p1 == OldWorld.Instance.MainPlayer.ActiveCharacter.ID)
otherName = p2name;
else if (p2 == OldWorld.Instance.MainPlayer.ActiveCharacter.ID)
otherName = p1name;
else
throw new ArgumentException("Invalid player ID for this trade session!", nameof(p1));
m_game.Hud.SetStatusLabel(EOResourceID.STATUS_LABEL_TYPE_ACTION, EOResourceID.STATUS_LABEL_TRADE_YOU_ARE_TRADING_WITH,
otherName + " " + OldWorld.GetString(EOResourceID.STATUS_LABEL_DRAG_AND_DROP_ITEMS));
}
private void _tradeCancel(short otherPlayerID)
{
if (TradeDialog.Instance == null) return;
TradeDialog.Instance.Close(XNADialogResult.NO_BUTTON_PRESSED);
m_game.Hud.SetStatusLabel(EOResourceID.STATUS_LABEL_TYPE_ACTION, EOResourceID.STATUS_LABEL_TRADE_ABORTED);
}
private void _tradeRemotePlayerAgree(short otherPlayerID, bool agree)
{
if (TradeDialog.Instance == null) return;
TradeDialog.Instance.SetPlayerAgree(false, agree);
}
private void _tradeSetLocalPlayerAgree(bool agree)
{
if (TradeDialog.Instance == null) return;
TradeDialog.Instance.SetPlayerAgree(true, agree);
}
private void _tradeOfferUpdate(short id1, List<InventoryItem> items1, short id2, List<InventoryItem> items2)
{
if (TradeDialog.Instance == null) return;
TradeDialog.Instance.SetPlayerItems(id1, items1);
TradeDialog.Instance.SetPlayerItems(id2, items2);
}
private void _tradeCompleted(short id1, List<InventoryItem> items1, short id2, List<InventoryItem> items2)
{
if (TradeDialog.Instance == null) return;
TradeDialog.Instance.CompleteTrade(id1, items1, id2, items2);
}
private void _skillmasterOpen(SkillmasterData data)
{
if (SkillmasterDialog.Instance != null)
SkillmasterDialog.Instance.SetSkillmasterData(data);
}
private void _statskillLearnError(SkillMasterReply reply, short id)
{
switch (reply)
{
//not sure if this will ever actually be sent because client validates data before trying to learn a skill
case SkillMasterReply.ErrorWrongClass:
EOMessageBox.Show(DialogResourceID.SKILL_LEARN_WRONG_CLASS, " " + OldWorld.Instance.ECF[id].Name + "!", EODialogButtons.Ok, EOMessageBoxStyle.SmallDialogSmallHeader);
break;
case SkillMasterReply.ErrorRemoveItems:
EOMessageBox.Show(DialogResourceID.SKILL_RESET_CHARACTER_CLEAR_PAPERDOLL, EODialogButtons.Ok, EOMessageBoxStyle.SmallDialogSmallHeader);
break;
}
}
private void _statskillLearnSpellSuccess(short id, int remaining)
{
OldWorld.Instance.MainPlayer.ActiveCharacter.Spells.Add(new InventorySpell(id, 0));
if (SkillmasterDialog.Instance != null)
SkillmasterDialog.Instance.RemoveSkillByIDFromLearnList(id);
OldWorld.Instance.MainPlayer.ActiveCharacter.UpdateInventoryItem(1, remaining);
m_game.Hud.AddNewSpellToActiveSpellsByID(id);
}
private void _statskillForgetSpell(short id)
{
OldWorld.Instance.MainPlayer.ActiveCharacter.Spells.RemoveAll(_spell => _spell.ID == id);
EOMessageBox.Show(DialogResourceID.SKILL_FORGET_SUCCESS, EODialogButtons.Ok, EOMessageBoxStyle.SmallDialogSmallHeader);
m_game.Hud.RemoveSpellFromActiveSpellsByID(id);
}
private void _statskillTrainSpell(short skillPtsRemaining, short spellID, short spellLevel)
{
var character = OldWorld.Instance.MainPlayer.ActiveCharacter;
character.Stats.SkillPoints = skillPtsRemaining;
var spellNdx = character.Spells.FindIndex(x => x.ID == spellID);
character.Spells[spellNdx] = new InventorySpell(spellID, spellLevel);
m_game.Hud.RefreshStats();
m_game.Hud.UpdateActiveSpellLevelByID(spellID, spellLevel);
}
private void _statskillReset(StatResetData data)
{
OldCharacter c;
(c = OldWorld.Instance.MainPlayer.ActiveCharacter).Spells.Clear();
EOMessageBox.Show(DialogResourceID.SKILL_RESET_CHARACTER_COMPLETE, EODialogButtons.Ok, EOMessageBoxStyle.SmallDialogSmallHeader);
c.Stats.StatPoints = data.StatPoints;
c.Stats.SkillPoints = data.SkillPoints;
c.Stats.HP = data.HP;
c.Stats.MaxHP = data.MaxHP;
c.Stats.TP = data.TP;
c.Stats.MaxTP = data.MaxTP;
c.Stats.SP = data.MaxSP;
c.Stats.MaxSP = data.MaxSP;
c.Stats.Str = data.Str;
c.Stats.Int = data.Int;
c.Stats.Wis = data.Wis;
c.Stats.Agi = data.Agi;
c.Stats.Con = data.Con;
c.Stats.Cha = data.Cha;
c.Stats.MinDam = data.MinDam;
c.Stats.MaxDam = data.MaxDam;
c.Stats.Accuracy = data.Accuracy;
c.Stats.Evade = data.Evade;
c.Stats.Armor = data.Armor;
m_game.Hud.RefreshStats();
m_game.Hud.RemoveAllSpells();
}
private void _questDialog(QuestState stateinfo, Dictionary<short, string> dialognames, List<string> pages, Dictionary<short, string> links)
{
if (QuestDialog.Instance == null)
QuestDialog.SetupInstance(m_packetAPI);
if (QuestDialog.Instance == null)
throw new InvalidOperationException("Something went wrong creating the instance");
QuestDialog.Instance.SetDisplayData(stateinfo, dialognames, pages, links);
}
private void _questProgress(short numquests, List<InProgressQuestData> questinfo)
{
if (QuestProgressDialog.Instance == null) return;
QuestProgressDialog.Instance.SetInProgressDisplayData(numquests, questinfo);
}
private void _questHistory(short numquests, List<string> completedquestnames)
{
if (QuestProgressDialog.Instance == null) return;
QuestProgressDialog.Instance.SetHistoryDisplayData(numquests, completedquestnames);
}
private void _setStatusLabel(string message)
{
m_game.Hud.SetStatusLabel(EOResourceID.STATUS_LABEL_TYPE_WARNING, message);
m_game.Hud.AddChat(ChatTab.System, "", message, ChatIcon.QuestMessage, ChatColor.Server);
}
private void _playSoundEffect(int effectID)
{
try
{
if (OldWorld.Instance.SoundEnabled)
m_game.SoundManager.GetSoundEffectRef((SoundEffectID) effectID).Play();
}
catch { /* Ignore errors when the sound effect ID from the server is invalid */ }
}
private void _playerCastGroupSpell(short spellID, short fromPlayerID, short fromPlayerTP, short spellHPgain, List<GroupSpellTarget> spellTargets)
{
OldWorld.Instance.ActiveMapRenderer.PlayerCastSpellGroup(fromPlayerID, spellID, spellHPgain, spellTargets);
if (fromPlayerID == OldWorld.Instance.MainPlayer.ActiveCharacter.ID)
{
OldWorld.Instance.MainPlayer.ActiveCharacter.Stats.TP = fromPlayerTP;
m_game.Hud.RefreshStats();
}
}
}
}