Skip to content

Commit

Permalink
summons
Browse files Browse the repository at this point in the history
tracer for debug
fixes
  • Loading branch information
Bia10 committed Apr 16, 2018
1 parent ff5e72c commit 1c2bbde
Show file tree
Hide file tree
Showing 20 changed files with 454 additions and 46 deletions.
1 change: 1 addition & 0 deletions src/Common/Common.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@
<Compile Include="IO\LogLevel.cs" />
<Compile Include="IO\SettingReadException.cs" />
<Compile Include="IO\Settings.cs" />
<Compile Include="IO\Tracer.cs" />
<Compile Include="Network\ClientHandler.cs" />
<Compile Include="Network\ClientOperationCode.cs" />
<Compile Include="Network\InteroperabilityOperationCode.cs" />
Expand Down
2 changes: 1 addition & 1 deletion src/Common/Constants.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ public static string Explain(ServerRegsitrationResponse Packet)
}
}
}

public enum ServerRegsitrationResponse : byte
{
Valid,
Expand All @@ -31,6 +30,7 @@ public enum ServerRegsitrationResponse : byte
Full
}

// TODO: refactor into separate files under constants folder
#region Interaction
public enum InteractionCode : byte
{
Expand Down
2 changes: 1 addition & 1 deletion src/Common/Constants/CharacterConstants.cs
Original file line number Diff line number Diff line change
Expand Up @@ -967,7 +967,7 @@ public enum ThunderBreaker : int
Straight = 15001001,
SomersaultKick = 15001002,
Dash = 15001003,
Lightning = 15001004
LightningSprite = 15001004
}

public enum ThunderBreaker2 : int
Expand Down
106 changes: 106 additions & 0 deletions src/Common/IO/Tracer.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,106 @@
using System;

namespace Destiny.IO
{
public class Tracer
{
#region traceError
public static void TraceErrorMessage(string message,
[System.Runtime.CompilerServices.CallerMemberName] string memberName = "",
[System.Runtime.CompilerServices.CallerFilePath] string sourceFilePath = "",
[System.Runtime.CompilerServices.CallerLineNumber] int sourceLineNumber = 0)
{
Log.Error("Error message: {0}", message);
Log.Error("Method/Property name: {0}", memberName);
Log.Error("Source file path: {0}", sourceFilePath);
Log.Error("Source file line number: {0}", sourceLineNumber);
}

public static void TraceErrorMessage(string message,
[System.Runtime.CompilerServices.CallerMemberName] string memberName = "",
[System.Runtime.CompilerServices.CallerFilePath] string sourceFilePath = "",
[System.Runtime.CompilerServices.CallerLineNumber] int sourceLineNumber = 0, params object[] args)
{
Log.Error("Error message: {0}", message);
Log.Error("Method/Property name: {0}", memberName);
Log.Error("Source file path: {0}", sourceFilePath);
Log.Error("Source file line number: {0}", sourceLineNumber);
Log.Error("Additional debug info: {0}", args);
}

public static void TraceErrorMessage(Exception e, string message,
[System.Runtime.CompilerServices.CallerMemberName] string memberName = "",
[System.Runtime.CompilerServices.CallerFilePath] string sourceFilePath = "",
[System.Runtime.CompilerServices.CallerLineNumber] int sourceLineNumber = 0)
{
Log.Error("Error message: {0}", message);
Log.Error("Method/Property name: {0}", memberName);
Log.Error("Source file path: {0}", sourceFilePath);
Log.Error("Source file line number: {0}", sourceLineNumber);
Log.Error("Exception information: {0}", e);
}
#endregion

#region traceWarn
public static void TraceWarnMessage(string message,
[System.Runtime.CompilerServices.CallerMemberName] string memberName = "",
[System.Runtime.CompilerServices.CallerFilePath] string sourceFilePath = "",
[System.Runtime.CompilerServices.CallerLineNumber] int sourceLineNumber = 0)
{
Log.Warn("Error message: {0}", message);
Log.Warn("Method/Property name: {0}", memberName);
Log.Warn("Source file path: {0}", sourceFilePath);
Log.Warn("Source file line number: {0}", sourceLineNumber);
}

public static void TraceWarnMessage(string message,
[System.Runtime.CompilerServices.CallerMemberName] string memberName = "",
[System.Runtime.CompilerServices.CallerFilePath] string sourceFilePath = "",
[System.Runtime.CompilerServices.CallerLineNumber] int sourceLineNumber = 0, params object[] args)
{
Log.Warn("Error message: {0}", message);
Log.Warn("Method/Property name: {0}", memberName);
Log.Warn("Source file path: {0}", sourceFilePath);
Log.Warn("Source file line number: {0}", sourceLineNumber);
Log.Warn("Additional debug info: {0}", args);
}

public static void TraceWarnMessage(Exception e, string message,
[System.Runtime.CompilerServices.CallerMemberName] string memberName = "",
[System.Runtime.CompilerServices.CallerFilePath] string sourceFilePath = "",
[System.Runtime.CompilerServices.CallerLineNumber] int sourceLineNumber = 0)
{
Log.Warn("Error message: {0}", message);
Log.Warn("Method/Property name: {0}", memberName);
Log.Warn("Source file path: {0}", sourceFilePath);
Log.Warn("Source file line number: {0}", sourceLineNumber);
Log.Warn("Exception information: {0}", e);
}
#endregion

#region traceInfo
public static void TraceInfoMessage(string message,
[System.Runtime.CompilerServices.CallerMemberName] string memberName = "",
[System.Runtime.CompilerServices.CallerFilePath] string sourceFilePath = "",
[System.Runtime.CompilerServices.CallerLineNumber] int sourceLineNumber = 0)
{
Log.Inform("Error message: {0}", message);
Log.Inform("Method/Property name: {0}", memberName);
Log.Inform("Source file path: {0}", sourceFilePath);
Log.Inform("Source file line number: {0}", sourceLineNumber);
}

public static void TraceInfoMessage(string message,
[System.Runtime.CompilerServices.CallerMemberName] string memberName = "",
[System.Runtime.CompilerServices.CallerFilePath] string sourceFilePath = "",
[System.Runtime.CompilerServices.CallerLineNumber] int sourceLineNumber = 0, params object[] args)
{
Log.Inform("Error message: {0}", message);
Log.Inform("Method/Property name: {0}", memberName);
Log.Inform("Source file path: {0}", sourceFilePath);
Log.Inform("Source file line number: {0}", sourceLineNumber);
Log.Inform("Additional debug info: {0}", args);
}
#endregion traceInfo
}
}
2 changes: 1 addition & 1 deletion src/Common/Network/ServerOperationCode.cs
Original file line number Diff line number Diff line change
Expand Up @@ -378,7 +378,7 @@ public enum ServerOperationCode : short
ChangeParamResult = 323,
QuestCashResult = 324,
CashShopOperation = 325,
// 326
//326
//327
//328
//329
Expand Down
2 changes: 1 addition & 1 deletion src/Common/Shell/Shortcuts.cs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ public static void Apply()

if (System.Windows.Application.Current == null)
{
new System.Windows.Application();
var newApplication = new System.Windows.Application();
}

JumpList.SetJumpList(System.Windows.Application.Current, jumpList);
Expand Down
2 changes: 1 addition & 1 deletion src/WvsCenter/WvsCenterSetup.cs
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ public static void Run()
}

Log.SkipLine();
Log.Success("Configuration is done! Center server set up for use sucessfully.");
Log.Success("Configuration is done! Center server set up for use successfully.");
}

private static void PopulateCenterDatabase()
Expand Down
3 changes: 2 additions & 1 deletion src/WvsGame/Maple/Characters/Character.cs
Original file line number Diff line number Diff line change
Expand Up @@ -469,6 +469,7 @@ public int Experience
}
}

