Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
ziqian zhang
Grasscutter
Commits
a8293102
Commit
a8293102
authored
Jun 07, 2022
by
Melledy
Committed by
GitHub
Jun 07, 2022
Browse files
Merge branch 'development' into stable
parents
304b9cb8
ecf7a81a
Changes
410
Hide whitespace changes
Inline
Side-by-side
src/main/java/emu/grasscutter/server/packet/recv/HandlerUnionCmdNotify.java
View file @
a8293102
...
...
@@ -15,5 +15,14 @@ public class HandlerUnionCmdNotify extends PacketHandler {
for
(
UnionCmd
cmd
:
req
.
getCmdListList
())
{
session
.
getServer
().
getPacketHandler
().
handle
(
session
,
cmd
.
getMessageId
(),
EMPTY_BYTE_ARRAY
,
cmd
.
getBody
().
toByteArray
());
}
// Update
session
.
getPlayer
().
getCombatInvokeHandler
().
update
(
session
.
getPlayer
());
session
.
getPlayer
().
getAbilityInvokeHandler
().
update
(
session
.
getPlayer
());
// Handle attack results last
while
(!
session
.
getPlayer
().
getAttackResults
().
isEmpty
())
{
session
.
getPlayer
().
getScene
().
handleAttack
(
session
.
getPlayer
().
getAttackResults
().
poll
());
}
}
}
src/main/java/emu/grasscutter/server/packet/recv/HandlerVehicleInteractReq.java
View file @
a8293102
...
...
@@ -14,6 +14,7 @@ public class HandlerVehicleInteractReq extends PacketHandler {
@Override
public
void
handle
(
GameSession
session
,
byte
[]
header
,
byte
[]
payload
)
throws
Exception
{
VehicleInteractReqOuterClass
.
VehicleInteractReq
req
=
VehicleInteractReqOuterClass
.
VehicleInteractReq
.
parseFrom
(
payload
);
session
.
getPlayer
().
getStaminaManager
().
handleVehicleInteractReq
(
session
,
req
.
getEntityId
(),
req
.
getInteractType
());
session
.
send
(
new
PacketVehicleInteractRsp
(
session
.
getPlayer
(),
req
.
getEntityId
(),
req
.
getInteractType
()));
}
}
src/main/java/emu/grasscutter/server/packet/recv/HandlerWidgetDoBagReq.java
0 → 100644
View file @
a8293102
package
emu.grasscutter.server.packet.recv
;
import
emu.grasscutter.Grasscutter
;
import
emu.grasscutter.data.GameData
;
import
emu.grasscutter.data.excels.GadgetData
;
import
emu.grasscutter.game.entity.EntityVehicle
;
import
emu.grasscutter.game.entity.GameEntity
;
import
emu.grasscutter.game.props.LifeState
;
import
emu.grasscutter.net.packet.Opcodes
;
import
emu.grasscutter.net.packet.PacketHandler
;
import
emu.grasscutter.net.packet.PacketOpcodes
;
import
emu.grasscutter.net.proto.*
;
import
emu.grasscutter.server.game.GameSession
;
import
emu.grasscutter.server.packet.send.PacketSceneEntityAppearNotify
;
import
emu.grasscutter.server.packet.send.PacketWidgetCoolDownNotify
;
import
emu.grasscutter.server.packet.send.PacketWidgetDoBagRsp
;
import
emu.grasscutter.server.packet.send.PacketWidgetGadgetDataNotify
;
import
emu.grasscutter.utils.Position
;
import
java.util.List
;
@Opcodes
(
PacketOpcodes
.
WidgetDoBagReq
)
public
class
HandlerWidgetDoBagReq
extends
PacketHandler
{
@Override
public
void
handle
(
GameSession
session
,
byte
[]
header
,
byte
[]
payload
)
throws
Exception
{
WidgetDoBagReqOuterClass
.
WidgetDoBagReq
req
=
WidgetDoBagReqOuterClass
.
WidgetDoBagReq
.
parseFrom
(
payload
);
switch
(
req
.
getMaterialId
())
{
case
220026
->
{
GadgetData
gadgetData
=
GameData
.
getGadgetDataMap
().
get
(
70500025
);
Position
pos
=
new
Position
(
req
.
getWidgetCreatorInfo
().
getLocationInfo
().
getPos
());
Position
rot
=
new
Position
(
req
.
getWidgetCreatorInfo
().
getLocationInfo
().
getRot
());
GameEntity
entity
=
new
EntityVehicle
(
session
.
getPlayer
().
getScene
(),
session
.
getPlayer
(),
gadgetData
.
getId
(),
0
,
pos
,
rot
);
session
.
getPlayer
().
getScene
().
addEntity
(
entity
);
session
.
send
(
new
PacketWidgetGadgetDataNotify
(
70500025
,
List
.
of
(
entity
.
getId
())));
// ???
session
.
send
(
new
PacketWidgetCoolDownNotify
(
15
,
System
.
currentTimeMillis
()
+
5000L
,
true
));
session
.
send
(
new
PacketWidgetCoolDownNotify
(
15
,
System
.
currentTimeMillis
()
+
5000L
,
true
));
// Send twice, and I don't know why, Ask mhy
session
.
send
(
new
PacketWidgetDoBagRsp
());
}
default
->
{
session
.
send
(
new
PacketWidgetDoBagRsp
());
}
}
}
}
src/main/java/emu/grasscutter/server/packet/send/PacketAllWidgetDataNotify.java
0 → 100644
View file @
a8293102
package
emu.grasscutter.server.packet.send
;
import
emu.grasscutter.game.player.Player
;
import
emu.grasscutter.net.packet.BasePacket
;
import
emu.grasscutter.net.packet.PacketOpcodes
;
import
emu.grasscutter.net.proto.AllWidgetDataNotifyOuterClass.AllWidgetDataNotify
;
import
emu.grasscutter.net.proto.LunchBoxDataOuterClass
;
import
emu.grasscutter.net.proto.WidgetSlotDataOuterClass
;
import
emu.grasscutter.net.proto.WidgetSlotTagOuterClass
;
import
java.util.List
;
import
java.util.Map
;
public
class
PacketAllWidgetDataNotify
extends
BasePacket
{
public
PacketAllWidgetDataNotify
(
Player
player
)
{
super
(
PacketOpcodes
.
AllWidgetDataNotify
);
// TODO: Implement this
AllWidgetDataNotify
.
Builder
proto
=
AllWidgetDataNotify
.
newBuilder
()
// If you want to implement this, feel free to do so. :)
.
setLunchBoxData
(
LunchBoxDataOuterClass
.
LunchBoxData
.
newBuilder
().
build
()
)
// Maybe it's a little difficult, or it makes you upset :(
.
addAllOneoffGatherPointDetectorDataList
(
List
.
of
())
// So, goodbye, and hopefully sometime in the future o(* ̄▽ ̄*)ブ
.
addAllCoolDownGroupDataList
(
List
.
of
())
// I'll see your PR with a title that says (・∀・(・∀・(・∀・*)
.
addAllAnchorPointList
(
List
.
of
())
// "Complete implementation of widget functionality" b( ̄▽ ̄)d
.
addAllClientCollectorDataList
(
List
.
of
())
// Good luck, my boy.
.
addAllNormalCoolDownDataList
(
List
.
of
());
if
(
player
.
getWidgetId
()
==
null
)
{
proto
.
addAllSlotList
(
List
.
of
());
}
else
{
proto
.
addSlotList
(
WidgetSlotDataOuterClass
.
WidgetSlotData
.
newBuilder
()
.
setIsActive
(
true
)
.
setMaterialId
(
player
.
getWidgetId
())
.
build
()
);
proto
.
addSlotList
(
WidgetSlotDataOuterClass
.
WidgetSlotData
.
newBuilder
()
.
setTag
(
WidgetSlotTagOuterClass
.
WidgetSlotTag
.
WIDGET_SLOT_TAG_ATTACH_AVATAR
)
.
build
()
);
}
AllWidgetDataNotify
protoData
=
proto
.
build
();
this
.
setData
(
protoData
);
}
}
src/main/java/emu/grasscutter/server/packet/send/PacketBuyGoodsRsp.java
View file @
a8293102
...
...
@@ -11,7 +11,7 @@ public class PacketBuyGoodsRsp extends BasePacket {
BuyGoodsRspOuterClass
.
BuyGoodsRsp
buyGoodsRsp
=
BuyGoodsRspOuterClass
.
BuyGoodsRsp
.
newBuilder
()
.
setShopType
(
shopType
)
.
setB
oughtNum
(
boughtNum
)
.
setB
uyCount
(
boughtNum
)
.
addGoodsList
(
ShopGoodsOuterClass
.
ShopGoods
.
newBuilder
()
.
mergeFrom
(
sg
)
.
setBoughtNum
(
boughtNum
)
...
...
src/main/java/emu/grasscutter/server/packet/send/PacketCanUseSkillNotify.java
0 → 100644
View file @
a8293102
package
emu.grasscutter.server.packet.send
;
import
emu.grasscutter.net.packet.BasePacket
;
import
emu.grasscutter.net.packet.PacketOpcodes
;
import
emu.grasscutter.net.proto.CanUseSkillNotifyOuterClass
;
public
class
PacketCanUseSkillNotify
extends
BasePacket
{
public
PacketCanUseSkillNotify
(
boolean
canUseSkill
)
{
super
(
PacketOpcodes
.
CanUseSkillNotify
);
CanUseSkillNotifyOuterClass
.
CanUseSkillNotify
proto
=
CanUseSkillNotifyOuterClass
.
CanUseSkillNotify
.
newBuilder
()
.
setIsCanUseSkill
(
canUseSkill
)
.
build
();
this
.
setData
(
proto
);
}
}
src/main/java/emu/grasscutter/server/packet/send/PacketCodexDataFullNotify.java
0 → 100644
View file @
a8293102
package
emu.grasscutter.server.packet.send
;
import
java.util.Collections
;
import
emu.grasscutter.data.GameData
;
import
emu.grasscutter.game.player.Player
;
import
emu.grasscutter.net.packet.BasePacket
;
import
emu.grasscutter.net.packet.PacketOpcodes
;
import
emu.grasscutter.net.proto.CodexDataFullNotifyOuterClass.CodexDataFullNotify
;
import
emu.grasscutter.net.proto.CodexTypeDataOuterClass.CodexTypeData
;
public
class
PacketCodexDataFullNotify
extends
BasePacket
{
public
PacketCodexDataFullNotify
(
Player
player
)
{
super
(
PacketOpcodes
.
CodexDataFullNotify
,
true
);
//Quests
CodexTypeData
.
Builder
questTypeData
=
CodexTypeData
.
newBuilder
()
.
setTypeValue
(
1
);
//Weapons
CodexTypeData
.
Builder
weaponTypeData
=
CodexTypeData
.
newBuilder
()
.
setTypeValue
(
2
);
//Animals
CodexTypeData
.
Builder
animalTypeData
=
CodexTypeData
.
newBuilder
()
.
setTypeValue
(
3
);
//Materials
CodexTypeData
.
Builder
materialTypeData
=
CodexTypeData
.
newBuilder
()
.
setTypeValue
(
4
);
//Books
CodexTypeData
.
Builder
bookTypeData
=
CodexTypeData
.
newBuilder
()
.
setTypeValue
(
5
);
//Tips
CodexTypeData
.
Builder
pushTipsTypeData
=
CodexTypeData
.
newBuilder
()
.
setTypeValue
(
6
);
//Views
CodexTypeData
.
Builder
viewTypeData
=
CodexTypeData
.
newBuilder
()
.
setTypeValue
(
7
);
//Reliquary
CodexTypeData
.
Builder
reliquaryData
=
CodexTypeData
.
newBuilder
()
.
setTypeValue
(
8
);
player
.
getQuestManager
().
forEachMainQuest
(
mainQuest
->
{
if
(
mainQuest
.
isFinished
()){
var
codexQuest
=
GameData
.
getCodexQuestDataIdMap
().
get
(
mainQuest
.
getParentQuestId
());
if
(
codexQuest
!=
null
){
questTypeData
.
addCodexIdList
(
codexQuest
.
getId
()).
addAllHaveViewedList
(
Collections
.
singleton
(
true
));
}
}
});
player
.
getCodex
().
getUnlockedWeapon
().
forEach
(
weapon
->
{
var
codexWeapon
=
GameData
.
getCodexWeaponDataIdMap
().
get
(
weapon
);
if
(
codexWeapon
!=
null
){
weaponTypeData
.
addCodexIdList
(
codexWeapon
.
getId
()).
addAllHaveViewedList
(
Collections
.
singleton
(
true
));
}
});
player
.
getCodex
().
getUnlockedAnimal
().
forEach
((
animal
,
amount
)
->
{
var
codexAnimal
=
GameData
.
getCodexAnimalDataMap
().
get
(
animal
);
if
(
codexAnimal
!=
null
){
animalTypeData
.
addCodexIdList
(
codexAnimal
.
getId
()).
addAllHaveViewedList
(
Collections
.
singleton
(
true
));
}
});
player
.
getCodex
().
getUnlockedMaterial
().
forEach
(
material
->
{
var
codexMaterial
=
GameData
.
getCodexMaterialDataIdMap
().
get
(
material
);
if
(
codexMaterial
!=
null
){
materialTypeData
.
addCodexIdList
(
codexMaterial
.
getId
()).
addAllHaveViewedList
(
Collections
.
singleton
(
true
));
}
});
player
.
getCodex
().
getUnlockedReliquarySuitCodex
().
forEach
(
reliquarySuit
->
{
reliquaryData
.
addCodexIdList
(
reliquarySuit
).
addAllHaveViewedList
(
Collections
.
singleton
(
true
));
});
CodexDataFullNotify
.
Builder
proto
=
CodexDataFullNotify
.
newBuilder
()
.
addTypeDataList
(
questTypeData
.
build
())
.
addTypeDataList
(
weaponTypeData
)
.
addTypeDataList
(
animalTypeData
)
.
addTypeDataList
(
materialTypeData
)
.
addTypeDataList
(
bookTypeData
)
.
addTypeDataList
(
pushTipsTypeData
.
build
())
.
addTypeDataList
(
viewTypeData
.
build
())
.
addTypeDataList
(
reliquaryData
);
this
.
setData
(
proto
);
}
}
src/main/java/emu/grasscutter/server/packet/send/PacketCodexDataUpdateNotify.java
0 → 100644
View file @
a8293102
package
emu.grasscutter.server.packet.send
;
import
emu.grasscutter.data.GameData
;
import
emu.grasscutter.game.quest.GameMainQuest
;
import
emu.grasscutter.net.packet.BasePacket
;
import
emu.grasscutter.net.packet.PacketOpcodes
;
import
emu.grasscutter.net.proto.CodexDataUpdateNotifyOuterClass.CodexDataUpdateNotify
;
public
class
PacketCodexDataUpdateNotify
extends
BasePacket
{
public
PacketCodexDataUpdateNotify
(
GameMainQuest
quest
)
{
super
(
PacketOpcodes
.
CodexDataUpdateNotify
,
true
);
var
codexQuest
=
GameData
.
getCodexQuestDataIdMap
().
get
(
quest
.
getParentQuestId
());
if
(
codexQuest
!=
null
){
CodexDataUpdateNotify
proto
=
CodexDataUpdateNotify
.
newBuilder
()
.
setTypeValue
(
1
)
.
setId
(
codexQuest
.
getId
())
.
build
();
this
.
setData
(
proto
);
}
}
public
PacketCodexDataUpdateNotify
(
int
typeValue
,
int
codexId
){
super
(
PacketOpcodes
.
CodexDataUpdateNotify
,
true
);
CodexDataUpdateNotify
proto
=
CodexDataUpdateNotify
.
newBuilder
()
.
setTypeValue
(
typeValue
)
.
setId
(
codexId
)
.
build
();
this
.
setData
(
proto
);
}
}
src/main/java/emu/grasscutter/server/packet/send/PacketVehicle
Spawn
Rsp.java
→
src/main/java/emu/grasscutter/server/packet/send/Packet
Create
VehicleRsp.java
View file @
a8293102
package
emu.grasscutter.server.packet.send
;
import
emu.grasscutter.Grasscutter
;
import
emu.grasscutter.game.player.Player
;
import
emu.grasscutter.game.entity.EntityVehicle
;
import
emu.grasscutter.game.props.FightProperty
;
...
...
@@ -9,21 +8,19 @@ import emu.grasscutter.game.entity.GameEntity;
import
emu.grasscutter.net.packet.BasePacket
;
import
emu.grasscutter.net.packet.PacketOpcodes
;
import
emu.grasscutter.net.proto.VehicleInteractTypeOuterClass
;
import
emu.grasscutter.net.proto.VehicleMemberOuterClass.VehicleMember
;
import
emu.grasscutter.net.proto.Vehicle
Spawn
RspOuterClass.Vehicle
Spawn
Rsp
;
import
emu.grasscutter.net.proto.
Create
VehicleRspOuterClass.
Create
VehicleRsp
;
import
emu.grasscutter.utils.Position
;
import
java.util.List
;
public
class
PacketCreateVehicleRsp
extends
BasePacket
{
import
static
emu
.
grasscutter
.
net
.
proto
.
VehicleInteractTypeOuterClass
.
VehicleInteractType
.
VEHICLE_INTERACT_OUT
;
public
class
PacketVehicleSpawnRsp
extends
BasePacket
{
public
PacketVehicleSpawnRsp
(
Player
player
,
int
vehicleId
,
int
pointId
,
Position
pos
,
Position
rot
)
{
super
(
PacketOpcodes
.
VehicleSpawnRsp
);
VehicleSpawnRsp
.
Builder
proto
=
VehicleSpawnRsp
.
newBuilder
();
public
PacketCreateVehicleRsp
(
Player
player
,
int
vehicleId
,
int
pointId
,
Position
pos
,
Position
rot
)
{
super
(
PacketOpcodes
.
CreateVehicleRsp
);
CreateVehicleRsp
.
Builder
proto
=
CreateVehicleRsp
.
newBuilder
();
// Eject vehicle members and Kill previous vehicles if there are any
List
<
GameEntity
>
previousVehicles
=
player
.
getScene
().
getEntities
().
values
().
stream
()
...
...
@@ -36,7 +33,7 @@ public class PacketVehicleSpawnRsp extends BasePacket {
List
<
VehicleMember
>
vehicleMembers
=
((
EntityVehicle
)
entity
).
getVehicleMembers
().
stream
().
toList
();
vehicleMembers
.
stream
().
forEach
(
vehicleMember
->
{
player
.
getScene
().
broadcastPacket
(
new
PacketVehicleInteractRsp
(((
EntityVehicle
)
entity
),
vehicleMember
,
VEHICLE_INTERACT_OUT
));
player
.
getScene
().
broadcastPacket
(
new
PacketVehicleInteractRsp
(((
EntityVehicle
)
entity
),
vehicleMember
,
VehicleInteractTypeOuterClass
.
VehicleInteractType
.
VEHICLE_INTERACT_
TYPE_
OUT
));
});
player
.
getScene
().
killEntity
(
entity
,
0
);
...
...
src/main/java/emu/grasscutter/server/packet/send/PacketDoGachaRsp.java
View file @
a8293102
...
...
@@ -2,6 +2,7 @@ package emu.grasscutter.server.packet.send;
import
java.util.List
;
import
emu.grasscutter.data.common.ItemParamData
;
import
emu.grasscutter.game.gacha.GachaBanner
;
import
emu.grasscutter.net.packet.BasePacket
;
import
emu.grasscutter.net.packet.PacketOpcodes
;
...
...
@@ -14,16 +15,18 @@ public class PacketDoGachaRsp extends BasePacket {
public
PacketDoGachaRsp
(
GachaBanner
banner
,
List
<
GachaItem
>
list
)
{
super
(
PacketOpcodes
.
DoGachaRsp
);
ItemParamData
costItem
=
banner
.
getCost
(
1
);
ItemParamData
costItem10
=
banner
.
getCost
(
10
);
DoGachaRsp
p
=
DoGachaRsp
.
newBuilder
()
.
setGachaType
(
banner
.
getGachaType
())
.
setGachaScheduleId
(
banner
.
getScheduleId
())
.
setGachaTimes
(
list
.
size
())
.
setNewGachaRandom
(
12345
)
.
setLeftGachaTimes
(
Integer
.
MAX_VALUE
)
.
setCostItemId
(
banner
.
getC
ostItem
())
.
setCostItemNum
(
1
)
.
setTenCostItemId
(
banner
.
getCostItem
())
.
setTenCostItemNum
(
10
)
.
setCostItemId
(
c
ostItem
.
getId
())
.
setCostItemNum
(
costItem
.
getCount
()
)
.
setTenCostItemId
(
costItem10
.
getId
())
.
setTenCostItemNum
(
costItem10
.
getCount
()
)
.
addAllGachaItemList
(
list
)
.
build
();
...
...
src/main/java/emu/grasscutter/server/packet/send/PacketDungeonChallengeFinishNotify.java
View file @
a8293102
...
...
@@ -13,7 +13,7 @@ public class PacketDungeonChallengeFinishNotify extends BasePacket {
DungeonChallengeFinishNotify
proto
=
DungeonChallengeFinishNotify
.
newBuilder
()
.
setChallengeIndex
(
challenge
.
getChallengeIndex
())
.
setIsSuccess
(
challenge
.
isSuccess
())
.
set
Unk1
(
2
)
.
set
ChallengeRecordType
(
2
)
.
build
();
this
.
setData
(
proto
);
...
...
src/main/java/emu/grasscutter/server/packet/send/PacketDungeonSettleNotify.java
View file @
a8293102
...
...
@@ -29,10 +29,10 @@ public class PacketDungeonSettleNotify extends BasePacket {
)
{
super
(
PacketOpcodes
.
DungeonSettleNotify
);
var
continueStatus
=
TowerLevelEndNotify
.
ContinueStateType
.
CONTINUE_STATE_CAN_NOT_CONTINUE_VALUE
;
var
continueStatus
=
TowerLevelEndNotify
.
ContinueStateType
.
CONTINUE_STATE_
TYPE_
CAN_NOT_CONTINUE_VALUE
;
if
(
challenge
.
isSuccess
()
&&
canJump
){
continueStatus
=
hasNextLevel
?
TowerLevelEndNotify
.
ContinueStateType
.
CONTINUE_STATE_CAN_ENTER_NEXT_LEVEL_VALUE
:
TowerLevelEndNotify
.
ContinueStateType
.
CONTINUE_STATE_CAN_ENTER_NEXT_FLOOR_VALUE
;
continueStatus
=
hasNextLevel
?
TowerLevelEndNotify
.
ContinueStateType
.
CONTINUE_STATE_
TYPE_
CAN_ENTER_NEXT_LEVEL_VALUE
:
TowerLevelEndNotify
.
ContinueStateType
.
CONTINUE_STATE_
TYPE_
CAN_ENTER_NEXT_FLOOR_VALUE
;
}
var
towerLevelEndNotify
=
TowerLevelEndNotify
.
newBuilder
()
...
...
@@ -46,7 +46,7 @@ public class PacketDungeonSettleNotify extends BasePacket {
.
setCount
(
1000
)
.
build
())
;
if
(
nextFloorId
>
0
){
if
(
nextFloorId
>
0
&&
canJump
){
towerLevelEndNotify
.
setNextFloorId
(
nextFloorId
);
}
...
...
src/main/java/emu/grasscutter/server/packet/send/PacketEntityAiSyncNotify.java
View file @
a8293102
...
...
@@ -13,7 +13,7 @@ public class PacketEntityAiSyncNotify extends BasePacket {
EntityAiSyncNotify
.
Builder
proto
=
EntityAiSyncNotify
.
newBuilder
();
for
(
int
monsterId
:
notify
.
getLocalAvatarAlertedMonsterListList
())
{
proto
.
addInfoList
(
AiSyncInfo
.
newBuilder
().
setEntityId
(
monsterId
));
proto
.
addInfoList
(
AiSyncInfo
.
newBuilder
().
setEntityId
(
monsterId
)
.
setHasPathToTarget
(
true
)
);
}
this
.
setData
(
proto
);
...
...
src/main/java/emu/grasscutter/server/packet/send/PacketEntityFightPropChangeReasonNotify.java
View file @
a8293102
...
...
@@ -11,21 +11,27 @@ import emu.grasscutter.net.proto.PropChangeReasonOuterClass.PropChangeReason;
import
java.util.List
;
public
class
PacketEntityFightPropChangeReasonNotify
extends
BasePacket
{
public
PacketEntityFightPropChangeReasonNotify
(
GameEntity
entity
,
FightProperty
prop
,
Float
value
,
List
<
Integer
>
param
,
PropChangeReason
reason
,
ChangeHpReason
changeHpReason
)
{
super
(
PacketOpcodes
.
EntityFightPropChangeReasonNotify
);
EntityFightPropChangeReasonNotify
.
Builder
proto
=
EntityFightPropChangeReasonNotify
.
newBuilder
()
.
setEntityId
(
entity
.
getId
())
.
setPropType
(
prop
.
getId
())
.
setPropDelta
(
value
)
.
setReason
(
reason
)
.
setChangeHpReason
(
changeHpReason
);
for
(
int
p:
param
){
for
(
int
p
:
param
){
proto
.
addParamList
(
p
);
}
this
.
setData
(
proto
);
}
public
PacketEntityFightPropChangeReasonNotify
(
GameEntity
entity
,
FightProperty
prop
,
Float
value
,
PropChangeReason
reason
,
ChangeHpReason
changeHpReason
)
{
super
(
PacketOpcodes
.
EntityFightPropChangeReasonNotify
);
EntityFightPropChangeReasonNotify
proto
=
EntityFightPropChangeReasonNotify
.
newBuilder
()
.
setEntityId
(
entity
.
getId
())
.
setPropType
(
prop
.
getId
())
...
...
@@ -33,6 +39,20 @@ public class PacketEntityFightPropChangeReasonNotify extends BasePacket {
.
setReason
(
reason
)
.
setChangeHpReason
(
changeHpReason
)
.
build
();
this
.
setData
(
proto
);
}
public
PacketEntityFightPropChangeReasonNotify
(
GameEntity
entity
,
FightProperty
prop
,
Float
value
,
PropChangeReason
reason
)
{
super
(
PacketOpcodes
.
EntityFightPropChangeReasonNotify
);
EntityFightPropChangeReasonNotify
proto
=
EntityFightPropChangeReasonNotify
.
newBuilder
()
.
setEntityId
(
entity
.
getId
())
.
setPropType
(
prop
.
getId
())
.
setPropDelta
(
value
)
.
setReason
(
reason
)
.
build
();
this
.
setData
(
proto
);
}
}
src/main/java/emu/grasscutter/server/packet/send/PacketEvtAvatarStandUpNotify.java
View file @
a8293102
...
...
@@ -12,7 +12,7 @@ public class PacketEvtAvatarStandUpNotify extends BasePacket {
EvtAvatarStandUpNotify
proto
=
EvtAvatarStandUpNotify
.
newBuilder
()
.
setEntityId
(
notify
.
getEntityId
())
.
setDirection
(
notify
.
getDirection
())
.
setPerformI
D
(
notify
.
getPerformI
D
())
.
setPerformI
d
(
notify
.
getPerformI
d
())
.
setChairId
(
notify
.
getChairId
())
.
build
();
...
...
src/main/java/emu/grasscutter/server/packet/send/PacketFinishedParentQuestNotify.java
0 → 100644
View file @
a8293102
package
emu.grasscutter.server.packet.send
;
import
emu.grasscutter.game.player.Player
;
import
emu.grasscutter.game.quest.GameMainQuest
;
import
emu.grasscutter.net.packet.BasePacket
;
import
emu.grasscutter.net.packet.PacketOpcodes
;
import
emu.grasscutter.net.proto.FinishedParentQuestNotifyOuterClass.FinishedParentQuestNotify
;
public
class
PacketFinishedParentQuestNotify
extends
BasePacket
{
public
PacketFinishedParentQuestNotify
(
Player
player
)
{
super
(
PacketOpcodes
.
FinishedParentQuestNotify
,
true
);
FinishedParentQuestNotify
.
Builder
proto
=
FinishedParentQuestNotify
.
newBuilder
();
for
(
GameMainQuest
mainQuest
:
player
.
getQuestManager
().
getQuests
().
values
())
{
proto
.
addParentQuestList
(
mainQuest
.
toProto
());
}
this
.
setData
(
proto
);
}
}
src/main/java/emu/grasscutter/server/packet/send/PacketFinishedParentQuestUpdateNotify.java
0 → 100644
View file @
a8293102
package
emu.grasscutter.server.packet.send
;
import
emu.grasscutter.game.quest.GameMainQuest
;
import
emu.grasscutter.net.packet.BasePacket
;
import
emu.grasscutter.net.packet.PacketOpcodes
;
import
emu.grasscutter.net.proto.FinishedParentQuestUpdateNotifyOuterClass.FinishedParentQuestUpdateNotify
;
public
class
PacketFinishedParentQuestUpdateNotify
extends
BasePacket
{
public
PacketFinishedParentQuestUpdateNotify
(
GameMainQuest
quest
)
{
super
(
PacketOpcodes
.
FinishedParentQuestUpdateNotify
);
FinishedParentQuestUpdateNotify
proto
=
FinishedParentQuestUpdateNotify
.
newBuilder
()
.
addParentQuestList
(
quest
.
toProto
())
.
build
();
this
.
setData
(
proto
);
}
}
src/main/java/emu/grasscutter/server/packet/send/PacketForgeDataNotify.java
0 → 100644
View file @
a8293102
package
emu.grasscutter.server.packet.send
;
import
emu.grasscutter.game.player.Player
;
import
emu.grasscutter.net.packet.BasePacket
;
import
emu.grasscutter.net.packet.PacketOpcodes
;
import
emu.grasscutter.net.proto.ForgeDataNotifyOuterClass.ForgeDataNotify
;
public
class
PacketForgeDataNotify
extends
BasePacket
{
public
PacketForgeDataNotify
(
Player
player
)
{
super
(
PacketOpcodes
.
ForgeDataNotify
);
int
adventureRank
=
player
.
getLevel
();
int
numQueues
=
(
adventureRank
>=
15
)
?
4
:
(
adventureRank
>=
10
)
?
3
:
(
adventureRank
>=
5
)
?
2
:
1
;
ForgeDataNotify
proto
=
ForgeDataNotify
.
newBuilder
()
.
addAllForgeIdList
(
player
.
getUnlockedForgingBlueprints
())
.
setMaxQueueNum
(
numQueues
)
.
build
();
// ToDo: Add the information for the actual forging queues
// and ongoing forges.
this
.
setData
(
proto
);
}
}
src/main/java/emu/grasscutter/server/packet/send/PacketForgeFormulaDataNotify.java
0 → 100644
View file @
a8293102
package
emu.grasscutter.server.packet.send
;
import
emu.grasscutter.net.packet.BasePacket
;
import
emu.grasscutter.net.packet.PacketOpcodes
;
import
emu.grasscutter.net.proto.ForgeFormulaDataNotifyOuterClass.ForgeFormulaDataNotify
;
public
class
PacketForgeFormulaDataNotify
extends
BasePacket
{
public
PacketForgeFormulaDataNotify
(
int
itemId
)
{
super
(
PacketOpcodes
.
ForgeFormulaDataNotify
);
ForgeFormulaDataNotify
proto
=
ForgeFormulaDataNotify
.
newBuilder
()
.
setForgeId
(
itemId
)
.
setIsLocked
(
false
)
.
build
();
this
.
setData
(
proto
);
}
}
src/main/java/emu/grasscutter/server/packet/send/PacketGetAllMailRsp.java
View file @
a8293102
...
...
@@ -5,6 +5,7 @@ import emu.grasscutter.game.mail.Mail;
import
emu.grasscutter.game.player.Player
;
import
emu.grasscutter.net.packet.BasePacket
;
import
emu.grasscutter.net.packet.PacketOpcodes
;
import
emu.grasscutter.net.proto.EquipParamOuterClass
;
import
emu.grasscutter.net.proto.GetAllMailRspOuterClass.GetAllMailRsp
;
import
emu.grasscutter.net.proto.ItemParamOuterClass
;
import
emu.grasscutter.net.proto.MailDataOuterClass
;
...
...
@@ -23,9 +24,9 @@ public class PacketGetAllMailRsp extends BasePacket {
GetAllMailRsp
.
Builder
proto
=
GetAllMailRsp
.
newBuilder
();
if
(
isGiftMail
)
{
proto
.
set
IsGiftMail
(
true
);
proto
.
set
ANKKGPJCINB
(
true
);
}
else
{
proto
.
set
IsGiftMail
(
false
);
proto
.
set
ANKKGPJCINB
(
false
);
if
(
player
.
getAllMail
().
size
()
!=
0
)
{
// Make sure the player has mail
List
<
MailData
>
mailDataList
=
new
ArrayList
<
MailData
>();
...
...
@@ -43,10 +44,10 @@ public class PacketGetAllMailRsp extends BasePacket {
for
(
Mail
.
MailItem
item
:
message
.
itemList
)
{
MailItemOuterClass
.
MailItem
.
Builder
mailItem
=
MailItemOuterClass
.
MailItem
.
newBuilder
();
Item
ParamOuterClass
.
Item
Param
.
Builder
itemParam
=
Item
ParamOuterClass
.
Item
Param
.
newBuilder
();
Equip
ParamOuterClass
.
Equip
Param
.
Builder
itemParam
=
Equip
ParamOuterClass
.
Equip
Param
.
newBuilder
();
itemParam
.
setItemId
(
item
.
itemId
);
itemParam
.
set
Count
(
item
.
itemCount
);
mailItem
.
set
Item
Param
(
itemParam
.
build
());
itemParam
.
set
ItemNum
(
item
.
itemCount
);
mailItem
.
set
Equip
Param
(
itemParam
.
build
());
mailItems
.
add
(
mailItem
.
build
());
}
...
...
@@ -60,7 +61,7 @@ public class PacketGetAllMailRsp extends BasePacket {
mailData
.
setImportance
(
message
.
importance
);
mailData
.
setIsRead
(
message
.
isRead
);
mailData
.
setIsAttachmentGot
(
message
.
isAttachmentGot
);
mailData
.
set
State
Value
(
1
);
mailData
.
set
BHCAHLJIKFF
Value
(
1
);
mailDataList
.
add
(
mailData
.
build
());
}
...
...
Prev
1
…
12
13
14
15
16
17
18
19
20
21
Next
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment