| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516 |
- package msg
- import (
- "rocommon"
- "rocommon/service"
- "rocommon/util"
- "roserver/baseserver/model"
- model2 "roserver/game/model"
- "roserver/serverproto"
- "strings"
- )
- func init() {
- serverproto.Handle_GAME_CSGMCommandReq = model.HandleBackendMessage(func(ev rocommon.ProcEvent, cliId model.ClientID) {
- msg := ev.Msg().(*serverproto.CSGMCommandReq)
- util.DebugF("receive CSGMCommandReq msg=%v", msg)
- roleOuter := model2.RoleMag.GetRoleOrKick(cliId, ev)
- if roleOuter == nil {
- return
- }
- role := roleOuter.(model2.RoleLogicOuter)
- cmdList := strings.Split(msg.GmCmd, " ")
- if len(cmdList) <= 0 {
- util.DebugF("uid=%v gm command invalid gm=%v", role.(*model2.Role).GetUUid(), msg.GmCmd)
- return
- }
- cmdStr := strings.ToLower(cmdList[0])
- switch cmdStr {
- case "addres":
- if len(cmdList) >= 3 {
- resType, _ := model.Str2Num(cmdList[1])
- resValue, _ := model.Str2Num(cmdList[2])
- roleOuter.(*model2.Role).GetRoleBag().AddItem(int32(resType), int32(resValue),
- model2.AddItemST{AddFrom: model2.AddFrom_System, Notify: true})
- //switch serverproto.ResType(resType) {
- //case serverproto.ResType_Res_Coin:
- // fallthrough
- //case serverproto.ResType_Res_RoleBaseExp:
- // fallthrough
- //case serverproto.ResType_Res_RoleJobExp:
- // fallthrough
- //case serverproto.ResType_Res_HeroBaseExp:
- // fallthrough
- //case serverproto.ResType_Res_Cruise:
- // fallthrough
- //case serverproto.ResType_Res_Sprite:
- // fallthrough
- //case serverproto.ResType_Res_Reslove:
- // fallthrough
- //case serverproto.ResType_Res_Fashion:
- // fallthrough
- //case serverproto.ResType_Res_EvilExp:
- // fallthrough
- //case serverproto.ResType_Res_Guild:
- // fallthrough
- //case serverproto.ResType_Res_DaoChang100:
- // fallthrough
- //case serverproto.ResType_Res_PetCoin:
- // fallthrough
- //case serverproto.ResType_Res_VipExp:
- // fallthrough
- //case serverproto.ResType_Res_PetExp:
- // role.AddRes(int32(resType), model2.AddItemST{ItemCount: int32(resValue)}, true)
- // roleOuter.(*model2.Role).BaseChangeNtf()
- //default:
- // roleOuter.(*model2.Role).GetRoleBag().AddItem(int32(resType), int32(resValue),
- // model2.AddItemST{AddFrom: model2.AddFrom_System, Notify: true})
- //}
- }
- case "addhero":
- if len(cmdList) >= 2 {
- configId, _ := model.Str2Num(cmdList[1])
- role.AddHero(int32(configId))
- }
- case "addequip":
- if len(cmdList) >= 3 {
- configId, _ := model.Str2Num(cmdList[1])
- num, _ := model.Str2Num(cmdList[2])
- role.AddEquip(int32(configId), int32(num), true, false)
- }
- case "studyskill":
- if len(cmdList) >= 2 {
- heroId, _ := model.Str2Num(cmdList[1])
- skillId, _ := model.Str2Num(cmdList[2])
- role.SkillLevelUp(int32(heroId), int32(skillId))
- }
- case "activeskill":
- if len(cmdList) >= 2 {
- heroId, _ := model.Str2Num(cmdList[1])
- skillId, _ := model.Str2Num(cmdList[2])
- role.ActiveSkill(int32(heroId), int32(skillId))
- }
- case "addfashion":
- if len(cmdList) >= 2 {
- fashionCfgId, _ := model.Str2Num(cmdList[1])
- roleOuter.(*model2.Role).GetRoleFashion().AddFashion(int32(fashionCfgId), false)
- roleOuter.(*model2.Role).GetRoleFashion().FashionChangeNtf([]int32{int32(fashionCfgId)})
- }
- case "cleanbag":
- roleOuter.(*model2.Role).GetRoleBag().GMClearBag()
- case "cleanpet":
- roleOuter.(*model2.Role).GetRolePet().GMClearPet()
- case "addmail":
- if len(cmdList) >= 2 {
- mailCfgId, _ := model.Str2Num(cmdList[1])
- var itemList = map[int32]int32{}
- if len(cmdList) > 2 {
- for i := 2; i < len(cmdList); i++ {
- res, val := model.Str2Res(cmdList[i])
- itemList[int32(res)] = int32(val)
- }
- }
- roleOuter.(*model2.Role).AddMail(int32(mailCfgId), serverproto.MailType_MailType_System, itemList, nil, "", "")
- }
- case "addmail1":
- if len(cmdList) >= 3 {
- title := cmdList[1]
- content := cmdList[2]
- roleOuter.(*model2.Role).AddMail(0, serverproto.MailType_MailType_System, nil, nil, title, content)
- }
- case "setmap": //设置挑战到的关卡,关卡相关的其他数据不做处理
- if len(cmdList) >= 3 {
- mapId, _ := model.Str2Num(cmdList[1])
- levelId, _ := model.Str2Num(cmdList[2])
- roleOuter.(*model2.Role).GetRoleBattle().GMSetMapLevel(uint32(mapId), uint32(levelId), false)
- }
- case "sethardmap": //设置挑战到的关卡,关卡相关的其他数据不做处理
- if len(cmdList) >= 3 {
- mapId, _ := model.Str2Num(cmdList[1])
- levelId, _ := model.Str2Num(cmdList[2])
- roleOuter.(*model2.Role).GetRoleBattle().GMSetMapLevel(uint32(mapId), uint32(levelId), true)
- }
- case "signup":
- if len(cmdList) >= 2 {
- typeId, _ := model.Str2Num(cmdList[1])
- if typeId == 1 {
- roleOuter.(*model2.Role).GetSignUpInfo()
- }
- if typeId == 2 {
- roleOuter.(*model2.Role).OnSignUp()
- }
- }
- case "setsignday":
- if roleOuter.(*model2.Role).GetRoleActivity() != nil {
- if len(cmdList) == 2 {
- day, _ := model.Str2Num(cmdList[1])
- roleOuter.(*model2.Role).GetRoleActivity().SetSignDay(int32(day), -1)
- } else if len(cmdList) == 3 {
- day, _ := model.Str2Num(cmdList[1])
- sec, _ := model.Str2Num(cmdList[2])
- roleOuter.(*model2.Role).GetRoleActivity().SetSignDay(int32(day), int32(sec))
- }
- }
- case "testfightpower":
- //roleOuter.(*model2.Role).GetRoleFightPower().FashionAttrChange()
- case "income": //minutes
- if len(cmdList) >= 2 {
- incomeTime, _ := model.Str2Num(cmdList[1])
- if incomeTime > 0 {
- role.(*model2.Role).GetRoleBattle().GMIncome(int32(incomeTime))
- }
- }
- case "closeresetskill":
- roleOuter.(*model2.Role).GetRoleBase().RoleData().SkillResetCount = -1
- roleOuter.(*model2.Role).GetRoleBase().SetDirty(true)
- case "climbingtower":
- if len(cmdList) >= 2 {
- level, _ := model.Str2Num(cmdList[1])
- roleOuter.(*model2.Role).GetRoleTower().SetTowerLevel(int32(level))
- }
- case "resetboss":
- roleOuter.(*model2.Role).GetRoleMap().GmReset()
- case "addpet":
- if len(cmdList) >= 3 {
- petCfgId, _ := model.Str2Num(cmdList[1])
- petAddNum, _ := model.Str2Num(cmdList[2])
- for idx := 0; idx < petAddNum; idx++ {
- roleOuter.(*model2.Role).GetRolePet().AddPet(int32(petCfgId))
- }
- }
- case "addguildactive":
- if len(cmdList) >= 2 {
- active, _ := model.Str2Num(cmdList[1])
- roleOuter.(*model2.Role).GetRoleGuild().GMAddGuildActivity(int32(active))
- }
- case "guildcd":
- roleOuter.(*model2.Role).GetRoleGuild().ClearGuildApplyCD()
- case "darkshop":
- ackMsg := &serverproto.SCShopRefreshAck{
- Error: int32(serverproto.ErrorCode_ERROR_FAIL),
- }
- bRet := roleOuter.(*model2.Role).GetRoleShop().HandleSpecialShopRefresh(3, ackMsg)
- ackMsg.Error = int32(bRet)
- roleOuter.(*model2.Role).ReplayGate(ackMsg, true)
- case "quickbattle":
- roleOuter.(*model2.Role).GetQuickBattleReward()
- case "pay":
- if len(cmdList) >= 2 {
- payAmount, _ := model.Str2Num(cmdList[1])
- if payAmount > 0 {
- role.(*model2.Role).GMPay(float32(payAmount))
- }
- }
- case "cfgreload":
- //model.ReloadConfig()
- case "getrushdata":
- if len(cmdList) >= 2 {
- rushType, _ := model.Str2Num(cmdList[1])
- reqMsg := &serverproto.SSGetRushDataReq{
- Uid: roleOuter.(*model2.Role).GetUUid(),
- }
- if rushType == model.Rush_Type_Tower {
- reqMsg.RushType = model.Rush_Type_Tower
- } else if rushType == model.Rush_Type_Arena {
- reqMsg.RushType = model.Rush_Type_Arena
- }
- model2.SendRankService(reqMsg)
- }
- case "getrushinfo":
- if len(cmdList) >= 2 {
- reqMsg := &serverproto.SSOnlineGetRushInfoReq{
- Uid: roleOuter.(*model2.Role).GetUUid(),
- }
- model2.SendRankService(reqMsg)
- }
- case "getrushreward":
- if len(cmdList) >= 2 {
- rushType, _ := model.Str2Num(cmdList[1])
- reqMsg := &serverproto.SSTestRushRankRewardNtf{
- Uid: roleOuter.(*model2.Role).GetUUid(),
- RushType: int32(rushType),
- }
- model2.SendRankService(reqMsg)
- }
- case "expedition":
- if len(cmdList) < 2 {
- roleOuter.(*model2.Role).GetRoleBattle().GmExpeditionOpenAll()
- } else {
- level, _ := model.Str2Num(cmdList[1])
- roleOuter.(*model2.Role).GetRoleBattle().GmExpeditionOpen(int32(level))
- }
- case "expeditionscore":
- if len(cmdList) >= 2 {
- score, _ := model.Str2Num(cmdList[1])
- roleOuter.(*model2.Role).GetRoleBattle().GmExpeditionRankScore(int32(score))
- }
- case "expeditionfightcount":
- if len(cmdList) >= 2 {
- count, _ := model.Str2Num(cmdList[1])
- roleOuter.(*model2.Role).GetRoleBattle().GmExpeditionFightCount(int32(count))
- }
- case "statistic":
- if len(cmdList) >= 2 {
- cheatType, _ := model.Str2Num(cmdList[1])
- role.(model2.RoleLogicOuter).OnAntiCheatReq(int32(cheatType))
- }
- case "giftcode":
- reqMsg := &serverproto.CSGiftRewardReq{
- Uuid: roleOuter.(*model2.Role).GetUUid(),
- }
- reqMsg.GiftCode = "C003gfhmvk"
- role.(*model2.Role).SendSocial(reqMsg)
- case "rushmap":
- // roleOuter.(*model2.Role).GetRushMapLevelReward(model.Rush_Type_Map)
- case "shop":
- if len(cmdList) >= 2 {
- goodsid, _ := model.Str2Num(cmdList[1])
- ackMsg := &serverproto.SCShopBuyItemAck{
- Error: int32(serverproto.ErrorCode_ERROR_FAIL),
- GoodsType: 1,
- GoodsId: int32(goodsid),
- }
- bRet, buyTime, buyNum := role.(*model2.Role).GetRoleShop().BuyItem(1, int32(goodsid), 1, ackMsg)
- ackMsg.Error = int32(bRet)
- ackMsg.CurNum = buyNum
- ackMsg.CurBuyTime = buyTime
- role.(*model2.Role).ReplayGate(ackMsg, true)
- }
- case "rj":
- tmpRole := roleOuter.(*model2.Role)
- if len(cmdList) >= 3 {
- heroId, _ := model.Str2Num(cmdList[1])
- rjId, _ := model.Str2Num(cmdList[2])
- tmpRole.HeroReplaceJob(int32(heroId), int32(rjId))
- }
- case "guildbattlerank":
- reqMsg := &serverproto.SSGuildBattleCPRankReq{}
- reqMsg.Uid = roleOuter.(*model2.Role).GetUUid()
- reqMsg.GuildId = uint64(role.(model2.RoleLogicOuter).GetRoleGuildId())
- role.(*model2.Role).SendGuild(reqMsg)
- case "guildbattlecp":
- if len(cmdList) >= 2 {
- reqMsg := &serverproto.SSGuildBattleGMAddGuildCPReq{}
- reqMsg.GuildId = uint64(role.(model2.RoleLogicOuter).GetRoleGuildId())
- score, _ := model.Str2Num(cmdList[1])
- reqMsg.AddScore = uint32(score)
- reqMsg.Uid = role.(*model2.Role).GetUUid()
- role.(*model2.Role).SendGuild(reqMsg)
- }
- case "guildbattlescore":
- if len(cmdList) >= 4 {
- reqMsg := &serverproto.SSGuildBattleGMAddGuildScoreReq{}
- battleIdx, _ := model.Str2Num(cmdList[1])
- guildIdx, _ := model.Str2Num(cmdList[2])
- score, _ := model.Str2Num(cmdList[3])
- reqMsg.BattleIndex = int32(battleIdx)
- reqMsg.GuildIndex = int32(guildIdx)
- reqMsg.AddScore = int32(score)
- role.(*model2.Role).SendGuild(reqMsg)
- }
- case "guildoperator":
- if len(cmdList) >= 2 {
- reqMsg := &serverproto.SSGuildBattleGMOperatorReq{}
- operator, _ := model.Str2Num(cmdList[1])
- if operator != 0 && operator != 1 {
- return
- }
- reqMsg.Operator = int32(operator)
- role.(*model2.Role).SendGuild(reqMsg)
- }
- case "guildreward":
- roleOuter.(*model2.Role).GetRoleGuild().GuildBattleOnline()
- case "guildleader":
- if len(cmdList) >= 2 {
- reqMsg := &serverproto.SSGuildBattleGMChangeLeaderReq{}
- guildId, err := model.Str2NumU64(cmdList[1])
- if err != nil {
- return
- }
- reqMsg.GuildId = guildId
- role.(*model2.Role).SendGuild(reqMsg)
- }
- case "guildkickmember":
- if len(cmdList) >= 3 {
- reqMsg := &serverproto.SSGuildBattleGMKickMemberReq{}
- guildId, err := model.Str2NumU64(cmdList[1])
- if err != nil {
- return
- }
- uid, err2 := model.Str2NumU64(cmdList[2])
- if err2 != nil {
- return
- }
- reqMsg.GuildId = guildId
- reqMsg.Uid = uid
- role.(*model2.Role).SendGuild(reqMsg)
- }
- case "guilddemondamage":
- reqMsg := &serverproto.SSGuildBattleGMDemonDamageReq{}
- role.(*model2.Role).SendGuild(reqMsg)
- case "stopguildbattle":
- reqMsg := &serverproto.SSWebGMGuildBattle{}
- role.(*model2.Role).SendGuild(reqMsg)
- case "resetchat":
- //清空禁言
- roleOuter.(*model2.Role).BanRoleChat(false, 0, 0)
- case "petlevel":
- if len(cmdList) >= 4 {
- petId, _ := model.Str2Num(cmdList[1])
- level, _ := model.Str2Num(cmdList[2])
- advLevel, _ := model.Str2Num(cmdList[3])
- roleOuter.(*model2.Role).GetRolePet().GMPetLevel(uint32(petId), int32(level), int32(advLevel))
- }
- case "petskill":
- if len(cmdList) >= 4 {
- petId, _ := model.Str2Num(cmdList[1])
- skillId, _ := model.Str2Num(cmdList[2])
- level, _ := model.Str2Num(cmdList[3])
- roleOuter.(*model2.Role).GetRolePet().GMPetSkillLevel(uint32(petId), int32(skillId), int32(level))
- }
- case "skillequiptest":
- tmpRole := roleOuter.(*model2.Role)
- roleOuter.(*model2.Role).GetRoleBag().AddItem(int32(48), int32(10000),
- model2.AddItemST{AddFrom: model2.AddFrom_System, Notify: true})
- roleOuter.(*model2.Role).GetRoleBag().AddItem(int32(1), int32(100000),
- model2.AddItemST{AddFrom: model2.AddFrom_System, Notify: true})
- roleOuter.(*model2.Role).GetRoleBag().AddItem(int32(2), int32(10000),
- model2.AddItemST{AddFrom: model2.AddFrom_System, Notify: true})
- tmpRole.AddSkillEquip(14200, 1, true, true)
- equipId := tmpRole.GetRoleSkillEquip().GetSkillEquipMaxId()
- mainHeroId := tmpRole.GetRoleHero().GetMainHero().Id
- tmpRole.SkillEquipUp(mainHeroId, equipId, 0)
- tmpRole.SkillEquipSlotLevelUp(mainHeroId, 0)
- var cost []uint32
- cost = append(cost, equipId-1)
- tmpRole.SkillEquipStarLevelUp(mainHeroId, equipId, cost)
- case "toptower":
- tmpRole := roleOuter.(*model2.Role)
- crossSSMsg := &serverproto.SSCrossTopTowerForceWinRankUpdateNtf{
- FightUid: tmpRole.GetUUid(),
- }
- tmpRole.SendSocial(crossSSMsg)
- case "activitysignin":
- if len(cmdList) >= 3 {
- day, _ := model.Str2Num(cmdList[1])
- activityId, _ := model.Str2Num(cmdList[2])
- roleOuter.(*model2.Role).GetRoleActivity().SetActivitySignDay(int32(day), int32(activityId))
- }
- case "competitiondebug":
- //model2.CompetitionMag.GMSendReward()
- roleOuter.(*model2.Role).GetRoleCompetition().AddSeasonBoxScore(0, true)
- case "combineserver":
- roleOuter.(*model2.Role).GMSetCombineServerFinish()
- case "reloadcombineserver":
- var cfgList []string
- cfgList = append(cfgList, "CombinedServiceCfg")
- model2.ServerReloadConfig(cfgList)
- model2.RoleMag.ServerReloadConfigNtf(cfgList)
- case "rechargelimit":
- tmpRole := roleOuter.(*model2.Role)
- tmpRole.GetRoleRune().GMAddCreditRecharge(0, true)
- case "btfirst":
- rewardIdx, _ := model.Str2Num(cmdList[1])
- tmpRole := roleOuter.(*model2.Role)
- tmpRole.PayInfoGet(int32(serverproto.PayGoodsType_EPayType_BTRecharge100), 2, 1, 0, 0, 0, "")
- tmpRole.GetRoleBT().FirstRechargeReward(int32(rewardIdx))
- tmpRole.GetRoleBT().Recharge100Reward()
- case "test":
- //role.AddRes(int32(serverproto.ResType_Res_PetExp), int32(999999), true)
- //role.AddRes(int32(serverproto.ResType_Res_PetCoin), int32(999999), true)
- //role.AddRes(int32(serverproto.ResType_Res_Rmb), int32(999999), true)
- tmpRole := roleOuter.(*model2.Role)
- //tmpRole.GetRoleRune().GMAddCreditRecharge(200, false)
- //tmpRole.PayInfoGet(1, 1, 1)
- //tmpRole.GetRoleBT().GetShopInfo()
- resType := int32(serverproto.ResType_Res_BoliShopExp)
- resValue := 9999
- roleOuter.(*model2.Role).GetRoleBag().AddItem(int32(resType), int32(resValue),
- model2.AddItemST{AddFrom: model2.AddFrom_System, Notify: true})
- //reqMsg := &serverproto.CSDaoChang100SelfInfoReq{}
- //tmpRole.GetDaoChang100SelfPosInfo(reqMsg)
- //
- //reqMsg1 := &serverproto.CSDaoChang100Req{}
- //for idx := 1; idx <= 20; idx++ {
- // reqMsg1.PosIdxList = append(reqMsg1.PosIdxList, int32(idx))
- //}
- //tmpRole.GetDaoChang100PosInfo(reqMsg1.PosIdxList)
- //tmpRole.DaoChang100ChallengeReq(1)
- //
- //reqMsg2 := &serverproto.CSDaoChang100ChallengeResultReq{
- // PosIdx: 1,
- // BattleResult: false,
- // PosUid: 1001, //robotid
- //}
- //tmpRole.DaoChang100ChallengeResultReq(reqMsg2)
- //
- //tmpRole.DaoChang100BuyChallengeCount()
- //tmpRole.GMCalAttr()
- //tmpRole.ExpeditionScoreRankList(1)
- //tmpRole.GetRoleBag().AddItem(int32(serverproto.ResType_Res_Rmb), int32(9999999),
- // model2.AddItemST{AddFrom: model2.AddFrom_System, Notify: true})
- //
- //tmpRole.GetRoleDaoChang100().DaoChang100Wheel()
- //tmpRole.GetRoleDaoChang100().DaoChang100WheelRefresh()
- //tmpRole.GetRoleDaoChang100().DaoChang100WheelOpen()
- //tmpRole.GetRoleDaoChang100().DaoChang100WheelReward(true)
- //
- //tmpRole.GetRoleDaoChang100().DaoChang100WheelClose()
- //tmpRole.GetRoleDaoChang100().DaoChang100WheelReward(false)
- //tmpRole.GetRoleDaoChang100().DaoChang100WheelReward(false)
- //tmpRole.YuanHangTrialViewList()
- //if len(cmdList) >= 2 {
- // operator, _ := model.Str2Num(cmdList[1])
- // switch operator {
- // case 1: //发起续航试炼
- //
- // }
- //}
- tmpRole.ActivitySummon(94, 5)
- tmpRole.OnDrawReq(1, 5)
- tmpRole.OnDrawReq(3, 5)
- return
- //tmpRole.RefreshYuanHangTrialType(false)
- tmpRole.GetRoleCross().TopTowerChallengeReq(1)
- if len(cmdList) >= 2 {
- //cmdId, _ := model.Str2Num(cmdList[1])
- model2.TmpLeaseId = service.GetServiceDiscovery().UpdateStateToETCD("teststate", cmdList[1], model2.TmpLeaseId)
- }
- ssStateMsg := &serverproto.SSGetGServerStateReq{
- ServerType: 31,
- }
- tmpRole.SendSocial(ssStateMsg)
- }
- })
- }
|