/*
else
{
if (experience >= CharacterConstants.ExperienceTables.CharacterLevel[this.Level])
Expand All @@ -483,6 +484,7 @@ public int Experience
experience = CharacterConstants.ExperienceTables.CharacterLevel[this.Level] - 1;
}
}
*/

if (this.IsInitialized && delta != 0)
{
Expand Down Expand Up @@ -2195,7 +2197,6 @@ public void EnterPortal(Packet iPacket)
if (false) // TODO: Check if portal is onlyOnce and player already used it.
{
// TODO: Send a "closed for now" portal message.

return;
}

Expand Down
7 changes: 6 additions & 1 deletion src/WvsGame/Maple/Characters/CharacterSkills.cs
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,12 @@ public void Delete()
}
}

public void Cast(Packet iPacket)
public static Skill GetNewSkillFromInt(int skillMapleID)
{
return new Skill(skillMapleID);
}

public void Cast(Packet iPacket)
{
iPacket.ReadInt(); // NOTE: Ticks.
int mapleID = iPacket.ReadInt();
Expand Down
1 change: 1 addition & 0 deletions src/WvsGame/Maple/Characters/CharacterTrocks.cs
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,7 @@ public void Update(Packet iPacket)
this.VIP.Add(mapID);
}
}

else
{
return;
Expand Down
4 changes: 2 additions & 2 deletions src/WvsGame/Maple/Commands/Implementation/MapCommand.cs
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,8 @@ public override void Execute(Character caller, string[] args)
{
if (true) // TODO: Check if map exists.
caller.ChangeMap(mapID, portalID);
else
caller.Notify(string.Format("[Command] Invalid map ID {0}.", mapID));
//else
//caller.Notify(string.Format("[Command] Invalid map ID {0}.", mapID));
}
else
{
Expand Down
81 changes: 81 additions & 0 deletions src/WvsGame/Maple/Commands/Implementation/SummonCommand.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
using System;
using Destiny.Maple.Characters;
using Destiny.Maple.Life;

namespace Destiny.Maple.Commands.Implementation
{
public sealed class SummonCommand : Command
{
public override string Name
{
get
{
return "summon";
}
}

public override string Parameters
{
get
{
return "{ skillID | exact name } [ amount ] ";
}
}

public override bool IsRestricted
{
get
{
return true;
}
}

public override void Execute(Character caller, string[] args)
{
if (args.Length < 1)
{
this.ShowSyntax(caller);
}
else
{
int amount = 0;
bool isAmountSpecified;

if (args.Length > 1)
{
isAmountSpecified = int.TryParse(args[args.Length - 1], out amount);
}
else
{
isAmountSpecified = false;
}

if (amount < 1)
{
amount = 1;
}

int skillID = -1;

try
{
skillID = int.Parse(args[0]);
}
catch (FormatException)
{
// TODO: Fetch from strings.
}

Skill skillToSummonFrom = CharacterSkills.GetNewSkillFromInt(skillID);
Summon summon = Summon.GetNewSummonFromSkill(skillToSummonFrom);

// TODO: disperse multiple spawn, they are called with identical position thus overlap
for (int i = 0; i < amount; i++)
{
caller.Map.Summons.Add(summon);
}

}
}
}
}
3 changes: 1 addition & 2 deletions src/WvsGame/Maple/Item.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

namespace Destiny.Maple
{
public class Item : Drop
public class Item : Drop // TODO: too big and fugly; redo
{
public static ItemConstants.ItemType GetType(int mapleID)
{
Expand Down Expand Up @@ -93,7 +93,6 @@ public static ItemConstants.ItemType GetType(int mapleID)

public List<Tuple<int, short>> Summons { get; private set; }


public ItemConstants.ItemType Type
{
get
Expand Down
Loading

0 comments on commit 1c2bbde

Please sign in to comment.