Browse Source

feat: Add percentage of determination/addiction/cooling time

Add percentage of determination/addiction/cooling time
tags/0.1.0
Shawqeem 2 years ago
parent
commit
58ff0c0697
9 changed files with 377 additions and 312 deletions
  1. +36
    -8
      logic/Client/MainWindow.xaml.cs
  2. +18
    -7
      logic/Client/StatusBarOfHunter.xaml.cs
  3. +35
    -25
      logic/Client/StatusBarOfSurvivor.xaml.cs
  4. +1
    -1
      logic/GameClass/GameObj/Character/Character.Skill.cs
  5. +4
    -5
      logic/GameClass/GameObj/Map/MapInfo.cs
  6. +8
    -0
      logic/Preparation/Preparation.csproj
  7. +255
    -0
      logic/Preparation/Utility/Transformation.cs
  8. +15
    -261
      logic/Server/CopyInfo.cs
  9. +5
    -5
      logic/Server/RpcServices.cs

+ 36
- 8
logic/Client/MainWindow.xaml.cs View File

@@ -19,6 +19,7 @@ using Protobuf;
using Playback; using Playback;
using CommandLine; using CommandLine;
using Preparation.Utility; using Preparation.Utility;
using Preparation.Interface;


// 目前MainWindow还未复现的功能: // 目前MainWindow还未复现的功能:
// private void ClickToSetMode(object sender, RoutedEventArgs e) // private void ClickToSetMode(object sender, RoutedEventArgs e)
@@ -408,11 +409,23 @@ namespace Client
switch (obj.MessageOfObjCase) switch (obj.MessageOfObjCase)
{ {
case MessageOfObj.MessageOfObjOneofCase.StudentMessage: case MessageOfObj.MessageOfObjOneofCase.StudentMessage:

if (humanOrButcher && obj.StudentMessage.PlayerId == playerID) if (humanOrButcher && obj.StudentMessage.PlayerId == playerID)
{ {
human = obj.StudentMessage; human = obj.StudentMessage;
} }
if (obj.StudentMessage.PlayerId < GameData.numOfStudent)
{
IStudentType occupation = (IStudentType)OccupationFactory.FindIOccupation(Transformation.ToStudentType(obj.StudentMessage.StudentType));
totalLife[obj.StudentMessage.PlayerId] = occupation.MaxHp;
totalDeath[obj.StudentMessage.PlayerId] = occupation.MaxGamingAddiction;
int i = 0;
foreach (var skill in occupation.ListOfIActiveSkill)
{
var iActiveSkill = SkillFactory.FindIActiveSkill(skill);
coolTime[i, obj.StudentMessage.PlayerId] = iActiveSkill.SkillCD;
++i;
}
}
listOfHuman.Add(obj.StudentMessage); listOfHuman.Add(obj.StudentMessage);
break; break;
case MessageOfObj.MessageOfObjOneofCase.TrickerMessage: case MessageOfObj.MessageOfObjOneofCase.TrickerMessage:
@@ -420,6 +433,14 @@ namespace Client
{ {
butcher = obj.TrickerMessage; butcher = obj.TrickerMessage;
} }
IGhostType occupation1 = (IGhostType)OccupationFactory.FindIOccupation(Transformation.ToTrickerType(obj.TrickerMessage.TrickerType));
int j = 0;
foreach (var skill in occupation1.ListOfIActiveSkill)
{
var iActiveSkill = SkillFactory.FindIActiveSkill(skill);
coolTime[j, 4] = iActiveSkill.SkillCD;
++j;
}
listOfButcher.Add(obj.TrickerMessage); listOfButcher.Add(obj.TrickerMessage);
break; break;
case MessageOfObj.MessageOfObjOneofCase.PropMessage: case MessageOfObj.MessageOfObjOneofCase.PropMessage:
@@ -644,7 +665,7 @@ namespace Client
return true; return true;
} }


private void Refresh(object? sender, EventArgs e) // 已按照3.5版proto更新信息,circumstance栏未更新 log未更新
private void Refresh(object? sender, EventArgs e) //log未更新
{ {
// Bonus(); // Bonus();
if (WindowState == WindowState.Maximized) if (WindowState == WindowState.Maximized)
@@ -652,16 +673,21 @@ namespace Client
else else
MaxButton.Content = "🗖"; MaxButton.Content = "🗖";
if (StatusBarsOfSurvivor != null) if (StatusBarsOfSurvivor != null)
for (int i = 4; i < 8; i++)
{
for (int i = 0; i < GameData.numOfStudent; i++)
{ {
StatusBarsOfSurvivor[i - 4].SetFontSize(12 * UpperLayerOfMap.ActualHeight / 650);
StatusBarsOfSurvivor[i].SetFontSize(12 * UpperLayerOfMap.ActualHeight / 650);
StatusBarsOfSurvivor[i].NewData(totalLife, totalDeath, coolTime);
} }
}
if (StatusBarsOfHunter != null) if (StatusBarsOfHunter != null)
{
StatusBarsOfHunter.SetFontSize(12 * UpperLayerOfMap.ActualHeight / 650); StatusBarsOfHunter.SetFontSize(12 * UpperLayerOfMap.ActualHeight / 650);
StatusBarsOfHunter.NewData(totalLife, totalDeath, coolTime);
}
if (StatusBarsOfCircumstance != null) if (StatusBarsOfCircumstance != null)
StatusBarsOfCircumstance.SetFontSize(12 * UpperLayerOfMap.ActualHeight / 650); StatusBarsOfCircumstance.SetFontSize(12 * UpperLayerOfMap.ActualHeight / 650);
// 完成窗口信息更新 // 完成窗口信息更新

if (!isClientStocked) if (!isClientStocked)
{ {
unit = Math.Sqrt(UpperLayerOfMap.ActualHeight * UpperLayerOfMap.ActualWidth) / 50; unit = Math.Sqrt(UpperLayerOfMap.ActualHeight * UpperLayerOfMap.ActualWidth) / 50;
@@ -1362,10 +1388,10 @@ namespace Client
{ 6, 6, 0, 0, 7, 7, 6, 7, 7, 0, 0, 0, 0, 0, 0, 0, 14, 0, 0, 0, 0, 0, 0, 0, 4, 0, 0, 6, 6, 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 6, 6, 0, 0, 0, 0, 6 }, { 6, 6, 0, 0, 7, 7, 6, 7, 7, 0, 0, 0, 0, 0, 0, 0, 14, 0, 0, 0, 0, 0, 0, 0, 4, 0, 0, 6, 6, 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 6, 6, 0, 0, 0, 0, 6 },
{ 6, 6, 15, 0, 0, 0, 7, 0, 0, 0, 0, 6, 6, 6, 6, 6, 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 6, 6, 6, 6, 11, 6, 0, 0, 0, 0, 0, 6 }, { 6, 6, 15, 0, 0, 0, 7, 0, 0, 0, 0, 6, 6, 6, 6, 6, 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 6, 6, 6, 6, 11, 6, 0, 0, 0, 0, 0, 6 },
{ 6, 6, 6, 0, 0, 0, 0, 0, 0, 0, 0, 6, 0, 0, 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8, 0, 0, 0, 0, 0, 6, 0, 0, 0, 0, 7, 6, 6, 6, 0, 0, 6 },
{ 6, 0, 0, 0, 0, 0, 6, 7, 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7, 0, 0, 0, 7, 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 11, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 6 }, { 6, 0, 0, 0, 0, 0, 6, 7, 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7, 0, 0, 0, 7, 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 11, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 6 },
@@ -1382,5 +1408,7 @@ namespace Client
bool isEmergencyOpened = false; bool isEmergencyOpened = false;
bool isEmergencyDrawed = false; bool isEmergencyDrawed = false;
const double radiusTimes = 1.0 * Preparation.Utility.GameData.characterRadius / Preparation.Utility.GameData.numOfPosGridPerCell; const double radiusTimes = 1.0 * Preparation.Utility.GameData.characterRadius / Preparation.Utility.GameData.numOfPosGridPerCell;
private int[] totalLife = new int[4] { 100, 100, 100, 100 }, totalDeath = new int[4] { 100, 100, 100, 100 };
private int[,] coolTime = new int[3, 5] { { 100, 100, 100, 100, 100 }, { 100, 100, 100, 100, 100 }, { 100, 100, 100, 100, 100 } };
} }
} }

+ 18
- 7
logic/Client/StatusBarOfHunter.xaml.cs View File

@@ -3,10 +3,6 @@ using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Text; using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows; using System.Windows;
using System.Windows.Controls; using System.Windows.Controls;
using System.Windows.Data; using System.Windows.Data;
@@ -16,6 +12,7 @@ using System.Windows.Media;
using System.Windows.Media.Imaging; using System.Windows.Media.Imaging;
using System.Windows.Shapes; using System.Windows.Shapes;
using Protobuf; using Protobuf;
using Preparation.Utility;


namespace Client namespace Client
{ {
@@ -127,11 +124,11 @@ namespace Client
} }
scores.Text = "Scores: " + Convert.ToString(obj.Score); scores.Text = "Scores: " + Convert.ToString(obj.Score);
if (obj.TimeUntilSkillAvailable[0] >= 0) if (obj.TimeUntilSkillAvailable[0] >= 0)
skillprogress0.Value = 100 - obj.TimeUntilSkillAvailable[0] / coolTime0[4] * 100;
skillprogress0.Value = 100 - 100.0 * obj.TimeUntilSkillAvailable[0] / coolTime0[4];
if (obj.TimeUntilSkillAvailable[1] >= 0) if (obj.TimeUntilSkillAvailable[1] >= 0)
skillprogress1.Value = 100 - obj.TimeUntilSkillAvailable[1] / coolTime1[4] * 100;
skillprogress1.Value = 100 - 100.0 * obj.TimeUntilSkillAvailable[1] / coolTime1[4];
if (obj.TimeUntilSkillAvailable[2] >= 0) if (obj.TimeUntilSkillAvailable[2] >= 0)
skillprogress2.Value = 100 - obj.TimeUntilSkillAvailable[2] / coolTime2[4] * 100;
skillprogress2.Value = 100 - 100.0 * obj.TimeUntilSkillAvailable[2] / coolTime2[4];
if (obj.PlayerState == PlayerState.Quit) if (obj.PlayerState == PlayerState.Quit)
{ {
skillprogress0.Value = skillprogress1.Value = skillprogress2.Value = 0; skillprogress0.Value = skillprogress1.Value = skillprogress2.Value = 0;
@@ -255,6 +252,20 @@ namespace Client
SetStaticValue(obj); SetStaticValue(obj);
SetDynamicValue(obj); SetDynamicValue(obj);
} }
public void NewData(int[] life, int[] death, int[,] coolTime)
{
for (int i = 0; i < GameData.numOfStudent; ++i)
{
totalLife[i] = life[i];
totalDeath[i] = death[i];
coolTime0[i] = coolTime[0, i];
coolTime1[i] = coolTime[1, i];
coolTime2[i] = coolTime[2, i];
}
coolTime0[4] = coolTime[0, 4];
coolTime1[4] = coolTime[1, 4];
coolTime2[4] = coolTime[2, 4];
}
private int[] totalLife = new int[4] { 100, 100, 100, 100 }, totalDeath = new int[4] { 100, 100, 100, 100 }; private int[] totalLife = new int[4] { 100, 100, 100, 100 }, totalDeath = new int[4] { 100, 100, 100, 100 };
private int[] coolTime0 = new int[5] { 100, 100, 100, 100, 100 }, coolTime1 = new int[5] { 100, 100, 100, 100, 100 }, coolTime2 = new int[5] { 100, 100, 100, 100, 100 }; private int[] coolTime0 = new int[5] { 100, 100, 100, 100, 100 }, coolTime1 = new int[5] { 100, 100, 100, 100, 100 }, coolTime2 = new int[5] { 100, 100, 100, 100, 100 };
private bool initialized; private bool initialized;


+ 35
- 25
logic/Client/StatusBarOfSurvivor.xaml.cs View File

@@ -12,6 +12,7 @@ using System.Windows.Media;
using System.Windows.Media.Imaging; using System.Windows.Media.Imaging;
using System.Windows.Shapes; using System.Windows.Shapes;
using Protobuf; using Protobuf;
using Preparation.Utility;


namespace Client namespace Client
{ {
@@ -32,7 +33,6 @@ namespace Client
{ {
serial.FontSize = scores.FontSize = status.FontSize = activeSkill0.FontSize = activeSkill1.FontSize = activeSkill2.FontSize = prop0.FontSize = prop1.FontSize = prop2.FontSize = fontsize; serial.FontSize = scores.FontSize = status.FontSize = activeSkill0.FontSize = activeSkill1.FontSize = activeSkill2.FontSize = prop0.FontSize = prop1.FontSize = prop2.FontSize = fontsize;
} }

private void SetStaticValue(MessageOfStudent obj) private void SetStaticValue(MessageOfStudent obj)
{ {
switch (obj.StudentType) // coolTime参数未设定, switch (obj.StudentType) // coolTime参数未设定,
@@ -65,20 +65,16 @@ namespace Client
{ {
int life = obj.Determination, death = obj.Addiction; int life = obj.Determination, death = obj.Addiction;
int perLife = (int)(100.0 * life / totalLife[i]), perDeath = (int)(100.0 * death / totalDeath[i]); int perLife = (int)(100.0 * life / totalLife[i]), perDeath = (int)(100.0 * death / totalDeath[i]);
if (perLife > 100)
perLife = 0;
if (perDeath > 100)
perDeath = 0;
switch (obj.PlayerState) switch (obj.PlayerState)
{ {
case PlayerState.Idle: case PlayerState.Idle:
status.Text = "♥: " + Convert.ToString(life) + "," + Convert.ToString(perLife) + "%\nIdle";
status.Text = "♥: " + Convert.ToString(life) + "\nIdle, " + Convert.ToString(perLife) + "%";
break; break;
case PlayerState.Learning: case PlayerState.Learning:
status.Text = "♥: " + Convert.ToString(life) + "," + Convert.ToString(perLife) + "%\nLearning";
status.Text = "♥: " + Convert.ToString(life) + "\nLearning, " + Convert.ToString(perLife) + "%";
break; break;
case PlayerState.Addicted: case PlayerState.Addicted:
status.Text = "💀: " + Convert.ToString(death) + "," + Convert.ToString(perDeath) + "%\nAddicted";
status.Text = "💀: " + Convert.ToString(death) + "\nAddicted, " + Convert.ToString(perDeath) + "%";
break; break;
case PlayerState.Graduated: case PlayerState.Graduated:
status.Text = "♥" + "\nGraduated"; status.Text = "♥" + "\nGraduated";
@@ -87,54 +83,54 @@ namespace Client
status.Text = "💀" + "\nQuit"; status.Text = "💀" + "\nQuit";
break; break;
case PlayerState.Treated: case PlayerState.Treated:
status.Text = "♥: " + Convert.ToString(life) + "," + Convert.ToString(perLife) + "%\nTreated";
status.Text = "♥: " + Convert.ToString(life) + "\nTreated, " + Convert.ToString(perLife) + "%";
break; break;
case PlayerState.Rescued: case PlayerState.Rescued:
status.Text = "💀: " + Convert.ToString(death) + "," + Convert.ToString(perDeath) + "%\nRescued";
status.Text = "💀: " + Convert.ToString(death) + "\nRescued, " + Convert.ToString(perDeath) + "%";
break; break;
case PlayerState.Stunned: case PlayerState.Stunned:
status.Text = "♥: " + Convert.ToString(life) + "," + Convert.ToString(perLife) + "%\nStunned";
status.Text = "♥: " + Convert.ToString(life) + "\nStunned, " + Convert.ToString(perLife) + "%";
break; break;
case PlayerState.Treating: case PlayerState.Treating:
status.Text = "♥: " + Convert.ToString(life) + "," + Convert.ToString(perLife) + "%\nTreating";
status.Text = "♥: " + Convert.ToString(life) + "\nTreating, " + Convert.ToString(perLife) + "%";
break; break;
case PlayerState.Rescuing: case PlayerState.Rescuing:
status.Text = "♥: " + Convert.ToString(life) + "," + Convert.ToString(perLife) + "%\nRescuing";
status.Text = "♥: " + Convert.ToString(life) + "\nRescuing, " + Convert.ToString(perLife) + "%";
break; break;
case PlayerState.Swinging: case PlayerState.Swinging:
status.Text = "♥: " + Convert.ToString(life) + "," + Convert.ToString(perLife) + "%\nSwinging";
status.Text = "♥: " + Convert.ToString(life) + "\nSwinging, " + Convert.ToString(perLife) + "%";
break; break;
case PlayerState.Attacking: case PlayerState.Attacking:
status.Text = "♥: " + Convert.ToString(life) + "," + Convert.ToString(perLife) + "%\nAttacking";
status.Text = "♥: " + Convert.ToString(life) + "\nAttacking, " + Convert.ToString(perLife) + "%";
break; break;
case PlayerState.Locking: case PlayerState.Locking:
status.Text = "♥: " + Convert.ToString(life) + "," + Convert.ToString(perLife) + "%\nLocking";
status.Text = "♥: " + Convert.ToString(life) + "\nLocking, " + Convert.ToString(perLife) + "%";
break; break;
case PlayerState.Rummaging: case PlayerState.Rummaging:
status.Text = "♥: " + Convert.ToString(life) + "," + Convert.ToString(perLife) + "%\nRummaging";
status.Text = "♥: " + Convert.ToString(life) + "\nRummaging, " + Convert.ToString(perLife) + "%";
break; break;
case PlayerState.Climbing: case PlayerState.Climbing:
status.Text = "♥: " + Convert.ToString(life) + "," + Convert.ToString(perLife) + "%\nClimbing";
status.Text = "♥: " + Convert.ToString(life) + "\nClimbing, " + Convert.ToString(perLife) + "%";
break; break;
case PlayerState.OpeningAChest: case PlayerState.OpeningAChest:
status.Text = "♥: " + Convert.ToString(life) + "," + Convert.ToString(perLife) + "%\nOpeningAChest";
status.Text = "♥: " + Convert.ToString(life) + "\nOpeningAChest, " + Convert.ToString(perLife) + "%";
break; break;
case PlayerState.UsingSpecialSkill: case PlayerState.UsingSpecialSkill:
status.Text = "♥: " + Convert.ToString(life) + "," + Convert.ToString(perLife) + "%\nUsingSpecialSkill";
status.Text = "♥: " + Convert.ToString(life) + "\nUsingSpecialSkill, " + Convert.ToString(perLife) + "%";
break; break;
case PlayerState.OpeningAGate: case PlayerState.OpeningAGate:
status.Text = "♥: " + Convert.ToString(life) + "," + Convert.ToString(perLife) + "%\nOpeningAGate";
status.Text = "♥: " + Convert.ToString(life) + "\nOpeningAGate, " + Convert.ToString(perLife) + "%";
break; break;
default: default:
break; break;
} }
scores.Text = "Scores: " + obj.Score; scores.Text = "Scores: " + obj.Score;
if (obj.TimeUntilSkillAvailable[0] >= 0) if (obj.TimeUntilSkillAvailable[0] >= 0)
skillprogress0.Value = 100 - obj.TimeUntilSkillAvailable[0] / coolTime0[i] * 100;
skillprogress0.Value = 100 - 100.0 * obj.TimeUntilSkillAvailable[0] / coolTime0[i];
if (obj.TimeUntilSkillAvailable[1] >= 0) if (obj.TimeUntilSkillAvailable[1] >= 0)
skillprogress1.Value = 100 - obj.TimeUntilSkillAvailable[1] / coolTime1[i] * 100;
skillprogress1.Value = 100 - 100.0 * obj.TimeUntilSkillAvailable[1] / coolTime1[i];
if (obj.TimeUntilSkillAvailable[2] >= 0) if (obj.TimeUntilSkillAvailable[2] >= 0)
skillprogress2.Value = 100 - obj.TimeUntilSkillAvailable[2] / coolTime2[i] * 100;
skillprogress2.Value = 100 - 100.0 * obj.TimeUntilSkillAvailable[2] / coolTime2[i];
if (obj.PlayerState == PlayerState.Quit) if (obj.PlayerState == PlayerState.Quit)
{ {
skillprogress0.Value = skillprogress1.Value = skillprogress2.Value = 0; skillprogress0.Value = skillprogress1.Value = skillprogress2.Value = 0;
@@ -251,13 +247,27 @@ namespace Client
} }
} }
} }

public void SetValue(MessageOfStudent obj, long i) public void SetValue(MessageOfStudent obj, long i)
{ {
if (!initialized) if (!initialized)
SetStaticValue(obj); SetStaticValue(obj);
SetDynamicValue(obj, i); SetDynamicValue(obj, i);
} }
public void NewData(int[] life, int[] death, int[,] coolTime)
{
for (int i = 0; i < GameData.numOfStudent; ++i)
{
totalLife[i] = life[i];
totalDeath[i] = death[i];
coolTime0[i] = coolTime[0, i];
coolTime1[i] = coolTime[1, i];
coolTime2[i] = coolTime[2, i];
}
coolTime0[4] = coolTime[0, 4];
coolTime1[4] = coolTime[1, 4];
coolTime2[4] = coolTime[2, 4];
}

private int[] totalLife = new int[4] { 100, 100, 100, 100 }, totalDeath = new int[4] { 100, 100, 100, 100 }; private int[] totalLife = new int[4] { 100, 100, 100, 100 }, totalDeath = new int[4] { 100, 100, 100, 100 };
private int[] coolTime0 = new int[5] { 100, 100, 100, 100, 100 }, coolTime1 = new int[5] { 100, 100, 100, 100, 100 }, coolTime2 = new int[5] { 100, 100, 100, 100, 100 }; private int[] coolTime0 = new int[5] { 100, 100, 100, 100, 100 }, coolTime1 = new int[5] { 100, 100, 100, 100, 100 }, coolTime2 = new int[5] { 100, 100, 100, 100, 100 };
private bool initialized; private bool initialized;


+ 1
- 1
logic/GameClass/GameObj/Character/Character.Skill.cs View File

@@ -76,7 +76,7 @@ namespace GameClass.GameObj
foreach (var activeSkill in this.Occupation.ListOfIActiveSkill) foreach (var activeSkill in this.Occupation.ListOfIActiveSkill)
{ {
this.IActiveSkillDictionary.Add(activeSkill, SkillFactory.FindIActiveSkill(activeSkill)); this.IActiveSkillDictionary.Add(activeSkill, SkillFactory.FindIActiveSkill(activeSkill));
this.TimeUntilActiveSkillAvailable.Add(activeSkill, IActiveSkillDictionary[activeSkill].SkillCD);
this.TimeUntilActiveSkillAvailable.Add(activeSkill, 0);
} }


// UsePassiveSkill(); //创建player时开始被动技能,这一过程也可以放到gamestart时进行 // UsePassiveSkill(); //创建player时开始被动技能,这一过程也可以放到gamestart时进行


+ 4
- 5
logic/GameClass/GameObj/Map/MapInfo.cs View File

@@ -52,10 +52,10 @@ namespace GameClass.GameObj
{ 6, 6, 0, 0, 7, 7, 6, 7, 7, 0, 0, 0, 0, 0, 0, 0, 14, 0, 0, 0, 0, 0, 0, 0, 4, 0, 0, 6, 6, 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 6, 6, 0, 0, 0, 0, 6 }, { 6, 6, 0, 0, 7, 7, 6, 7, 7, 0, 0, 0, 0, 0, 0, 0, 14, 0, 0, 0, 0, 0, 0, 0, 4, 0, 0, 6, 6, 6, 0, 0, 0, 0, 0, 0, 0, 0, 0,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6, 6, 6, 6, 0, 0, 0, 0, 6, 0, 0, 0, 0, 7, 6, 6, 0, 0, 0, 6 },
{ 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 6, 6, 7, 15, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 6, 0, 0, 0, 0, 6, 0, 0, 0, 7, 7, 6, 6, 0, 0, 0, 6 }, { 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 6, 6, 7, 15, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 6, 0, 0, 0, 0, 6, 0, 0, 0, 7, 7, 6, 6, 0, 0, 0, 6 },
{ 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6 } { 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6 }
};

};
} }
} }

