Skip to content
This repository has been archived by the owner on Dec 30, 2023. It is now read-only.

Commit

Permalink
remove roleinit protocol
Browse files Browse the repository at this point in the history
  • Loading branch information
fztcjjl committed Dec 16, 2015
1 parent 17bc1b4 commit 1459d2a
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 160 deletions.
34 changes: 1 addition & 33 deletions game/user/user.lua
Original file line number Diff line number Diff line change
Expand Up @@ -43,37 +43,6 @@ function response.unload(uid)
EntUser:unload(uid)
end

function response.RoleInitRequest(data)
local args = pb_decode(data)
local uid = data.uid
local fd = data.fd
if user_dc.req.check_role_exists(uid) then
LOG_ERROR("uid %d has role, role init failed", uid)
return
end

local row = {
uid = uid,
name = args.name,
level = 1,
exp = 0,
rtime = os.time(),
ltime = os.time()
}

local ret = user_dc.req.add(row)

init_building(uid)

if ret then
local userinfo = user_dc.req.get(uid)
local proto = "user.UserInfoResponse"
local payload = pb_encode(proto, userinfo)

send_client(data.fd, proto, payload)
end
end

function response.RoleRenameRequest(data)
local args = pb_decode(data)
local uid = data.uid
Expand All @@ -90,8 +59,7 @@ function response.RoleRenameRequest(data)
return
end

local userinfo = user_dc.req.get(uid)
send_client(data.fd, "user.UserInfoResponse", userinfo)
send_client(data.fd, "user.UserInfoResponse", { name = args.name })
end

function response.UserInfoRequest(data)
Expand Down
48 changes: 0 additions & 48 deletions protocol/config.pb

This file was deleted.

43 changes: 0 additions & 43 deletions protocol/config.proto

This file was deleted.

24 changes: 10 additions & 14 deletions protocol/user.pb
Original file line number Diff line number Diff line change
@@ -1,18 +1,14 @@

�
�

user.protouser"
RoleInitRequest
name ( "
RoleInitResonpse"!
RoleRenameRequest
name ( "
RoleRenameResponse"
user.protouser"
UserInfoRequest"g
UserInfoResponse
uid (
name ( 
level (
exp (
rtime (
ltime (
uid (
name ( 
level (
exp (
rtime (
ltime ("!
RoleRenameRequest
name (
31 changes: 9 additions & 22 deletions protocol/user.proto
Original file line number Diff line number Diff line change
@@ -1,32 +1,19 @@
package user;

// 角色初始化
message RoleInitRequest {
required string name = 1;
message UserInfoRequest {

}

message RoleInitResonpse {

message UserInfoResponse {
optional int32 uid = 1;
optional string name = 2;
optional int32 level = 3;
optional int32 exp = 4;
optional int32 rtime = 5;
optional int32 ltime = 6;
}

// 角色改名
message RoleRenameRequest {
required string name = 1;
}

message RoleRenameResponse {

}

message UserInfoRequest {

}

message UserInfoResponse {
required int32 uid = 1;
required string name = 2;
required int32 level = 3;
required int32 exp = 4;
required int32 rtime = 5;
required int32 ltime = 6;
}

0 comments on commit 1459d2a

Please sign in to comment.