+ 8
- 0
logic/Preparation/Preparation.csproj View File

@@ -7,5 +7,13 @@
<StartupObject /> <StartupObject />
<Nullable>enable</Nullable> <Nullable>enable</Nullable>
</PropertyGroup> </PropertyGroup>
<ItemGroup>
<PackageReference Include="Google.Protobuf" Version="3.22.1" />
</ItemGroup>


<ItemGroup>
<ProjectReference Include="..\..\dependency\proto\Protos.csproj" />
</ItemGroup>
</Project> </Project>

+ 255
- 0
logic/Preparation/Utility/Transformation.cs View File

@@ -0,0 +1,255 @@
using Protobuf;

namespace Preparation.Utility
{
public static class Transformation
{

public static Protobuf.PlaceType ToPlaceType(Preparation.Utility.PlaceType place)
{
switch (place)
{
case Preparation.Utility.PlaceType.Window:
return Protobuf.PlaceType.Window;
case Preparation.Utility.PlaceType.EmergencyExit:
return Protobuf.PlaceType.HiddenGate;
case Preparation.Utility.PlaceType.Doorway:
return Protobuf.PlaceType.Gate;
case Preparation.Utility.PlaceType.Chest:
return Protobuf.PlaceType.Chest;
case Preparation.Utility.PlaceType.Door3:
return Protobuf.PlaceType.Door3;
case Preparation.Utility.PlaceType.Door5:
return Protobuf.PlaceType.Door5;
case Preparation.Utility.PlaceType.Door6:
return Protobuf.PlaceType.Door6;
case Preparation.Utility.PlaceType.Generator:
return Protobuf.PlaceType.Classroom;
case Preparation.Utility.PlaceType.Grass:
return Protobuf.PlaceType.Grass;
case Preparation.Utility.PlaceType.Wall:
return Protobuf.PlaceType.Wall;
case Preparation.Utility.PlaceType.Null:
case Preparation.Utility.PlaceType.BirthPoint1:
case Preparation.Utility.PlaceType.BirthPoint2:
case Preparation.Utility.PlaceType.BirthPoint3:
case Preparation.Utility.PlaceType.BirthPoint4:
case Preparation.Utility.PlaceType.BirthPoint5:
return Protobuf.PlaceType.Land;
default:
return Protobuf.PlaceType.NullPlaceType;
}
}
public static Protobuf.PropType ToPropType(Preparation.Utility.PropType prop)
{
switch (prop)
{
case Preparation.Utility.PropType.AddSpeed:
return Protobuf.PropType.AddSpeed;
case Preparation.Utility.PropType.AddLifeOrClairaudience:
return Protobuf.PropType.AddLifeOrClairaudience;
case Preparation.Utility.PropType.AddHpOrAp:
return Protobuf.PropType.AddHpOrAp;
case Preparation.Utility.PropType.ShieldOrSpear:
return Protobuf.PropType.ShieldOrSpear;
case Preparation.Utility.PropType.RecoveryFromDizziness:
return Protobuf.PropType.RecoveryFromDizziness;
case Preparation.Utility.PropType.Key3:
return Protobuf.PropType.Key3;
case Preparation.Utility.PropType.Key5:
return Protobuf.PropType.Key5;
case Preparation.Utility.PropType.Key6:
return Protobuf.PropType.Key6;
default:
return Protobuf.PropType.NullPropType;
}
}

public static Preparation.Utility.PropType ToPropType(Protobuf.PropType prop)
{
switch (prop)
{
case Protobuf.PropType.AddSpeed:
return Preparation.Utility.PropType.AddSpeed;
case Protobuf.PropType.AddLifeOrClairaudience:
return Preparation.Utility.PropType.AddLifeOrClairaudience;
case Protobuf.PropType.AddHpOrAp:
return Preparation.Utility.PropType.AddHpOrAp;
case Protobuf.PropType.ShieldOrSpear:
return Preparation.Utility.PropType.ShieldOrSpear;
case Protobuf.PropType.RecoveryFromDizziness:
return Preparation.Utility.PropType.RecoveryFromDizziness;
case Protobuf.PropType.Key3:
return Preparation.Utility.PropType.Key3;
case Protobuf.PropType.Key5:
return Preparation.Utility.PropType.Key5;
case Protobuf.PropType.Key6:
return Preparation.Utility.PropType.Key6;
default:
return Preparation.Utility.PropType.Null;
}
}

public static Protobuf.PlayerState ToPlayerState(Preparation.Utility.PlayerStateType playerState)
{
switch (playerState)
{
case Preparation.Utility.PlayerStateType.Moving:
case Preparation.Utility.PlayerStateType.Null:
return PlayerState.Idle;
case Preparation.Utility.PlayerStateType.Addicted:
return PlayerState.Addicted;
case Preparation.Utility.PlayerStateType.ClimbingThroughWindows:
return PlayerState.Climbing;
case Preparation.Utility.PlayerStateType.Deceased:
return PlayerState.Quit;
case Preparation.Utility.PlayerStateType.Escaped:
return PlayerState.Graduated;
case Preparation.Utility.PlayerStateType.Fixing:
return PlayerState.Learning;
case Preparation.Utility.PlayerStateType.LockingOrOpeningTheDoor:
return PlayerState.Locking;
case Preparation.Utility.PlayerStateType.OpeningTheChest:
return PlayerState.OpeningAChest;
case Preparation.Utility.PlayerStateType.Rescued:
return PlayerState.Rescued;
case Preparation.Utility.PlayerStateType.Rescuing:
return PlayerState.Rescuing;
case Preparation.Utility.PlayerStateType.Stunned:
return PlayerState.Stunned;
case Preparation.Utility.PlayerStateType.Swinging:
return PlayerState.Swinging;
case Preparation.Utility.PlayerStateType.Treated:
return PlayerState.Treated;
case Preparation.Utility.PlayerStateType.Treating:
return PlayerState.Treating;
case Preparation.Utility.PlayerStateType.TryingToAttack:
return PlayerState.Attacking;
case Preparation.Utility.PlayerStateType.UsingSkill:
return PlayerState.UsingSpecialSkill;
case Preparation.Utility.PlayerStateType.OpeningTheDoorway:
return PlayerState.OpeningAGate;
default:
return PlayerState.NullStatus;
}
}
public static Protobuf.StudentBuffType ToStudentBuffType(Preparation.Utility.BuffType buffType)
{
switch (buffType)
{
case Preparation.Utility.BuffType.AddSpeed:
return Protobuf.StudentBuffType.StudentAddSpeed;
case Preparation.Utility.BuffType.AddLife:
return Protobuf.StudentBuffType.AddLife;
case Preparation.Utility.BuffType.Shield:
return Protobuf.StudentBuffType.Shield;
case Preparation.Utility.BuffType.Invisible:
return Protobuf.StudentBuffType.StudentInvisible;
default:
return Protobuf.StudentBuffType.NullSbuffType;
}
}
public static Protobuf.TrickerBuffType ToTrickerBuffType(Preparation.Utility.BuffType buffType)
{
switch (buffType)
{
case Preparation.Utility.BuffType.AddSpeed:
return Protobuf.TrickerBuffType.TrickerAddSpeed;
case Preparation.Utility.BuffType.Spear:
return Protobuf.TrickerBuffType.Spear;
case Preparation.Utility.BuffType.AddAp:
return Protobuf.TrickerBuffType.AddAp;
case Preparation.Utility.BuffType.Clairaudience:
return Protobuf.TrickerBuffType.Clairaudience;
case Preparation.Utility.BuffType.Invisible:
return Protobuf.TrickerBuffType.TrickerInvisible;
default:
return Protobuf.TrickerBuffType.NullTbuffType;
}
}
public static Protobuf.BulletType ToBulletType(Preparation.Utility.BulletType bulletType)
{
switch (bulletType)
{
case Preparation.Utility.BulletType.FlyingKnife:
return Protobuf.BulletType.FlyingKnife;
case Preparation.Utility.BulletType.CommonAttackOfGhost:
return Protobuf.BulletType.CommonAttackOfTricker;
case Preparation.Utility.BulletType.BombBomb:
return Protobuf.BulletType.BombBomb;
case Preparation.Utility.BulletType.JumpyDumpty:
return Protobuf.BulletType.JumpyDumpty;
default:
return Protobuf.BulletType.NullBulletType;
}
}

public static Protobuf.StudentType ToStudentType(Preparation.Utility.CharacterType characterType)
{
switch (characterType)
{
case Preparation.Utility.CharacterType.Athlete:
return Protobuf.StudentType.Athlete;
case Preparation.Utility.CharacterType.Teacher:
return Protobuf.StudentType.Teacher;
case Preparation.Utility.CharacterType.StraightAStudent:
return Protobuf.StudentType.StraightAStudent;
case Preparation.Utility.CharacterType.Robot:
return Protobuf.StudentType.Robot;
case Preparation.Utility.CharacterType.TechOtaku:
return Protobuf.StudentType.TechOtaku;
default:
return Protobuf.StudentType.NullStudentType;
}
}

public static Preparation.Utility.CharacterType ToStudentType(Protobuf.StudentType characterType)
{
switch (characterType)
{
case Protobuf.StudentType.Athlete:
return Preparation.Utility.CharacterType.Athlete;
case Protobuf.StudentType.Teacher:
return Preparation.Utility.CharacterType.Teacher;
case Protobuf.StudentType.StraightAStudent:
return Preparation.Utility.CharacterType.StraightAStudent;
case Protobuf.StudentType.Robot:
return Preparation.Utility.CharacterType.Robot;
case Protobuf.StudentType.TechOtaku:
return Preparation.Utility.CharacterType.TechOtaku;
default:
return Preparation.Utility.CharacterType.Null;
}
}
public static Protobuf.TrickerType ToTrickerType(Preparation.Utility.CharacterType characterType)
{
switch (characterType)
{
case Preparation.Utility.CharacterType.Assassin:
return Protobuf.TrickerType.Assassin;
case Preparation.Utility.CharacterType.Klee:
return Protobuf.TrickerType.Klee;
case Preparation.Utility.CharacterType.ANoisyPerson:
return Protobuf.TrickerType.ANoisyPerson;
default:
return Protobuf.TrickerType.NullTrickerType;
}
}

public static Preparation.Utility.CharacterType ToTrickerType(Protobuf.TrickerType characterType)
{
switch (characterType)
{
case Protobuf.TrickerType.Assassin:
return Preparation.Utility.CharacterType.Assassin;
case Protobuf.TrickerType.Klee:
return Preparation.Utility.CharacterType.Klee;
case Protobuf.TrickerType.ANoisyPerson:
return Preparation.Utility.CharacterType.ANoisyPerson;
default:
return Preparation.Utility.CharacterType.Null;
}
}

}
}

+ 15
- 261
logic/Server/CopyInfo.cs View File

@@ -9,252 +9,6 @@ namespace Server


public static class CopyInfo public static class CopyInfo
{ {
public static Protobuf.PlaceType ToPlaceType(Preparation.Utility.PlaceType place)
{
switch (place)
{
case Preparation.Utility.PlaceType.Window:
return Protobuf.PlaceType.Window;
case Preparation.Utility.PlaceType.EmergencyExit:
return Protobuf.PlaceType.HiddenGate;
case Preparation.Utility.PlaceType.Doorway:
return Protobuf.PlaceType.Gate;
case Preparation.Utility.PlaceType.Chest:
return Protobuf.PlaceType.Chest;
case Preparation.Utility.PlaceType.Door3:
return Protobuf.PlaceType.Door3;
case Preparation.Utility.PlaceType.Door5:
return Protobuf.PlaceType.Door5;
case Preparation.Utility.PlaceType.Door6:
return Protobuf.PlaceType.Door6;
case Preparation.Utility.PlaceType.Generator:
return Protobuf.PlaceType.Classroom;
case Preparation.Utility.PlaceType.Grass:
return Protobuf.PlaceType.Grass;
case Preparation.Utility.PlaceType.Wall:
return Protobuf.PlaceType.Wall;
case Preparation.Utility.PlaceType.Null:
case Preparation.Utility.PlaceType.BirthPoint1:
case Preparation.Utility.PlaceType.BirthPoint2:
case Preparation.Utility.PlaceType.BirthPoint3:
case Preparation.Utility.PlaceType.BirthPoint4:
case Preparation.Utility.PlaceType.BirthPoint5:
return Protobuf.PlaceType.Land;
default:
return Protobuf.PlaceType.NullPlaceType;
}
}
public static Protobuf.PropType ToPropType(Preparation.Utility.PropType prop)
{
switch (prop)
{
case Preparation.Utility.PropType.AddSpeed:
return Protobuf.PropType.AddSpeed;
case Preparation.Utility.PropType.AddLifeOrClairaudience:
return Protobuf.PropType.AddLifeOrClairaudience;
case Preparation.Utility.PropType.AddHpOrAp:
return Protobuf.PropType.AddHpOrAp;
case Preparation.Utility.PropType.ShieldOrSpear:
return Protobuf.PropType.ShieldOrSpear;
case Preparation.Utility.PropType.RecoveryFromDizziness:
return Protobuf.PropType.RecoveryFromDizziness;
case Preparation.Utility.PropType.Key3:
return Protobuf.PropType.Key3;
case Preparation.Utility.PropType.Key5:
return Protobuf.PropType.Key5;
case Preparation.Utility.PropType.Key6:
return Protobuf.PropType.Key6;
default:
return Protobuf.PropType.NullPropType;
}
}

public static Preparation.Utility.PropType ToPropType(Protobuf.PropType prop)
{
switch (prop)
{
case Protobuf.PropType.AddSpeed:
return Preparation.Utility.PropType.AddSpeed;
case Protobuf.PropType.AddLifeOrClairaudience:
return Preparation.Utility.PropType.AddLifeOrClairaudience;
case Protobuf.PropType.AddHpOrAp:
return Preparation.Utility.PropType.AddHpOrAp;
case Protobuf.PropType.ShieldOrSpear:
return Preparation.Utility.PropType.ShieldOrSpear;
case Protobuf.PropType.RecoveryFromDizziness:
return Preparation.Utility.PropType.RecoveryFromDizziness;
case Protobuf.PropType.Key3:
return Preparation.Utility.PropType.Key3;
case Protobuf.PropType.Key5:
return Preparation.Utility.PropType.Key5;
case Protobuf.PropType.Key6:
return Preparation.Utility.PropType.Key6;
default:
return Preparation.Utility.PropType.Null;
}
}

public static Protobuf.PlayerState ToPlayerState(Preparation.Utility.PlayerStateType playerState)
{
switch (playerState)
{
case Preparation.Utility.PlayerStateType.Moving:
case Preparation.Utility.PlayerStateType.Null:
return PlayerState.Idle;
case Preparation.Utility.PlayerStateType.Addicted:
return PlayerState.Addicted;
case Preparation.Utility.PlayerStateType.ClimbingThroughWindows:
return PlayerState.Climbing;
case Preparation.Utility.PlayerStateType.Deceased:
return PlayerState.Quit;
case Preparation.Utility.PlayerStateType.Escaped:
return PlayerState.Graduated;
case Preparation.Utility.PlayerStateType.Fixing:
return PlayerState.Learning;
case Preparation.Utility.PlayerStateType.LockingOrOpeningTheDoor:
return PlayerState.Locking;
case Preparation.Utility.PlayerStateType.OpeningTheChest:
return PlayerState.OpeningAChest;
case Preparation.Utility.PlayerStateType.Rescued:
return PlayerState.Rescued;
case Preparation.Utility.PlayerStateType.Rescuing:
return PlayerState.Rescuing;
case Preparation.Utility.PlayerStateType.Stunned:
return PlayerState.Stunned;
case Preparation.Utility.PlayerStateType.Swinging:
return PlayerState.Swinging;
case Preparation.Utility.PlayerStateType.Treated:
return PlayerState.Treated;
case Preparation.Utility.PlayerStateType.Treating:
return PlayerState.Treating;
case Preparation.Utility.PlayerStateType.TryingToAttack:
return PlayerState.Attacking;
case Preparation.Utility.PlayerStateType.UsingSkill:
return PlayerState.UsingSpecialSkill;
case Preparation.Utility.PlayerStateType.OpeningTheDoorway:
return PlayerState.OpeningAGate;
default:
return PlayerState.NullStatus;
}
}
public static Protobuf.StudentBuffType ToStudentBuffType(Preparation.Utility.BuffType buffType)
{
switch (buffType)
{
case Preparation.Utility.BuffType.AddSpeed:
return Protobuf.StudentBuffType.StudentAddSpeed;
case Preparation.Utility.BuffType.AddLife:
return Protobuf.StudentBuffType.AddLife;
case Preparation.Utility.BuffType.Shield:
return Protobuf.StudentBuffType.Shield;
case Preparation.Utility.BuffType.Invisible:
return Protobuf.StudentBuffType.StudentInvisible;
default:
return Protobuf.StudentBuffType.NullSbuffType;
}
}
public static Protobuf.TrickerBuffType ToTrickerBuffType(Preparation.Utility.BuffType buffType)
{
switch (buffType)
{
case Preparation.Utility.BuffType.AddSpeed:
return Protobuf.TrickerBuffType.TrickerAddSpeed;
case Preparation.Utility.BuffType.Spear:
return Protobuf.TrickerBuffType.Spear;
case Preparation.Utility.BuffType.AddAp:
return Protobuf.TrickerBuffType.AddAp;
case Preparation.Utility.BuffType.Clairaudience:
return Protobuf.TrickerBuffType.Clairaudience;
case Preparation.Utility.BuffType.Invisible:
return Protobuf.TrickerBuffType.TrickerInvisible;
default:
return Protobuf.TrickerBuffType.NullTbuffType;
}
}
public static Protobuf.BulletType ToBulletType(Preparation.Utility.BulletType bulletType)
{
switch (bulletType)
{
case Preparation.Utility.BulletType.FlyingKnife:
return Protobuf.BulletType.FlyingKnife;
case Preparation.Utility.BulletType.CommonAttackOfGhost:
return Protobuf.BulletType.CommonAttackOfTricker;
case Preparation.Utility.BulletType.BombBomb:
return Protobuf.BulletType.BombBomb;
case Preparation.Utility.BulletType.JumpyDumpty:
return Protobuf.BulletType.JumpyDumpty;
default:
return Protobuf.BulletType.NullBulletType;
}
}

public static Protobuf.StudentType ToStudentType(Preparation.Utility.CharacterType characterType)
{
switch (characterType)
{
case Preparation.Utility.CharacterType.Athlete:
return Protobuf.StudentType.Athlete;
case Preparation.Utility.CharacterType.Teacher:
return Protobuf.StudentType.Teacher;
case Preparation.Utility.CharacterType.StraightAStudent:
return Protobuf.StudentType.StraightAStudent;
case Preparation.Utility.CharacterType.Robot:
return Protobuf.StudentType.Robot;
case Preparation.Utility.CharacterType.TechOtaku:
return Protobuf.StudentType.TechOtaku;
default:
return Protobuf.StudentType.NullStudentType;
}
}

public static Preparation.Utility.CharacterType ToStudentType(Protobuf.StudentType characterType)
{
switch (characterType)
{
case Protobuf.StudentType.Athlete:
return Preparation.Utility.CharacterType.Athlete;
case Protobuf.StudentType.Teacher:
return Preparation.Utility.CharacterType.Teacher;
case Protobuf.StudentType.StraightAStudent:
return Preparation.Utility.CharacterType.StraightAStudent;
case Protobuf.StudentType.Robot:
return Preparation.Utility.CharacterType.Robot;
case Protobuf.StudentType.TechOtaku:
return Preparation.Utility.CharacterType.TechOtaku;
default:
return Preparation.Utility.CharacterType.Null;
}
}
public static Protobuf.TrickerType ToTrickerType(Preparation.Utility.CharacterType characterType)
{
switch (characterType)
{
case Preparation.Utility.CharacterType.Assassin:
return Protobuf.TrickerType.Assassin;
case Preparation.Utility.CharacterType.Klee:
return Protobuf.TrickerType.Klee;
case Preparation.Utility.CharacterType.ANoisyPerson:
return Protobuf.TrickerType.ANoisyPerson;
default:
return Protobuf.TrickerType.NullTrickerType;
}
}

public static Preparation.Utility.CharacterType ToTrickerType(Protobuf.TrickerType characterType)
{
switch (characterType)
{
case Protobuf.TrickerType.Assassin:
return Preparation.Utility.CharacterType.Assassin;
case Protobuf.TrickerType.Klee:
return Preparation.Utility.CharacterType.Klee;
case Protobuf.TrickerType.ANoisyPerson:
return Preparation.Utility.CharacterType.ANoisyPerson;
default:
return Preparation.Utility.CharacterType.Null;
}
}

public static MessageOfObj? Auto(GameObj gameObj) public static MessageOfObj? Auto(GameObj gameObj)
{ {
switch (gameObj.Type) switch (gameObj.Type)
@@ -312,12 +66,12 @@ namespace Server
msg.StudentMessage.TimeUntilSkillAvailable.Add(-1); msg.StudentMessage.TimeUntilSkillAvailable.Add(-1);


foreach (var value in player.PropInventory) foreach (var value in player.PropInventory)
msg.StudentMessage.Prop.Add(ToPropType(value.GetPropType()));
msg.StudentMessage.Prop.Add(Transformation.ToPropType(value.GetPropType()));


msg.StudentMessage.Place = ToPlaceType((Preparation.Utility.PlaceType)player.Place);
msg.StudentMessage.Place = Transformation.ToPlaceType((Preparation.Utility.PlaceType)player.Place);
msg.StudentMessage.Guid = player.ID; msg.StudentMessage.Guid = player.ID;


msg.StudentMessage.PlayerState = ToPlayerState((PlayerStateType)player.PlayerState);
msg.StudentMessage.PlayerState = Transformation.ToPlayerState((PlayerStateType)player.PlayerState);
msg.StudentMessage.PlayerId = player.PlayerID; msg.StudentMessage.PlayerId = player.PlayerID;
msg.StudentMessage.ViewRange = player.ViewRange; msg.StudentMessage.ViewRange = player.ViewRange;
msg.StudentMessage.Radius = player.Radius; msg.StudentMessage.Radius = player.Radius;
@@ -329,14 +83,14 @@ namespace Server
foreach (KeyValuePair<Preparation.Utility.BuffType, bool> kvp in player.Buff) foreach (KeyValuePair<Preparation.Utility.BuffType, bool> kvp in player.Buff)
{ {
if (kvp.Value) if (kvp.Value)
msg.StudentMessage.Buff.Add(ToStudentBuffType(kvp.Key));
msg.StudentMessage.Buff.Add(Transformation.ToStudentBuffType(kvp.Key));
} }


msg.StudentMessage.BulletType = ToBulletType((Preparation.Utility.BulletType)player.BulletOfPlayer);
msg.StudentMessage.BulletType = Transformation.ToBulletType((Preparation.Utility.BulletType)player.BulletOfPlayer);
msg.StudentMessage.LearningSpeed = player.FixSpeed; msg.StudentMessage.LearningSpeed = player.FixSpeed;
msg.StudentMessage.TreatSpeed = player.TreatSpeed; msg.StudentMessage.TreatSpeed = player.TreatSpeed;
msg.StudentMessage.FacingDirection = player.FacingDirection.Angle(); msg.StudentMessage.FacingDirection = player.FacingDirection.Angle();
msg.StudentMessage.StudentType = ToStudentType(player.CharacterType);
msg.StudentMessage.StudentType = Transformation.ToStudentType(player.CharacterType);
return msg; return msg;
} }


@@ -354,25 +108,25 @@ namespace Server
for (int i = 0; i < GameData.maxNumOfSkill - player.TimeUntilActiveSkillAvailable.Count(); ++i) for (int i = 0; i < GameData.maxNumOfSkill - player.TimeUntilActiveSkillAvailable.Count(); ++i)
msg.TrickerMessage.TimeUntilSkillAvailable.Add(-1); msg.TrickerMessage.TimeUntilSkillAvailable.Add(-1);


msg.TrickerMessage.Place = ToPlaceType((Preparation.Utility.PlaceType)player.Place);
msg.TrickerMessage.Place = Transformation.ToPlaceType((Preparation.Utility.PlaceType)player.Place);
foreach (var value in player.PropInventory) foreach (var value in player.PropInventory)
msg.TrickerMessage.Prop.Add(ToPropType(value.GetPropType()));
msg.TrickerMessage.Prop.Add(Transformation.ToPropType(value.GetPropType()));


msg.TrickerMessage.TrickerType = ToTrickerType(player.CharacterType);
msg.TrickerMessage.TrickerType = Transformation.ToTrickerType(player.CharacterType);
msg.TrickerMessage.Guid = player.ID; msg.TrickerMessage.Guid = player.ID;
msg.TrickerMessage.Score = player.Score; msg.TrickerMessage.Score = player.Score;
msg.TrickerMessage.PlayerId = player.PlayerID; msg.TrickerMessage.PlayerId = player.PlayerID;
msg.TrickerMessage.ViewRange = player.ViewRange; msg.TrickerMessage.ViewRange = player.ViewRange;
msg.TrickerMessage.Radius = player.Radius; msg.TrickerMessage.Radius = player.Radius;
msg.TrickerMessage.PlayerState = ToPlayerState((PlayerStateType)player.PlayerState);
msg.TrickerMessage.PlayerState = Transformation.ToPlayerState((PlayerStateType)player.PlayerState);
msg.TrickerMessage.TrickDesire = (player.BgmDictionary.ContainsKey(BgmType.StudentIsApproaching)) ? player.BgmDictionary[BgmType.StudentIsApproaching] : 0; msg.TrickerMessage.TrickDesire = (player.BgmDictionary.ContainsKey(BgmType.StudentIsApproaching)) ? player.BgmDictionary[BgmType.StudentIsApproaching] : 0;
msg.TrickerMessage.ClassVolume = (player.BgmDictionary.ContainsKey(BgmType.GeneratorIsBeingFixed)) ? player.BgmDictionary[BgmType.GeneratorIsBeingFixed] : 0; msg.TrickerMessage.ClassVolume = (player.BgmDictionary.ContainsKey(BgmType.GeneratorIsBeingFixed)) ? player.BgmDictionary[BgmType.GeneratorIsBeingFixed] : 0;
msg.TrickerMessage.FacingDirection = player.FacingDirection.Angle(); msg.TrickerMessage.FacingDirection = player.FacingDirection.Angle();
msg.TrickerMessage.BulletType = ToBulletType((Preparation.Utility.BulletType)player.BulletOfPlayer);
msg.TrickerMessage.BulletType = Transformation.ToBulletType((Preparation.Utility.BulletType)player.BulletOfPlayer);
foreach (KeyValuePair<Preparation.Utility.BuffType, bool> kvp in player.Buff) foreach (KeyValuePair<Preparation.Utility.BuffType, bool> kvp in player.Buff)
{ {
if (kvp.Value) if (kvp.Value)
msg.TrickerMessage.Buff.Add(ToTrickerBuffType(kvp.Key));
msg.TrickerMessage.Buff.Add(Transformation.ToTrickerBuffType(kvp.Key));
} }




@@ -388,7 +142,7 @@ namespace Server
msg.BulletMessage.FacingDirection = bullet.FacingDirection.Angle(); msg.BulletMessage.FacingDirection = bullet.FacingDirection.Angle();
msg.BulletMessage.Guid = bullet.ID; msg.BulletMessage.Guid = bullet.ID;
msg.BulletMessage.Team = (bullet.Parent.IsGhost()) ? PlayerType.TrickerPlayer : PlayerType.StudentPlayer; msg.BulletMessage.Team = (bullet.Parent.IsGhost()) ? PlayerType.TrickerPlayer : PlayerType.StudentPlayer;
msg.BulletMessage.Place = ToPlaceType((Preparation.Utility.PlaceType)bullet.Place);
msg.BulletMessage.Place = Transformation.ToPlaceType((Preparation.Utility.PlaceType)bullet.Place);
msg.BulletMessage.BombRange = bullet.BulletBombRange; msg.BulletMessage.BombRange = bullet.BulletBombRange;
msg.BulletMessage.Speed = bullet.Speed; msg.BulletMessage.Speed = bullet.Speed;
return msg; return msg;
@@ -398,12 +152,12 @@ namespace Server
{ {
MessageOfObj msg = new MessageOfObj(); MessageOfObj msg = new MessageOfObj();
msg.PropMessage = new(); msg.PropMessage = new();
msg.PropMessage.Type = ToPropType(prop.GetPropType());
msg.PropMessage.Type = Transformation.ToPropType(prop.GetPropType());
msg.PropMessage.X = prop.Position.x; msg.PropMessage.X = prop.Position.x;
msg.PropMessage.Y = prop.Position.y; msg.PropMessage.Y = prop.Position.y;
msg.PropMessage.FacingDirection = prop.FacingDirection.Angle(); msg.PropMessage.FacingDirection = prop.FacingDirection.Angle();
msg.PropMessage.Guid = prop.ID; msg.PropMessage.Guid = prop.ID;
msg.PropMessage.Place = ToPlaceType((Preparation.Utility.PlaceType)prop.Place);
msg.PropMessage.Place = Transformation.ToPlaceType((Preparation.Utility.PlaceType)prop.Place);
return msg; return msg;
} }




+ 5
- 5
logic/Server/RpcServices.cs View File

@@ -86,9 +86,9 @@ namespace Server


Preparation.Utility.CharacterType characterType = Preparation.Utility.CharacterType.Null; Preparation.Utility.CharacterType characterType = Preparation.Utility.CharacterType.Null;
if (request.PlayerType == PlayerType.StudentPlayer) if (request.PlayerType == PlayerType.StudentPlayer)
characterType = CopyInfo.ToStudentType(request.StudentType);
characterType = Transformation.ToStudentType(request.StudentType);
else if (request.PlayerType == PlayerType.TrickerPlayer) else if (request.PlayerType == PlayerType.TrickerPlayer)
characterType = CopyInfo.ToTrickerType(request.TrickerType);
characterType = Transformation.ToTrickerType(request.TrickerType);


lock (addPlayerLock) lock (addPlayerLock)
{ {
@@ -229,7 +229,7 @@ namespace Server
return Task.FromResult(boolRes); return Task.FromResult(boolRes);
} }
var gameID = communicationToGameID[request.PlayerId]; var gameID = communicationToGameID[request.PlayerId];
boolRes.ActSuccess = game.PickProp(gameID, CopyInfo.ToPropType(request.PropType));
boolRes.ActSuccess = game.PickProp(gameID, Transformation.ToPropType(request.PropType));
return Task.FromResult(boolRes); return Task.FromResult(boolRes);
} }


@@ -245,7 +245,7 @@ namespace Server
return Task.FromResult(boolRes); return Task.FromResult(boolRes);
} }
var gameID = communicationToGameID[request.PlayerId]; var gameID = communicationToGameID[request.PlayerId];
game.UseProp(gameID, CopyInfo.ToPropType(request.PropType));
game.UseProp(gameID, Transformation.ToPropType(request.PropType));
boolRes.ActSuccess = true; boolRes.ActSuccess = true;
return Task.FromResult(boolRes); return Task.FromResult(boolRes);
} }
@@ -261,7 +261,7 @@ namespace Server
return Task.FromResult(boolRes); return Task.FromResult(boolRes);
} }
var gameID = communicationToGameID[request.PlayerId]; var gameID = communicationToGameID[request.PlayerId];
game.ThrowProp(gameID, CopyInfo.ToPropType(request.PropType));
game.ThrowProp(gameID, Transformation.ToPropType(request.PropType));
boolRes.ActSuccess = true; boolRes.ActSuccess = true;
return Task.FromResult(boolRes); return Task.FromResult(boolRes);
} }


Loading…
Cancel
Save